From 23b7a0846825dfd15e56035d223fd1edcbe50a75 Mon Sep 17 00:00:00 2001 From: Rak Siva Date: Wed, 14 Feb 2024 14:44:58 -0700 Subject: [PATCH 01/34] wip: update --- makefile | 11 +- nitric/proto/apis/v1/apis.proto | 111 + nitric/proto/deployments/v1/deployments.proto | 312 + nitric/proto/http/v1/http.proto | 29 + nitric/proto/keyvalue/v1/keyvalue.proto | 77 + nitric/proto/queues/v1/queues.proto | 79 + nitric/proto/resources/v1/resources.proto | 125 + nitric/proto/schedules/v1/schedules.proto | 69 + nitric/proto/secrets/v1/secrets.proto | 59 + nitric/proto/storage/v1/storage.proto | 189 + nitric/proto/topics/v1/topics.proto | 90 + nitric/proto/websockets/v1/websockets.proto | 147 + src/Nitric.Sdk/Common/Constants.cs | 20 - src/Nitric.Sdk/Document/AbstractCollection.cs | 104 - src/Nitric.Sdk/Document/CollectionGroupRef.cs | 41 - src/Nitric.Sdk/Document/CollectionRef.cs | 81 - .../Document/{Document.cs => Document.cs.old} | 0 .../{DocumentRef.cs => DocumentRef.cs.old} | 0 ...umentsClient.cs => DocumentsClient.cs.old} | 0 .../Document/{Key.cs => Key.cs.old} | 0 .../Document/{Query.cs => Query.cs.old} | 0 src/Nitric.Sdk/Nitric.Sdk.csproj | 11 +- .../proto/apis/v1/Apis.cs} | 1886 +-- .../Proto/nitric/proto/apis/v1/ApisGrpc.cs | 217 + .../proto/deployments/v1/Deployments.cs} | 2827 ++-- .../proto/deployments/v1/DeploymentsGrpc.cs} | 76 +- .../Error.cs => nitric/proto/http/v1/Http.cs} | 444 +- .../proto/http/v1/HttpGrpc.cs} | 74 +- .../nitric/proto/keyvalue/v1/Keyvalue.cs | 1761 +++ .../nitric/proto/keyvalue/v1/KeyvalueGrpc.cs | 306 + .../proto/queues/v1/Queues.cs} | 1143 +- .../nitric/proto/queues/v1/QueuesGrpc.cs | 306 + .../proto/resources/v1/Resources.cs} | 1802 +-- .../proto/resources/v1/ResourcesGrpc.cs | 185 + .../nitric/proto/schedules/v1/Schedules.cs | 1955 +++ .../proto/schedules/v1/SchedulesGrpc.cs | 132 + .../proto/secrets/v1/Secrets.cs} | 130 +- .../proto/secrets/v1/SecretsGrpc.cs} | 87 +- .../Proto/nitric/proto/storage/v1/Storage.cs | 4379 ++++++ .../proto/storage/v1/StorageGrpc.cs | 258 +- .../Proto/nitric/proto/topics/v1/Topics.cs | 2025 +++ .../proto/topics/v1/TopicsGrpc.cs} | 175 +- .../proto/websockets/v1/Websockets.cs} | 2633 ++-- .../proto/websockets/v1/WebsocketsGrpc.cs | 444 + .../Proto/proto/document/v1/DocumentGrpc.cs | 417 - src/Nitric.Sdk/Proto/proto/event/v1/Event.cs | 1259 -- src/Nitric.Sdk/Proto/proto/faas/v1/Faas.cs | 7168 --------- .../Proto/proto/queue/v1/QueueGrpc.cs | 372 - .../Proto/proto/resource/v1/ResourceGrpc.cs | 251 - .../Proto/proto/websocket/v1/Websocket.cs | 799 - .../Proto/proto/websocket/v1/WebsocketGrpc.cs | 242 - src/Nitric.Sdk/Proto/validate/Validate.cs | 13116 ---------------- .../BucketNotificationContext.cs | 0 .../{Function => Service}/EventContext.cs | 0 src/Nitric.Sdk/{Function => Service}/Faas.cs | 0 .../{Function => Service}/Frequency.cs | 0 .../{Function => Service}/HttpContext.cs | 0 .../{Function => Service}/Middleware.cs | 0 .../{Function => Service}/TriggerContext.cs | 0 .../{Function => Service}/WebsocketContext.cs | 0 src/Nitric.Sdk/Storage/Bucket.cs | 2 +- src/Nitric.Sdk/Storage/File.cs | 2 +- .../{Event/Event.cs => Topic/Event.cs.old} | 0 .../{Event => Topic}/EventsClient.cs | 10 +- src/Nitric.Sdk/{Event => Topic}/Topic.cs | 0 65 files changed, 18747 insertions(+), 29691 deletions(-) create mode 100644 nitric/proto/apis/v1/apis.proto create mode 100644 nitric/proto/deployments/v1/deployments.proto create mode 100644 nitric/proto/http/v1/http.proto create mode 100644 nitric/proto/keyvalue/v1/keyvalue.proto create mode 100644 nitric/proto/queues/v1/queues.proto create mode 100644 nitric/proto/resources/v1/resources.proto create mode 100644 nitric/proto/schedules/v1/schedules.proto create mode 100644 nitric/proto/secrets/v1/secrets.proto create mode 100644 nitric/proto/storage/v1/storage.proto create mode 100644 nitric/proto/topics/v1/topics.proto create mode 100644 nitric/proto/websockets/v1/websockets.proto delete mode 100644 src/Nitric.Sdk/Common/Constants.cs delete mode 100644 src/Nitric.Sdk/Document/AbstractCollection.cs delete mode 100644 src/Nitric.Sdk/Document/CollectionGroupRef.cs delete mode 100644 src/Nitric.Sdk/Document/CollectionRef.cs rename src/Nitric.Sdk/Document/{Document.cs => Document.cs.old} (100%) rename src/Nitric.Sdk/Document/{DocumentRef.cs => DocumentRef.cs.old} (100%) rename src/Nitric.Sdk/Document/{DocumentsClient.cs => DocumentsClient.cs.old} (100%) rename src/Nitric.Sdk/Document/{Key.cs => Key.cs.old} (100%) rename src/Nitric.Sdk/Document/{Query.cs => Query.cs.old} (100%) rename src/Nitric.Sdk/Proto/{proto/storage/v1/Storage.cs => nitric/proto/apis/v1/Apis.cs} (55%) create mode 100644 src/Nitric.Sdk/Proto/nitric/proto/apis/v1/ApisGrpc.cs rename src/Nitric.Sdk/Proto/{proto/deploy/v1/Deploy.cs => nitric/proto/deployments/v1/Deployments.cs} (72%) rename src/Nitric.Sdk/Proto/{proto/deploy/v1/DeployGrpc.cs => nitric/proto/deployments/v1/DeploymentsGrpc.cs} (63%) rename src/Nitric.Sdk/Proto/{proto/error/v1/Error.cs => nitric/proto/http/v1/Http.cs} (50%) rename src/Nitric.Sdk/Proto/{proto/faas/v1/FaasGrpc.cs => nitric/proto/http/v1/HttpGrpc.cs} (54%) create mode 100644 src/Nitric.Sdk/Proto/nitric/proto/keyvalue/v1/Keyvalue.cs create mode 100644 src/Nitric.Sdk/Proto/nitric/proto/keyvalue/v1/KeyvalueGrpc.cs rename src/Nitric.Sdk/Proto/{proto/queue/v1/Queue.cs => nitric/proto/queues/v1/Queues.cs} (69%) create mode 100644 src/Nitric.Sdk/Proto/nitric/proto/queues/v1/QueuesGrpc.cs rename src/Nitric.Sdk/Proto/{proto/resource/v1/Resource.cs => nitric/proto/resources/v1/Resources.cs} (59%) create mode 100644 src/Nitric.Sdk/Proto/nitric/proto/resources/v1/ResourcesGrpc.cs create mode 100644 src/Nitric.Sdk/Proto/nitric/proto/schedules/v1/Schedules.cs create mode 100644 src/Nitric.Sdk/Proto/nitric/proto/schedules/v1/SchedulesGrpc.cs rename src/Nitric.Sdk/Proto/{proto/secret/v1/Secret.cs => nitric/proto/secrets/v1/Secrets.cs} (88%) rename src/Nitric.Sdk/Proto/{proto/secret/v1/SecretGrpc.cs => nitric/proto/secrets/v1/SecretsGrpc.cs} (65%) create mode 100644 src/Nitric.Sdk/Proto/nitric/proto/storage/v1/Storage.cs rename src/Nitric.Sdk/Proto/{ => nitric}/proto/storage/v1/StorageGrpc.cs (67%) create mode 100644 src/Nitric.Sdk/Proto/nitric/proto/topics/v1/Topics.cs rename src/Nitric.Sdk/Proto/{proto/event/v1/EventGrpc.cs => nitric/proto/topics/v1/TopicsGrpc.cs} (50%) rename src/Nitric.Sdk/Proto/{proto/document/v1/Document.cs => nitric/proto/websockets/v1/Websockets.cs} (50%) create mode 100644 src/Nitric.Sdk/Proto/nitric/proto/websockets/v1/WebsocketsGrpc.cs delete mode 100644 src/Nitric.Sdk/Proto/proto/document/v1/DocumentGrpc.cs delete mode 100644 src/Nitric.Sdk/Proto/proto/event/v1/Event.cs delete mode 100644 src/Nitric.Sdk/Proto/proto/faas/v1/Faas.cs delete mode 100644 src/Nitric.Sdk/Proto/proto/queue/v1/QueueGrpc.cs delete mode 100644 src/Nitric.Sdk/Proto/proto/resource/v1/ResourceGrpc.cs delete mode 100644 src/Nitric.Sdk/Proto/proto/websocket/v1/Websocket.cs delete mode 100644 src/Nitric.Sdk/Proto/proto/websocket/v1/WebsocketGrpc.cs delete mode 100644 src/Nitric.Sdk/Proto/validate/Validate.cs rename src/Nitric.Sdk/{Function => Service}/BucketNotificationContext.cs (100%) rename src/Nitric.Sdk/{Function => Service}/EventContext.cs (100%) rename src/Nitric.Sdk/{Function => Service}/Faas.cs (100%) rename src/Nitric.Sdk/{Function => Service}/Frequency.cs (100%) rename src/Nitric.Sdk/{Function => Service}/HttpContext.cs (100%) rename src/Nitric.Sdk/{Function => Service}/Middleware.cs (100%) rename src/Nitric.Sdk/{Function => Service}/TriggerContext.cs (100%) rename src/Nitric.Sdk/{Function => Service}/WebsocketContext.cs (100%) rename src/Nitric.Sdk/{Event/Event.cs => Topic/Event.cs.old} (100%) rename src/Nitric.Sdk/{Event => Topic}/EventsClient.cs (90%) rename src/Nitric.Sdk/{Event => Topic}/Topic.cs (100%) diff --git a/makefile b/makefile index b883610..4fa962b 100644 --- a/makefile +++ b/makefile @@ -19,7 +19,16 @@ download: tar xvzf contracts.tgz rm contracts.tgz -pack: clean download +download-local: + @rm -rf ./nitric + @mkdir ./nitric + @cp -r ${NITRIC_CORE_HOME}/nitric/proto ./nitric + +# /Users/rs/Development/nitric + +# "rm -r ./nitric && mkdir ./nitric && cp -r $NITRIC_CORE_HOME/nitric/proto ./nitric", + +pack: clean download-local dotnet build src/Nitric.Sdk/Nitric.Sdk.csproj -c Release mkdir -p __out dotnet pack -c Release -o __out \ No newline at end of file diff --git a/nitric/proto/apis/v1/apis.proto b/nitric/proto/apis/v1/apis.proto new file mode 100644 index 0000000..6996e61 --- /dev/null +++ b/nitric/proto/apis/v1/apis.proto @@ -0,0 +1,111 @@ +syntax = "proto3"; +package nitric.proto.apis.v1; + +// protoc plugin options for code generation +option go_package = "github.com/nitrictech/nitric/core/pkg/proto/apis/v1;apispb"; +option java_package = "io.nitric.proto.apis.v1"; +option java_multiple_files = true; +option java_outer_classname = "Apis"; +option php_namespace = "Nitric\\Proto\\Apis\\V1"; +option csharp_namespace = "Nitric.Proto.Apis.v1"; + +// Service for publishing asynchronous messages +service Api { + // Serve a route on an API + rpc Serve(stream ClientMessage) returns (stream ServerMessage); + + // Retrieve details about an API + rpc Details(ApiDetailsRequest) returns (ApiDetailsResponse); +} + +message ApiDetailsRequest { + string api_name = 1; +} + +message ApiDetailsResponse { + string url = 1; +} + +message ClientMessage { + // globally unique ID of the request/response pair + string id = 1; + + oneof content { + // Register a subscription to a topic + RegistrationRequest registration_request = 2; + + // Response to an HTTP request + HttpResponse http_response = 3; + } +} + +message HeaderValue { repeated string value = 1; } + +message QueryValue { repeated string value = 1; } + +message HttpRequest { + // The request method + string method = 1; + + // The path of the request + string path = 2; + + // HTTP request headers + map headers = 3; + + // HTTP Query params + map query_params = 4; + + // HTTP Path parameters + map path_params = 5; + + // HTTP Request body + bytes body = 6; +} + +// HttpResponseMessage +message HttpResponse { + // The HTTP status of the request + int32 status = 1; + + // HTTP response headers + map headers = 2; + + // HTTP response body + bytes body = 3; +} + +message ServerMessage { + // globally unique ID of the request/response pair + string id = 1; + + oneof content { + // Response to a topic subscription request + RegistrationResponse registration_response = 2; + + // Response to a topic message request + HttpRequest http_request = 3; + } +} + +message RegistrationResponse {} + +message ApiWorkerScopes { repeated string scopes = 1; } + +message ApiWorkerOptions { + // Apply security definitions to this operation + // This will be mapped to named ApiSecurityDefinitionResource(s) + map security = 1; + // explicitly disable security for this endpoint + // We need to do this as the default value of a repeated field + // is always empty so there is no way of knowing if security is explicitly + // disabled + bool security_disabled = 2; +} + +message RegistrationRequest { + string api = 1; + string path = 2; + repeated string methods = 3; + ApiWorkerOptions options = 4; +} diff --git a/nitric/proto/deployments/v1/deployments.proto b/nitric/proto/deployments/v1/deployments.proto new file mode 100644 index 0000000..d98dcc9 --- /dev/null +++ b/nitric/proto/deployments/v1/deployments.proto @@ -0,0 +1,312 @@ +syntax = "proto3"; +package nitric.proto.deployments.v1; + +//protoc plugin options for code generation +option go_package = "github.com/nitrictech/nitric/core/pkg/proto/deployments/v1;deploymentspb"; +option java_package = "io.nitric.proto.deployments.v1"; +option java_multiple_files = true; +option java_outer_classname = "Deployments"; +option php_namespace = "Nitric\\Proto\\Deployments\\V1"; +option csharp_namespace = "Nitric.Proto.Deployments.v1"; + +import "google/protobuf/struct.proto"; +import "nitric/proto/resources/v1/resources.proto"; +import "nitric/proto/storage/v1/storage.proto"; + +// The Nitric Deloyment Service contract +service Deployment { + // Begins a new deployment + // Server will stream updates back to the connected client + // on the status of the deployment + rpc Up (DeploymentUpRequest) returns (stream DeploymentUpEvent); + // Tears down an existing deployment + // Server will stream updates back to the connected client + // on the status of the teardown + rpc Down (DeploymentDownRequest) returns (stream DeploymentDownEvent); +} + +message DeploymentUpRequest { + // The spec to deploy + Spec spec = 1; + + // A map of attributes related to the deploy request + // this allows for adding project identifiers etc. + google.protobuf.Struct attributes = 2; + + // A hint to the provider of the kind of output that the client can accept + // This will allow provider developers to provider richer output back to clients. + bool interactive = 3; +} + +message DeploymentUpEvent { + oneof content { + string message = 1; + ResourceUpdate update = 2; + UpResult result = 3; + } +} + +enum ResourceDeploymentAction { + // A new resource is being created + CREATE = 0; + // An existing resource is being updated + UPDATE = 1; + // An existing resource is being replaced + REPLACE = 2; + // No-op on the resource (it already exists and requires no changes) + SAME = 3; + // An existing resource is being deleted + DELETE = 4; +} + +enum ResourceDeploymentStatus { + // The action hasn't started, usually due to a dependency + PENDING = 0; + // The action in currently in-flight, e.g. waiting for cloud provder to provision a resource + IN_PROGRESS = 1; + // The action has been applied successfully + SUCCESS = 2; + // The action has failed to be (completely) applied + FAILED = 3; +} + +/* + +hello : service : created +| latest message goes here. +|- Container Image : created +|- ECR Repository : failed + +*/ + +message ResourceUpdate { + // The resource being updated, if this is nil the update applies to the stack + nitric.proto.resources.v1.ResourceIdentifier id = 1; + + // The type of update being applied + ResourceDeploymentAction action = 3; + + // The current status of the action being applied + ResourceDeploymentStatus status = 4; + + // (optional) A globally unique identifier (scoped to the id above), used when Nitric Resources map 1:many in a cloud provider. + // e.g. the container image repository for a service deployment. + // This can also be set when id is nil above and it will imply a non-nitric resource that is necessary to deploy for a stack to operate + // e.g. an Azure StorageAccount + string sub_resource = 5; + + // Additional information about the update + string message = 6; +} + +// Terminal message indicating deployment success +message UpResult { + // Indicate the success status + bool success = 1; + + // Simple formatted string output as result + string details = 2; +} + +message DeploymentDownRequest { + // A map of attributes related to the deploy request + // this allows for adding project identifiers etc. + google.protobuf.Struct attributes = 1; + + // A hint to the provider of the kind of output that the client can accept + // This will allow provider developers to provider richer output back to clients. + bool interactive = 2; +} + +message DeploymentDownEvent { + oneof content { + string message = 1; + DownResult result = 2; + ResourceUpdate update = 3; + } +} + +// Terminal message indicating deployment success +message DownResult {} + +// An image source to be used for service deployment +message ImageSource { + // URI of the docker image + // TODO: May also need to provide auth information (although this should just be configured on the running client already) + string uri = 1; +} + +// A unit of service (i.e. function/container) +message Service { + // Source of the service + oneof source { + // Container image as a service + ImageSource image = 1; + // Alternative sources could include + // - zipped code sources + // - git/scm repository URIs + + } + + // Expected worker count for this service + int32 workers = 10; + // Configurable timeout for request handling + int32 timeout = 11 [deprecated = true]; + // Configurable memory size for this instance + int32 memory = 12 [deprecated = true]; + + // A simple type property + // describes the requested type of service that this should be + // for this project, a provider can implement how this request is satisfied + // in any way + string type = 13; + + // Environment variables for this service + map env = 14; +} + +message Bucket { + repeated BucketListener listeners = 1; +} + +message BucketListener { + nitric.proto.storage.v1.RegistrationRequest config = 1; + oneof target { + // The name of an service to target + string service = 2; + } +} + + +message Topic { + repeated SubscriptionTarget subscriptions = 1; +} + +message Queue {} + +message KeyValueStore { + +} + +message Secret { + +} + +message SubscriptionTarget { + oneof target { + // The name of an service to target + string service = 1; + + // Additional targets could potentially include + // - HTTP/API Endpoints + // - Queues + } +} + +message TopicSubscription { + SubscriptionTarget target = 1; +} + +message HttpTarget { + oneof target { + // The name of an service to target + string service = 1; + } +} + +// A http resource +message Http { + HttpTarget target = 1; +} + +message Api { + oneof document { + // An OpenAPI document for deployment + // This document will contain extensions that hint of services that should be targeted as part of the deployment + string openapi = 1; + } +} + +// Declare a new websocket +message Websocket { + // Target for handling new client connections + WebsocketTarget connect_target = 1; + // Target for handling client disconnections + WebsocketTarget disconnect_target = 2; + // Target for handling all other message types + WebsocketTarget message_target = 3; +} + +message WebsocketTarget { + oneof target { + // The name of an service to target + string service = 1; + + // Additional targets could potentially include + // - HTTP/API Endpoints + } +} + +message ScheduleTarget { + oneof target { + // The name of an service to target + string service = 1; + + // Additional targets could potentially include + // - HTTP/API Endpoints + } +} + +message Schedule { + ScheduleTarget target = 1; + + oneof cadence { + ScheduleEvery every = 10; + ScheduleCron cron = 11; + } +} + +message ScheduleEvery { + // rate string e.g. '5 minutes'. Value frequencies are 'minutes', 'hours', 'days'. + string rate = 1; +} + +message ScheduleCron { + // standard unix cron expression + string expression = 1; +} + +message Resource { + nitric.proto.resources.v1.ResourceIdentifier id = 1; + + oneof config { + Service service = 10; + Bucket bucket = 11; + Topic topic = 12; + Api api = 13; + Policy policy = 14; + Schedule schedule = 15; + KeyValueStore key_value_store = 16; + Secret secret = 17; + Websocket websocket = 18; + Http http = 19; + Queue queue = 20; + } +} + +// This is already defined in the resource contracts... +// Need to determine if it's worth re-using +// unfortunately there are parts we don't want to duplicate, such as API config +message Policy { + repeated Resource principals = 1; + // TODO: Split out discrete action definitions from resources + // Also need to allow custom action types as well + // Should incorporate action re-use here... + repeated nitric.proto.resources.v1.Action actions = 2; + repeated Resource resources = 3; +} + +message Spec { + // list of resources to deploy + repeated Resource resources = 1; +} diff --git a/nitric/proto/http/v1/http.proto b/nitric/proto/http/v1/http.proto new file mode 100644 index 0000000..293fd05 --- /dev/null +++ b/nitric/proto/http/v1/http.proto @@ -0,0 +1,29 @@ +syntax = "proto3"; +package nitric.proto.http.v1; + +// protoc plugin options for code generation +option go_package = "github.com/nitrictech/nitric/core/pkg/proto/http/v1;httppb"; +option java_package = "io.nitric.proto.http.v1"; +option java_multiple_files = true; +option java_outer_classname = "Https"; +option php_namespace = "Nitric\\Proto\\Http\\V1"; +option csharp_namespace = "Nitric.Proto.Http.v1"; + +// Service for publishing asynchronous messages +service Http { + // Proxy an HTTP server + rpc Proxy(stream ClientMessage) returns (stream ServerMessage); +} + +message ClientMessage { + // Details of the HTTP server to proxy + HttpProxyRequest request = 1; +} + +message ServerMessage {} + +message HttpProxyRequest { + // The local port the server can be accessed on + string host = 1; +} + diff --git a/nitric/proto/keyvalue/v1/keyvalue.proto b/nitric/proto/keyvalue/v1/keyvalue.proto new file mode 100644 index 0000000..e328dcf --- /dev/null +++ b/nitric/proto/keyvalue/v1/keyvalue.proto @@ -0,0 +1,77 @@ +syntax = "proto3"; +package nitric.proto.KeyValue.v1; + +import "google/protobuf/struct.proto"; + +// protoc plugin options for code generation +// option go_package = "nitric/v1;v1"; +option go_package = "github.com/nitrictech/nitric/core/pkg/proto/keyvalue/v1;KeyValuepb"; +option java_package = "io.nitric.proto.keyvalue.v1"; +option java_multiple_files = true; +option java_outer_classname = "KeyValue"; +option php_namespace = "Nitric\\Proto\\KeyValue\\V1"; +option csharp_namespace = "Nitric.Proto.KeyValue.v1"; + +// Service for storage and retrieval of simple JSON keyValue +service KeyValue { + // Get an existing document + rpc Get (KeyValueGetRequest) returns (KeyValueGetResponse); + + // Create a new or overwrite an existing document + rpc Set (KeyValueSetRequest) returns (KeyValueSetResponse); + + // Delete an existing document + rpc Delete (KeyValueDeleteRequest) returns (KeyValueDeleteResponse); +} + +// Provides a Key Value Store type for storing documents +message Store { + // The store name + string name = 1; +} + +// ValueRef provides a unique identifier for a value +message ValueRef { + // The key/value store name + string store = 1; + + // The item's unique key within the store + string key = 2; +} + +// Value provides a return value type +message Value { + // ValueRef of the key/value pair, which includes the store and key + ValueRef ref = 1; + + // The content (JSON object) + google.protobuf.Struct content = 2; +} + +// Service Request & Response Messages + +message KeyValueGetRequest { + // ValueRef of the key/value pair to get, which includes the store and key + ValueRef ref = 1; +} + +message KeyValueGetResponse { + // The retrieved value + Value value = 1; +} + +message KeyValueSetRequest { + // ValueRef of the key/value pair to set, which includes the store and key + ValueRef ref = 1 ; + // The value content to store (JSON object) + google.protobuf.Struct content = 3; +} + +message KeyValueSetResponse {} + +message KeyValueDeleteRequest { + // ValueRef of the key/value pair to delete, which includes the store and key + ValueRef ref = 1; +} + +message KeyValueDeleteResponse {} diff --git a/nitric/proto/queues/v1/queues.proto b/nitric/proto/queues/v1/queues.proto new file mode 100644 index 0000000..337be4d --- /dev/null +++ b/nitric/proto/queues/v1/queues.proto @@ -0,0 +1,79 @@ +syntax = "proto3"; +package nitric.proto.queues.v1; + +import "google/protobuf/struct.proto"; + +// protoc plugin options for code generation +option go_package = "github.com/nitrictech/nitric/core/pkg/proto/queues/v1;queuespb"; +option java_package = "io.nitric.proto.queues.v1"; +option java_multiple_files = true; +option java_outer_classname = "QueuesService"; +option php_namespace = "Nitric\\Proto\\Queues\\V1"; +option csharp_namespace = "Nitric.Proto.Queues.v1"; + +// The Nitric Queue Service contract +service Queues { + // Send messages to a queue + rpc Send (QueueSendRequestBatch) returns (QueueSendResponse); + // Receive message(s) from a queue + rpc Receive (QueueReceiveRequest) returns (QueueReceiveResponse); + // Complete an item previously popped from a queue + rpc Complete (QueueCompleteRequest) returns (QueueCompleteResponse); +} + +message QueueSendRequestBatch { + // The Nitric name for the queue + // this will automatically be resolved to the provider specific queue identifier. + string queue_name = 1; + // Array of tasks to push to the queue + repeated QueueSendRequest requests = 2; +} + +// Response for sending a collection of tasks +message QueueSendResponse { + // A list of tasks that failed to be queued + repeated FailedSendRequest failed_requests = 1; +} + +message QueueReceiveRequest { + // The nitric name for the queue + // this will automatically be resolved to the provider specific queue identifier. + string queue_name = 1; + // The max number of items to pop off the queue, may be capped by provider specific limitations + int32 depth = 2; +} + +message QueueReceiveResponse { + // Array of tasks popped off the queue + repeated ReceivedTask tasks = 1; +} + +message QueueCompleteRequest { + // The nitric name for the queue + // this will automatically be resolved to the provider specific queue identifier. + string queue_name = 1; + + // Lease id of the task to be completed + string lease_id = 2; +} + +message QueueCompleteResponse {} + +// A task to be sent to a queue. +message QueueSendRequest { + // The payload of the task + google.protobuf.Struct payload = 1; +} + +message ReceivedTask { + string lease_id = 1; + + google.protobuf.Struct payload = 2; +} + +message FailedSendRequest { + // The task that failed to be pushed + QueueSendRequest request = 1; + // A message describing the failure + string message = 2; +} diff --git a/nitric/proto/resources/v1/resources.proto b/nitric/proto/resources/v1/resources.proto new file mode 100644 index 0000000..987b783 --- /dev/null +++ b/nitric/proto/resources/v1/resources.proto @@ -0,0 +1,125 @@ +syntax = "proto3"; +package nitric.proto.resources.v1; + +//protoc plugin options for code generation +option go_package = "github.com/nitrictech/nitric/core/pkg/proto/resources/v1;resourcespb"; +option java_package = "io.nitric.proto.resources.v1"; +option java_multiple_files = true; +option java_outer_classname = "Resources"; +option php_namespace = "Nitric\\Proto\\Resources\\V1"; +option csharp_namespace = "Nitric.Proto.Resources.v1"; + +// Nitric Resource Service +// The service definition exists to allow a nitric application to declare peripheral dependencies +service Resources { + // Declare a resource for the nitric application + // At Deploy time this will create resources as part of the nitric stacks dependency graph + // At runtime + rpc Declare (ResourceDeclareRequest) returns (ResourceDeclareResponse); +} + +message PolicyResource { + repeated ResourceIdentifier principals = 1; + repeated Action actions = 2; + repeated ResourceIdentifier resources = 3; +} + +enum ResourceType { + Api = 0; + Service = 1; + Bucket = 2; + Topic = 3; + Schedule = 4; + Subscription = 5; + KeyValueStore = 6; + Policy = 7; + Secret = 8; + BucketListener = 9; + Websocket = 10; + Http = 11; + ApiSecurityDefinition = 12; + Queue = 13; +} + +// Unique identifier for a resource within a nitric application. +message ResourceIdentifier { + ResourceType type = 1; + string name = 2; +} + +message ResourceDeclareRequest { + ResourceIdentifier id = 1; + + oneof config { + PolicyResource policy = 10; + BucketResource bucket = 11; + TopicResource topic = 12; + KeyValueStoreResource key_value_store = 13; + SecretResource secret = 14; + ApiResource api = 15; + ApiSecurityDefinitionResource api_security_definition = 16; + QueueResource queue = 17; + } +} + +message BucketResource {} +message TopicResource {} +message QueueResource {} +message KeyValueStoreResource {} +message SecretResource {} + +message ApiOpenIdConnectionDefinition { + string issuer = 1; + repeated string audiences = 2; +} + +message ApiSecurityDefinitionResource { + string api_name = 1; + + oneof definition { + ApiOpenIdConnectionDefinition oidc = 2; + } +} + +message ApiScopes { + repeated string scopes = 1; +} + +message ApiResource { + // root level security map for this api + // references ApiSecurityDefinitionResource(s) + map security = 1; +} + +enum Action { + // Bucket Permissions: 0XX + BucketFileList = 0; + BucketFileGet = 1; + BucketFilePut = 2; + BucketFileDelete = 3; + + // Topic Permissions: 2XX + TopicList = 200; + TopicDetail = 201; + TopicEventPublish = 202; + + // Collection Permissions: 3XX + KeyValueStoreRead = 300; + KeyValueStoreWrite = 301; + KeyValueStoreDelete = 302; + + // Secret Permissions: 4XX + SecretPut = 400; + SecretAccess = 401; + + // Websocket Permissions: 5XX + WebsocketManage = 500; + + // Queue Permissions: 6XX + QueueSend = 600; + QueueReceive = 601; + QueueList = 602; + QueueDetail = 603; +} + +message ResourceDeclareResponse {} diff --git a/nitric/proto/schedules/v1/schedules.proto b/nitric/proto/schedules/v1/schedules.proto new file mode 100644 index 0000000..5957b35 --- /dev/null +++ b/nitric/proto/schedules/v1/schedules.proto @@ -0,0 +1,69 @@ +syntax = "proto3"; +package nitric.proto.schedules.v1; + +// protoc plugin options for code generation +option go_package = "github.com/nitrictech/nitric/core/pkg/proto/schedules/v1;schedulespb"; +option java_package = "io.nitric.proto.schedules.v1"; +option java_multiple_files = true; +option java_outer_classname = "SchedulesService"; +option php_namespace = "Nitric\\Proto\\Schedules\\V1"; +option csharp_namespace = "Nitric.Proto.Schedules.v1"; + +// Service for publishing asynchronous messages +service Schedules { + rpc Schedule(stream ClientMessage) returns (stream ServerMessage); +} + +message ClientMessage { + // globally unique ID of the request/response pair + string id = 1; + + oneof content { + // Register a subscription to a schedule + RegistrationRequest registration_request = 2; + + // Response to a schedule interval + IntervalResponse interval_response = 3; + } +} + +message IntervalRequest { + string schedule_name = 1; +} + +message MessageResponse { + bool success = 1; +} + +message ServerMessage { + // globally unique ID of the request/response pair + string id = 1; + + oneof content { + // Response to a schedule subscription request + RegistrationResponse registration_response = 2; + + // A schedule interval trigger request + IntervalRequest interval_request = 3; + } +} + +message RegistrationRequest { + string schedule_name = 1; + oneof cadence { + ScheduleEvery every = 10; + ScheduleCron cron = 11; + } +} + +message ScheduleEvery { + string rate = 1; +} + +message ScheduleCron { + string expression = 1; +} + +message RegistrationResponse {} + +message IntervalResponse {} diff --git a/nitric/proto/secrets/v1/secrets.proto b/nitric/proto/secrets/v1/secrets.proto new file mode 100644 index 0000000..ced438a --- /dev/null +++ b/nitric/proto/secrets/v1/secrets.proto @@ -0,0 +1,59 @@ +syntax = "proto3"; +package nitric.proto.secrets.v1; + +//protoc plugin options for code generation +option go_package = "github.com/nitrictech/nitric/core/pkg/proto/secrets/v1;secretspb"; +option java_package = "io.nitric.proto.secrets.v1"; +option java_multiple_files = true; +option java_outer_classname = "SecretsService"; +option php_namespace = "Nitric\\Proto\\Secrets\\V1"; +option csharp_namespace = "Nitric.Proto.Secrets.v1"; + +service SecretManager { + // Updates a secret, creating a new one if it doesn't already exist + rpc Put (SecretPutRequest) returns (SecretPutResponse); + // Gets a secret from a Secret Store + rpc Access (SecretAccessRequest) returns (SecretAccessResponse); +} + +// Request to put a secret to a Secret Store +message SecretPutRequest { + // The Secret to put to the Secret store + Secret secret = 1; + // The value to assign to that secret + bytes value = 2; +} + +// Result from putting the secret to a Secret Store +message SecretPutResponse { + // The id of the secret + SecretVersion secret_version = 1; +} + +// Request to get a secret from a Secret Store +message SecretAccessRequest { + // The id of the secret + SecretVersion secret_version = 1; +} + +// The secret response +message SecretAccessResponse { + // The version of the secret that was requested + SecretVersion secret_version = 1; + // The value of the secret + bytes value = 2; +} + +// The secret container +message Secret { + // The secret name + string name = 1; +} + +// A version of a secret +message SecretVersion { + // Reference to the secret container + Secret secret = 1; + // The secret version + string version = 2; +} \ No newline at end of file diff --git a/nitric/proto/storage/v1/storage.proto b/nitric/proto/storage/v1/storage.proto new file mode 100644 index 0000000..7ec6c6c --- /dev/null +++ b/nitric/proto/storage/v1/storage.proto @@ -0,0 +1,189 @@ +syntax = "proto3"; +package nitric.proto.storage.v1; + +// protoc plugin options for code generation +option go_package = "github.com/nitrictech/nitric/core/pkg/proto/storage/v1;storagepb"; +option java_package = "io.nitric.proto.storage.v1"; +option java_multiple_files = true; +option java_outer_classname = "StorageService"; +option php_namespace = "Nitric\\Proto\\Storage\\V1"; +option csharp_namespace = "Nitric.Proto.Storage.v1"; + +import "google/protobuf/duration.proto"; + +// Services for storage and retrieval of blobs in the form of byte arrays, such as text and binary blobs. +service Storage { + // Retrieve an item from a bucket + rpc Read (StorageReadRequest) returns (StorageReadResponse); + // Store an item to a bucket + rpc Write (StorageWriteRequest) returns (StorageWriteResponse); + // Delete an item from a bucket + rpc Delete (StorageDeleteRequest) returns (StorageDeleteResponse); + // Generate a pre-signed URL for direct operations on an item + rpc PreSignUrl (StoragePreSignUrlRequest) returns (StoragePreSignUrlResponse); + // List blobs currently in the bucket + rpc ListBlobs (StorageListBlobsRequest) returns (StorageListBlobsResponse); + // Determine is an object exists in a bucket + rpc Exists (StorageExistsRequest) returns (StorageExistsResponse); +} + +service StorageListener { + // Listen for changes on a bucket + rpc Listen (stream ClientMessage) returns (stream ServerMessage); +} + + +message ClientMessage { + // globally unique ID of the request/response pair + string id = 1; + + oneof content { + // Watch for changes on a bucket + RegistrationRequest registration_request = 2; + // Stop watching for changes on a bucket + BlobEventResponse blob_event_response = 3; + } +} + +message ServerMessage { + // globally unique ID of the request/response pair + string id = 1; + + oneof content { + // Watch for changes on a bucket + RegistrationResponse registration_response = 2; + // Stop watching for changes on a bucket + BlobEventRequest blob_event_request = 3; + } +} + +message BlobEventRequest { + string bucket_name = 1; + + // Now we don't need to specify a type enum, the specific contents/type comes in a single field of the context. + oneof event { + BlobEvent blob_event = 10; + } +} + +message BlobEvent { + // The key of the blob the event is for + string key = 1; + + // The type of event that occurred + BlobEventType type = 2; +} + + +message BlobEventResponse { + bool success = 1; +} + +enum BlobEventType { + Created = 0; + Deleted = 1; +} + +message RegistrationRequest { + // Name of the bucket to watch + string bucket_name = 1; + + // Event type to listen for + BlobEventType blob_event_type = 2; + + // A blob key prefix to filter events by + string key_prefix_filter = 3; +} + +message RegistrationResponse { + // The ID of the registration + string id = 1; +} + +// Request to put (create/update) a storage item +message StorageWriteRequest { + // Nitric name of the bucket to store in + // this will be automatically resolved to the provider specific bucket identifier. + string bucket_name = 1; + // Key to store the item under + string key = 2; + // bytes array to store + bytes body = 3; +} + +// Result of putting a storage item +message StorageWriteResponse {} + +// Request to retrieve a storage item +message StorageReadRequest { + // Nitric name of the bucket to retrieve from + // this will be automatically resolved to the provider specific bucket identifier. + string bucket_name = 1; + // Key of item to retrieve + string key = 2; +} + +// Returned storage item +message StorageReadResponse { + // The body bytes of the retrieved storage item + bytes body = 1; +} + +// Request to delete a storage item +message StorageDeleteRequest { + // Name of the bucket to delete from + string bucket_name = 1; + // Key of item to delete + string key = 2; +} + +// Result of deleting a storage item +message StorageDeleteResponse {} + +// Request to generate a pre-signed URL for a blob to perform a specific operation, such as read or write. +message StoragePreSignUrlRequest { + // Nitric name of the bucket to retrieve from + // this will be automatically resolved to the provider specific bucket identifier. + string bucket_name = 1; + // Key of item to generate the signed URL for. + // The URL and the token it contains will only be valid for operations on this resource specifically. + string key = 2; + // Operation + enum Operation { + READ = 0; + WRITE = 1; + } + Operation operation = 3; + // Expiry defined as as protobuf duration + google.protobuf.Duration expiry = 4; +} + +message StoragePreSignUrlResponse { + // The pre-signed url, restricted to the operation, resource and expiry time specified in the request. + string url = 1; +} + +message StorageListBlobsRequest { + string bucket_name = 1; + + string prefix = 2; +} + +message Blob { + string key = 1; +} + +message StorageListBlobsResponse { + // keys of the blobs in the bucket + repeated Blob blobs = 1; +} + +message StorageExistsRequest { + string bucket_name = 1; + // Key of item to retrieve + string key = 2; +} + +message StorageExistsResponse { + bool exists = 1; +} \ No newline at end of file diff --git a/nitric/proto/topics/v1/topics.proto b/nitric/proto/topics/v1/topics.proto new file mode 100644 index 0000000..e03ee75 --- /dev/null +++ b/nitric/proto/topics/v1/topics.proto @@ -0,0 +1,90 @@ +syntax = "proto3"; +package nitric.proto.topics.v1; + +import "google/protobuf/struct.proto"; +import "google/protobuf/duration.proto"; + +// protoc plugin options for code generation +option go_package = "github.com/nitrictech/nitric/core/pkg/proto/topics/v1;topicspb"; +option java_package = "io.nitric.proto.topics.v1"; +option java_multiple_files = true; +option java_outer_classname = "TopicsService"; +option php_namespace = "Nitric\\Proto\\Topics\\V1"; +option csharp_namespace = "Nitric.Proto.Topics.v1"; + +// Service for publishing asynchronous messages +service Topics { + // Publishes a message to a given topic + rpc Publish (TopicPublishRequest) returns (TopicPublishResponse); +} + +// Service for subscribing to asynchronous messages +service Subscriber { + // Subscribe to a topic and handle incoming messages + rpc Subscribe (stream ClientMessage) returns (stream ServerMessage); +} + +message ClientMessage { + // globally unique ID of the request/response pair + string id = 1; + + oneof content { + // Register a subscription to a topic + RegistrationRequest registration_request = 2; + + // Handle a message received from a topic + MessageResponse message_response = 3; + } +} + +message MessageRequest { + string topic_name = 1; + + // Message Type + Message message = 2; +} + +message MessageResponse { + bool success = 1; +} + +message ServerMessage { + // globally unique ID of the request/response pair + string id = 1; + + oneof content { + // Response to a topic subscription request + RegistrationResponse registration_response = 2; + + // Response to a topic message request + MessageRequest message_request = 3; + } +} + +message RegistrationRequest { + string topic_name = 1; +} + +message RegistrationResponse {} + +message Message { + // The topic message contents + oneof content { + google.protobuf.Struct struct_payload = 1; + } +} + +// Request to publish a message to a topic +message TopicPublishRequest { + // The name of the topic to publish the topic to + string topic_name = 1; + + // The message to be published + Message message = 2; + + // An optional delay specified in seconds (minimum 10 seconds) + google.protobuf.Duration delay = 3; +} + +// Result of publishing an topic +message TopicPublishResponse {} diff --git a/nitric/proto/websockets/v1/websockets.proto b/nitric/proto/websockets/v1/websockets.proto new file mode 100644 index 0000000..606a6c6 --- /dev/null +++ b/nitric/proto/websockets/v1/websockets.proto @@ -0,0 +1,147 @@ +syntax = "proto3"; +package nitric.proto.websockets.v1; + +// protoc plugin options for code generation +option go_package = "github.com/nitrictech/nitric/core/pkg/proto/websockets/v1;websocketspb"; +option java_package = "io.nitric.proto.websockets.v1"; +option java_multiple_files = true; +option java_outer_classname = "WebsocketsService"; +option php_namespace = "Nitric\\Proto\\Websockets\\V1"; +option csharp_namespace = "Nitric.Proto.Websockets.v1"; + +service Websocket { + // Send a messages to a websocket + rpc Send(WebsocketSendRequest) returns (WebsocketSendResponse); + + // Close a websocket connection + // This can be used to force a client to disconnect + rpc Close(WebsocketCloseRequest) returns (WebsocketCloseResponse); + + // Retrieve details about an API + rpc Details(WebsocketDetailsRequest) returns (WebsocketDetailsResponse); +} + +message WebsocketDetailsRequest { + string socket_name = 1; +} + +message WebsocketDetailsResponse { + string url = 1; +} + +service WebsocketHandler { + // Handle incoming websocket events + rpc HandleEvents (stream ClientMessage) returns (stream ServerMessage); +} + +message WebsocketSendRequest { + // The nitric name of the socket to send on + string socket_name = 1; + // The connection ID of the client to send to + string connection_id = 2; + // The data to send to the socket + bytes data = 3; +} + +message WebsocketSendResponse {} + +message WebsocketCloseRequest { + // The nitric name of the socket to send on + string socket_name = 1; + // The connection ID of the client to send to + string connection_id = 2; +} + +message WebsocketCloseResponse {} + + +// Messages the client is able to send to the server +message ClientMessage { + // Client message ID, used to pair requests/responses + string id = 1; + + oneof content { + // Client initialisation request + // A worker will not be eligible for triggers + // until it has identified itself + RegistrationRequest registration_request = 2; + + // Client responding with result of a trigger + WebsocketEventResponse websocket_event_response = 3; + } +} + +enum WebsocketEventType { + // Specialised Event for handling new client connections + Connect = 0; + // Specialised Event for handling existing client connections + Disconnect = 1; + // All other types of events are messages + Message = 2; +} + +// Placeholder message +message RegistrationResponse {} + +message RegistrationRequest { + // The nitric name of the socket that this worker listens on + string socket_name = 1; + // The type of event that this worker handles + WebsocketEventType event_type = 2; +} + +message WebsocketEventRequest { + // The nitric name of the socket that this worker listens on + string socket_name = 1; + + // The connection this trigger came from + string connectionId = 2; + + oneof websocket_event { + WebsocketConnectionEvent connection = 10; + WebsocketDisconnectionEvent disconnection = 11; + WebsocketMessageEvent message = 12; + } +} + +message QueryValue { repeated string value = 1; } + +// Messages the server is able to send to the client +message ServerMessage { + // Server message ID, used to pair requests/responses + string id = 1; + + oneof content { + // Server responding + // with client configuration details to an + // InitRequest + RegistrationResponse registration_response = 2; + + // Server requesting client to process an event + WebsocketEventRequest websocket_event_request = 3; + } +} + +message WebsocketEventResponse { + oneof websocket_response { + WebsocketConnectionResponse connection_response = 10; + // WebsocketDisconnectionResponse disconnection_response = 11; + // WebsocketMessageEventResponse message_response = 12; + } +} + +message WebsocketConnectionEvent { + // The query params available in the connection request + map query_params = 1; +} + +message WebsocketConnectionResponse { + bool reject = 1; +} + +message WebsocketDisconnectionEvent {} + +message WebsocketMessageEvent { + // Data available on + bytes body = 1; +} diff --git a/src/Nitric.Sdk/Common/Constants.cs b/src/Nitric.Sdk/Common/Constants.cs deleted file mode 100644 index fcc3f8f..0000000 --- a/src/Nitric.Sdk/Common/Constants.cs +++ /dev/null @@ -1,20 +0,0 @@ -// Copyright 2021, Nitric Technologies Pty Ltd. -// -// 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. -namespace Nitric.Sdk.Common -{ - internal static class Constants - { - internal static int DepthLimit => 1; - } -} diff --git a/src/Nitric.Sdk/Document/AbstractCollection.cs b/src/Nitric.Sdk/Document/AbstractCollection.cs deleted file mode 100644 index 719554e..0000000 --- a/src/Nitric.Sdk/Document/AbstractCollection.cs +++ /dev/null @@ -1,104 +0,0 @@ -// Copyright 2021, Nitric Technologies Pty Ltd. -// -// 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. - -using System; -using DocumentServiceClient = Nitric.Proto.Document.v1.DocumentService.DocumentServiceClient; -using Collection = Nitric.Proto.Document.v1.Collection; - -namespace Nitric.Sdk.Document -{ - public abstract class AbstractCollection - { - internal readonly DocumentServiceClient DocumentClient; - - /// - /// The name of the collection - /// - public readonly string Name; - - /// - /// A reference to the document this collection sits below. - /// - /// If set, this is a sub-collection. - /// - public readonly Key ParentKey; - - /// - /// Construct a new collection - /// - /// The client reference to use for operations on this collection - /// The name of the collection - /// An optional parent key - /// Throws if a required parameter is missing - protected AbstractCollection(DocumentServiceClient documentClient, string name, Key parentKey) - { - if (string.IsNullOrEmpty(name)) - { - throw new ArgumentNullException(nameof(name)); - } - - this.Name = name; - this.ParentKey = parentKey; - this.DocumentClient = documentClient; - } - - internal Collection ToGrpcCollection() - { - var collection = new Collection() - { - Name = this.Name, - }; - if (this.ParentKey != null) - { - collection.Parent = this.ParentKey.ToKey(); - } - - return collection; - } - - /// - /// Determines the depth of this collection. - /// - /// If the collection has no parent collections the depth will be 1. The depth is increased by 1 for each parent. - /// - /// - public int Depth() - { - var parentDepth = (this.ParentKey != null) ? this.ParentKey.Collection.Depth() : 0; - return 1 + parentDepth; - } - } - - /// - /// Document collection base class - /// - /// The type for documents in this collection - public abstract class AbstractCollection : AbstractCollection - { - - public AbstractCollection(DocumentServiceClient documentClient, string name, Key parentKey) : base(documentClient, name, parentKey) { - - } - - /// - /// Construct a query to find documents in the collection - /// - /// A new query builder - public Query Query() - { - return new Query(this.DocumentClient, this); - } - - } -} diff --git a/src/Nitric.Sdk/Document/CollectionGroupRef.cs b/src/Nitric.Sdk/Document/CollectionGroupRef.cs deleted file mode 100644 index df5c30e..0000000 --- a/src/Nitric.Sdk/Document/CollectionGroupRef.cs +++ /dev/null @@ -1,41 +0,0 @@ -// Copyright 2021, Nitric Technologies Pty Ltd. -// -// 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. - -using System.Collections.Generic; -using DocumentServiceClient = Nitric.Proto.Document.v1.DocumentService.DocumentServiceClient; - -namespace Nitric.Sdk.Document -{ - /// - /// Represents a group of collections, used to search for documents in across multiple collections. - /// - /// This is typically used to search all sub-collections below docs in a single parent collections. - /// - /// E.g. search all cities in all states. The group of sub-collections are expected to have the same name (e.g. "cities") - /// - /// The type of documents contained in the group of collections - public class CollectionGroup : AbstractCollection - { - /// - /// Construct a new collection group - /// - /// The document client used to interact with this group - /// A name of the collections - /// The parent of the collection - public CollectionGroup(DocumentServiceClient documentClient, string name, Key parentKey) - : base(documentClient, name, parentKey) - { - } - } -} diff --git a/src/Nitric.Sdk/Document/CollectionRef.cs b/src/Nitric.Sdk/Document/CollectionRef.cs deleted file mode 100644 index 1a85dc7..0000000 --- a/src/Nitric.Sdk/Document/CollectionRef.cs +++ /dev/null @@ -1,81 +0,0 @@ -// Copyright 2021, Nitric Technologies Pty Ltd. -// -// 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. - -using System; -using DocumentServiceClient = Nitric.Proto.Document.v1.DocumentService.DocumentServiceClient; -using Constants = Nitric.Sdk.Common.Constants; - -namespace Nitric.Sdk.Document -{ - /// - /// A reference to a collection in the underlying document database. - /// - /// The type of documents stored in the collection. - public class CollectionRef : AbstractCollection - { - internal CollectionRef(DocumentServiceClient documentClient, string name, Key parentKey = null) - : base(documentClient, name, parentKey) - { - } - - /// - /// Create a reference to a document within the collection. - /// - /// The unique ID of the document. - /// A new document reference, which can be used to interact with the document. - /// - public DocumentRef Doc(string documentId) - { - if (string.IsNullOrEmpty(documentId)) - { - throw new ArgumentNullException(nameof(documentId)); - } - - return new DocumentRef( - this.DocumentClient, - this, - documentId); - } - - /// - /// Returns a reference to all sub-collections with a particular name within this collection. - /// - /// E.g. if this is a 'states' collection, the sub-collections could be 'cities'. - /// - /// The sub-collection name - /// A reference to all sub-collections with the provided name - /// - /// - public CollectionGroup Collection(string name) - { - if (string.IsNullOrEmpty(name)) - { - throw new ArgumentNullException(name); - } - - var collectionDepth = this.Depth(); - if (collectionDepth > Constants.DepthLimit) - { - throw new NotSupportedException("Currently sub-collections are only able to be nested to a depth of " + - Constants.DepthLimit + ", found depth " + collectionDepth); - } - - var parentKey = new Key { Collection = this }; - return new CollectionGroup( - this.DocumentClient, - name, - parentKey); - } - } -} diff --git a/src/Nitric.Sdk/Document/Document.cs b/src/Nitric.Sdk/Document/Document.cs.old similarity index 100% rename from src/Nitric.Sdk/Document/Document.cs rename to src/Nitric.Sdk/Document/Document.cs.old diff --git a/src/Nitric.Sdk/Document/DocumentRef.cs b/src/Nitric.Sdk/Document/DocumentRef.cs.old similarity index 100% rename from src/Nitric.Sdk/Document/DocumentRef.cs rename to src/Nitric.Sdk/Document/DocumentRef.cs.old diff --git a/src/Nitric.Sdk/Document/DocumentsClient.cs b/src/Nitric.Sdk/Document/DocumentsClient.cs.old similarity index 100% rename from src/Nitric.Sdk/Document/DocumentsClient.cs rename to src/Nitric.Sdk/Document/DocumentsClient.cs.old diff --git a/src/Nitric.Sdk/Document/Key.cs b/src/Nitric.Sdk/Document/Key.cs.old similarity index 100% rename from src/Nitric.Sdk/Document/Key.cs rename to src/Nitric.Sdk/Document/Key.cs.old diff --git a/src/Nitric.Sdk/Document/Query.cs b/src/Nitric.Sdk/Document/Query.cs.old similarity index 100% rename from src/Nitric.Sdk/Document/Query.cs rename to src/Nitric.Sdk/Document/Query.cs.old diff --git a/src/Nitric.Sdk/Nitric.Sdk.csproj b/src/Nitric.Sdk/Nitric.Sdk.csproj index b7be4fe..6e2db1f 100644 --- a/src/Nitric.Sdk/Nitric.Sdk.csproj +++ b/src/Nitric.Sdk/Nitric.Sdk.csproj @@ -13,7 +13,7 @@ - + @@ -23,13 +23,12 @@ - - - + - + - + diff --git a/src/Nitric.Sdk/Proto/proto/storage/v1/Storage.cs b/src/Nitric.Sdk/Proto/nitric/proto/apis/v1/Apis.cs similarity index 55% rename from src/Nitric.Sdk/Proto/proto/storage/v1/Storage.cs rename to src/Nitric.Sdk/Proto/nitric/proto/apis/v1/Apis.cs index 1cd507d..fb39536 100644 --- a/src/Nitric.Sdk/Proto/proto/storage/v1/Storage.cs +++ b/src/Nitric.Sdk/Proto/nitric/proto/apis/v1/Apis.cs @@ -1,6 +1,6 @@ // // Generated by the protocol buffer compiler. DO NOT EDIT! -// source: proto/storage/v1/storage.proto +// source: nitric/proto/apis/v1/apis.proto // #pragma warning disable 1591, 0612, 3021 #region Designer generated code @@ -9,95 +9,99 @@ using pbc = global::Google.Protobuf.Collections; using pbr = global::Google.Protobuf.Reflection; using scg = global::System.Collections.Generic; -namespace Nitric.Proto.Storage.v1 { +namespace Nitric.Proto.Apis.v1 { - /// Holder for reflection information generated from proto/storage/v1/storage.proto - public static partial class StorageReflection { + /// Holder for reflection information generated from nitric/proto/apis/v1/apis.proto + public static partial class ApisReflection { #region Descriptor - /// File descriptor for proto/storage/v1/storage.proto + /// File descriptor for nitric/proto/apis/v1/apis.proto public static pbr::FileDescriptor Descriptor { get { return descriptor; } } private static pbr::FileDescriptor descriptor; - static StorageReflection() { + static ApisReflection() { byte[] descriptorData = global::System.Convert.FromBase64String( string.Concat( - "Ch5wcm90by9zdG9yYWdlL3YxL3N0b3JhZ2UucHJvdG8SEW5pdHJpYy5zdG9y", - "YWdlLnYxGhd2YWxpZGF0ZS92YWxpZGF0ZS5wcm90byJOChNTdG9yYWdlV3Jp", - "dGVSZXF1ZXN0EhMKC2J1Y2tldF9uYW1lGAEgASgJEhQKA2tleRgCIAEoCUIH", - "+kIEcgIQARIMCgRib2R5GAMgASgMIhYKFFN0b3JhZ2VXcml0ZVJlc3BvbnNl", - "Ij8KElN0b3JhZ2VSZWFkUmVxdWVzdBITCgtidWNrZXRfbmFtZRgBIAEoCRIU", - "CgNrZXkYAiABKAlCB/pCBHICEAEiIwoTU3RvcmFnZVJlYWRSZXNwb25zZRIM", - "CgRib2R5GAEgASgMIkEKFFN0b3JhZ2VEZWxldGVSZXF1ZXN0EhMKC2J1Y2tl", - "dF9uYW1lGAEgASgJEhQKA2tleRgCIAEoCUIH+kIEcgIQASIXChVTdG9yYWdl", - "RGVsZXRlUmVzcG9uc2UiwQEKGFN0b3JhZ2VQcmVTaWduVXJsUmVxdWVzdBIT", - "CgtidWNrZXRfbmFtZRgBIAEoCRIUCgNrZXkYAiABKAlCB/pCBHICEAESSAoJ", - "b3BlcmF0aW9uGAMgASgOMjUubml0cmljLnN0b3JhZ2UudjEuU3RvcmFnZVBy", - "ZVNpZ25VcmxSZXF1ZXN0Lk9wZXJhdGlvbhIOCgZleHBpcnkYBCABKA0iIAoJ", - "T3BlcmF0aW9uEggKBFJFQUQQABIJCgVXUklURRABIigKGVN0b3JhZ2VQcmVT", - "aWduVXJsUmVzcG9uc2USCwoDdXJsGAEgASgJIj4KF1N0b3JhZ2VMaXN0Rmls", - "ZXNSZXF1ZXN0EhMKC2J1Y2tldF9uYW1lGAEgASgJEg4KBnByZWZpeBgCIAEo", - "CSITCgRGaWxlEgsKA2tleRgBIAEoCSJCChhTdG9yYWdlTGlzdEZpbGVzUmVz", - "cG9uc2USJgoFZmlsZXMYASADKAsyFy5uaXRyaWMuc3RvcmFnZS52MS5GaWxl", - "IjwKFFN0b3JhZ2VFeGlzdHNSZXF1ZXN0Eg4KBmJ1Y2tldBgBIAEoCRIUCgNr", - "ZXkYAiABKAlCB/pCBHICEAEiJwoVU3RvcmFnZUV4aXN0c1Jlc3BvbnNlEg4K", - "BmV4aXN0cxgBIAEoCDLKBAoOU3RvcmFnZVNlcnZpY2USVQoEUmVhZBIlLm5p", - "dHJpYy5zdG9yYWdlLnYxLlN0b3JhZ2VSZWFkUmVxdWVzdBomLm5pdHJpYy5z", - "dG9yYWdlLnYxLlN0b3JhZ2VSZWFkUmVzcG9uc2USWAoFV3JpdGUSJi5uaXRy", - "aWMuc3RvcmFnZS52MS5TdG9yYWdlV3JpdGVSZXF1ZXN0Gicubml0cmljLnN0", - "b3JhZ2UudjEuU3RvcmFnZVdyaXRlUmVzcG9uc2USWwoGRGVsZXRlEicubml0", - "cmljLnN0b3JhZ2UudjEuU3RvcmFnZURlbGV0ZVJlcXVlc3QaKC5uaXRyaWMu", - "c3RvcmFnZS52MS5TdG9yYWdlRGVsZXRlUmVzcG9uc2USZwoKUHJlU2lnblVy", - "bBIrLm5pdHJpYy5zdG9yYWdlLnYxLlN0b3JhZ2VQcmVTaWduVXJsUmVxdWVz", - "dBosLm5pdHJpYy5zdG9yYWdlLnYxLlN0b3JhZ2VQcmVTaWduVXJsUmVzcG9u", - "c2USZAoJTGlzdEZpbGVzEioubml0cmljLnN0b3JhZ2UudjEuU3RvcmFnZUxp", - "c3RGaWxlc1JlcXVlc3QaKy5uaXRyaWMuc3RvcmFnZS52MS5TdG9yYWdlTGlz", - "dEZpbGVzUmVzcG9uc2USWwoGRXhpc3RzEicubml0cmljLnN0b3JhZ2UudjEu", - "U3RvcmFnZUV4aXN0c1JlcXVlc3QaKC5uaXRyaWMuc3RvcmFnZS52MS5TdG9y", - "YWdlRXhpc3RzUmVzcG9uc2VCkQEKGmlvLm5pdHJpYy5wcm90by5zdG9yYWdl", - "LnYxQghTdG9yYWdlc1ABWjNnaXRodWIuY29tL25pdHJpY3RlY2gvbml0cmlj", - "L2NvcmUvcGtnL2FwaS9uaXRyaWMvdjGqAhdOaXRyaWMuUHJvdG8uU3RvcmFn", - "ZS52McoCF05pdHJpY1xQcm90b1xTdG9yYWdlXFYxYgZwcm90bzM=")); + "Ch9uaXRyaWMvcHJvdG8vYXBpcy92MS9hcGlzLnByb3RvEhRuaXRyaWMucHJv", + "dG8uYXBpcy52MSIlChFBcGlEZXRhaWxzUmVxdWVzdBIQCghhcGlfbmFtZRgB", + "IAEoCSIhChJBcGlEZXRhaWxzUmVzcG9uc2USCwoDdXJsGAEgASgJIq4BCg1D", + "bGllbnRNZXNzYWdlEgoKAmlkGAEgASgJEkkKFHJlZ2lzdHJhdGlvbl9yZXF1", + "ZXN0GAIgASgLMikubml0cmljLnByb3RvLmFwaXMudjEuUmVnaXN0cmF0aW9u", + "UmVxdWVzdEgAEjsKDWh0dHBfcmVzcG9uc2UYAyABKAsyIi5uaXRyaWMucHJv", + "dG8uYXBpcy52MS5IdHRwUmVzcG9uc2VIAEIJCgdjb250ZW50IhwKC0hlYWRl", + "clZhbHVlEg0KBXZhbHVlGAEgAygJIhsKClF1ZXJ5VmFsdWUSDQoFdmFsdWUY", + "ASADKAki6AMKC0h0dHBSZXF1ZXN0Eg4KBm1ldGhvZBgBIAEoCRIMCgRwYXRo", + "GAIgASgJEj8KB2hlYWRlcnMYAyADKAsyLi5uaXRyaWMucHJvdG8uYXBpcy52", + "MS5IdHRwUmVxdWVzdC5IZWFkZXJzRW50cnkSSAoMcXVlcnlfcGFyYW1zGAQg", + "AygLMjIubml0cmljLnByb3RvLmFwaXMudjEuSHR0cFJlcXVlc3QuUXVlcnlQ", + "YXJhbXNFbnRyeRJGCgtwYXRoX3BhcmFtcxgFIAMoCzIxLm5pdHJpYy5wcm90", + "by5hcGlzLnYxLkh0dHBSZXF1ZXN0LlBhdGhQYXJhbXNFbnRyeRIMCgRib2R5", + "GAYgASgMGlEKDEhlYWRlcnNFbnRyeRILCgNrZXkYASABKAkSMAoFdmFsdWUY", + "AiABKAsyIS5uaXRyaWMucHJvdG8uYXBpcy52MS5IZWFkZXJWYWx1ZToCOAEa", + "VAoQUXVlcnlQYXJhbXNFbnRyeRILCgNrZXkYASABKAkSLwoFdmFsdWUYAiAB", + "KAsyIC5uaXRyaWMucHJvdG8uYXBpcy52MS5RdWVyeVZhbHVlOgI4ARoxCg9Q", + "YXRoUGFyYW1zRW50cnkSCwoDa2V5GAEgASgJEg0KBXZhbHVlGAIgASgJOgI4", + "ASLBAQoMSHR0cFJlc3BvbnNlEg4KBnN0YXR1cxgBIAEoBRJACgdoZWFkZXJz", + "GAIgAygLMi8ubml0cmljLnByb3RvLmFwaXMudjEuSHR0cFJlc3BvbnNlLkhl", + "YWRlcnNFbnRyeRIMCgRib2R5GAMgASgMGlEKDEhlYWRlcnNFbnRyeRILCgNr", + "ZXkYASABKAkSMAoFdmFsdWUYAiABKAsyIS5uaXRyaWMucHJvdG8uYXBpcy52", + "MS5IZWFkZXJWYWx1ZToCOAEirgEKDVNlcnZlck1lc3NhZ2USCgoCaWQYASAB", + "KAkSSwoVcmVnaXN0cmF0aW9uX3Jlc3BvbnNlGAIgASgLMioubml0cmljLnBy", + "b3RvLmFwaXMudjEuUmVnaXN0cmF0aW9uUmVzcG9uc2VIABI5CgxodHRwX3Jl", + "cXVlc3QYAyABKAsyIS5uaXRyaWMucHJvdG8uYXBpcy52MS5IdHRwUmVxdWVz", + "dEgAQgkKB2NvbnRlbnQiFgoUUmVnaXN0cmF0aW9uUmVzcG9uc2UiIQoPQXBp", + "V29ya2VyU2NvcGVzEg4KBnNjb3BlcxgBIAMoCSLNAQoQQXBpV29ya2VyT3B0", + "aW9ucxJGCghzZWN1cml0eRgBIAMoCzI0Lm5pdHJpYy5wcm90by5hcGlzLnYx", + "LkFwaVdvcmtlck9wdGlvbnMuU2VjdXJpdHlFbnRyeRIZChFzZWN1cml0eV9k", + "aXNhYmxlZBgCIAEoCBpWCg1TZWN1cml0eUVudHJ5EgsKA2tleRgBIAEoCRI0", + "CgV2YWx1ZRgCIAEoCzIlLm5pdHJpYy5wcm90by5hcGlzLnYxLkFwaVdvcmtl", + "clNjb3BlczoCOAEiegoTUmVnaXN0cmF0aW9uUmVxdWVzdBILCgNhcGkYASAB", + "KAkSDAoEcGF0aBgCIAEoCRIPCgdtZXRob2RzGAMgAygJEjcKB29wdGlvbnMY", + "BCABKAsyJi5uaXRyaWMucHJvdG8uYXBpcy52MS5BcGlXb3JrZXJPcHRpb25z", + "MroBCgNBcGkSVQoFU2VydmUSIy5uaXRyaWMucHJvdG8uYXBpcy52MS5DbGll", + "bnRNZXNzYWdlGiMubml0cmljLnByb3RvLmFwaXMudjEuU2VydmVyTWVzc2Fn", + "ZSgBMAESXAoHRGV0YWlscxInLm5pdHJpYy5wcm90by5hcGlzLnYxLkFwaURl", + "dGFpbHNSZXF1ZXN0Gigubml0cmljLnByb3RvLmFwaXMudjEuQXBpRGV0YWls", + "c1Jlc3BvbnNlQosBChdpby5uaXRyaWMucHJvdG8uYXBpcy52MUIEQXBpc1AB", + "WjpnaXRodWIuY29tL25pdHJpY3RlY2gvbml0cmljL2NvcmUvcGtnL3Byb3Rv", + "L2FwaXMvdjE7YXBpc3BiqgIUTml0cmljLlByb3RvLkFwaXMudjHKAhROaXRy", + "aWNcUHJvdG9cQXBpc1xWMWIGcHJvdG8z")); descriptor = pbr::FileDescriptor.FromGeneratedCode(descriptorData, - new pbr::FileDescriptor[] { global::Validate.ValidateReflection.Descriptor, }, + new pbr::FileDescriptor[] { }, new pbr::GeneratedClrTypeInfo(null, null, new pbr::GeneratedClrTypeInfo[] { - new pbr::GeneratedClrTypeInfo(typeof(global::Nitric.Proto.Storage.v1.StorageWriteRequest), global::Nitric.Proto.Storage.v1.StorageWriteRequest.Parser, new[]{ "BucketName", "Key", "Body" }, null, null, null, null), - new pbr::GeneratedClrTypeInfo(typeof(global::Nitric.Proto.Storage.v1.StorageWriteResponse), global::Nitric.Proto.Storage.v1.StorageWriteResponse.Parser, null, null, null, null, null), - new pbr::GeneratedClrTypeInfo(typeof(global::Nitric.Proto.Storage.v1.StorageReadRequest), global::Nitric.Proto.Storage.v1.StorageReadRequest.Parser, new[]{ "BucketName", "Key" }, null, null, null, null), - new pbr::GeneratedClrTypeInfo(typeof(global::Nitric.Proto.Storage.v1.StorageReadResponse), global::Nitric.Proto.Storage.v1.StorageReadResponse.Parser, new[]{ "Body" }, null, null, null, null), - new pbr::GeneratedClrTypeInfo(typeof(global::Nitric.Proto.Storage.v1.StorageDeleteRequest), global::Nitric.Proto.Storage.v1.StorageDeleteRequest.Parser, new[]{ "BucketName", "Key" }, null, null, null, null), - new pbr::GeneratedClrTypeInfo(typeof(global::Nitric.Proto.Storage.v1.StorageDeleteResponse), global::Nitric.Proto.Storage.v1.StorageDeleteResponse.Parser, null, null, null, null, null), - new pbr::GeneratedClrTypeInfo(typeof(global::Nitric.Proto.Storage.v1.StoragePreSignUrlRequest), global::Nitric.Proto.Storage.v1.StoragePreSignUrlRequest.Parser, new[]{ "BucketName", "Key", "Operation", "Expiry" }, null, new[]{ typeof(global::Nitric.Proto.Storage.v1.StoragePreSignUrlRequest.Types.Operation) }, null, null), - new pbr::GeneratedClrTypeInfo(typeof(global::Nitric.Proto.Storage.v1.StoragePreSignUrlResponse), global::Nitric.Proto.Storage.v1.StoragePreSignUrlResponse.Parser, new[]{ "Url" }, null, null, null, null), - new pbr::GeneratedClrTypeInfo(typeof(global::Nitric.Proto.Storage.v1.StorageListFilesRequest), global::Nitric.Proto.Storage.v1.StorageListFilesRequest.Parser, new[]{ "BucketName", "Prefix" }, null, null, null, null), - new pbr::GeneratedClrTypeInfo(typeof(global::Nitric.Proto.Storage.v1.File), global::Nitric.Proto.Storage.v1.File.Parser, new[]{ "Key" }, null, null, null, null), - new pbr::GeneratedClrTypeInfo(typeof(global::Nitric.Proto.Storage.v1.StorageListFilesResponse), global::Nitric.Proto.Storage.v1.StorageListFilesResponse.Parser, new[]{ "Files" }, null, null, null, null), - new pbr::GeneratedClrTypeInfo(typeof(global::Nitric.Proto.Storage.v1.StorageExistsRequest), global::Nitric.Proto.Storage.v1.StorageExistsRequest.Parser, new[]{ "Bucket", "Key" }, null, null, null, null), - new pbr::GeneratedClrTypeInfo(typeof(global::Nitric.Proto.Storage.v1.StorageExistsResponse), global::Nitric.Proto.Storage.v1.StorageExistsResponse.Parser, new[]{ "Exists" }, null, null, null, null) + new pbr::GeneratedClrTypeInfo(typeof(global::Nitric.Proto.Apis.v1.ApiDetailsRequest), global::Nitric.Proto.Apis.v1.ApiDetailsRequest.Parser, new[]{ "ApiName" }, null, null, null, null), + new pbr::GeneratedClrTypeInfo(typeof(global::Nitric.Proto.Apis.v1.ApiDetailsResponse), global::Nitric.Proto.Apis.v1.ApiDetailsResponse.Parser, new[]{ "Url" }, null, null, null, null), + new pbr::GeneratedClrTypeInfo(typeof(global::Nitric.Proto.Apis.v1.ClientMessage), global::Nitric.Proto.Apis.v1.ClientMessage.Parser, new[]{ "Id", "RegistrationRequest", "HttpResponse" }, new[]{ "Content" }, null, null, null), + new pbr::GeneratedClrTypeInfo(typeof(global::Nitric.Proto.Apis.v1.HeaderValue), global::Nitric.Proto.Apis.v1.HeaderValue.Parser, new[]{ "Value" }, null, null, null, null), + new pbr::GeneratedClrTypeInfo(typeof(global::Nitric.Proto.Apis.v1.QueryValue), global::Nitric.Proto.Apis.v1.QueryValue.Parser, new[]{ "Value" }, null, null, null, null), + new pbr::GeneratedClrTypeInfo(typeof(global::Nitric.Proto.Apis.v1.HttpRequest), global::Nitric.Proto.Apis.v1.HttpRequest.Parser, new[]{ "Method", "Path", "Headers", "QueryParams", "PathParams", "Body" }, null, null, null, new pbr::GeneratedClrTypeInfo[] { null, null, null, }), + new pbr::GeneratedClrTypeInfo(typeof(global::Nitric.Proto.Apis.v1.HttpResponse), global::Nitric.Proto.Apis.v1.HttpResponse.Parser, new[]{ "Status", "Headers", "Body" }, null, null, null, new pbr::GeneratedClrTypeInfo[] { null, }), + new pbr::GeneratedClrTypeInfo(typeof(global::Nitric.Proto.Apis.v1.ServerMessage), global::Nitric.Proto.Apis.v1.ServerMessage.Parser, new[]{ "Id", "RegistrationResponse", "HttpRequest" }, new[]{ "Content" }, null, null, null), + new pbr::GeneratedClrTypeInfo(typeof(global::Nitric.Proto.Apis.v1.RegistrationResponse), global::Nitric.Proto.Apis.v1.RegistrationResponse.Parser, null, null, null, null, null), + new pbr::GeneratedClrTypeInfo(typeof(global::Nitric.Proto.Apis.v1.ApiWorkerScopes), global::Nitric.Proto.Apis.v1.ApiWorkerScopes.Parser, new[]{ "Scopes" }, null, null, null, null), + new pbr::GeneratedClrTypeInfo(typeof(global::Nitric.Proto.Apis.v1.ApiWorkerOptions), global::Nitric.Proto.Apis.v1.ApiWorkerOptions.Parser, new[]{ "Security", "SecurityDisabled" }, null, null, null, new pbr::GeneratedClrTypeInfo[] { null, }), + new pbr::GeneratedClrTypeInfo(typeof(global::Nitric.Proto.Apis.v1.RegistrationRequest), global::Nitric.Proto.Apis.v1.RegistrationRequest.Parser, new[]{ "Api", "Path", "Methods", "Options" }, null, null, null, null) })); } #endregion } #region Messages - /// - /// Request to put (create/update) a storage item - /// - public sealed partial class StorageWriteRequest : pb::IMessage + public sealed partial class ApiDetailsRequest : pb::IMessage #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE , pb::IBufferMessage #endif { - private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new StorageWriteRequest()); + private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new ApiDetailsRequest()); private pb::UnknownFieldSet _unknownFields; [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public static pb::MessageParser Parser { get { return _parser; } } + public static pb::MessageParser Parser { get { return _parser; } } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public static pbr::MessageDescriptor Descriptor { - get { return global::Nitric.Proto.Storage.v1.StorageReflection.Descriptor.MessageTypes[0]; } + get { return global::Nitric.Proto.Apis.v1.ApisReflection.Descriptor.MessageTypes[0]; } } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] @@ -106,93 +110,55 @@ public sealed partial class StorageWriteRequest : pb::IMessageField number for the "bucket_name" field. - public const int BucketNameFieldNumber = 1; - private string bucketName_ = ""; - /// - /// Nitric name of the bucket to store in - /// this will be automatically resolved to the provider specific bucket identifier. - /// + /// Field number for the "api_name" field. + public const int ApiNameFieldNumber = 1; + private string apiName_ = ""; [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public string BucketName { - get { return bucketName_; } + public string ApiName { + get { return apiName_; } set { - bucketName_ = pb::ProtoPreconditions.CheckNotNull(value, "value"); - } - } - - /// Field number for the "key" field. - public const int KeyFieldNumber = 2; - private string key_ = ""; - /// - /// Key to store the item under - /// - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public string Key { - get { return key_; } - set { - key_ = pb::ProtoPreconditions.CheckNotNull(value, "value"); - } - } - - /// Field number for the "body" field. - public const int BodyFieldNumber = 3; - private pb::ByteString body_ = pb::ByteString.Empty; - /// - /// bytes array to store - /// - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public pb::ByteString Body { - get { return body_; } - set { - body_ = pb::ProtoPreconditions.CheckNotNull(value, "value"); + apiName_ = pb::ProtoPreconditions.CheckNotNull(value, "value"); } } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public override bool Equals(object other) { - return Equals(other as StorageWriteRequest); + return Equals(other as ApiDetailsRequest); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public bool Equals(StorageWriteRequest other) { + public bool Equals(ApiDetailsRequest other) { if (ReferenceEquals(other, null)) { return false; } if (ReferenceEquals(other, this)) { return true; } - if (BucketName != other.BucketName) return false; - if (Key != other.Key) return false; - if (Body != other.Body) return false; + if (ApiName != other.ApiName) return false; return Equals(_unknownFields, other._unknownFields); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public override int GetHashCode() { int hash = 1; - if (BucketName.Length != 0) hash ^= BucketName.GetHashCode(); - if (Key.Length != 0) hash ^= Key.GetHashCode(); - if (Body.Length != 0) hash ^= Body.GetHashCode(); + if (ApiName.Length != 0) hash ^= ApiName.GetHashCode(); if (_unknownFields != null) { hash ^= _unknownFields.GetHashCode(); } @@ -209,17 +175,9 @@ public void WriteTo(pb::CodedOutputStream output) { #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE output.WriteRawMessage(this); #else - if (BucketName.Length != 0) { + if (ApiName.Length != 0) { output.WriteRawTag(10); - output.WriteString(BucketName); - } - if (Key.Length != 0) { - output.WriteRawTag(18); - output.WriteString(Key); - } - if (Body.Length != 0) { - output.WriteRawTag(26); - output.WriteBytes(Body); + output.WriteString(ApiName); } if (_unknownFields != null) { _unknownFields.WriteTo(output); @@ -230,17 +188,9 @@ public void WriteTo(pb::CodedOutputStream output) { #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE [global::System.Diagnostics.DebuggerNonUserCodeAttribute] void pb::IBufferMessage.InternalWriteTo(ref pb::WriteContext output) { - if (BucketName.Length != 0) { + if (ApiName.Length != 0) { output.WriteRawTag(10); - output.WriteString(BucketName); - } - if (Key.Length != 0) { - output.WriteRawTag(18); - output.WriteString(Key); - } - if (Body.Length != 0) { - output.WriteRawTag(26); - output.WriteBytes(Body); + output.WriteString(ApiName); } if (_unknownFields != null) { _unknownFields.WriteTo(ref output); @@ -251,14 +201,8 @@ public void WriteTo(pb::CodedOutputStream output) { [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public int CalculateSize() { int size = 0; - if (BucketName.Length != 0) { - size += 1 + pb::CodedOutputStream.ComputeStringSize(BucketName); - } - if (Key.Length != 0) { - size += 1 + pb::CodedOutputStream.ComputeStringSize(Key); - } - if (Body.Length != 0) { - size += 1 + pb::CodedOutputStream.ComputeBytesSize(Body); + if (ApiName.Length != 0) { + size += 1 + pb::CodedOutputStream.ComputeStringSize(ApiName); } if (_unknownFields != null) { size += _unknownFields.CalculateSize(); @@ -267,18 +211,12 @@ public int CalculateSize() { } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void MergeFrom(StorageWriteRequest other) { + public void MergeFrom(ApiDetailsRequest other) { if (other == null) { return; } - if (other.BucketName.Length != 0) { - BucketName = other.BucketName; - } - if (other.Key.Length != 0) { - Key = other.Key; - } - if (other.Body.Length != 0) { - Body = other.Body; + if (other.ApiName.Length != 0) { + ApiName = other.ApiName; } _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields); } @@ -295,15 +233,7 @@ public void MergeFrom(pb::CodedInputStream input) { _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input); break; case 10: { - BucketName = input.ReadString(); - break; - } - case 18: { - Key = input.ReadString(); - break; - } - case 26: { - Body = input.ReadBytes(); + ApiName = input.ReadString(); break; } } @@ -321,15 +251,7 @@ public void MergeFrom(pb::CodedInputStream input) { _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, ref input); break; case 10: { - BucketName = input.ReadString(); - break; - } - case 18: { - Key = input.ReadString(); - break; - } - case 26: { - Body = input.ReadBytes(); + ApiName = input.ReadString(); break; } } @@ -339,22 +261,19 @@ public void MergeFrom(pb::CodedInputStream input) { } - /// - /// Result of putting a storage item - /// - public sealed partial class StorageWriteResponse : pb::IMessage + public sealed partial class ApiDetailsResponse : pb::IMessage #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE , pb::IBufferMessage #endif { - private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new StorageWriteResponse()); + private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new ApiDetailsResponse()); private pb::UnknownFieldSet _unknownFields; [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public static pb::MessageParser Parser { get { return _parser; } } + public static pb::MessageParser Parser { get { return _parser; } } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public static pbr::MessageDescriptor Descriptor { - get { return global::Nitric.Proto.Storage.v1.StorageReflection.Descriptor.MessageTypes[1]; } + get { return global::Nitric.Proto.Apis.v1.ApisReflection.Descriptor.MessageTypes[1]; } } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] @@ -363,41 +282,55 @@ public sealed partial class StorageWriteResponse : pb::IMessageField number for the "url" field. + public const int UrlFieldNumber = 1; + private string url_ = ""; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public string Url { + get { return url_; } + set { + url_ = pb::ProtoPreconditions.CheckNotNull(value, "value"); + } } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public override bool Equals(object other) { - return Equals(other as StorageWriteResponse); + return Equals(other as ApiDetailsResponse); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public bool Equals(StorageWriteResponse other) { + public bool Equals(ApiDetailsResponse other) { if (ReferenceEquals(other, null)) { return false; } if (ReferenceEquals(other, this)) { return true; } + if (Url != other.Url) return false; return Equals(_unknownFields, other._unknownFields); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public override int GetHashCode() { int hash = 1; + if (Url.Length != 0) hash ^= Url.GetHashCode(); if (_unknownFields != null) { hash ^= _unknownFields.GetHashCode(); } @@ -414,6 +347,10 @@ public void WriteTo(pb::CodedOutputStream output) { #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE output.WriteRawMessage(this); #else + if (Url.Length != 0) { + output.WriteRawTag(10); + output.WriteString(Url); + } if (_unknownFields != null) { _unknownFields.WriteTo(output); } @@ -423,6 +360,10 @@ public void WriteTo(pb::CodedOutputStream output) { #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE [global::System.Diagnostics.DebuggerNonUserCodeAttribute] void pb::IBufferMessage.InternalWriteTo(ref pb::WriteContext output) { + if (Url.Length != 0) { + output.WriteRawTag(10); + output.WriteString(Url); + } if (_unknownFields != null) { _unknownFields.WriteTo(ref output); } @@ -432,6 +373,9 @@ public void WriteTo(pb::CodedOutputStream output) { [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public int CalculateSize() { int size = 0; + if (Url.Length != 0) { + size += 1 + pb::CodedOutputStream.ComputeStringSize(Url); + } if (_unknownFields != null) { size += _unknownFields.CalculateSize(); } @@ -439,10 +383,13 @@ public int CalculateSize() { } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void MergeFrom(StorageWriteResponse other) { + public void MergeFrom(ApiDetailsResponse other) { if (other == null) { return; } + if (other.Url.Length != 0) { + Url = other.Url; + } _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields); } @@ -457,6 +404,10 @@ public void MergeFrom(pb::CodedInputStream input) { default: _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input); break; + case 10: { + Url = input.ReadString(); + break; + } } } #endif @@ -471,6 +422,10 @@ public void MergeFrom(pb::CodedInputStream input) { default: _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, ref input); break; + case 10: { + Url = input.ReadString(); + break; + } } } } @@ -478,22 +433,19 @@ public void MergeFrom(pb::CodedInputStream input) { } - /// - /// Request to retrieve a storage item - /// - public sealed partial class StorageReadRequest : pb::IMessage + public sealed partial class ClientMessage : pb::IMessage #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE , pb::IBufferMessage #endif { - private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new StorageReadRequest()); + private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new ClientMessage()); private pb::UnknownFieldSet _unknownFields; [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public static pb::MessageParser Parser { get { return _parser; } } + public static pb::MessageParser Parser { get { return _parser; } } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public static pbr::MessageDescriptor Descriptor { - get { return global::Nitric.Proto.Storage.v1.StorageReflection.Descriptor.MessageTypes[2]; } + get { return global::Nitric.Proto.Apis.v1.ApisReflection.Descriptor.MessageTypes[2]; } } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] @@ -502,76 +454,120 @@ public sealed partial class StorageReadRequest : pb::IMessageField number for the "id" field. + public const int IdFieldNumber = 1; + private string id_ = ""; + /// + /// globally unique ID of the request/response pair + /// + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public string Id { + get { return id_; } + set { + id_ = pb::ProtoPreconditions.CheckNotNull(value, "value"); + } } - /// Field number for the "bucket_name" field. - public const int BucketNameFieldNumber = 1; - private string bucketName_ = ""; + /// Field number for the "registration_request" field. + public const int RegistrationRequestFieldNumber = 2; /// - /// Nitric name of the bucket to retrieve from - /// this will be automatically resolved to the provider specific bucket identifier. + /// Register a subscription to a topic /// [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public string BucketName { - get { return bucketName_; } + public global::Nitric.Proto.Apis.v1.RegistrationRequest RegistrationRequest { + get { return contentCase_ == ContentOneofCase.RegistrationRequest ? (global::Nitric.Proto.Apis.v1.RegistrationRequest) content_ : null; } set { - bucketName_ = pb::ProtoPreconditions.CheckNotNull(value, "value"); + content_ = value; + contentCase_ = value == null ? ContentOneofCase.None : ContentOneofCase.RegistrationRequest; } } - /// Field number for the "key" field. - public const int KeyFieldNumber = 2; - private string key_ = ""; + /// Field number for the "http_response" field. + public const int HttpResponseFieldNumber = 3; /// - /// Key of item to retrieve + /// Response to an HTTP request /// [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public string Key { - get { return key_; } + public global::Nitric.Proto.Apis.v1.HttpResponse HttpResponse { + get { return contentCase_ == ContentOneofCase.HttpResponse ? (global::Nitric.Proto.Apis.v1.HttpResponse) content_ : null; } set { - key_ = pb::ProtoPreconditions.CheckNotNull(value, "value"); + content_ = value; + contentCase_ = value == null ? ContentOneofCase.None : ContentOneofCase.HttpResponse; } } + private object content_; + /// Enum of possible cases for the "content" oneof. + public enum ContentOneofCase { + None = 0, + RegistrationRequest = 2, + HttpResponse = 3, + } + private ContentOneofCase contentCase_ = ContentOneofCase.None; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public ContentOneofCase ContentCase { + get { return contentCase_; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public void ClearContent() { + contentCase_ = ContentOneofCase.None; + content_ = null; + } + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public override bool Equals(object other) { - return Equals(other as StorageReadRequest); + return Equals(other as ClientMessage); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public bool Equals(StorageReadRequest other) { + public bool Equals(ClientMessage other) { if (ReferenceEquals(other, null)) { return false; } if (ReferenceEquals(other, this)) { return true; } - if (BucketName != other.BucketName) return false; - if (Key != other.Key) return false; + if (Id != other.Id) return false; + if (!object.Equals(RegistrationRequest, other.RegistrationRequest)) return false; + if (!object.Equals(HttpResponse, other.HttpResponse)) return false; + if (ContentCase != other.ContentCase) return false; return Equals(_unknownFields, other._unknownFields); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public override int GetHashCode() { int hash = 1; - if (BucketName.Length != 0) hash ^= BucketName.GetHashCode(); - if (Key.Length != 0) hash ^= Key.GetHashCode(); + if (Id.Length != 0) hash ^= Id.GetHashCode(); + if (contentCase_ == ContentOneofCase.RegistrationRequest) hash ^= RegistrationRequest.GetHashCode(); + if (contentCase_ == ContentOneofCase.HttpResponse) hash ^= HttpResponse.GetHashCode(); + hash ^= (int) contentCase_; if (_unknownFields != null) { hash ^= _unknownFields.GetHashCode(); } @@ -588,13 +584,17 @@ public void WriteTo(pb::CodedOutputStream output) { #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE output.WriteRawMessage(this); #else - if (BucketName.Length != 0) { + if (Id.Length != 0) { output.WriteRawTag(10); - output.WriteString(BucketName); + output.WriteString(Id); } - if (Key.Length != 0) { + if (contentCase_ == ContentOneofCase.RegistrationRequest) { output.WriteRawTag(18); - output.WriteString(Key); + output.WriteMessage(RegistrationRequest); + } + if (contentCase_ == ContentOneofCase.HttpResponse) { + output.WriteRawTag(26); + output.WriteMessage(HttpResponse); } if (_unknownFields != null) { _unknownFields.WriteTo(output); @@ -605,13 +605,17 @@ public void WriteTo(pb::CodedOutputStream output) { #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE [global::System.Diagnostics.DebuggerNonUserCodeAttribute] void pb::IBufferMessage.InternalWriteTo(ref pb::WriteContext output) { - if (BucketName.Length != 0) { + if (Id.Length != 0) { output.WriteRawTag(10); - output.WriteString(BucketName); + output.WriteString(Id); } - if (Key.Length != 0) { + if (contentCase_ == ContentOneofCase.RegistrationRequest) { output.WriteRawTag(18); - output.WriteString(Key); + output.WriteMessage(RegistrationRequest); + } + if (contentCase_ == ContentOneofCase.HttpResponse) { + output.WriteRawTag(26); + output.WriteMessage(HttpResponse); } if (_unknownFields != null) { _unknownFields.WriteTo(ref output); @@ -622,11 +626,14 @@ public void WriteTo(pb::CodedOutputStream output) { [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public int CalculateSize() { int size = 0; - if (BucketName.Length != 0) { - size += 1 + pb::CodedOutputStream.ComputeStringSize(BucketName); + if (Id.Length != 0) { + size += 1 + pb::CodedOutputStream.ComputeStringSize(Id); + } + if (contentCase_ == ContentOneofCase.RegistrationRequest) { + size += 1 + pb::CodedOutputStream.ComputeMessageSize(RegistrationRequest); } - if (Key.Length != 0) { - size += 1 + pb::CodedOutputStream.ComputeStringSize(Key); + if (contentCase_ == ContentOneofCase.HttpResponse) { + size += 1 + pb::CodedOutputStream.ComputeMessageSize(HttpResponse); } if (_unknownFields != null) { size += _unknownFields.CalculateSize(); @@ -635,16 +642,28 @@ public int CalculateSize() { } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void MergeFrom(StorageReadRequest other) { + public void MergeFrom(ClientMessage other) { if (other == null) { return; } - if (other.BucketName.Length != 0) { - BucketName = other.BucketName; + if (other.Id.Length != 0) { + Id = other.Id; } - if (other.Key.Length != 0) { - Key = other.Key; + switch (other.ContentCase) { + case ContentOneofCase.RegistrationRequest: + if (RegistrationRequest == null) { + RegistrationRequest = new global::Nitric.Proto.Apis.v1.RegistrationRequest(); + } + RegistrationRequest.MergeFrom(other.RegistrationRequest); + break; + case ContentOneofCase.HttpResponse: + if (HttpResponse == null) { + HttpResponse = new global::Nitric.Proto.Apis.v1.HttpResponse(); + } + HttpResponse.MergeFrom(other.HttpResponse); + break; } + _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields); } @@ -660,11 +679,25 @@ public void MergeFrom(pb::CodedInputStream input) { _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input); break; case 10: { - BucketName = input.ReadString(); + Id = input.ReadString(); break; } case 18: { - Key = input.ReadString(); + global::Nitric.Proto.Apis.v1.RegistrationRequest subBuilder = new global::Nitric.Proto.Apis.v1.RegistrationRequest(); + if (contentCase_ == ContentOneofCase.RegistrationRequest) { + subBuilder.MergeFrom(RegistrationRequest); + } + input.ReadMessage(subBuilder); + RegistrationRequest = subBuilder; + break; + } + case 26: { + global::Nitric.Proto.Apis.v1.HttpResponse subBuilder = new global::Nitric.Proto.Apis.v1.HttpResponse(); + if (contentCase_ == ContentOneofCase.HttpResponse) { + subBuilder.MergeFrom(HttpResponse); + } + input.ReadMessage(subBuilder); + HttpResponse = subBuilder; break; } } @@ -682,11 +715,25 @@ public void MergeFrom(pb::CodedInputStream input) { _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, ref input); break; case 10: { - BucketName = input.ReadString(); + Id = input.ReadString(); break; } case 18: { - Key = input.ReadString(); + global::Nitric.Proto.Apis.v1.RegistrationRequest subBuilder = new global::Nitric.Proto.Apis.v1.RegistrationRequest(); + if (contentCase_ == ContentOneofCase.RegistrationRequest) { + subBuilder.MergeFrom(RegistrationRequest); + } + input.ReadMessage(subBuilder); + RegistrationRequest = subBuilder; + break; + } + case 26: { + global::Nitric.Proto.Apis.v1.HttpResponse subBuilder = new global::Nitric.Proto.Apis.v1.HttpResponse(); + if (contentCase_ == ContentOneofCase.HttpResponse) { + subBuilder.MergeFrom(HttpResponse); + } + input.ReadMessage(subBuilder); + HttpResponse = subBuilder; break; } } @@ -696,22 +743,19 @@ public void MergeFrom(pb::CodedInputStream input) { } - /// - /// Returned storage item - /// - public sealed partial class StorageReadResponse : pb::IMessage + public sealed partial class HeaderValue : pb::IMessage #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE , pb::IBufferMessage #endif { - private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new StorageReadResponse()); + private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new HeaderValue()); private pb::UnknownFieldSet _unknownFields; [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public static pb::MessageParser Parser { get { return _parser; } } + public static pb::MessageParser Parser { get { return _parser; } } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public static pbr::MessageDescriptor Descriptor { - get { return global::Nitric.Proto.Storage.v1.StorageReflection.Descriptor.MessageTypes[3]; } + get { return global::Nitric.Proto.Apis.v1.ApisReflection.Descriptor.MessageTypes[3]; } } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] @@ -720,58 +764,54 @@ public sealed partial class StorageReadResponse : pb::IMessageField number for the "body" field. - public const int BodyFieldNumber = 1; - private pb::ByteString body_ = pb::ByteString.Empty; - /// - /// The body bytes of the retrieved storage item - /// + /// Field number for the "value" field. + public const int ValueFieldNumber = 1; + private static readonly pb::FieldCodec _repeated_value_codec + = pb::FieldCodec.ForString(10); + private readonly pbc::RepeatedField value_ = new pbc::RepeatedField(); [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public pb::ByteString Body { - get { return body_; } - set { - body_ = pb::ProtoPreconditions.CheckNotNull(value, "value"); - } + public pbc::RepeatedField Value { + get { return value_; } } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public override bool Equals(object other) { - return Equals(other as StorageReadResponse); + return Equals(other as HeaderValue); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public bool Equals(StorageReadResponse other) { + public bool Equals(HeaderValue other) { if (ReferenceEquals(other, null)) { return false; } if (ReferenceEquals(other, this)) { return true; } - if (Body != other.Body) return false; + if(!value_.Equals(other.value_)) return false; return Equals(_unknownFields, other._unknownFields); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public override int GetHashCode() { int hash = 1; - if (Body.Length != 0) hash ^= Body.GetHashCode(); + hash ^= value_.GetHashCode(); if (_unknownFields != null) { hash ^= _unknownFields.GetHashCode(); } @@ -788,10 +828,7 @@ public void WriteTo(pb::CodedOutputStream output) { #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE output.WriteRawMessage(this); #else - if (Body.Length != 0) { - output.WriteRawTag(10); - output.WriteBytes(Body); - } + value_.WriteTo(output, _repeated_value_codec); if (_unknownFields != null) { _unknownFields.WriteTo(output); } @@ -801,10 +838,7 @@ public void WriteTo(pb::CodedOutputStream output) { #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE [global::System.Diagnostics.DebuggerNonUserCodeAttribute] void pb::IBufferMessage.InternalWriteTo(ref pb::WriteContext output) { - if (Body.Length != 0) { - output.WriteRawTag(10); - output.WriteBytes(Body); - } + value_.WriteTo(ref output, _repeated_value_codec); if (_unknownFields != null) { _unknownFields.WriteTo(ref output); } @@ -814,9 +848,7 @@ public void WriteTo(pb::CodedOutputStream output) { [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public int CalculateSize() { int size = 0; - if (Body.Length != 0) { - size += 1 + pb::CodedOutputStream.ComputeBytesSize(Body); - } + size += value_.CalculateSize(_repeated_value_codec); if (_unknownFields != null) { size += _unknownFields.CalculateSize(); } @@ -824,13 +856,11 @@ public int CalculateSize() { } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void MergeFrom(StorageReadResponse other) { + public void MergeFrom(HeaderValue other) { if (other == null) { return; } - if (other.Body.Length != 0) { - Body = other.Body; - } + value_.Add(other.value_); _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields); } @@ -846,7 +876,7 @@ public void MergeFrom(pb::CodedInputStream input) { _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input); break; case 10: { - Body = input.ReadBytes(); + value_.AddEntriesFrom(input, _repeated_value_codec); break; } } @@ -864,7 +894,7 @@ public void MergeFrom(pb::CodedInputStream input) { _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, ref input); break; case 10: { - Body = input.ReadBytes(); + value_.AddEntriesFrom(ref input, _repeated_value_codec); break; } } @@ -874,22 +904,19 @@ public void MergeFrom(pb::CodedInputStream input) { } - /// - /// Request to delete a storage item - /// - public sealed partial class StorageDeleteRequest : pb::IMessage + public sealed partial class QueryValue : pb::IMessage #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE , pb::IBufferMessage #endif { - private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new StorageDeleteRequest()); + private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new QueryValue()); private pb::UnknownFieldSet _unknownFields; [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public static pb::MessageParser Parser { get { return _parser; } } + public static pb::MessageParser Parser { get { return _parser; } } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public static pbr::MessageDescriptor Descriptor { - get { return global::Nitric.Proto.Storage.v1.StorageReflection.Descriptor.MessageTypes[4]; } + get { return global::Nitric.Proto.Apis.v1.ApisReflection.Descriptor.MessageTypes[4]; } } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] @@ -898,258 +925,54 @@ public sealed partial class StorageDeleteRequest : pb::IMessageField number for the "bucket_name" field. - public const int BucketNameFieldNumber = 1; - private string bucketName_ = ""; - /// - /// Name of the bucket to delete from - /// - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public string BucketName { - get { return bucketName_; } - set { - bucketName_ = pb::ProtoPreconditions.CheckNotNull(value, "value"); - } - } - - /// Field number for the "key" field. - public const int KeyFieldNumber = 2; - private string key_ = ""; - /// - /// Key of item to delete - /// - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public string Key { - get { return key_; } - set { - key_ = pb::ProtoPreconditions.CheckNotNull(value, "value"); - } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public override bool Equals(object other) { - return Equals(other as StorageDeleteRequest); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public bool Equals(StorageDeleteRequest other) { - if (ReferenceEquals(other, null)) { - return false; - } - if (ReferenceEquals(other, this)) { - return true; - } - if (BucketName != other.BucketName) return false; - if (Key != other.Key) return false; - return Equals(_unknownFields, other._unknownFields); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public override int GetHashCode() { - int hash = 1; - if (BucketName.Length != 0) hash ^= BucketName.GetHashCode(); - if (Key.Length != 0) hash ^= Key.GetHashCode(); - if (_unknownFields != null) { - hash ^= _unknownFields.GetHashCode(); - } - return hash; - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public override string ToString() { - return pb::JsonFormatter.ToDiagnosticString(this); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void WriteTo(pb::CodedOutputStream output) { - #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE - output.WriteRawMessage(this); - #else - if (BucketName.Length != 0) { - output.WriteRawTag(10); - output.WriteString(BucketName); - } - if (Key.Length != 0) { - output.WriteRawTag(18); - output.WriteString(Key); - } - if (_unknownFields != null) { - _unknownFields.WriteTo(output); - } - #endif - } - - #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - void pb::IBufferMessage.InternalWriteTo(ref pb::WriteContext output) { - if (BucketName.Length != 0) { - output.WriteRawTag(10); - output.WriteString(BucketName); - } - if (Key.Length != 0) { - output.WriteRawTag(18); - output.WriteString(Key); - } - if (_unknownFields != null) { - _unknownFields.WriteTo(ref output); - } - } - #endif - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public int CalculateSize() { - int size = 0; - if (BucketName.Length != 0) { - size += 1 + pb::CodedOutputStream.ComputeStringSize(BucketName); - } - if (Key.Length != 0) { - size += 1 + pb::CodedOutputStream.ComputeStringSize(Key); - } - if (_unknownFields != null) { - size += _unknownFields.CalculateSize(); - } - return size; - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void MergeFrom(StorageDeleteRequest other) { - if (other == null) { - return; - } - if (other.BucketName.Length != 0) { - BucketName = other.BucketName; - } - if (other.Key.Length != 0) { - Key = other.Key; - } - _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void MergeFrom(pb::CodedInputStream input) { - #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE - input.ReadRawMessage(this); - #else - uint tag; - while ((tag = input.ReadTag()) != 0) { - switch(tag) { - default: - _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input); - break; - case 10: { - BucketName = input.ReadString(); - break; - } - case 18: { - Key = input.ReadString(); - break; - } - } - } - #endif - } - - #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - void pb::IBufferMessage.InternalMergeFrom(ref pb::ParseContext input) { - uint tag; - while ((tag = input.ReadTag()) != 0) { - switch(tag) { - default: - _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, ref input); - break; - case 10: { - BucketName = input.ReadString(); - break; - } - case 18: { - Key = input.ReadString(); - break; - } - } - } - } - #endif - - } - - /// - /// Result of deleting a storage item - /// - public sealed partial class StorageDeleteResponse : pb::IMessage - #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE - , pb::IBufferMessage - #endif - { - private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new StorageDeleteResponse()); - private pb::UnknownFieldSet _unknownFields; - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public static pb::MessageParser Parser { get { return _parser; } } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public static pbr::MessageDescriptor Descriptor { - get { return global::Nitric.Proto.Storage.v1.StorageReflection.Descriptor.MessageTypes[5]; } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - pbr::MessageDescriptor pb::IMessage.Descriptor { - get { return Descriptor; } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public StorageDeleteResponse() { - OnConstruction(); - } - - partial void OnConstruction(); - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public StorageDeleteResponse(StorageDeleteResponse other) : this() { - _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields); + public QueryValue Clone() { + return new QueryValue(this); } + /// Field number for the "value" field. + public const int ValueFieldNumber = 1; + private static readonly pb::FieldCodec _repeated_value_codec + = pb::FieldCodec.ForString(10); + private readonly pbc::RepeatedField value_ = new pbc::RepeatedField(); [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public StorageDeleteResponse Clone() { - return new StorageDeleteResponse(this); + public pbc::RepeatedField Value { + get { return value_; } } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public override bool Equals(object other) { - return Equals(other as StorageDeleteResponse); + return Equals(other as QueryValue); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public bool Equals(StorageDeleteResponse other) { + public bool Equals(QueryValue other) { if (ReferenceEquals(other, null)) { return false; } if (ReferenceEquals(other, this)) { return true; } + if(!value_.Equals(other.value_)) return false; return Equals(_unknownFields, other._unknownFields); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public override int GetHashCode() { int hash = 1; + hash ^= value_.GetHashCode(); if (_unknownFields != null) { hash ^= _unknownFields.GetHashCode(); } @@ -1166,6 +989,7 @@ public void WriteTo(pb::CodedOutputStream output) { #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE output.WriteRawMessage(this); #else + value_.WriteTo(output, _repeated_value_codec); if (_unknownFields != null) { _unknownFields.WriteTo(output); } @@ -1175,6 +999,7 @@ public void WriteTo(pb::CodedOutputStream output) { #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE [global::System.Diagnostics.DebuggerNonUserCodeAttribute] void pb::IBufferMessage.InternalWriteTo(ref pb::WriteContext output) { + value_.WriteTo(ref output, _repeated_value_codec); if (_unknownFields != null) { _unknownFields.WriteTo(ref output); } @@ -1184,6 +1009,7 @@ public void WriteTo(pb::CodedOutputStream output) { [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public int CalculateSize() { int size = 0; + size += value_.CalculateSize(_repeated_value_codec); if (_unknownFields != null) { size += _unknownFields.CalculateSize(); } @@ -1191,10 +1017,11 @@ public int CalculateSize() { } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void MergeFrom(StorageDeleteResponse other) { + public void MergeFrom(QueryValue other) { if (other == null) { return; } + value_.Add(other.value_); _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields); } @@ -1209,6 +1036,10 @@ public void MergeFrom(pb::CodedInputStream input) { default: _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input); break; + case 10: { + value_.AddEntriesFrom(input, _repeated_value_codec); + break; + } } } #endif @@ -1223,6 +1054,10 @@ public void MergeFrom(pb::CodedInputStream input) { default: _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, ref input); break; + case 10: { + value_.AddEntriesFrom(ref input, _repeated_value_codec); + break; + } } } } @@ -1230,22 +1065,19 @@ public void MergeFrom(pb::CodedInputStream input) { } - /// - /// Request to generate a pre-signed URL for a file to perform a specific operation, such as read or write. - /// - public sealed partial class StoragePreSignUrlRequest : pb::IMessage + public sealed partial class HttpRequest : pb::IMessage #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE , pb::IBufferMessage #endif { - private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new StoragePreSignUrlRequest()); + private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new HttpRequest()); private pb::UnknownFieldSet _unknownFields; [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public static pb::MessageParser Parser { get { return _parser; } } + public static pb::MessageParser Parser { get { return _parser; } } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public static pbr::MessageDescriptor Descriptor { - get { return global::Nitric.Proto.Storage.v1.StorageReflection.Descriptor.MessageTypes[6]; } + get { return global::Nitric.Proto.Apis.v1.ApisReflection.Descriptor.MessageTypes[5]; } } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] @@ -1254,110 +1086,140 @@ public sealed partial class StoragePreSignUrlRequest : pb::IMessageField number for the "bucket_name" field. - public const int BucketNameFieldNumber = 1; - private string bucketName_ = ""; + /// Field number for the "method" field. + public const int MethodFieldNumber = 1; + private string method_ = ""; /// - /// Nitric name of the bucket to retrieve from - /// this will be automatically resolved to the provider specific bucket identifier. + /// The request method /// [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public string BucketName { - get { return bucketName_; } + public string Method { + get { return method_; } set { - bucketName_ = pb::ProtoPreconditions.CheckNotNull(value, "value"); + method_ = pb::ProtoPreconditions.CheckNotNull(value, "value"); } } - /// Field number for the "key" field. - public const int KeyFieldNumber = 2; - private string key_ = ""; + /// Field number for the "path" field. + public const int PathFieldNumber = 2; + private string path_ = ""; /// - /// Key of item to generate the signed URL for. - /// The URL and the token it contains will only be valid for operations on this resource specifically. + /// The path of the request /// [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public string Key { - get { return key_; } + public string Path { + get { return path_; } set { - key_ = pb::ProtoPreconditions.CheckNotNull(value, "value"); + path_ = pb::ProtoPreconditions.CheckNotNull(value, "value"); } } - /// Field number for the "operation" field. - public const int OperationFieldNumber = 3; - private global::Nitric.Proto.Storage.v1.StoragePreSignUrlRequest.Types.Operation operation_ = global::Nitric.Proto.Storage.v1.StoragePreSignUrlRequest.Types.Operation.Read; + /// Field number for the "headers" field. + public const int HeadersFieldNumber = 3; + private static readonly pbc::MapField.Codec _map_headers_codec + = new pbc::MapField.Codec(pb::FieldCodec.ForString(10, ""), pb::FieldCodec.ForMessage(18, global::Nitric.Proto.Apis.v1.HeaderValue.Parser), 26); + private readonly pbc::MapField headers_ = new pbc::MapField(); + /// + /// HTTP request headers + /// [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public global::Nitric.Proto.Storage.v1.StoragePreSignUrlRequest.Types.Operation Operation { - get { return operation_; } - set { - operation_ = value; - } + public pbc::MapField Headers { + get { return headers_; } + } + + /// Field number for the "query_params" field. + public const int QueryParamsFieldNumber = 4; + private static readonly pbc::MapField.Codec _map_queryParams_codec + = new pbc::MapField.Codec(pb::FieldCodec.ForString(10, ""), pb::FieldCodec.ForMessage(18, global::Nitric.Proto.Apis.v1.QueryValue.Parser), 34); + private readonly pbc::MapField queryParams_ = new pbc::MapField(); + /// + /// HTTP Query params + /// + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public pbc::MapField QueryParams { + get { return queryParams_; } + } + + /// Field number for the "path_params" field. + public const int PathParamsFieldNumber = 5; + private static readonly pbc::MapField.Codec _map_pathParams_codec + = new pbc::MapField.Codec(pb::FieldCodec.ForString(10, ""), pb::FieldCodec.ForString(18, ""), 42); + private readonly pbc::MapField pathParams_ = new pbc::MapField(); + /// + /// HTTP Path parameters + /// + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public pbc::MapField PathParams { + get { return pathParams_; } } - /// Field number for the "expiry" field. - public const int ExpiryFieldNumber = 4; - private uint expiry_; + /// Field number for the "body" field. + public const int BodyFieldNumber = 6; + private pb::ByteString body_ = pb::ByteString.Empty; /// - /// Expiry time in seconds for the token included in the signed URL. - /// Time starts from when the access token is generated, not when this request is made. - /// e.g. time.Now().Add(expiry * time.Second) on the server + /// HTTP Request body /// [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public uint Expiry { - get { return expiry_; } + public pb::ByteString Body { + get { return body_; } set { - expiry_ = value; + body_ = pb::ProtoPreconditions.CheckNotNull(value, "value"); } } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public override bool Equals(object other) { - return Equals(other as StoragePreSignUrlRequest); + return Equals(other as HttpRequest); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public bool Equals(StoragePreSignUrlRequest other) { + public bool Equals(HttpRequest other) { if (ReferenceEquals(other, null)) { return false; } if (ReferenceEquals(other, this)) { return true; } - if (BucketName != other.BucketName) return false; - if (Key != other.Key) return false; - if (Operation != other.Operation) return false; - if (Expiry != other.Expiry) return false; + if (Method != other.Method) return false; + if (Path != other.Path) return false; + if (!Headers.Equals(other.Headers)) return false; + if (!QueryParams.Equals(other.QueryParams)) return false; + if (!PathParams.Equals(other.PathParams)) return false; + if (Body != other.Body) return false; return Equals(_unknownFields, other._unknownFields); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public override int GetHashCode() { int hash = 1; - if (BucketName.Length != 0) hash ^= BucketName.GetHashCode(); - if (Key.Length != 0) hash ^= Key.GetHashCode(); - if (Operation != global::Nitric.Proto.Storage.v1.StoragePreSignUrlRequest.Types.Operation.Read) hash ^= Operation.GetHashCode(); - if (Expiry != 0) hash ^= Expiry.GetHashCode(); + if (Method.Length != 0) hash ^= Method.GetHashCode(); + if (Path.Length != 0) hash ^= Path.GetHashCode(); + hash ^= Headers.GetHashCode(); + hash ^= QueryParams.GetHashCode(); + hash ^= PathParams.GetHashCode(); + if (Body.Length != 0) hash ^= Body.GetHashCode(); if (_unknownFields != null) { hash ^= _unknownFields.GetHashCode(); } @@ -1374,21 +1236,20 @@ public void WriteTo(pb::CodedOutputStream output) { #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE output.WriteRawMessage(this); #else - if (BucketName.Length != 0) { + if (Method.Length != 0) { output.WriteRawTag(10); - output.WriteString(BucketName); + output.WriteString(Method); } - if (Key.Length != 0) { + if (Path.Length != 0) { output.WriteRawTag(18); - output.WriteString(Key); - } - if (Operation != global::Nitric.Proto.Storage.v1.StoragePreSignUrlRequest.Types.Operation.Read) { - output.WriteRawTag(24); - output.WriteEnum((int) Operation); + output.WriteString(Path); } - if (Expiry != 0) { - output.WriteRawTag(32); - output.WriteUInt32(Expiry); + headers_.WriteTo(output, _map_headers_codec); + queryParams_.WriteTo(output, _map_queryParams_codec); + pathParams_.WriteTo(output, _map_pathParams_codec); + if (Body.Length != 0) { + output.WriteRawTag(50); + output.WriteBytes(Body); } if (_unknownFields != null) { _unknownFields.WriteTo(output); @@ -1399,21 +1260,20 @@ public void WriteTo(pb::CodedOutputStream output) { #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE [global::System.Diagnostics.DebuggerNonUserCodeAttribute] void pb::IBufferMessage.InternalWriteTo(ref pb::WriteContext output) { - if (BucketName.Length != 0) { + if (Method.Length != 0) { output.WriteRawTag(10); - output.WriteString(BucketName); + output.WriteString(Method); } - if (Key.Length != 0) { + if (Path.Length != 0) { output.WriteRawTag(18); - output.WriteString(Key); + output.WriteString(Path); } - if (Operation != global::Nitric.Proto.Storage.v1.StoragePreSignUrlRequest.Types.Operation.Read) { - output.WriteRawTag(24); - output.WriteEnum((int) Operation); - } - if (Expiry != 0) { - output.WriteRawTag(32); - output.WriteUInt32(Expiry); + headers_.WriteTo(ref output, _map_headers_codec); + queryParams_.WriteTo(ref output, _map_queryParams_codec); + pathParams_.WriteTo(ref output, _map_pathParams_codec); + if (Body.Length != 0) { + output.WriteRawTag(50); + output.WriteBytes(Body); } if (_unknownFields != null) { _unknownFields.WriteTo(ref output); @@ -1424,17 +1284,17 @@ public void WriteTo(pb::CodedOutputStream output) { [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public int CalculateSize() { int size = 0; - if (BucketName.Length != 0) { - size += 1 + pb::CodedOutputStream.ComputeStringSize(BucketName); - } - if (Key.Length != 0) { - size += 1 + pb::CodedOutputStream.ComputeStringSize(Key); + if (Method.Length != 0) { + size += 1 + pb::CodedOutputStream.ComputeStringSize(Method); } - if (Operation != global::Nitric.Proto.Storage.v1.StoragePreSignUrlRequest.Types.Operation.Read) { - size += 1 + pb::CodedOutputStream.ComputeEnumSize((int) Operation); + if (Path.Length != 0) { + size += 1 + pb::CodedOutputStream.ComputeStringSize(Path); } - if (Expiry != 0) { - size += 1 + pb::CodedOutputStream.ComputeUInt32Size(Expiry); + size += headers_.CalculateSize(_map_headers_codec); + size += queryParams_.CalculateSize(_map_queryParams_codec); + size += pathParams_.CalculateSize(_map_pathParams_codec); + if (Body.Length != 0) { + size += 1 + pb::CodedOutputStream.ComputeBytesSize(Body); } if (_unknownFields != null) { size += _unknownFields.CalculateSize(); @@ -1443,21 +1303,21 @@ public int CalculateSize() { } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void MergeFrom(StoragePreSignUrlRequest other) { + public void MergeFrom(HttpRequest other) { if (other == null) { return; } - if (other.BucketName.Length != 0) { - BucketName = other.BucketName; + if (other.Method.Length != 0) { + Method = other.Method; } - if (other.Key.Length != 0) { - Key = other.Key; + if (other.Path.Length != 0) { + Path = other.Path; } - if (other.Operation != global::Nitric.Proto.Storage.v1.StoragePreSignUrlRequest.Types.Operation.Read) { - Operation = other.Operation; - } - if (other.Expiry != 0) { - Expiry = other.Expiry; + headers_.Add(other.headers_); + queryParams_.Add(other.queryParams_); + pathParams_.Add(other.pathParams_); + if (other.Body.Length != 0) { + Body = other.Body; } _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields); } @@ -1474,19 +1334,27 @@ public void MergeFrom(pb::CodedInputStream input) { _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input); break; case 10: { - BucketName = input.ReadString(); + Method = input.ReadString(); break; } case 18: { - Key = input.ReadString(); + Path = input.ReadString(); + break; + } + case 26: { + headers_.AddEntriesFrom(input, _map_headers_codec); + break; + } + case 34: { + queryParams_.AddEntriesFrom(input, _map_queryParams_codec); break; } - case 24: { - Operation = (global::Nitric.Proto.Storage.v1.StoragePreSignUrlRequest.Types.Operation) input.ReadEnum(); + case 42: { + pathParams_.AddEntriesFrom(input, _map_pathParams_codec); break; } - case 32: { - Expiry = input.ReadUInt32(); + case 50: { + Body = input.ReadBytes(); break; } } @@ -1504,19 +1372,27 @@ public void MergeFrom(pb::CodedInputStream input) { _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, ref input); break; case 10: { - BucketName = input.ReadString(); + Method = input.ReadString(); break; } case 18: { - Key = input.ReadString(); + Path = input.ReadString(); + break; + } + case 26: { + headers_.AddEntriesFrom(ref input, _map_headers_codec); break; } - case 24: { - Operation = (global::Nitric.Proto.Storage.v1.StoragePreSignUrlRequest.Types.Operation) input.ReadEnum(); + case 34: { + queryParams_.AddEntriesFrom(ref input, _map_queryParams_codec); break; } - case 32: { - Expiry = input.ReadUInt32(); + case 42: { + pathParams_.AddEntriesFrom(ref input, _map_pathParams_codec); + break; + } + case 50: { + Body = input.ReadBytes(); break; } } @@ -1524,36 +1400,24 @@ public void MergeFrom(pb::CodedInputStream input) { } #endif - #region Nested types - /// Container for nested types declared in the StoragePreSignUrlRequest message type. - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public static partial class Types { - /// - /// Operation - /// - public enum Operation { - [pbr::OriginalName("READ")] Read = 0, - [pbr::OriginalName("WRITE")] Write = 1, - } - - } - #endregion - } - public sealed partial class StoragePreSignUrlResponse : pb::IMessage + /// + /// HttpResponseMessage + /// + public sealed partial class HttpResponse : pb::IMessage #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE , pb::IBufferMessage #endif { - private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new StoragePreSignUrlResponse()); + private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new HttpResponse()); private pb::UnknownFieldSet _unknownFields; [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public static pb::MessageParser Parser { get { return _parser; } } + public static pb::MessageParser Parser { get { return _parser; } } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public static pbr::MessageDescriptor Descriptor { - get { return global::Nitric.Proto.Storage.v1.StorageReflection.Descriptor.MessageTypes[7]; } + get { return global::Nitric.Proto.Apis.v1.ApisReflection.Descriptor.MessageTypes[6]; } } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] @@ -1562,58 +1426,91 @@ public sealed partial class StoragePreSignUrlResponse : pb::IMessageField number for the "url" field. - public const int UrlFieldNumber = 1; - private string url_ = ""; + /// Field number for the "status" field. + public const int StatusFieldNumber = 1; + private int status_; /// - /// The pre-signed url, restricted to the operation, resource and expiry time specified in the request. + /// The HTTP status of the request /// [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public string Url { - get { return url_; } + public int Status { + get { return status_; } set { - url_ = pb::ProtoPreconditions.CheckNotNull(value, "value"); + status_ = value; + } + } + + /// Field number for the "headers" field. + public const int HeadersFieldNumber = 2; + private static readonly pbc::MapField.Codec _map_headers_codec + = new pbc::MapField.Codec(pb::FieldCodec.ForString(10, ""), pb::FieldCodec.ForMessage(18, global::Nitric.Proto.Apis.v1.HeaderValue.Parser), 18); + private readonly pbc::MapField headers_ = new pbc::MapField(); + /// + /// HTTP response headers + /// + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public pbc::MapField Headers { + get { return headers_; } + } + + /// Field number for the "body" field. + public const int BodyFieldNumber = 3; + private pb::ByteString body_ = pb::ByteString.Empty; + /// + /// HTTP response body + /// + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public pb::ByteString Body { + get { return body_; } + set { + body_ = pb::ProtoPreconditions.CheckNotNull(value, "value"); } } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public override bool Equals(object other) { - return Equals(other as StoragePreSignUrlResponse); + return Equals(other as HttpResponse); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public bool Equals(StoragePreSignUrlResponse other) { + public bool Equals(HttpResponse other) { if (ReferenceEquals(other, null)) { return false; } if (ReferenceEquals(other, this)) { return true; } - if (Url != other.Url) return false; + if (Status != other.Status) return false; + if (!Headers.Equals(other.Headers)) return false; + if (Body != other.Body) return false; return Equals(_unknownFields, other._unknownFields); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public override int GetHashCode() { int hash = 1; - if (Url.Length != 0) hash ^= Url.GetHashCode(); + if (Status != 0) hash ^= Status.GetHashCode(); + hash ^= Headers.GetHashCode(); + if (Body.Length != 0) hash ^= Body.GetHashCode(); if (_unknownFields != null) { hash ^= _unknownFields.GetHashCode(); } @@ -1630,9 +1527,14 @@ public void WriteTo(pb::CodedOutputStream output) { #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE output.WriteRawMessage(this); #else - if (Url.Length != 0) { - output.WriteRawTag(10); - output.WriteString(Url); + if (Status != 0) { + output.WriteRawTag(8); + output.WriteInt32(Status); + } + headers_.WriteTo(output, _map_headers_codec); + if (Body.Length != 0) { + output.WriteRawTag(26); + output.WriteBytes(Body); } if (_unknownFields != null) { _unknownFields.WriteTo(output); @@ -1643,9 +1545,14 @@ public void WriteTo(pb::CodedOutputStream output) { #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE [global::System.Diagnostics.DebuggerNonUserCodeAttribute] void pb::IBufferMessage.InternalWriteTo(ref pb::WriteContext output) { - if (Url.Length != 0) { - output.WriteRawTag(10); - output.WriteString(Url); + if (Status != 0) { + output.WriteRawTag(8); + output.WriteInt32(Status); + } + headers_.WriteTo(ref output, _map_headers_codec); + if (Body.Length != 0) { + output.WriteRawTag(26); + output.WriteBytes(Body); } if (_unknownFields != null) { _unknownFields.WriteTo(ref output); @@ -1656,8 +1563,12 @@ public void WriteTo(pb::CodedOutputStream output) { [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public int CalculateSize() { int size = 0; - if (Url.Length != 0) { - size += 1 + pb::CodedOutputStream.ComputeStringSize(Url); + if (Status != 0) { + size += 1 + pb::CodedOutputStream.ComputeInt32Size(Status); + } + size += headers_.CalculateSize(_map_headers_codec); + if (Body.Length != 0) { + size += 1 + pb::CodedOutputStream.ComputeBytesSize(Body); } if (_unknownFields != null) { size += _unknownFields.CalculateSize(); @@ -1666,12 +1577,16 @@ public int CalculateSize() { } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void MergeFrom(StoragePreSignUrlResponse other) { + public void MergeFrom(HttpResponse other) { if (other == null) { return; } - if (other.Url.Length != 0) { - Url = other.Url; + if (other.Status != 0) { + Status = other.Status; + } + headers_.Add(other.headers_); + if (other.Body.Length != 0) { + Body = other.Body; } _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields); } @@ -1687,8 +1602,16 @@ public void MergeFrom(pb::CodedInputStream input) { default: _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input); break; - case 10: { - Url = input.ReadString(); + case 8: { + Status = input.ReadInt32(); + break; + } + case 18: { + headers_.AddEntriesFrom(input, _map_headers_codec); + break; + } + case 26: { + Body = input.ReadBytes(); break; } } @@ -1705,8 +1628,16 @@ public void MergeFrom(pb::CodedInputStream input) { default: _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, ref input); break; - case 10: { - Url = input.ReadString(); + case 8: { + Status = input.ReadInt32(); + break; + } + case 18: { + headers_.AddEntriesFrom(ref input, _map_headers_codec); + break; + } + case 26: { + Body = input.ReadBytes(); break; } } @@ -1716,19 +1647,19 @@ public void MergeFrom(pb::CodedInputStream input) { } - public sealed partial class StorageListFilesRequest : pb::IMessage + public sealed partial class ServerMessage : pb::IMessage #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE , pb::IBufferMessage #endif { - private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new StorageListFilesRequest()); + private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new ServerMessage()); private pb::UnknownFieldSet _unknownFields; [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public static pb::MessageParser Parser { get { return _parser; } } + public static pb::MessageParser Parser { get { return _parser; } } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public static pbr::MessageDescriptor Descriptor { - get { return global::Nitric.Proto.Storage.v1.StorageReflection.Descriptor.MessageTypes[8]; } + get { return global::Nitric.Proto.Apis.v1.ApisReflection.Descriptor.MessageTypes[7]; } } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] @@ -1737,69 +1668,120 @@ public sealed partial class StorageListFilesRequest : pb::IMessageField number for the "id" field. + public const int IdFieldNumber = 1; + private string id_ = ""; + /// + /// globally unique ID of the request/response pair + /// + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public string Id { + get { return id_; } + set { + id_ = pb::ProtoPreconditions.CheckNotNull(value, "value"); + } } - /// Field number for the "bucket_name" field. - public const int BucketNameFieldNumber = 1; - private string bucketName_ = ""; + /// Field number for the "registration_response" field. + public const int RegistrationResponseFieldNumber = 2; + /// + /// Response to a topic subscription request + /// [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public string BucketName { - get { return bucketName_; } + public global::Nitric.Proto.Apis.v1.RegistrationResponse RegistrationResponse { + get { return contentCase_ == ContentOneofCase.RegistrationResponse ? (global::Nitric.Proto.Apis.v1.RegistrationResponse) content_ : null; } set { - bucketName_ = pb::ProtoPreconditions.CheckNotNull(value, "value"); + content_ = value; + contentCase_ = value == null ? ContentOneofCase.None : ContentOneofCase.RegistrationResponse; } } - /// Field number for the "prefix" field. - public const int PrefixFieldNumber = 2; - private string prefix_ = ""; + /// Field number for the "http_request" field. + public const int HttpRequestFieldNumber = 3; + /// + /// Response to a topic message request + /// [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public string Prefix { - get { return prefix_; } + public global::Nitric.Proto.Apis.v1.HttpRequest HttpRequest { + get { return contentCase_ == ContentOneofCase.HttpRequest ? (global::Nitric.Proto.Apis.v1.HttpRequest) content_ : null; } set { - prefix_ = pb::ProtoPreconditions.CheckNotNull(value, "value"); + content_ = value; + contentCase_ = value == null ? ContentOneofCase.None : ContentOneofCase.HttpRequest; } } + private object content_; + /// Enum of possible cases for the "content" oneof. + public enum ContentOneofCase { + None = 0, + RegistrationResponse = 2, + HttpRequest = 3, + } + private ContentOneofCase contentCase_ = ContentOneofCase.None; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public ContentOneofCase ContentCase { + get { return contentCase_; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public void ClearContent() { + contentCase_ = ContentOneofCase.None; + content_ = null; + } + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public override bool Equals(object other) { - return Equals(other as StorageListFilesRequest); + return Equals(other as ServerMessage); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public bool Equals(StorageListFilesRequest other) { + public bool Equals(ServerMessage other) { if (ReferenceEquals(other, null)) { return false; } if (ReferenceEquals(other, this)) { return true; } - if (BucketName != other.BucketName) return false; - if (Prefix != other.Prefix) return false; + if (Id != other.Id) return false; + if (!object.Equals(RegistrationResponse, other.RegistrationResponse)) return false; + if (!object.Equals(HttpRequest, other.HttpRequest)) return false; + if (ContentCase != other.ContentCase) return false; return Equals(_unknownFields, other._unknownFields); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public override int GetHashCode() { int hash = 1; - if (BucketName.Length != 0) hash ^= BucketName.GetHashCode(); - if (Prefix.Length != 0) hash ^= Prefix.GetHashCode(); + if (Id.Length != 0) hash ^= Id.GetHashCode(); + if (contentCase_ == ContentOneofCase.RegistrationResponse) hash ^= RegistrationResponse.GetHashCode(); + if (contentCase_ == ContentOneofCase.HttpRequest) hash ^= HttpRequest.GetHashCode(); + hash ^= (int) contentCase_; if (_unknownFields != null) { hash ^= _unknownFields.GetHashCode(); } @@ -1816,13 +1798,17 @@ public void WriteTo(pb::CodedOutputStream output) { #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE output.WriteRawMessage(this); #else - if (BucketName.Length != 0) { + if (Id.Length != 0) { output.WriteRawTag(10); - output.WriteString(BucketName); + output.WriteString(Id); } - if (Prefix.Length != 0) { + if (contentCase_ == ContentOneofCase.RegistrationResponse) { output.WriteRawTag(18); - output.WriteString(Prefix); + output.WriteMessage(RegistrationResponse); + } + if (contentCase_ == ContentOneofCase.HttpRequest) { + output.WriteRawTag(26); + output.WriteMessage(HttpRequest); } if (_unknownFields != null) { _unknownFields.WriteTo(output); @@ -1833,13 +1819,17 @@ public void WriteTo(pb::CodedOutputStream output) { #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE [global::System.Diagnostics.DebuggerNonUserCodeAttribute] void pb::IBufferMessage.InternalWriteTo(ref pb::WriteContext output) { - if (BucketName.Length != 0) { + if (Id.Length != 0) { output.WriteRawTag(10); - output.WriteString(BucketName); + output.WriteString(Id); } - if (Prefix.Length != 0) { + if (contentCase_ == ContentOneofCase.RegistrationResponse) { output.WriteRawTag(18); - output.WriteString(Prefix); + output.WriteMessage(RegistrationResponse); + } + if (contentCase_ == ContentOneofCase.HttpRequest) { + output.WriteRawTag(26); + output.WriteMessage(HttpRequest); } if (_unknownFields != null) { _unknownFields.WriteTo(ref output); @@ -1850,11 +1840,14 @@ public void WriteTo(pb::CodedOutputStream output) { [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public int CalculateSize() { int size = 0; - if (BucketName.Length != 0) { - size += 1 + pb::CodedOutputStream.ComputeStringSize(BucketName); + if (Id.Length != 0) { + size += 1 + pb::CodedOutputStream.ComputeStringSize(Id); + } + if (contentCase_ == ContentOneofCase.RegistrationResponse) { + size += 1 + pb::CodedOutputStream.ComputeMessageSize(RegistrationResponse); } - if (Prefix.Length != 0) { - size += 1 + pb::CodedOutputStream.ComputeStringSize(Prefix); + if (contentCase_ == ContentOneofCase.HttpRequest) { + size += 1 + pb::CodedOutputStream.ComputeMessageSize(HttpRequest); } if (_unknownFields != null) { size += _unknownFields.CalculateSize(); @@ -1863,16 +1856,28 @@ public int CalculateSize() { } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void MergeFrom(StorageListFilesRequest other) { + public void MergeFrom(ServerMessage other) { if (other == null) { return; } - if (other.BucketName.Length != 0) { - BucketName = other.BucketName; + if (other.Id.Length != 0) { + Id = other.Id; } - if (other.Prefix.Length != 0) { - Prefix = other.Prefix; + switch (other.ContentCase) { + case ContentOneofCase.RegistrationResponse: + if (RegistrationResponse == null) { + RegistrationResponse = new global::Nitric.Proto.Apis.v1.RegistrationResponse(); + } + RegistrationResponse.MergeFrom(other.RegistrationResponse); + break; + case ContentOneofCase.HttpRequest: + if (HttpRequest == null) { + HttpRequest = new global::Nitric.Proto.Apis.v1.HttpRequest(); + } + HttpRequest.MergeFrom(other.HttpRequest); + break; } + _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields); } @@ -1888,11 +1893,25 @@ public void MergeFrom(pb::CodedInputStream input) { _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input); break; case 10: { - BucketName = input.ReadString(); + Id = input.ReadString(); break; } case 18: { - Prefix = input.ReadString(); + global::Nitric.Proto.Apis.v1.RegistrationResponse subBuilder = new global::Nitric.Proto.Apis.v1.RegistrationResponse(); + if (contentCase_ == ContentOneofCase.RegistrationResponse) { + subBuilder.MergeFrom(RegistrationResponse); + } + input.ReadMessage(subBuilder); + RegistrationResponse = subBuilder; + break; + } + case 26: { + global::Nitric.Proto.Apis.v1.HttpRequest subBuilder = new global::Nitric.Proto.Apis.v1.HttpRequest(); + if (contentCase_ == ContentOneofCase.HttpRequest) { + subBuilder.MergeFrom(HttpRequest); + } + input.ReadMessage(subBuilder); + HttpRequest = subBuilder; break; } } @@ -1910,11 +1929,25 @@ public void MergeFrom(pb::CodedInputStream input) { _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, ref input); break; case 10: { - BucketName = input.ReadString(); + Id = input.ReadString(); break; } case 18: { - Prefix = input.ReadString(); + global::Nitric.Proto.Apis.v1.RegistrationResponse subBuilder = new global::Nitric.Proto.Apis.v1.RegistrationResponse(); + if (contentCase_ == ContentOneofCase.RegistrationResponse) { + subBuilder.MergeFrom(RegistrationResponse); + } + input.ReadMessage(subBuilder); + RegistrationResponse = subBuilder; + break; + } + case 26: { + global::Nitric.Proto.Apis.v1.HttpRequest subBuilder = new global::Nitric.Proto.Apis.v1.HttpRequest(); + if (contentCase_ == ContentOneofCase.HttpRequest) { + subBuilder.MergeFrom(HttpRequest); + } + input.ReadMessage(subBuilder); + HttpRequest = subBuilder; break; } } @@ -1924,19 +1957,19 @@ public void MergeFrom(pb::CodedInputStream input) { } - public sealed partial class File : pb::IMessage + public sealed partial class RegistrationResponse : pb::IMessage #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE , pb::IBufferMessage #endif { - private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new File()); + private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new RegistrationResponse()); private pb::UnknownFieldSet _unknownFields; [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public static pb::MessageParser Parser { get { return _parser; } } + public static pb::MessageParser Parser { get { return _parser; } } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public static pbr::MessageDescriptor Descriptor { - get { return global::Nitric.Proto.Storage.v1.StorageReflection.Descriptor.MessageTypes[9]; } + get { return global::Nitric.Proto.Apis.v1.ApisReflection.Descriptor.MessageTypes[8]; } } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] @@ -1945,55 +1978,41 @@ public sealed partial class File : pb::IMessage } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public File() { + public RegistrationResponse() { OnConstruction(); } partial void OnConstruction(); [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public File(File other) : this() { - key_ = other.key_; + public RegistrationResponse(RegistrationResponse other) : this() { _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public File Clone() { - return new File(this); - } - - /// Field number for the "key" field. - public const int KeyFieldNumber = 1; - private string key_ = ""; - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public string Key { - get { return key_; } - set { - key_ = pb::ProtoPreconditions.CheckNotNull(value, "value"); - } + public RegistrationResponse Clone() { + return new RegistrationResponse(this); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public override bool Equals(object other) { - return Equals(other as File); + return Equals(other as RegistrationResponse); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public bool Equals(File other) { + public bool Equals(RegistrationResponse other) { if (ReferenceEquals(other, null)) { return false; } if (ReferenceEquals(other, this)) { return true; } - if (Key != other.Key) return false; return Equals(_unknownFields, other._unknownFields); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public override int GetHashCode() { int hash = 1; - if (Key.Length != 0) hash ^= Key.GetHashCode(); if (_unknownFields != null) { hash ^= _unknownFields.GetHashCode(); } @@ -2010,10 +2029,6 @@ public void WriteTo(pb::CodedOutputStream output) { #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE output.WriteRawMessage(this); #else - if (Key.Length != 0) { - output.WriteRawTag(10); - output.WriteString(Key); - } if (_unknownFields != null) { _unknownFields.WriteTo(output); } @@ -2023,10 +2038,6 @@ public void WriteTo(pb::CodedOutputStream output) { #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE [global::System.Diagnostics.DebuggerNonUserCodeAttribute] void pb::IBufferMessage.InternalWriteTo(ref pb::WriteContext output) { - if (Key.Length != 0) { - output.WriteRawTag(10); - output.WriteString(Key); - } if (_unknownFields != null) { _unknownFields.WriteTo(ref output); } @@ -2036,9 +2047,6 @@ public void WriteTo(pb::CodedOutputStream output) { [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public int CalculateSize() { int size = 0; - if (Key.Length != 0) { - size += 1 + pb::CodedOutputStream.ComputeStringSize(Key); - } if (_unknownFields != null) { size += _unknownFields.CalculateSize(); } @@ -2046,13 +2054,10 @@ public int CalculateSize() { } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void MergeFrom(File other) { + public void MergeFrom(RegistrationResponse other) { if (other == null) { return; } - if (other.Key.Length != 0) { - Key = other.Key; - } _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields); } @@ -2067,10 +2072,6 @@ public void MergeFrom(pb::CodedInputStream input) { default: _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input); break; - case 10: { - Key = input.ReadString(); - break; - } } } #endif @@ -2085,10 +2086,6 @@ public void MergeFrom(pb::CodedInputStream input) { default: _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, ref input); break; - case 10: { - Key = input.ReadString(); - break; - } } } } @@ -2096,19 +2093,19 @@ public void MergeFrom(pb::CodedInputStream input) { } - public sealed partial class StorageListFilesResponse : pb::IMessage + public sealed partial class ApiWorkerScopes : pb::IMessage #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE , pb::IBufferMessage #endif { - private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new StorageListFilesResponse()); + private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new ApiWorkerScopes()); private pb::UnknownFieldSet _unknownFields; [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public static pb::MessageParser Parser { get { return _parser; } } + public static pb::MessageParser Parser { get { return _parser; } } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public static pbr::MessageDescriptor Descriptor { - get { return global::Nitric.Proto.Storage.v1.StorageReflection.Descriptor.MessageTypes[10]; } + get { return global::Nitric.Proto.Apis.v1.ApisReflection.Descriptor.MessageTypes[9]; } } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] @@ -2117,57 +2114,54 @@ public sealed partial class StorageListFilesResponse : pb::IMessageField number for the "files" field. - public const int FilesFieldNumber = 1; - private static readonly pb::FieldCodec _repeated_files_codec - = pb::FieldCodec.ForMessage(10, global::Nitric.Proto.Storage.v1.File.Parser); - private readonly pbc::RepeatedField files_ = new pbc::RepeatedField(); - /// - /// keys of the files in the bucket - /// + /// Field number for the "scopes" field. + public const int ScopesFieldNumber = 1; + private static readonly pb::FieldCodec _repeated_scopes_codec + = pb::FieldCodec.ForString(10); + private readonly pbc::RepeatedField scopes_ = new pbc::RepeatedField(); [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public pbc::RepeatedField Files { - get { return files_; } + public pbc::RepeatedField Scopes { + get { return scopes_; } } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public override bool Equals(object other) { - return Equals(other as StorageListFilesResponse); + return Equals(other as ApiWorkerScopes); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public bool Equals(StorageListFilesResponse other) { + public bool Equals(ApiWorkerScopes other) { if (ReferenceEquals(other, null)) { return false; } if (ReferenceEquals(other, this)) { return true; } - if(!files_.Equals(other.files_)) return false; + if(!scopes_.Equals(other.scopes_)) return false; return Equals(_unknownFields, other._unknownFields); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public override int GetHashCode() { int hash = 1; - hash ^= files_.GetHashCode(); + hash ^= scopes_.GetHashCode(); if (_unknownFields != null) { hash ^= _unknownFields.GetHashCode(); } @@ -2184,7 +2178,7 @@ public void WriteTo(pb::CodedOutputStream output) { #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE output.WriteRawMessage(this); #else - files_.WriteTo(output, _repeated_files_codec); + scopes_.WriteTo(output, _repeated_scopes_codec); if (_unknownFields != null) { _unknownFields.WriteTo(output); } @@ -2194,7 +2188,7 @@ public void WriteTo(pb::CodedOutputStream output) { #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE [global::System.Diagnostics.DebuggerNonUserCodeAttribute] void pb::IBufferMessage.InternalWriteTo(ref pb::WriteContext output) { - files_.WriteTo(ref output, _repeated_files_codec); + scopes_.WriteTo(ref output, _repeated_scopes_codec); if (_unknownFields != null) { _unknownFields.WriteTo(ref output); } @@ -2204,7 +2198,7 @@ public void WriteTo(pb::CodedOutputStream output) { [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public int CalculateSize() { int size = 0; - size += files_.CalculateSize(_repeated_files_codec); + size += scopes_.CalculateSize(_repeated_scopes_codec); if (_unknownFields != null) { size += _unknownFields.CalculateSize(); } @@ -2212,11 +2206,11 @@ public int CalculateSize() { } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void MergeFrom(StorageListFilesResponse other) { + public void MergeFrom(ApiWorkerScopes other) { if (other == null) { return; } - files_.Add(other.files_); + scopes_.Add(other.scopes_); _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields); } @@ -2232,7 +2226,7 @@ public void MergeFrom(pb::CodedInputStream input) { _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input); break; case 10: { - files_.AddEntriesFrom(input, _repeated_files_codec); + scopes_.AddEntriesFrom(input, _repeated_scopes_codec); break; } } @@ -2250,7 +2244,7 @@ public void MergeFrom(pb::CodedInputStream input) { _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, ref input); break; case 10: { - files_.AddEntriesFrom(ref input, _repeated_files_codec); + scopes_.AddEntriesFrom(ref input, _repeated_scopes_codec); break; } } @@ -2260,19 +2254,19 @@ public void MergeFrom(pb::CodedInputStream input) { } - public sealed partial class StorageExistsRequest : pb::IMessage + public sealed partial class ApiWorkerOptions : pb::IMessage #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE , pb::IBufferMessage #endif { - private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new StorageExistsRequest()); + private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new ApiWorkerOptions()); private pb::UnknownFieldSet _unknownFields; [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public static pb::MessageParser Parser { get { return _parser; } } + public static pb::MessageParser Parser { get { return _parser; } } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public static pbr::MessageDescriptor Descriptor { - get { return global::Nitric.Proto.Storage.v1.StorageReflection.Descriptor.MessageTypes[11]; } + get { return global::Nitric.Proto.Apis.v1.ApisReflection.Descriptor.MessageTypes[10]; } } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] @@ -2281,72 +2275,78 @@ public sealed partial class StorageExistsRequest : pb::IMessageField number for the "bucket" field. - public const int BucketFieldNumber = 1; - private string bucket_ = ""; + /// Field number for the "security" field. + public const int SecurityFieldNumber = 1; + private static readonly pbc::MapField.Codec _map_security_codec + = new pbc::MapField.Codec(pb::FieldCodec.ForString(10, ""), pb::FieldCodec.ForMessage(18, global::Nitric.Proto.Apis.v1.ApiWorkerScopes.Parser), 10); + private readonly pbc::MapField security_ = new pbc::MapField(); + /// + /// Apply security definitions to this operation + /// This will be mapped to named ApiSecurityDefinitionResource(s) + /// [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public string Bucket { - get { return bucket_; } - set { - bucket_ = pb::ProtoPreconditions.CheckNotNull(value, "value"); - } + public pbc::MapField Security { + get { return security_; } } - /// Field number for the "key" field. - public const int KeyFieldNumber = 2; - private string key_ = ""; + /// Field number for the "security_disabled" field. + public const int SecurityDisabledFieldNumber = 2; + private bool securityDisabled_; /// - /// Key of item to retrieve + /// explicitly disable security for this endpoint + /// We need to do this as the default value of a repeated field + /// is always empty so there is no way of knowing if security is explicitly + /// disabled /// [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public string Key { - get { return key_; } + public bool SecurityDisabled { + get { return securityDisabled_; } set { - key_ = pb::ProtoPreconditions.CheckNotNull(value, "value"); + securityDisabled_ = value; } } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public override bool Equals(object other) { - return Equals(other as StorageExistsRequest); + return Equals(other as ApiWorkerOptions); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public bool Equals(StorageExistsRequest other) { + public bool Equals(ApiWorkerOptions other) { if (ReferenceEquals(other, null)) { return false; } if (ReferenceEquals(other, this)) { return true; } - if (Bucket != other.Bucket) return false; - if (Key != other.Key) return false; + if (!Security.Equals(other.Security)) return false; + if (SecurityDisabled != other.SecurityDisabled) return false; return Equals(_unknownFields, other._unknownFields); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public override int GetHashCode() { int hash = 1; - if (Bucket.Length != 0) hash ^= Bucket.GetHashCode(); - if (Key.Length != 0) hash ^= Key.GetHashCode(); + hash ^= Security.GetHashCode(); + if (SecurityDisabled != false) hash ^= SecurityDisabled.GetHashCode(); if (_unknownFields != null) { hash ^= _unknownFields.GetHashCode(); } @@ -2363,13 +2363,10 @@ public void WriteTo(pb::CodedOutputStream output) { #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE output.WriteRawMessage(this); #else - if (Bucket.Length != 0) { - output.WriteRawTag(10); - output.WriteString(Bucket); - } - if (Key.Length != 0) { - output.WriteRawTag(18); - output.WriteString(Key); + security_.WriteTo(output, _map_security_codec); + if (SecurityDisabled != false) { + output.WriteRawTag(16); + output.WriteBool(SecurityDisabled); } if (_unknownFields != null) { _unknownFields.WriteTo(output); @@ -2380,13 +2377,10 @@ public void WriteTo(pb::CodedOutputStream output) { #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE [global::System.Diagnostics.DebuggerNonUserCodeAttribute] void pb::IBufferMessage.InternalWriteTo(ref pb::WriteContext output) { - if (Bucket.Length != 0) { - output.WriteRawTag(10); - output.WriteString(Bucket); - } - if (Key.Length != 0) { - output.WriteRawTag(18); - output.WriteString(Key); + security_.WriteTo(ref output, _map_security_codec); + if (SecurityDisabled != false) { + output.WriteRawTag(16); + output.WriteBool(SecurityDisabled); } if (_unknownFields != null) { _unknownFields.WriteTo(ref output); @@ -2397,11 +2391,9 @@ public void WriteTo(pb::CodedOutputStream output) { [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public int CalculateSize() { int size = 0; - if (Bucket.Length != 0) { - size += 1 + pb::CodedOutputStream.ComputeStringSize(Bucket); - } - if (Key.Length != 0) { - size += 1 + pb::CodedOutputStream.ComputeStringSize(Key); + size += security_.CalculateSize(_map_security_codec); + if (SecurityDisabled != false) { + size += 1 + 1; } if (_unknownFields != null) { size += _unknownFields.CalculateSize(); @@ -2410,15 +2402,13 @@ public int CalculateSize() { } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void MergeFrom(StorageExistsRequest other) { + public void MergeFrom(ApiWorkerOptions other) { if (other == null) { return; } - if (other.Bucket.Length != 0) { - Bucket = other.Bucket; - } - if (other.Key.Length != 0) { - Key = other.Key; + security_.Add(other.security_); + if (other.SecurityDisabled != false) { + SecurityDisabled = other.SecurityDisabled; } _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields); } @@ -2435,11 +2425,11 @@ public void MergeFrom(pb::CodedInputStream input) { _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input); break; case 10: { - Bucket = input.ReadString(); + security_.AddEntriesFrom(input, _map_security_codec); break; } - case 18: { - Key = input.ReadString(); + case 16: { + SecurityDisabled = input.ReadBool(); break; } } @@ -2457,11 +2447,11 @@ public void MergeFrom(pb::CodedInputStream input) { _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, ref input); break; case 10: { - Bucket = input.ReadString(); + security_.AddEntriesFrom(ref input, _map_security_codec); break; } - case 18: { - Key = input.ReadString(); + case 16: { + SecurityDisabled = input.ReadBool(); break; } } @@ -2471,19 +2461,19 @@ public void MergeFrom(pb::CodedInputStream input) { } - public sealed partial class StorageExistsResponse : pb::IMessage + public sealed partial class RegistrationRequest : pb::IMessage #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE , pb::IBufferMessage #endif { - private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new StorageExistsResponse()); + private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new RegistrationRequest()); private pb::UnknownFieldSet _unknownFields; [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public static pb::MessageParser Parser { get { return _parser; } } + public static pb::MessageParser Parser { get { return _parser; } } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public static pbr::MessageDescriptor Descriptor { - get { return global::Nitric.Proto.Storage.v1.StorageReflection.Descriptor.MessageTypes[12]; } + get { return global::Nitric.Proto.Apis.v1.ApisReflection.Descriptor.MessageTypes[11]; } } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] @@ -2492,55 +2482,96 @@ public sealed partial class StorageExistsResponse : pb::IMessageField number for the "api" field. + public const int ApiFieldNumber = 1; + private string api_ = ""; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public string Api { + get { return api_; } + set { + api_ = pb::ProtoPreconditions.CheckNotNull(value, "value"); + } + } + + /// Field number for the "path" field. + public const int PathFieldNumber = 2; + private string path_ = ""; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public string Path { + get { return path_; } + set { + path_ = pb::ProtoPreconditions.CheckNotNull(value, "value"); + } + } + + /// Field number for the "methods" field. + public const int MethodsFieldNumber = 3; + private static readonly pb::FieldCodec _repeated_methods_codec + = pb::FieldCodec.ForString(26); + private readonly pbc::RepeatedField methods_ = new pbc::RepeatedField(); + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public pbc::RepeatedField Methods { + get { return methods_; } } - /// Field number for the "exists" field. - public const int ExistsFieldNumber = 1; - private bool exists_; + /// Field number for the "options" field. + public const int OptionsFieldNumber = 4; + private global::Nitric.Proto.Apis.v1.ApiWorkerOptions options_; [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public bool Exists { - get { return exists_; } + public global::Nitric.Proto.Apis.v1.ApiWorkerOptions Options { + get { return options_; } set { - exists_ = value; + options_ = value; } } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public override bool Equals(object other) { - return Equals(other as StorageExistsResponse); + return Equals(other as RegistrationRequest); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public bool Equals(StorageExistsResponse other) { + public bool Equals(RegistrationRequest other) { if (ReferenceEquals(other, null)) { return false; } if (ReferenceEquals(other, this)) { return true; } - if (Exists != other.Exists) return false; + if (Api != other.Api) return false; + if (Path != other.Path) return false; + if(!methods_.Equals(other.methods_)) return false; + if (!object.Equals(Options, other.Options)) return false; return Equals(_unknownFields, other._unknownFields); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public override int GetHashCode() { int hash = 1; - if (Exists != false) hash ^= Exists.GetHashCode(); + if (Api.Length != 0) hash ^= Api.GetHashCode(); + if (Path.Length != 0) hash ^= Path.GetHashCode(); + hash ^= methods_.GetHashCode(); + if (options_ != null) hash ^= Options.GetHashCode(); if (_unknownFields != null) { hash ^= _unknownFields.GetHashCode(); } @@ -2557,9 +2588,18 @@ public void WriteTo(pb::CodedOutputStream output) { #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE output.WriteRawMessage(this); #else - if (Exists != false) { - output.WriteRawTag(8); - output.WriteBool(Exists); + if (Api.Length != 0) { + output.WriteRawTag(10); + output.WriteString(Api); + } + if (Path.Length != 0) { + output.WriteRawTag(18); + output.WriteString(Path); + } + methods_.WriteTo(output, _repeated_methods_codec); + if (options_ != null) { + output.WriteRawTag(34); + output.WriteMessage(Options); } if (_unknownFields != null) { _unknownFields.WriteTo(output); @@ -2570,9 +2610,18 @@ public void WriteTo(pb::CodedOutputStream output) { #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE [global::System.Diagnostics.DebuggerNonUserCodeAttribute] void pb::IBufferMessage.InternalWriteTo(ref pb::WriteContext output) { - if (Exists != false) { - output.WriteRawTag(8); - output.WriteBool(Exists); + if (Api.Length != 0) { + output.WriteRawTag(10); + output.WriteString(Api); + } + if (Path.Length != 0) { + output.WriteRawTag(18); + output.WriteString(Path); + } + methods_.WriteTo(ref output, _repeated_methods_codec); + if (options_ != null) { + output.WriteRawTag(34); + output.WriteMessage(Options); } if (_unknownFields != null) { _unknownFields.WriteTo(ref output); @@ -2583,8 +2632,15 @@ public void WriteTo(pb::CodedOutputStream output) { [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public int CalculateSize() { int size = 0; - if (Exists != false) { - size += 1 + 1; + if (Api.Length != 0) { + size += 1 + pb::CodedOutputStream.ComputeStringSize(Api); + } + if (Path.Length != 0) { + size += 1 + pb::CodedOutputStream.ComputeStringSize(Path); + } + size += methods_.CalculateSize(_repeated_methods_codec); + if (options_ != null) { + size += 1 + pb::CodedOutputStream.ComputeMessageSize(Options); } if (_unknownFields != null) { size += _unknownFields.CalculateSize(); @@ -2593,12 +2649,22 @@ public int CalculateSize() { } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void MergeFrom(StorageExistsResponse other) { + public void MergeFrom(RegistrationRequest other) { if (other == null) { return; } - if (other.Exists != false) { - Exists = other.Exists; + if (other.Api.Length != 0) { + Api = other.Api; + } + if (other.Path.Length != 0) { + Path = other.Path; + } + methods_.Add(other.methods_); + if (other.options_ != null) { + if (options_ == null) { + Options = new global::Nitric.Proto.Apis.v1.ApiWorkerOptions(); + } + Options.MergeFrom(other.Options); } _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields); } @@ -2614,8 +2680,23 @@ public void MergeFrom(pb::CodedInputStream input) { default: _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input); break; - case 8: { - Exists = input.ReadBool(); + case 10: { + Api = input.ReadString(); + break; + } + case 18: { + Path = input.ReadString(); + break; + } + case 26: { + methods_.AddEntriesFrom(input, _repeated_methods_codec); + break; + } + case 34: { + if (options_ == null) { + Options = new global::Nitric.Proto.Apis.v1.ApiWorkerOptions(); + } + input.ReadMessage(Options); break; } } @@ -2632,8 +2713,23 @@ public void MergeFrom(pb::CodedInputStream input) { default: _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, ref input); break; - case 8: { - Exists = input.ReadBool(); + case 10: { + Api = input.ReadString(); + break; + } + case 18: { + Path = input.ReadString(); + break; + } + case 26: { + methods_.AddEntriesFrom(ref input, _repeated_methods_codec); + break; + } + case 34: { + if (options_ == null) { + Options = new global::Nitric.Proto.Apis.v1.ApiWorkerOptions(); + } + input.ReadMessage(Options); break; } } diff --git a/src/Nitric.Sdk/Proto/nitric/proto/apis/v1/ApisGrpc.cs b/src/Nitric.Sdk/Proto/nitric/proto/apis/v1/ApisGrpc.cs new file mode 100644 index 0000000..fd82ae0 --- /dev/null +++ b/src/Nitric.Sdk/Proto/nitric/proto/apis/v1/ApisGrpc.cs @@ -0,0 +1,217 @@ +// +// Generated by the protocol buffer compiler. DO NOT EDIT! +// source: nitric/proto/apis/v1/apis.proto +// +#pragma warning disable 0414, 1591 +#region Designer generated code + +using grpc = global::Grpc.Core; + +namespace Nitric.Proto.Apis.v1 { + /// + /// Service for publishing asynchronous messages + /// + public static partial class Api + { + static readonly string __ServiceName = "nitric.proto.apis.v1.Api"; + + static void __Helper_SerializeMessage(global::Google.Protobuf.IMessage message, grpc::SerializationContext context) + { + #if !GRPC_DISABLE_PROTOBUF_BUFFER_SERIALIZATION + if (message is global::Google.Protobuf.IBufferMessage) + { + context.SetPayloadLength(message.CalculateSize()); + global::Google.Protobuf.MessageExtensions.WriteTo(message, context.GetBufferWriter()); + context.Complete(); + return; + } + #endif + context.Complete(global::Google.Protobuf.MessageExtensions.ToByteArray(message)); + } + + static class __Helper_MessageCache + { + public static readonly bool IsBufferMessage = global::System.Reflection.IntrospectionExtensions.GetTypeInfo(typeof(global::Google.Protobuf.IBufferMessage)).IsAssignableFrom(typeof(T)); + } + + static T __Helper_DeserializeMessage(grpc::DeserializationContext context, global::Google.Protobuf.MessageParser parser) where T : global::Google.Protobuf.IMessage + { + #if !GRPC_DISABLE_PROTOBUF_BUFFER_SERIALIZATION + if (__Helper_MessageCache.IsBufferMessage) + { + return parser.ParseFrom(context.PayloadAsReadOnlySequence()); + } + #endif + return parser.ParseFrom(context.PayloadAsNewBuffer()); + } + + static readonly grpc::Marshaller __Marshaller_nitric_proto_apis_v1_ClientMessage = grpc::Marshallers.Create(__Helper_SerializeMessage, context => __Helper_DeserializeMessage(context, global::Nitric.Proto.Apis.v1.ClientMessage.Parser)); + static readonly grpc::Marshaller __Marshaller_nitric_proto_apis_v1_ServerMessage = grpc::Marshallers.Create(__Helper_SerializeMessage, context => __Helper_DeserializeMessage(context, global::Nitric.Proto.Apis.v1.ServerMessage.Parser)); + static readonly grpc::Marshaller __Marshaller_nitric_proto_apis_v1_ApiDetailsRequest = grpc::Marshallers.Create(__Helper_SerializeMessage, context => __Helper_DeserializeMessage(context, global::Nitric.Proto.Apis.v1.ApiDetailsRequest.Parser)); + static readonly grpc::Marshaller __Marshaller_nitric_proto_apis_v1_ApiDetailsResponse = grpc::Marshallers.Create(__Helper_SerializeMessage, context => __Helper_DeserializeMessage(context, global::Nitric.Proto.Apis.v1.ApiDetailsResponse.Parser)); + + static readonly grpc::Method __Method_Serve = new grpc::Method( + grpc::MethodType.DuplexStreaming, + __ServiceName, + "Serve", + __Marshaller_nitric_proto_apis_v1_ClientMessage, + __Marshaller_nitric_proto_apis_v1_ServerMessage); + + static readonly grpc::Method __Method_Details = new grpc::Method( + grpc::MethodType.Unary, + __ServiceName, + "Details", + __Marshaller_nitric_proto_apis_v1_ApiDetailsRequest, + __Marshaller_nitric_proto_apis_v1_ApiDetailsResponse); + + /// Service descriptor + public static global::Google.Protobuf.Reflection.ServiceDescriptor Descriptor + { + get { return global::Nitric.Proto.Apis.v1.ApisReflection.Descriptor.Services[0]; } + } + + /// Base class for server-side implementations of Api + [grpc::BindServiceMethod(typeof(Api), "BindService")] + public abstract partial class ApiBase + { + /// + /// Serve a route on an API + /// + /// Used for reading requests from the client. + /// Used for sending responses back to the client. + /// The context of the server-side call handler being invoked. + /// A task indicating completion of the handler. + public virtual global::System.Threading.Tasks.Task Serve(grpc::IAsyncStreamReader requestStream, grpc::IServerStreamWriter responseStream, grpc::ServerCallContext context) + { + throw new grpc::RpcException(new grpc::Status(grpc::StatusCode.Unimplemented, "")); + } + + /// + /// Retrieve details about an API + /// + /// The request received from the client. + /// The context of the server-side call handler being invoked. + /// The response to send back to the client (wrapped by a task). + public virtual global::System.Threading.Tasks.Task Details(global::Nitric.Proto.Apis.v1.ApiDetailsRequest request, grpc::ServerCallContext context) + { + throw new grpc::RpcException(new grpc::Status(grpc::StatusCode.Unimplemented, "")); + } + + } + + /// Client for Api + public partial class ApiClient : grpc::ClientBase + { + /// Creates a new client for Api + /// The channel to use to make remote calls. + public ApiClient(grpc::ChannelBase channel) : base(channel) + { + } + /// Creates a new client for Api that uses a custom CallInvoker. + /// The callInvoker to use to make remote calls. + public ApiClient(grpc::CallInvoker callInvoker) : base(callInvoker) + { + } + /// Protected parameterless constructor to allow creation of test doubles. + protected ApiClient() : base() + { + } + /// Protected constructor to allow creation of configured clients. + /// The client configuration. + protected ApiClient(ClientBaseConfiguration configuration) : base(configuration) + { + } + + /// + /// Serve a route on an API + /// + /// The initial metadata to send with the call. This parameter is optional. + /// An optional deadline for the call. The call will be cancelled if deadline is hit. + /// An optional token for canceling the call. + /// The call object. + public virtual grpc::AsyncDuplexStreamingCall Serve(grpc::Metadata headers = null, global::System.DateTime? deadline = null, global::System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken)) + { + return Serve(new grpc::CallOptions(headers, deadline, cancellationToken)); + } + /// + /// Serve a route on an API + /// + /// The options for the call. + /// The call object. + public virtual grpc::AsyncDuplexStreamingCall Serve(grpc::CallOptions options) + { + return CallInvoker.AsyncDuplexStreamingCall(__Method_Serve, null, options); + } + /// + /// Retrieve details about an API + /// + /// The request to send to the server. + /// The initial metadata to send with the call. This parameter is optional. + /// An optional deadline for the call. The call will be cancelled if deadline is hit. + /// An optional token for canceling the call. + /// The response received from the server. + public virtual global::Nitric.Proto.Apis.v1.ApiDetailsResponse Details(global::Nitric.Proto.Apis.v1.ApiDetailsRequest request, grpc::Metadata headers = null, global::System.DateTime? deadline = null, global::System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken)) + { + return Details(request, new grpc::CallOptions(headers, deadline, cancellationToken)); + } + /// + /// Retrieve details about an API + /// + /// The request to send to the server. + /// The options for the call. + /// The response received from the server. + public virtual global::Nitric.Proto.Apis.v1.ApiDetailsResponse Details(global::Nitric.Proto.Apis.v1.ApiDetailsRequest request, grpc::CallOptions options) + { + return CallInvoker.BlockingUnaryCall(__Method_Details, null, options, request); + } + /// + /// Retrieve details about an API + /// + /// The request to send to the server. + /// The initial metadata to send with the call. This parameter is optional. + /// An optional deadline for the call. The call will be cancelled if deadline is hit. + /// An optional token for canceling the call. + /// The call object. + public virtual grpc::AsyncUnaryCall DetailsAsync(global::Nitric.Proto.Apis.v1.ApiDetailsRequest request, grpc::Metadata headers = null, global::System.DateTime? deadline = null, global::System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken)) + { + return DetailsAsync(request, new grpc::CallOptions(headers, deadline, cancellationToken)); + } + /// + /// Retrieve details about an API + /// + /// The request to send to the server. + /// The options for the call. + /// The call object. + public virtual grpc::AsyncUnaryCall DetailsAsync(global::Nitric.Proto.Apis.v1.ApiDetailsRequest request, grpc::CallOptions options) + { + return CallInvoker.AsyncUnaryCall(__Method_Details, null, options, request); + } + /// Creates a new instance of client from given ClientBaseConfiguration. + protected override ApiClient NewInstance(ClientBaseConfiguration configuration) + { + return new ApiClient(configuration); + } + } + + /// Creates service definition that can be registered with a server + /// An object implementing the server-side handling logic. + public static grpc::ServerServiceDefinition BindService(ApiBase serviceImpl) + { + return grpc::ServerServiceDefinition.CreateBuilder() + .AddMethod(__Method_Serve, serviceImpl.Serve) + .AddMethod(__Method_Details, serviceImpl.Details).Build(); + } + + /// Register service method with a service binder with or without implementation. Useful when customizing the service binding logic. + /// Note: this method is part of an experimental API that can change or be removed without any prior notice. + /// Service methods will be bound by calling AddMethod on this object. + /// An object implementing the server-side handling logic. + public static void BindService(grpc::ServiceBinderBase serviceBinder, ApiBase serviceImpl) + { + serviceBinder.AddMethod(__Method_Serve, serviceImpl == null ? null : new grpc::DuplexStreamingServerMethod(serviceImpl.Serve)); + serviceBinder.AddMethod(__Method_Details, serviceImpl == null ? null : new grpc::UnaryServerMethod(serviceImpl.Details)); + } + + } +} +#endregion diff --git a/src/Nitric.Sdk/Proto/proto/deploy/v1/Deploy.cs b/src/Nitric.Sdk/Proto/nitric/proto/deployments/v1/Deployments.cs similarity index 72% rename from src/Nitric.Sdk/Proto/proto/deploy/v1/Deploy.cs rename to src/Nitric.Sdk/Proto/nitric/proto/deployments/v1/Deployments.cs index 38cccd7..115a28b 100644 --- a/src/Nitric.Sdk/Proto/proto/deploy/v1/Deploy.cs +++ b/src/Nitric.Sdk/Proto/nitric/proto/deployments/v1/Deployments.cs @@ -1,6 +1,6 @@ // // Generated by the protocol buffer compiler. DO NOT EDIT! -// source: proto/deploy/v1/deploy.proto +// source: nitric/proto/deployments/v1/deployments.proto // #pragma warning disable 1591, 0612, 3021 #region Designer generated code @@ -9,142 +9,208 @@ using pbc = global::Google.Protobuf.Collections; using pbr = global::Google.Protobuf.Reflection; using scg = global::System.Collections.Generic; -namespace Nitric.Proto.Deploy.v1 { +namespace Nitric.Proto.Deployments.v1 { - /// Holder for reflection information generated from proto/deploy/v1/deploy.proto - public static partial class DeployReflection { + /// Holder for reflection information generated from nitric/proto/deployments/v1/deployments.proto + public static partial class DeploymentsReflection { #region Descriptor - /// File descriptor for proto/deploy/v1/deploy.proto + /// File descriptor for nitric/proto/deployments/v1/deployments.proto public static pbr::FileDescriptor Descriptor { get { return descriptor; } } private static pbr::FileDescriptor descriptor; - static DeployReflection() { + static DeploymentsReflection() { byte[] descriptorData = global::System.Convert.FromBase64String( string.Concat( - "Chxwcm90by9kZXBsb3kvdjEvZGVwbG95LnByb3RvEhBuaXRyaWMuZGVwbG95", - "LnYxGhxnb29nbGUvcHJvdG9idWYvc3RydWN0LnByb3RvGiBwcm90by9yZXNv", - "dXJjZS92MS9yZXNvdXJjZS5wcm90bxoYcHJvdG8vZmFhcy92MS9mYWFzLnBy", - "b3RvImQKD0RlcGxveVVwUmVxdWVzdBIkCgRzcGVjGAEgASgLMhYubml0cmlj", - "LmRlcGxveS52MS5TcGVjEisKCmF0dHJpYnV0ZXMYAiABKAsyFy5nb29nbGUu", - "cHJvdG9idWYuU3RydWN0IowBCg1EZXBsb3lVcEV2ZW50EjcKB21lc3NhZ2UY", - "ASABKAsyJC5uaXRyaWMuZGVwbG95LnYxLkRlcGxveUV2ZW50TWVzc2FnZUgA", - "EjcKBnJlc3VsdBgCIAEoCzIlLm5pdHJpYy5kZXBsb3kudjEuRGVwbG95VXBF", - "dmVudFJlc3VsdEgAQgkKB2NvbnRlbnQiJQoSRGVwbG95RXZlbnRNZXNzYWdl", - "Eg8KB21lc3NhZ2UYASABKAkiLgoIVXBSZXN1bHQSFwoNc3RyaW5nX3Jlc3Vs", - "dBgBIAEoCUgAQgkKB2NvbnRlbnQiUgoTRGVwbG95VXBFdmVudFJlc3VsdBIP", - "CgdzdWNjZXNzGAEgASgIEioKBnJlc3VsdBgCIAEoCzIaLm5pdHJpYy5kZXBs", - "b3kudjEuVXBSZXN1bHQiQAoRRGVwbG95RG93blJlcXVlc3QSKwoKYXR0cmli", - "dXRlcxgBIAEoCzIXLmdvb2dsZS5wcm90b2J1Zi5TdHJ1Y3QikAEKD0RlcGxv", - "eURvd25FdmVudBI3CgdtZXNzYWdlGAEgASgLMiQubml0cmljLmRlcGxveS52", - "MS5EZXBsb3lFdmVudE1lc3NhZ2VIABI5CgZyZXN1bHQYAiABKAsyJy5uaXRy", - "aWMuZGVwbG95LnYxLkRlcGxveURvd25FdmVudFJlc3VsdEgAQgkKB2NvbnRl", - "bnQiFwoVRGVwbG95RG93bkV2ZW50UmVzdWx0IhoKC0ltYWdlU291cmNlEgsK", - "A3VyaRgBIAEoCSL0AQoNRXhlY3V0aW9uVW5pdBIuCgVpbWFnZRgBIAEoCzId", - "Lm5pdHJpYy5kZXBsb3kudjEuSW1hZ2VTb3VyY2VIABIPCgd3b3JrZXJzGAog", - "ASgFEhMKB3RpbWVvdXQYCyABKAVCAhgBEhIKBm1lbW9yeRgMIAEoBUICGAES", - "DAoEdHlwZRgNIAEoCRI1CgNlbnYYDiADKAsyKC5uaXRyaWMuZGVwbG95LnYx", - "LkV4ZWN1dGlvblVuaXQuRW52RW50cnkaKgoIRW52RW50cnkSCwoDa2V5GAEg", - "ASgJEg0KBXZhbHVlGAIgASgJOgI4AUIICgZzb3VyY2UiSwoGQnVja2V0EkEK", - "DW5vdGlmaWNhdGlvbnMYASADKAsyKi5uaXRyaWMuZGVwbG95LnYxLkJ1Y2tl", - "dE5vdGlmaWNhdGlvblRhcmdldCJ4ChhCdWNrZXROb3RpZmljYXRpb25UYXJn", - "ZXQSOAoGY29uZmlnGAEgASgLMigubml0cmljLmZhYXMudjEuQnVja2V0Tm90", - "aWZpY2F0aW9uQ29uZmlnEhgKDmV4ZWN1dGlvbl91bml0GAIgASgJSABCCAoG", - "dGFyZ2V0IkQKBVRvcGljEjsKDXN1YnNjcmlwdGlvbnMYASADKAsyJC5uaXRy", - "aWMuZGVwbG95LnYxLlN1YnNjcmlwdGlvblRhcmdldCIHCgVRdWV1ZSIMCgpD", - "b2xsZWN0aW9uIggKBlNlY3JldCI4ChJTdWJzY3JpcHRpb25UYXJnZXQSGAoO", - "ZXhlY3V0aW9uX3VuaXQYASABKAlIAEIICgZ0YXJnZXQiSQoRVG9waWNTdWJz", - "Y3JpcHRpb24SNAoGdGFyZ2V0GAEgASgLMiQubml0cmljLmRlcGxveS52MS5T", - "dWJzY3JpcHRpb25UYXJnZXQiMAoKSHR0cFRhcmdldBIYCg5leGVjdXRpb25f", - "dW5pdBgBIAEoCUgAQggKBnRhcmdldCI0CgRIdHRwEiwKBnRhcmdldBgBIAEo", - "CzIcLm5pdHJpYy5kZXBsb3kudjEuSHR0cFRhcmdldCIkCgNBcGkSEQoHb3Bl", - "bmFwaRgBIAEoCUgAQgoKCGRvY3VtZW50Ir8BCglXZWJzb2NrZXQSOQoOY29u", - "bmVjdF90YXJnZXQYASABKAsyIS5uaXRyaWMuZGVwbG95LnYxLldlYnNvY2tl", - "dFRhcmdldBI8ChFkaXNjb25uZWN0X3RhcmdldBgCIAEoCzIhLm5pdHJpYy5k", - "ZXBsb3kudjEuV2Vic29ja2V0VGFyZ2V0EjkKDm1lc3NhZ2VfdGFyZ2V0GAMg", - "ASgLMiEubml0cmljLmRlcGxveS52MS5XZWJzb2NrZXRUYXJnZXQiNQoPV2Vi", - "c29ja2V0VGFyZ2V0EhgKDmV4ZWN1dGlvbl91bml0GAEgASgJSABCCAoGdGFy", - "Z2V0IjQKDlNjaGVkdWxlVGFyZ2V0EhgKDmV4ZWN1dGlvbl91bml0GAEgASgJ", - "SABCCAoGdGFyZ2V0IkoKCFNjaGVkdWxlEgwKBGNyb24YASABKAkSMAoGdGFy", - "Z2V0GAIgASgLMiAubml0cmljLmRlcGxveS52MS5TY2hlZHVsZVRhcmdldCLJ", - "BAoIUmVzb3VyY2USDAoEbmFtZRgBIAEoCRIuCgR0eXBlGAIgASgOMiAubml0", - "cmljLnJlc291cmNlLnYxLlJlc291cmNlVHlwZRI5Cg5leGVjdXRpb25fdW5p", - "dBgKIAEoCzIfLm5pdHJpYy5kZXBsb3kudjEuRXhlY3V0aW9uVW5pdEgAEioK", - "BmJ1Y2tldBgLIAEoCzIYLm5pdHJpYy5kZXBsb3kudjEuQnVja2V0SAASKAoF", - "dG9waWMYDCABKAsyFy5uaXRyaWMuZGVwbG95LnYxLlRvcGljSAASKAoFcXVl", - "dWUYDSABKAsyFy5uaXRyaWMuZGVwbG95LnYxLlF1ZXVlSAASJAoDYXBpGA4g", - "ASgLMhUubml0cmljLmRlcGxveS52MS5BcGlIABIqCgZwb2xpY3kYDyABKAsy", - "GC5uaXRyaWMuZGVwbG95LnYxLlBvbGljeUgAEi4KCHNjaGVkdWxlGBAgASgL", - "Mhoubml0cmljLmRlcGxveS52MS5TY2hlZHVsZUgAEjIKCmNvbGxlY3Rpb24Y", - "ESABKAsyHC5uaXRyaWMuZGVwbG95LnYxLkNvbGxlY3Rpb25IABIqCgZzZWNy", - "ZXQYEiABKAsyGC5uaXRyaWMuZGVwbG95LnYxLlNlY3JldEgAEjAKCXdlYnNv", - "Y2tldBgTIAEoCzIbLm5pdHJpYy5kZXBsb3kudjEuV2Vic29ja2V0SAASJgoE", - "aHR0cBgUIAEoCzIWLm5pdHJpYy5kZXBsb3kudjEuSHR0cEgAQggKBmNvbmZp", - "ZyKUAQoGUG9saWN5Ei4KCnByaW5jaXBhbHMYASADKAsyGi5uaXRyaWMuZGVw", - "bG95LnYxLlJlc291cmNlEisKB2FjdGlvbnMYAiADKA4yGi5uaXRyaWMucmVz", - "b3VyY2UudjEuQWN0aW9uEi0KCXJlc291cmNlcxgDIAMoCzIaLm5pdHJpYy5k", - "ZXBsb3kudjEuUmVzb3VyY2UiNQoEU3BlYxItCglyZXNvdXJjZXMYASADKAsy", - "Gi5uaXRyaWMuZGVwbG95LnYxLlJlc291cmNlMq0BCg1EZXBsb3lTZXJ2aWNl", - "EkoKAlVwEiEubml0cmljLmRlcGxveS52MS5EZXBsb3lVcFJlcXVlc3QaHy5u", - "aXRyaWMuZGVwbG95LnYxLkRlcGxveVVwRXZlbnQwARJQCgREb3duEiMubml0", - "cmljLmRlcGxveS52MS5EZXBsb3lEb3duUmVxdWVzdBohLm5pdHJpYy5kZXBs", - "b3kudjEuRGVwbG95RG93bkV2ZW50MAFClAEKGWlvLm5pdHJpYy5wcm90by5k", - "ZXBsb3kudjFCB0RlcGxveXNQAVo6Z2l0aHViLmNvbS9uaXRyaWN0ZWNoL25p", - "dHJpYy9jb3JlL3BrZy9hcGkvbml0cmljL2RlcGxveS92MaoCFk5pdHJpYy5Q", - "cm90by5EZXBsb3kudjHKAhZOaXRyaWNcUHJvdG9cRGVwbG95XFYxYgZwcm90", - "bzM=")); + "Ci1uaXRyaWMvcHJvdG8vZGVwbG95bWVudHMvdjEvZGVwbG95bWVudHMucHJv", + "dG8SG25pdHJpYy5wcm90by5kZXBsb3ltZW50cy52MRocZ29vZ2xlL3Byb3Rv", + "YnVmL3N0cnVjdC5wcm90bxopbml0cmljL3Byb3RvL3Jlc291cmNlcy92MS9y", + "ZXNvdXJjZXMucHJvdG8aJW5pdHJpYy9wcm90by9zdG9yYWdlL3YxL3N0b3Jh", + "Z2UucHJvdG8iiAEKE0RlcGxveW1lbnRVcFJlcXVlc3QSLwoEc3BlYxgBIAEo", + "CzIhLm5pdHJpYy5wcm90by5kZXBsb3ltZW50cy52MS5TcGVjEisKCmF0dHJp", + "YnV0ZXMYAiABKAsyFy5nb29nbGUucHJvdG9idWYuU3RydWN0EhMKC2ludGVy", + "YWN0aXZlGAMgASgIIqkBChFEZXBsb3ltZW50VXBFdmVudBIRCgdtZXNzYWdl", + "GAEgASgJSAASPQoGdXBkYXRlGAIgASgLMisubml0cmljLnByb3RvLmRlcGxv", + "eW1lbnRzLnYxLlJlc291cmNlVXBkYXRlSAASNwoGcmVzdWx0GAMgASgLMiUu", + "bml0cmljLnByb3RvLmRlcGxveW1lbnRzLnYxLlVwUmVzdWx0SABCCQoHY29u", + "dGVudCKAAgoOUmVzb3VyY2VVcGRhdGUSOQoCaWQYASABKAsyLS5uaXRyaWMu", + "cHJvdG8ucmVzb3VyY2VzLnYxLlJlc291cmNlSWRlbnRpZmllchJFCgZhY3Rp", + "b24YAyABKA4yNS5uaXRyaWMucHJvdG8uZGVwbG95bWVudHMudjEuUmVzb3Vy", + "Y2VEZXBsb3ltZW50QWN0aW9uEkUKBnN0YXR1cxgEIAEoDjI1Lm5pdHJpYy5w", + "cm90by5kZXBsb3ltZW50cy52MS5SZXNvdXJjZURlcGxveW1lbnRTdGF0dXMS", + "FAoMc3ViX3Jlc291cmNlGAUgASgJEg8KB21lc3NhZ2UYBiABKAkiLAoIVXBS", + "ZXN1bHQSDwoHc3VjY2VzcxgBIAEoCBIPCgdkZXRhaWxzGAIgASgJIlkKFURl", + "cGxveW1lbnREb3duUmVxdWVzdBIrCgphdHRyaWJ1dGVzGAEgASgLMhcuZ29v", + "Z2xlLnByb3RvYnVmLlN0cnVjdBITCgtpbnRlcmFjdGl2ZRgCIAEoCCKtAQoT", + "RGVwbG95bWVudERvd25FdmVudBIRCgdtZXNzYWdlGAEgASgJSAASOQoGcmVz", + "dWx0GAIgASgLMicubml0cmljLnByb3RvLmRlcGxveW1lbnRzLnYxLkRvd25S", + "ZXN1bHRIABI9CgZ1cGRhdGUYAyABKAsyKy5uaXRyaWMucHJvdG8uZGVwbG95", + "bWVudHMudjEuUmVzb3VyY2VVcGRhdGVIAEIJCgdjb250ZW50IgwKCkRvd25S", + "ZXN1bHQiGgoLSW1hZ2VTb3VyY2USCwoDdXJpGAEgASgJIv4BCgdTZXJ2aWNl", + "EjkKBWltYWdlGAEgASgLMigubml0cmljLnByb3RvLmRlcGxveW1lbnRzLnYx", + "LkltYWdlU291cmNlSAASDwoHd29ya2VycxgKIAEoBRITCgd0aW1lb3V0GAsg", + "ASgFQgIYARISCgZtZW1vcnkYDCABKAVCAhgBEgwKBHR5cGUYDSABKAkSOgoD", + "ZW52GA4gAygLMi0ubml0cmljLnByb3RvLmRlcGxveW1lbnRzLnYxLlNlcnZp", + "Y2UuRW52RW50cnkaKgoIRW52RW50cnkSCwoDa2V5GAEgASgJEg0KBXZhbHVl", + "GAIgASgJOgI4AUIICgZzb3VyY2UiSAoGQnVja2V0Ej4KCWxpc3RlbmVycxgB", + "IAMoCzIrLm5pdHJpYy5wcm90by5kZXBsb3ltZW50cy52MS5CdWNrZXRMaXN0", + "ZW5lciJrCg5CdWNrZXRMaXN0ZW5lchI8CgZjb25maWcYASABKAsyLC5uaXRy", + "aWMucHJvdG8uc3RvcmFnZS52MS5SZWdpc3RyYXRpb25SZXF1ZXN0EhEKB3Nl", + "cnZpY2UYAiABKAlIAEIICgZ0YXJnZXQiTwoFVG9waWMSRgoNc3Vic2NyaXB0", + "aW9ucxgBIAMoCzIvLm5pdHJpYy5wcm90by5kZXBsb3ltZW50cy52MS5TdWJz", + "Y3JpcHRpb25UYXJnZXQiBwoFUXVldWUiDwoNS2V5VmFsdWVTdG9yZSIICgZT", + "ZWNyZXQiMQoSU3Vic2NyaXB0aW9uVGFyZ2V0EhEKB3NlcnZpY2UYASABKAlI", + "AEIICgZ0YXJnZXQiVAoRVG9waWNTdWJzY3JpcHRpb24SPwoGdGFyZ2V0GAEg", + "ASgLMi8ubml0cmljLnByb3RvLmRlcGxveW1lbnRzLnYxLlN1YnNjcmlwdGlv", + "blRhcmdldCIpCgpIdHRwVGFyZ2V0EhEKB3NlcnZpY2UYASABKAlIAEIICgZ0", + "YXJnZXQiPwoESHR0cBI3CgZ0YXJnZXQYASABKAsyJy5uaXRyaWMucHJvdG8u", + "ZGVwbG95bWVudHMudjEuSHR0cFRhcmdldCIkCgNBcGkSEQoHb3BlbmFwaRgB", + "IAEoCUgAQgoKCGRvY3VtZW50IuABCglXZWJzb2NrZXQSRAoOY29ubmVjdF90", + "YXJnZXQYASABKAsyLC5uaXRyaWMucHJvdG8uZGVwbG95bWVudHMudjEuV2Vi", + "c29ja2V0VGFyZ2V0EkcKEWRpc2Nvbm5lY3RfdGFyZ2V0GAIgASgLMiwubml0", + "cmljLnByb3RvLmRlcGxveW1lbnRzLnYxLldlYnNvY2tldFRhcmdldBJECg5t", + "ZXNzYWdlX3RhcmdldBgDIAEoCzIsLm5pdHJpYy5wcm90by5kZXBsb3ltZW50", + "cy52MS5XZWJzb2NrZXRUYXJnZXQiLgoPV2Vic29ja2V0VGFyZ2V0EhEKB3Nl", + "cnZpY2UYASABKAlIAEIICgZ0YXJnZXQiLQoOU2NoZWR1bGVUYXJnZXQSEQoH", + "c2VydmljZRgBIAEoCUgAQggKBnRhcmdldCLKAQoIU2NoZWR1bGUSOwoGdGFy", + "Z2V0GAEgASgLMisubml0cmljLnByb3RvLmRlcGxveW1lbnRzLnYxLlNjaGVk", + "dWxlVGFyZ2V0EjsKBWV2ZXJ5GAogASgLMioubml0cmljLnByb3RvLmRlcGxv", + "eW1lbnRzLnYxLlNjaGVkdWxlRXZlcnlIABI5CgRjcm9uGAsgASgLMikubml0", + "cmljLnByb3RvLmRlcGxveW1lbnRzLnYxLlNjaGVkdWxlQ3JvbkgAQgkKB2Nh", + "ZGVuY2UiHQoNU2NoZWR1bGVFdmVyeRIMCgRyYXRlGAEgASgJIiIKDFNjaGVk", + "dWxlQ3JvbhISCgpleHByZXNzaW9uGAEgASgJIroFCghSZXNvdXJjZRI5CgJp", + "ZBgBIAEoCzItLm5pdHJpYy5wcm90by5yZXNvdXJjZXMudjEuUmVzb3VyY2VJ", + "ZGVudGlmaWVyEjcKB3NlcnZpY2UYCiABKAsyJC5uaXRyaWMucHJvdG8uZGVw", + "bG95bWVudHMudjEuU2VydmljZUgAEjUKBmJ1Y2tldBgLIAEoCzIjLm5pdHJp", + "Yy5wcm90by5kZXBsb3ltZW50cy52MS5CdWNrZXRIABIzCgV0b3BpYxgMIAEo", + "CzIiLm5pdHJpYy5wcm90by5kZXBsb3ltZW50cy52MS5Ub3BpY0gAEi8KA2Fw", + "aRgNIAEoCzIgLm5pdHJpYy5wcm90by5kZXBsb3ltZW50cy52MS5BcGlIABI1", + "CgZwb2xpY3kYDiABKAsyIy5uaXRyaWMucHJvdG8uZGVwbG95bWVudHMudjEu", + "UG9saWN5SAASOQoIc2NoZWR1bGUYDyABKAsyJS5uaXRyaWMucHJvdG8uZGVw", + "bG95bWVudHMudjEuU2NoZWR1bGVIABJFCg9rZXlfdmFsdWVfc3RvcmUYECAB", + "KAsyKi5uaXRyaWMucHJvdG8uZGVwbG95bWVudHMudjEuS2V5VmFsdWVTdG9y", + "ZUgAEjUKBnNlY3JldBgRIAEoCzIjLm5pdHJpYy5wcm90by5kZXBsb3ltZW50", + "cy52MS5TZWNyZXRIABI7Cgl3ZWJzb2NrZXQYEiABKAsyJi5uaXRyaWMucHJv", + "dG8uZGVwbG95bWVudHMudjEuV2Vic29ja2V0SAASMQoEaHR0cBgTIAEoCzIh", + "Lm5pdHJpYy5wcm90by5kZXBsb3ltZW50cy52MS5IdHRwSAASMwoFcXVldWUY", + "FCABKAsyIi5uaXRyaWMucHJvdG8uZGVwbG95bWVudHMudjEuUXVldWVIAEII", + "CgZjb25maWcisQEKBlBvbGljeRI5CgpwcmluY2lwYWxzGAEgAygLMiUubml0", + "cmljLnByb3RvLmRlcGxveW1lbnRzLnYxLlJlc291cmNlEjIKB2FjdGlvbnMY", + "AiADKA4yIS5uaXRyaWMucHJvdG8ucmVzb3VyY2VzLnYxLkFjdGlvbhI4Cgly", + "ZXNvdXJjZXMYAyADKAsyJS5uaXRyaWMucHJvdG8uZGVwbG95bWVudHMudjEu", + "UmVzb3VyY2UiQAoEU3BlYxI4CglyZXNvdXJjZXMYASADKAsyJS5uaXRyaWMu", + "cHJvdG8uZGVwbG95bWVudHMudjEuUmVzb3VyY2UqVQoYUmVzb3VyY2VEZXBs", + "b3ltZW50QWN0aW9uEgoKBkNSRUFURRAAEgoKBlVQREFURRABEgsKB1JFUExB", + "Q0UQAhIICgRTQU1FEAMSCgoGREVMRVRFEAQqUQoYUmVzb3VyY2VEZXBsb3lt", + "ZW50U3RhdHVzEgsKB1BFTkRJTkcQABIPCgtJTl9QUk9HUkVTUxABEgsKB1NV", + "Q0NFU1MQAhIKCgZGQUlMRUQQAzLmAQoKRGVwbG95bWVudBJoCgJVcBIwLm5p", + "dHJpYy5wcm90by5kZXBsb3ltZW50cy52MS5EZXBsb3ltZW50VXBSZXF1ZXN0", + "Gi4ubml0cmljLnByb3RvLmRlcGxveW1lbnRzLnYxLkRlcGxveW1lbnRVcEV2", + "ZW50MAESbgoERG93bhIyLm5pdHJpYy5wcm90by5kZXBsb3ltZW50cy52MS5E", + "ZXBsb3ltZW50RG93blJlcXVlc3QaMC5uaXRyaWMucHJvdG8uZGVwbG95bWVu", + "dHMudjEuRGVwbG95bWVudERvd25FdmVudDABQrUBCh5pby5uaXRyaWMucHJv", + "dG8uZGVwbG95bWVudHMudjFCC0RlcGxveW1lbnRzUAFaSGdpdGh1Yi5jb20v", + "bml0cmljdGVjaC9uaXRyaWMvY29yZS9wa2cvcHJvdG8vZGVwbG95bWVudHMv", + "djE7ZGVwbG95bWVudHNwYqoCG05pdHJpYy5Qcm90by5EZXBsb3ltZW50cy52", + "McoCG05pdHJpY1xQcm90b1xEZXBsb3ltZW50c1xWMWIGcHJvdG8z")); descriptor = pbr::FileDescriptor.FromGeneratedCode(descriptorData, - new pbr::FileDescriptor[] { global::Google.Protobuf.WellKnownTypes.StructReflection.Descriptor, global::Nitric.Proto.Resource.v1.ResourceReflection.Descriptor, global::Nitric.Proto.Faas.v1.FaasReflection.Descriptor, }, - new pbr::GeneratedClrTypeInfo(null, null, new pbr::GeneratedClrTypeInfo[] { - new pbr::GeneratedClrTypeInfo(typeof(global::Nitric.Proto.Deploy.v1.DeployUpRequest), global::Nitric.Proto.Deploy.v1.DeployUpRequest.Parser, new[]{ "Spec", "Attributes" }, null, null, null, null), - new pbr::GeneratedClrTypeInfo(typeof(global::Nitric.Proto.Deploy.v1.DeployUpEvent), global::Nitric.Proto.Deploy.v1.DeployUpEvent.Parser, new[]{ "Message", "Result" }, new[]{ "Content" }, null, null, null), - new pbr::GeneratedClrTypeInfo(typeof(global::Nitric.Proto.Deploy.v1.DeployEventMessage), global::Nitric.Proto.Deploy.v1.DeployEventMessage.Parser, new[]{ "Message" }, null, null, null, null), - new pbr::GeneratedClrTypeInfo(typeof(global::Nitric.Proto.Deploy.v1.UpResult), global::Nitric.Proto.Deploy.v1.UpResult.Parser, new[]{ "StringResult" }, new[]{ "Content" }, null, null, null), - new pbr::GeneratedClrTypeInfo(typeof(global::Nitric.Proto.Deploy.v1.DeployUpEventResult), global::Nitric.Proto.Deploy.v1.DeployUpEventResult.Parser, new[]{ "Success", "Result" }, null, null, null, null), - new pbr::GeneratedClrTypeInfo(typeof(global::Nitric.Proto.Deploy.v1.DeployDownRequest), global::Nitric.Proto.Deploy.v1.DeployDownRequest.Parser, new[]{ "Attributes" }, null, null, null, null), - new pbr::GeneratedClrTypeInfo(typeof(global::Nitric.Proto.Deploy.v1.DeployDownEvent), global::Nitric.Proto.Deploy.v1.DeployDownEvent.Parser, new[]{ "Message", "Result" }, new[]{ "Content" }, null, null, null), - new pbr::GeneratedClrTypeInfo(typeof(global::Nitric.Proto.Deploy.v1.DeployDownEventResult), global::Nitric.Proto.Deploy.v1.DeployDownEventResult.Parser, null, null, null, null, null), - new pbr::GeneratedClrTypeInfo(typeof(global::Nitric.Proto.Deploy.v1.ImageSource), global::Nitric.Proto.Deploy.v1.ImageSource.Parser, new[]{ "Uri" }, null, null, null, null), - new pbr::GeneratedClrTypeInfo(typeof(global::Nitric.Proto.Deploy.v1.ExecutionUnit), global::Nitric.Proto.Deploy.v1.ExecutionUnit.Parser, new[]{ "Image", "Workers", "Timeout", "Memory", "Type", "Env" }, new[]{ "Source" }, null, null, new pbr::GeneratedClrTypeInfo[] { null, }), - new pbr::GeneratedClrTypeInfo(typeof(global::Nitric.Proto.Deploy.v1.Bucket), global::Nitric.Proto.Deploy.v1.Bucket.Parser, new[]{ "Notifications" }, null, null, null, null), - new pbr::GeneratedClrTypeInfo(typeof(global::Nitric.Proto.Deploy.v1.BucketNotificationTarget), global::Nitric.Proto.Deploy.v1.BucketNotificationTarget.Parser, new[]{ "Config", "ExecutionUnit" }, new[]{ "Target" }, null, null, null), - new pbr::GeneratedClrTypeInfo(typeof(global::Nitric.Proto.Deploy.v1.Topic), global::Nitric.Proto.Deploy.v1.Topic.Parser, new[]{ "Subscriptions" }, null, null, null, null), - new pbr::GeneratedClrTypeInfo(typeof(global::Nitric.Proto.Deploy.v1.Queue), global::Nitric.Proto.Deploy.v1.Queue.Parser, null, null, null, null, null), - new pbr::GeneratedClrTypeInfo(typeof(global::Nitric.Proto.Deploy.v1.Collection), global::Nitric.Proto.Deploy.v1.Collection.Parser, null, null, null, null, null), - new pbr::GeneratedClrTypeInfo(typeof(global::Nitric.Proto.Deploy.v1.Secret), global::Nitric.Proto.Deploy.v1.Secret.Parser, null, null, null, null, null), - new pbr::GeneratedClrTypeInfo(typeof(global::Nitric.Proto.Deploy.v1.SubscriptionTarget), global::Nitric.Proto.Deploy.v1.SubscriptionTarget.Parser, new[]{ "ExecutionUnit" }, new[]{ "Target" }, null, null, null), - new pbr::GeneratedClrTypeInfo(typeof(global::Nitric.Proto.Deploy.v1.TopicSubscription), global::Nitric.Proto.Deploy.v1.TopicSubscription.Parser, new[]{ "Target" }, null, null, null, null), - new pbr::GeneratedClrTypeInfo(typeof(global::Nitric.Proto.Deploy.v1.HttpTarget), global::Nitric.Proto.Deploy.v1.HttpTarget.Parser, new[]{ "ExecutionUnit" }, new[]{ "Target" }, null, null, null), - new pbr::GeneratedClrTypeInfo(typeof(global::Nitric.Proto.Deploy.v1.Http), global::Nitric.Proto.Deploy.v1.Http.Parser, new[]{ "Target" }, null, null, null, null), - new pbr::GeneratedClrTypeInfo(typeof(global::Nitric.Proto.Deploy.v1.Api), global::Nitric.Proto.Deploy.v1.Api.Parser, new[]{ "Openapi" }, new[]{ "Document" }, null, null, null), - new pbr::GeneratedClrTypeInfo(typeof(global::Nitric.Proto.Deploy.v1.Websocket), global::Nitric.Proto.Deploy.v1.Websocket.Parser, new[]{ "ConnectTarget", "DisconnectTarget", "MessageTarget" }, null, null, null, null), - new pbr::GeneratedClrTypeInfo(typeof(global::Nitric.Proto.Deploy.v1.WebsocketTarget), global::Nitric.Proto.Deploy.v1.WebsocketTarget.Parser, new[]{ "ExecutionUnit" }, new[]{ "Target" }, null, null, null), - new pbr::GeneratedClrTypeInfo(typeof(global::Nitric.Proto.Deploy.v1.ScheduleTarget), global::Nitric.Proto.Deploy.v1.ScheduleTarget.Parser, new[]{ "ExecutionUnit" }, new[]{ "Target" }, null, null, null), - new pbr::GeneratedClrTypeInfo(typeof(global::Nitric.Proto.Deploy.v1.Schedule), global::Nitric.Proto.Deploy.v1.Schedule.Parser, new[]{ "Cron", "Target" }, null, null, null, null), - new pbr::GeneratedClrTypeInfo(typeof(global::Nitric.Proto.Deploy.v1.Resource), global::Nitric.Proto.Deploy.v1.Resource.Parser, new[]{ "Name", "Type", "ExecutionUnit", "Bucket", "Topic", "Queue", "Api", "Policy", "Schedule", "Collection", "Secret", "Websocket", "Http" }, new[]{ "Config" }, null, null, null), - new pbr::GeneratedClrTypeInfo(typeof(global::Nitric.Proto.Deploy.v1.Policy), global::Nitric.Proto.Deploy.v1.Policy.Parser, new[]{ "Principals", "Actions", "Resources" }, null, null, null, null), - new pbr::GeneratedClrTypeInfo(typeof(global::Nitric.Proto.Deploy.v1.Spec), global::Nitric.Proto.Deploy.v1.Spec.Parser, new[]{ "Resources" }, null, null, null, null) + new pbr::FileDescriptor[] { global::Google.Protobuf.WellKnownTypes.StructReflection.Descriptor, global::Nitric.Proto.Resources.v1.ResourcesReflection.Descriptor, global::Nitric.Proto.Storage.v1.StorageReflection.Descriptor, }, + new pbr::GeneratedClrTypeInfo(new[] {typeof(global::Nitric.Proto.Deployments.v1.ResourceDeploymentAction), typeof(global::Nitric.Proto.Deployments.v1.ResourceDeploymentStatus), }, null, new pbr::GeneratedClrTypeInfo[] { + new pbr::GeneratedClrTypeInfo(typeof(global::Nitric.Proto.Deployments.v1.DeploymentUpRequest), global::Nitric.Proto.Deployments.v1.DeploymentUpRequest.Parser, new[]{ "Spec", "Attributes", "Interactive" }, null, null, null, null), + new pbr::GeneratedClrTypeInfo(typeof(global::Nitric.Proto.Deployments.v1.DeploymentUpEvent), global::Nitric.Proto.Deployments.v1.DeploymentUpEvent.Parser, new[]{ "Message", "Update", "Result" }, new[]{ "Content" }, null, null, null), + new pbr::GeneratedClrTypeInfo(typeof(global::Nitric.Proto.Deployments.v1.ResourceUpdate), global::Nitric.Proto.Deployments.v1.ResourceUpdate.Parser, new[]{ "Id", "Action", "Status", "SubResource", "Message" }, null, null, null, null), + new pbr::GeneratedClrTypeInfo(typeof(global::Nitric.Proto.Deployments.v1.UpResult), global::Nitric.Proto.Deployments.v1.UpResult.Parser, new[]{ "Success", "Details" }, null, null, null, null), + new pbr::GeneratedClrTypeInfo(typeof(global::Nitric.Proto.Deployments.v1.DeploymentDownRequest), global::Nitric.Proto.Deployments.v1.DeploymentDownRequest.Parser, new[]{ "Attributes", "Interactive" }, null, null, null, null), + new pbr::GeneratedClrTypeInfo(typeof(global::Nitric.Proto.Deployments.v1.DeploymentDownEvent), global::Nitric.Proto.Deployments.v1.DeploymentDownEvent.Parser, new[]{ "Message", "Result", "Update" }, new[]{ "Content" }, null, null, null), + new pbr::GeneratedClrTypeInfo(typeof(global::Nitric.Proto.Deployments.v1.DownResult), global::Nitric.Proto.Deployments.v1.DownResult.Parser, null, null, null, null, null), + new pbr::GeneratedClrTypeInfo(typeof(global::Nitric.Proto.Deployments.v1.ImageSource), global::Nitric.Proto.Deployments.v1.ImageSource.Parser, new[]{ "Uri" }, null, null, null, null), + new pbr::GeneratedClrTypeInfo(typeof(global::Nitric.Proto.Deployments.v1.Service), global::Nitric.Proto.Deployments.v1.Service.Parser, new[]{ "Image", "Workers", "Timeout", "Memory", "Type", "Env" }, new[]{ "Source" }, null, null, new pbr::GeneratedClrTypeInfo[] { null, }), + new pbr::GeneratedClrTypeInfo(typeof(global::Nitric.Proto.Deployments.v1.Bucket), global::Nitric.Proto.Deployments.v1.Bucket.Parser, new[]{ "Listeners" }, null, null, null, null), + new pbr::GeneratedClrTypeInfo(typeof(global::Nitric.Proto.Deployments.v1.BucketListener), global::Nitric.Proto.Deployments.v1.BucketListener.Parser, new[]{ "Config", "Service" }, new[]{ "Target" }, null, null, null), + new pbr::GeneratedClrTypeInfo(typeof(global::Nitric.Proto.Deployments.v1.Topic), global::Nitric.Proto.Deployments.v1.Topic.Parser, new[]{ "Subscriptions" }, null, null, null, null), + new pbr::GeneratedClrTypeInfo(typeof(global::Nitric.Proto.Deployments.v1.Queue), global::Nitric.Proto.Deployments.v1.Queue.Parser, null, null, null, null, null), + new pbr::GeneratedClrTypeInfo(typeof(global::Nitric.Proto.Deployments.v1.KeyValueStore), global::Nitric.Proto.Deployments.v1.KeyValueStore.Parser, null, null, null, null, null), + new pbr::GeneratedClrTypeInfo(typeof(global::Nitric.Proto.Deployments.v1.Secret), global::Nitric.Proto.Deployments.v1.Secret.Parser, null, null, null, null, null), + new pbr::GeneratedClrTypeInfo(typeof(global::Nitric.Proto.Deployments.v1.SubscriptionTarget), global::Nitric.Proto.Deployments.v1.SubscriptionTarget.Parser, new[]{ "Service" }, new[]{ "Target" }, null, null, null), + new pbr::GeneratedClrTypeInfo(typeof(global::Nitric.Proto.Deployments.v1.TopicSubscription), global::Nitric.Proto.Deployments.v1.TopicSubscription.Parser, new[]{ "Target" }, null, null, null, null), + new pbr::GeneratedClrTypeInfo(typeof(global::Nitric.Proto.Deployments.v1.HttpTarget), global::Nitric.Proto.Deployments.v1.HttpTarget.Parser, new[]{ "Service" }, new[]{ "Target" }, null, null, null), + new pbr::GeneratedClrTypeInfo(typeof(global::Nitric.Proto.Deployments.v1.Http), global::Nitric.Proto.Deployments.v1.Http.Parser, new[]{ "Target" }, null, null, null, null), + new pbr::GeneratedClrTypeInfo(typeof(global::Nitric.Proto.Deployments.v1.Api), global::Nitric.Proto.Deployments.v1.Api.Parser, new[]{ "Openapi" }, new[]{ "Document" }, null, null, null), + new pbr::GeneratedClrTypeInfo(typeof(global::Nitric.Proto.Deployments.v1.Websocket), global::Nitric.Proto.Deployments.v1.Websocket.Parser, new[]{ "ConnectTarget", "DisconnectTarget", "MessageTarget" }, null, null, null, null), + new pbr::GeneratedClrTypeInfo(typeof(global::Nitric.Proto.Deployments.v1.WebsocketTarget), global::Nitric.Proto.Deployments.v1.WebsocketTarget.Parser, new[]{ "Service" }, new[]{ "Target" }, null, null, null), + new pbr::GeneratedClrTypeInfo(typeof(global::Nitric.Proto.Deployments.v1.ScheduleTarget), global::Nitric.Proto.Deployments.v1.ScheduleTarget.Parser, new[]{ "Service" }, new[]{ "Target" }, null, null, null), + new pbr::GeneratedClrTypeInfo(typeof(global::Nitric.Proto.Deployments.v1.Schedule), global::Nitric.Proto.Deployments.v1.Schedule.Parser, new[]{ "Target", "Every", "Cron" }, new[]{ "Cadence" }, null, null, null), + new pbr::GeneratedClrTypeInfo(typeof(global::Nitric.Proto.Deployments.v1.ScheduleEvery), global::Nitric.Proto.Deployments.v1.ScheduleEvery.Parser, new[]{ "Rate" }, null, null, null, null), + new pbr::GeneratedClrTypeInfo(typeof(global::Nitric.Proto.Deployments.v1.ScheduleCron), global::Nitric.Proto.Deployments.v1.ScheduleCron.Parser, new[]{ "Expression" }, null, null, null, null), + new pbr::GeneratedClrTypeInfo(typeof(global::Nitric.Proto.Deployments.v1.Resource), global::Nitric.Proto.Deployments.v1.Resource.Parser, new[]{ "Id", "Service", "Bucket", "Topic", "Api", "Policy", "Schedule", "KeyValueStore", "Secret", "Websocket", "Http", "Queue" }, new[]{ "Config" }, null, null, null), + new pbr::GeneratedClrTypeInfo(typeof(global::Nitric.Proto.Deployments.v1.Policy), global::Nitric.Proto.Deployments.v1.Policy.Parser, new[]{ "Principals", "Actions", "Resources" }, null, null, null, null), + new pbr::GeneratedClrTypeInfo(typeof(global::Nitric.Proto.Deployments.v1.Spec), global::Nitric.Proto.Deployments.v1.Spec.Parser, new[]{ "Resources" }, null, null, null, null) })); } #endregion } + #region Enums + public enum ResourceDeploymentAction { + /// + /// A new resource is being created + /// + [pbr::OriginalName("CREATE")] Create = 0, + /// + /// An existing resource is being updated + /// + [pbr::OriginalName("UPDATE")] Update = 1, + /// + /// An existing resource is being replaced + /// + [pbr::OriginalName("REPLACE")] Replace = 2, + /// + /// No-op on the resource (it already exists and requires no changes) + /// + [pbr::OriginalName("SAME")] Same = 3, + /// + /// An existing resource is being deleted + /// + [pbr::OriginalName("DELETE")] Delete = 4, + } + + public enum ResourceDeploymentStatus { + /// + /// The action hasn't started, usually due to a dependency + /// + [pbr::OriginalName("PENDING")] Pending = 0, + /// + /// The action in currently in-flight, e.g. waiting for cloud provder to provision a resource + /// + [pbr::OriginalName("IN_PROGRESS")] InProgress = 1, + /// + /// The action has been applied successfully + /// + [pbr::OriginalName("SUCCESS")] Success = 2, + /// + /// The action has failed to be (completely) applied + /// + [pbr::OriginalName("FAILED")] Failed = 3, + } + + #endregion + #region Messages - public sealed partial class DeployUpRequest : pb::IMessage + public sealed partial class DeploymentUpRequest : pb::IMessage #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE , pb::IBufferMessage #endif { - private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new DeployUpRequest()); + private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new DeploymentUpRequest()); private pb::UnknownFieldSet _unknownFields; [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public static pb::MessageParser Parser { get { return _parser; } } + public static pb::MessageParser Parser { get { return _parser; } } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public static pbr::MessageDescriptor Descriptor { - get { return global::Nitric.Proto.Deploy.v1.DeployReflection.Descriptor.MessageTypes[0]; } + get { return global::Nitric.Proto.Deployments.v1.DeploymentsReflection.Descriptor.MessageTypes[0]; } } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] @@ -153,32 +219,33 @@ public sealed partial class DeployUpRequest : pb::IMessage } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public DeployUpRequest() { + public DeploymentUpRequest() { OnConstruction(); } partial void OnConstruction(); [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public DeployUpRequest(DeployUpRequest other) : this() { + public DeploymentUpRequest(DeploymentUpRequest other) : this() { spec_ = other.spec_ != null ? other.spec_.Clone() : null; attributes_ = other.attributes_ != null ? other.attributes_.Clone() : null; + interactive_ = other.interactive_; _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public DeployUpRequest Clone() { - return new DeployUpRequest(this); + public DeploymentUpRequest Clone() { + return new DeploymentUpRequest(this); } /// Field number for the "spec" field. public const int SpecFieldNumber = 1; - private global::Nitric.Proto.Deploy.v1.Spec spec_; + private global::Nitric.Proto.Deployments.v1.Spec spec_; /// /// The spec to deploy /// [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public global::Nitric.Proto.Deploy.v1.Spec Spec { + public global::Nitric.Proto.Deployments.v1.Spec Spec { get { return spec_; } set { spec_ = value; @@ -200,13 +267,28 @@ public DeployUpRequest Clone() { } } + /// Field number for the "interactive" field. + public const int InteractiveFieldNumber = 3; + private bool interactive_; + /// + /// A hint to the provider of the kind of output that the client can accept + /// This will allow provider developers to provider richer output back to clients. + /// + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public bool Interactive { + get { return interactive_; } + set { + interactive_ = value; + } + } + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public override bool Equals(object other) { - return Equals(other as DeployUpRequest); + return Equals(other as DeploymentUpRequest); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public bool Equals(DeployUpRequest other) { + public bool Equals(DeploymentUpRequest other) { if (ReferenceEquals(other, null)) { return false; } @@ -215,6 +297,7 @@ public bool Equals(DeployUpRequest other) { } if (!object.Equals(Spec, other.Spec)) return false; if (!object.Equals(Attributes, other.Attributes)) return false; + if (Interactive != other.Interactive) return false; return Equals(_unknownFields, other._unknownFields); } @@ -223,6 +306,7 @@ public override int GetHashCode() { int hash = 1; if (spec_ != null) hash ^= Spec.GetHashCode(); if (attributes_ != null) hash ^= Attributes.GetHashCode(); + if (Interactive != false) hash ^= Interactive.GetHashCode(); if (_unknownFields != null) { hash ^= _unknownFields.GetHashCode(); } @@ -247,6 +331,10 @@ public void WriteTo(pb::CodedOutputStream output) { output.WriteRawTag(18); output.WriteMessage(Attributes); } + if (Interactive != false) { + output.WriteRawTag(24); + output.WriteBool(Interactive); + } if (_unknownFields != null) { _unknownFields.WriteTo(output); } @@ -264,6 +352,10 @@ public void WriteTo(pb::CodedOutputStream output) { output.WriteRawTag(18); output.WriteMessage(Attributes); } + if (Interactive != false) { + output.WriteRawTag(24); + output.WriteBool(Interactive); + } if (_unknownFields != null) { _unknownFields.WriteTo(ref output); } @@ -279,6 +371,9 @@ public int CalculateSize() { if (attributes_ != null) { size += 1 + pb::CodedOutputStream.ComputeMessageSize(Attributes); } + if (Interactive != false) { + size += 1 + 1; + } if (_unknownFields != null) { size += _unknownFields.CalculateSize(); } @@ -286,13 +381,13 @@ public int CalculateSize() { } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void MergeFrom(DeployUpRequest other) { + public void MergeFrom(DeploymentUpRequest other) { if (other == null) { return; } if (other.spec_ != null) { if (spec_ == null) { - Spec = new global::Nitric.Proto.Deploy.v1.Spec(); + Spec = new global::Nitric.Proto.Deployments.v1.Spec(); } Spec.MergeFrom(other.Spec); } @@ -302,6 +397,9 @@ public void MergeFrom(DeployUpRequest other) { } Attributes.MergeFrom(other.Attributes); } + if (other.Interactive != false) { + Interactive = other.Interactive; + } _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields); } @@ -318,7 +416,7 @@ public void MergeFrom(pb::CodedInputStream input) { break; case 10: { if (spec_ == null) { - Spec = new global::Nitric.Proto.Deploy.v1.Spec(); + Spec = new global::Nitric.Proto.Deployments.v1.Spec(); } input.ReadMessage(Spec); break; @@ -330,6 +428,10 @@ public void MergeFrom(pb::CodedInputStream input) { input.ReadMessage(Attributes); break; } + case 24: { + Interactive = input.ReadBool(); + break; + } } } #endif @@ -346,7 +448,7 @@ public void MergeFrom(pb::CodedInputStream input) { break; case 10: { if (spec_ == null) { - Spec = new global::Nitric.Proto.Deploy.v1.Spec(); + Spec = new global::Nitric.Proto.Deployments.v1.Spec(); } input.ReadMessage(Spec); break; @@ -358,6 +460,10 @@ public void MergeFrom(pb::CodedInputStream input) { input.ReadMessage(Attributes); break; } + case 24: { + Interactive = input.ReadBool(); + break; + } } } } @@ -365,19 +471,19 @@ public void MergeFrom(pb::CodedInputStream input) { } - public sealed partial class DeployUpEvent : pb::IMessage + public sealed partial class DeploymentUpEvent : pb::IMessage #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE , pb::IBufferMessage #endif { - private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new DeployUpEvent()); + private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new DeploymentUpEvent()); private pb::UnknownFieldSet _unknownFields; [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public static pb::MessageParser Parser { get { return _parser; } } + public static pb::MessageParser Parser { get { return _parser; } } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public static pbr::MessageDescriptor Descriptor { - get { return global::Nitric.Proto.Deploy.v1.DeployReflection.Descriptor.MessageTypes[1]; } + get { return global::Nitric.Proto.Deployments.v1.DeploymentsReflection.Descriptor.MessageTypes[1]; } } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] @@ -386,17 +492,20 @@ public sealed partial class DeployUpEvent : pb::IMessage } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public DeployUpEvent() { + public DeploymentUpEvent() { OnConstruction(); } partial void OnConstruction(); [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public DeployUpEvent(DeployUpEvent other) : this() { + public DeploymentUpEvent(DeploymentUpEvent other) : this() { switch (other.ContentCase) { case ContentOneofCase.Message: - Message = other.Message.Clone(); + Message = other.Message; + break; + case ContentOneofCase.Update: + Update = other.Update.Clone(); break; case ContentOneofCase.Result: Result = other.Result.Clone(); @@ -407,26 +516,37 @@ public DeployUpEvent(DeployUpEvent other) : this() { } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public DeployUpEvent Clone() { - return new DeployUpEvent(this); + public DeploymentUpEvent Clone() { + return new DeploymentUpEvent(this); } /// Field number for the "message" field. public const int MessageFieldNumber = 1; [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public global::Nitric.Proto.Deploy.v1.DeployEventMessage Message { - get { return contentCase_ == ContentOneofCase.Message ? (global::Nitric.Proto.Deploy.v1.DeployEventMessage) content_ : null; } + public string Message { + get { return contentCase_ == ContentOneofCase.Message ? (string) content_ : ""; } + set { + content_ = pb::ProtoPreconditions.CheckNotNull(value, "value"); + contentCase_ = ContentOneofCase.Message; + } + } + + /// Field number for the "update" field. + public const int UpdateFieldNumber = 2; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public global::Nitric.Proto.Deployments.v1.ResourceUpdate Update { + get { return contentCase_ == ContentOneofCase.Update ? (global::Nitric.Proto.Deployments.v1.ResourceUpdate) content_ : null; } set { content_ = value; - contentCase_ = value == null ? ContentOneofCase.None : ContentOneofCase.Message; + contentCase_ = value == null ? ContentOneofCase.None : ContentOneofCase.Update; } } /// Field number for the "result" field. - public const int ResultFieldNumber = 2; + public const int ResultFieldNumber = 3; [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public global::Nitric.Proto.Deploy.v1.DeployUpEventResult Result { - get { return contentCase_ == ContentOneofCase.Result ? (global::Nitric.Proto.Deploy.v1.DeployUpEventResult) content_ : null; } + public global::Nitric.Proto.Deployments.v1.UpResult Result { + get { return contentCase_ == ContentOneofCase.Result ? (global::Nitric.Proto.Deployments.v1.UpResult) content_ : null; } set { content_ = value; contentCase_ = value == null ? ContentOneofCase.None : ContentOneofCase.Result; @@ -438,7 +558,8 @@ public DeployUpEvent Clone() { public enum ContentOneofCase { None = 0, Message = 1, - Result = 2, + Update = 2, + Result = 3, } private ContentOneofCase contentCase_ = ContentOneofCase.None; [global::System.Diagnostics.DebuggerNonUserCodeAttribute] @@ -454,18 +575,19 @@ public void ClearContent() { [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public override bool Equals(object other) { - return Equals(other as DeployUpEvent); + return Equals(other as DeploymentUpEvent); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public bool Equals(DeployUpEvent other) { + public bool Equals(DeploymentUpEvent other) { if (ReferenceEquals(other, null)) { return false; } if (ReferenceEquals(other, this)) { return true; } - if (!object.Equals(Message, other.Message)) return false; + if (Message != other.Message) return false; + if (!object.Equals(Update, other.Update)) return false; if (!object.Equals(Result, other.Result)) return false; if (ContentCase != other.ContentCase) return false; return Equals(_unknownFields, other._unknownFields); @@ -475,6 +597,7 @@ public bool Equals(DeployUpEvent other) { public override int GetHashCode() { int hash = 1; if (contentCase_ == ContentOneofCase.Message) hash ^= Message.GetHashCode(); + if (contentCase_ == ContentOneofCase.Update) hash ^= Update.GetHashCode(); if (contentCase_ == ContentOneofCase.Result) hash ^= Result.GetHashCode(); hash ^= (int) contentCase_; if (_unknownFields != null) { @@ -495,10 +618,14 @@ public void WriteTo(pb::CodedOutputStream output) { #else if (contentCase_ == ContentOneofCase.Message) { output.WriteRawTag(10); - output.WriteMessage(Message); + output.WriteString(Message); } - if (contentCase_ == ContentOneofCase.Result) { + if (contentCase_ == ContentOneofCase.Update) { output.WriteRawTag(18); + output.WriteMessage(Update); + } + if (contentCase_ == ContentOneofCase.Result) { + output.WriteRawTag(26); output.WriteMessage(Result); } if (_unknownFields != null) { @@ -512,10 +639,14 @@ public void WriteTo(pb::CodedOutputStream output) { void pb::IBufferMessage.InternalWriteTo(ref pb::WriteContext output) { if (contentCase_ == ContentOneofCase.Message) { output.WriteRawTag(10); - output.WriteMessage(Message); + output.WriteString(Message); } - if (contentCase_ == ContentOneofCase.Result) { + if (contentCase_ == ContentOneofCase.Update) { output.WriteRawTag(18); + output.WriteMessage(Update); + } + if (contentCase_ == ContentOneofCase.Result) { + output.WriteRawTag(26); output.WriteMessage(Result); } if (_unknownFields != null) { @@ -528,7 +659,10 @@ public void WriteTo(pb::CodedOutputStream output) { public int CalculateSize() { int size = 0; if (contentCase_ == ContentOneofCase.Message) { - size += 1 + pb::CodedOutputStream.ComputeMessageSize(Message); + size += 1 + pb::CodedOutputStream.ComputeStringSize(Message); + } + if (contentCase_ == ContentOneofCase.Update) { + size += 1 + pb::CodedOutputStream.ComputeMessageSize(Update); } if (contentCase_ == ContentOneofCase.Result) { size += 1 + pb::CodedOutputStream.ComputeMessageSize(Result); @@ -540,20 +674,23 @@ public int CalculateSize() { } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void MergeFrom(DeployUpEvent other) { + public void MergeFrom(DeploymentUpEvent other) { if (other == null) { return; } switch (other.ContentCase) { case ContentOneofCase.Message: - if (Message == null) { - Message = new global::Nitric.Proto.Deploy.v1.DeployEventMessage(); + Message = other.Message; + break; + case ContentOneofCase.Update: + if (Update == null) { + Update = new global::Nitric.Proto.Deployments.v1.ResourceUpdate(); } - Message.MergeFrom(other.Message); + Update.MergeFrom(other.Update); break; case ContentOneofCase.Result: if (Result == null) { - Result = new global::Nitric.Proto.Deploy.v1.DeployUpEventResult(); + Result = new global::Nitric.Proto.Deployments.v1.UpResult(); } Result.MergeFrom(other.Result); break; @@ -574,16 +711,20 @@ public void MergeFrom(pb::CodedInputStream input) { _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input); break; case 10: { - global::Nitric.Proto.Deploy.v1.DeployEventMessage subBuilder = new global::Nitric.Proto.Deploy.v1.DeployEventMessage(); - if (contentCase_ == ContentOneofCase.Message) { - subBuilder.MergeFrom(Message); + Message = input.ReadString(); + break; + } + case 18: { + global::Nitric.Proto.Deployments.v1.ResourceUpdate subBuilder = new global::Nitric.Proto.Deployments.v1.ResourceUpdate(); + if (contentCase_ == ContentOneofCase.Update) { + subBuilder.MergeFrom(Update); } input.ReadMessage(subBuilder); - Message = subBuilder; + Update = subBuilder; break; } - case 18: { - global::Nitric.Proto.Deploy.v1.DeployUpEventResult subBuilder = new global::Nitric.Proto.Deploy.v1.DeployUpEventResult(); + case 26: { + global::Nitric.Proto.Deployments.v1.UpResult subBuilder = new global::Nitric.Proto.Deployments.v1.UpResult(); if (contentCase_ == ContentOneofCase.Result) { subBuilder.MergeFrom(Result); } @@ -606,16 +747,20 @@ public void MergeFrom(pb::CodedInputStream input) { _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, ref input); break; case 10: { - global::Nitric.Proto.Deploy.v1.DeployEventMessage subBuilder = new global::Nitric.Proto.Deploy.v1.DeployEventMessage(); - if (contentCase_ == ContentOneofCase.Message) { - subBuilder.MergeFrom(Message); + Message = input.ReadString(); + break; + } + case 18: { + global::Nitric.Proto.Deployments.v1.ResourceUpdate subBuilder = new global::Nitric.Proto.Deployments.v1.ResourceUpdate(); + if (contentCase_ == ContentOneofCase.Update) { + subBuilder.MergeFrom(Update); } input.ReadMessage(subBuilder); - Message = subBuilder; + Update = subBuilder; break; } - case 18: { - global::Nitric.Proto.Deploy.v1.DeployUpEventResult subBuilder = new global::Nitric.Proto.Deploy.v1.DeployUpEventResult(); + case 26: { + global::Nitric.Proto.Deployments.v1.UpResult subBuilder = new global::Nitric.Proto.Deployments.v1.UpResult(); if (contentCase_ == ContentOneofCase.Result) { subBuilder.MergeFrom(Result); } @@ -630,22 +775,19 @@ public void MergeFrom(pb::CodedInputStream input) { } - /// - /// Messages to provide status updates on the deployment - /// - public sealed partial class DeployEventMessage : pb::IMessage + public sealed partial class ResourceUpdate : pb::IMessage #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE , pb::IBufferMessage #endif { - private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new DeployEventMessage()); + private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new ResourceUpdate()); private pb::UnknownFieldSet _unknownFields; [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public static pb::MessageParser Parser { get { return _parser; } } + public static pb::MessageParser Parser { get { return _parser; } } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public static pbr::MessageDescriptor Descriptor { - get { return global::Nitric.Proto.Deploy.v1.DeployReflection.Descriptor.MessageTypes[2]; } + get { return global::Nitric.Proto.Deployments.v1.DeploymentsReflection.Descriptor.MessageTypes[2]; } } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] @@ -654,26 +796,92 @@ public sealed partial class DeployEventMessage : pb::IMessageField number for the "id" field. + public const int IdFieldNumber = 1; + private global::Nitric.Proto.Resources.v1.ResourceIdentifier id_; + /// + /// The resource being updated, if this is nil the update applies to the stack + /// + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public global::Nitric.Proto.Resources.v1.ResourceIdentifier Id { + get { return id_; } + set { + id_ = value; + } + } + + /// Field number for the "action" field. + public const int ActionFieldNumber = 3; + private global::Nitric.Proto.Deployments.v1.ResourceDeploymentAction action_ = global::Nitric.Proto.Deployments.v1.ResourceDeploymentAction.Create; + /// + /// The type of update being applied + /// + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public global::Nitric.Proto.Deployments.v1.ResourceDeploymentAction Action { + get { return action_; } + set { + action_ = value; + } + } + + /// Field number for the "status" field. + public const int StatusFieldNumber = 4; + private global::Nitric.Proto.Deployments.v1.ResourceDeploymentStatus status_ = global::Nitric.Proto.Deployments.v1.ResourceDeploymentStatus.Pending; + /// + /// The current status of the action being applied + /// + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public global::Nitric.Proto.Deployments.v1.ResourceDeploymentStatus Status { + get { return status_; } + set { + status_ = value; + } + } + + /// Field number for the "sub_resource" field. + public const int SubResourceFieldNumber = 5; + private string subResource_ = ""; + /// + /// (optional) A globally unique identifier (scoped to the id above), used when Nitric Resources map 1:many in a cloud provider. + /// e.g. the container image repository for a service deployment. + /// This can also be set when id is nil above and it will imply a non-nitric resource that is necessary to deploy for a stack to operate + /// e.g. an Azure StorageAccount + /// + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public string SubResource { + get { return subResource_; } + set { + subResource_ = pb::ProtoPreconditions.CheckNotNull(value, "value"); + } } /// Field number for the "message" field. - public const int MessageFieldNumber = 1; + public const int MessageFieldNumber = 6; private string message_ = ""; + /// + /// Additional information about the update + /// [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public string Message { get { return message_; } @@ -684,17 +892,21 @@ public string Message { [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public override bool Equals(object other) { - return Equals(other as DeployEventMessage); + return Equals(other as ResourceUpdate); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public bool Equals(DeployEventMessage other) { + public bool Equals(ResourceUpdate other) { if (ReferenceEquals(other, null)) { return false; } if (ReferenceEquals(other, this)) { return true; } + if (!object.Equals(Id, other.Id)) return false; + if (Action != other.Action) return false; + if (Status != other.Status) return false; + if (SubResource != other.SubResource) return false; if (Message != other.Message) return false; return Equals(_unknownFields, other._unknownFields); } @@ -702,6 +914,10 @@ public bool Equals(DeployEventMessage other) { [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public override int GetHashCode() { int hash = 1; + if (id_ != null) hash ^= Id.GetHashCode(); + if (Action != global::Nitric.Proto.Deployments.v1.ResourceDeploymentAction.Create) hash ^= Action.GetHashCode(); + if (Status != global::Nitric.Proto.Deployments.v1.ResourceDeploymentStatus.Pending) hash ^= Status.GetHashCode(); + if (SubResource.Length != 0) hash ^= SubResource.GetHashCode(); if (Message.Length != 0) hash ^= Message.GetHashCode(); if (_unknownFields != null) { hash ^= _unknownFields.GetHashCode(); @@ -719,8 +935,24 @@ public void WriteTo(pb::CodedOutputStream output) { #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE output.WriteRawMessage(this); #else - if (Message.Length != 0) { + if (id_ != null) { output.WriteRawTag(10); + output.WriteMessage(Id); + } + if (Action != global::Nitric.Proto.Deployments.v1.ResourceDeploymentAction.Create) { + output.WriteRawTag(24); + output.WriteEnum((int) Action); + } + if (Status != global::Nitric.Proto.Deployments.v1.ResourceDeploymentStatus.Pending) { + output.WriteRawTag(32); + output.WriteEnum((int) Status); + } + if (SubResource.Length != 0) { + output.WriteRawTag(42); + output.WriteString(SubResource); + } + if (Message.Length != 0) { + output.WriteRawTag(50); output.WriteString(Message); } if (_unknownFields != null) { @@ -732,8 +964,24 @@ public void WriteTo(pb::CodedOutputStream output) { #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE [global::System.Diagnostics.DebuggerNonUserCodeAttribute] void pb::IBufferMessage.InternalWriteTo(ref pb::WriteContext output) { - if (Message.Length != 0) { + if (id_ != null) { output.WriteRawTag(10); + output.WriteMessage(Id); + } + if (Action != global::Nitric.Proto.Deployments.v1.ResourceDeploymentAction.Create) { + output.WriteRawTag(24); + output.WriteEnum((int) Action); + } + if (Status != global::Nitric.Proto.Deployments.v1.ResourceDeploymentStatus.Pending) { + output.WriteRawTag(32); + output.WriteEnum((int) Status); + } + if (SubResource.Length != 0) { + output.WriteRawTag(42); + output.WriteString(SubResource); + } + if (Message.Length != 0) { + output.WriteRawTag(50); output.WriteString(Message); } if (_unknownFields != null) { @@ -745,6 +993,18 @@ public void WriteTo(pb::CodedOutputStream output) { [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public int CalculateSize() { int size = 0; + if (id_ != null) { + size += 1 + pb::CodedOutputStream.ComputeMessageSize(Id); + } + if (Action != global::Nitric.Proto.Deployments.v1.ResourceDeploymentAction.Create) { + size += 1 + pb::CodedOutputStream.ComputeEnumSize((int) Action); + } + if (Status != global::Nitric.Proto.Deployments.v1.ResourceDeploymentStatus.Pending) { + size += 1 + pb::CodedOutputStream.ComputeEnumSize((int) Status); + } + if (SubResource.Length != 0) { + size += 1 + pb::CodedOutputStream.ComputeStringSize(SubResource); + } if (Message.Length != 0) { size += 1 + pb::CodedOutputStream.ComputeStringSize(Message); } @@ -755,10 +1015,25 @@ public int CalculateSize() { } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void MergeFrom(DeployEventMessage other) { + public void MergeFrom(ResourceUpdate other) { if (other == null) { return; } + if (other.id_ != null) { + if (id_ == null) { + Id = new global::Nitric.Proto.Resources.v1.ResourceIdentifier(); + } + Id.MergeFrom(other.Id); + } + if (other.Action != global::Nitric.Proto.Deployments.v1.ResourceDeploymentAction.Create) { + Action = other.Action; + } + if (other.Status != global::Nitric.Proto.Deployments.v1.ResourceDeploymentStatus.Pending) { + Status = other.Status; + } + if (other.SubResource.Length != 0) { + SubResource = other.SubResource; + } if (other.Message.Length != 0) { Message = other.Message; } @@ -777,6 +1052,25 @@ public void MergeFrom(pb::CodedInputStream input) { _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input); break; case 10: { + if (id_ == null) { + Id = new global::Nitric.Proto.Resources.v1.ResourceIdentifier(); + } + input.ReadMessage(Id); + break; + } + case 24: { + Action = (global::Nitric.Proto.Deployments.v1.ResourceDeploymentAction) input.ReadEnum(); + break; + } + case 32: { + Status = (global::Nitric.Proto.Deployments.v1.ResourceDeploymentStatus) input.ReadEnum(); + break; + } + case 42: { + SubResource = input.ReadString(); + break; + } + case 50: { Message = input.ReadString(); break; } @@ -795,6 +1089,25 @@ public void MergeFrom(pb::CodedInputStream input) { _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, ref input); break; case 10: { + if (id_ == null) { + Id = new global::Nitric.Proto.Resources.v1.ResourceIdentifier(); + } + input.ReadMessage(Id); + break; + } + case 24: { + Action = (global::Nitric.Proto.Deployments.v1.ResourceDeploymentAction) input.ReadEnum(); + break; + } + case 32: { + Status = (global::Nitric.Proto.Deployments.v1.ResourceDeploymentStatus) input.ReadEnum(); + break; + } + case 42: { + SubResource = input.ReadString(); + break; + } + case 50: { Message = input.ReadString(); break; } @@ -805,6 +1118,9 @@ public void MergeFrom(pb::CodedInputStream input) { } + /// + /// Terminal message indicating deployment success + /// public sealed partial class UpResult : pb::IMessage #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE , pb::IBufferMessage @@ -817,7 +1133,7 @@ public sealed partial class UpResult : pb::IMessage [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public static pbr::MessageDescriptor Descriptor { - get { return global::Nitric.Proto.Deploy.v1.DeployReflection.Descriptor.MessageTypes[3]; } + get { return global::Nitric.Proto.Deployments.v1.DeploymentsReflection.Descriptor.MessageTypes[3]; } } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] @@ -834,12 +1150,8 @@ public UpResult() { [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public UpResult(UpResult other) : this() { - switch (other.ContentCase) { - case ContentOneofCase.StringResult: - StringResult = other.StringResult; - break; - } - + success_ = other.success_; + details_ = other.details_; _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields); } @@ -848,36 +1160,32 @@ public UpResult Clone() { return new UpResult(this); } - /// Field number for the "string_result" field. - public const int StringResultFieldNumber = 1; + /// Field number for the "success" field. + public const int SuccessFieldNumber = 1; + private bool success_; /// - /// Simple formatted string output as result + /// Indicate the success status /// [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public string StringResult { - get { return contentCase_ == ContentOneofCase.StringResult ? (string) content_ : ""; } + public bool Success { + get { return success_; } set { - content_ = pb::ProtoPreconditions.CheckNotNull(value, "value"); - contentCase_ = ContentOneofCase.StringResult; + success_ = value; } } - private object content_; - /// Enum of possible cases for the "content" oneof. - public enum ContentOneofCase { - None = 0, - StringResult = 1, - } - private ContentOneofCase contentCase_ = ContentOneofCase.None; - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public ContentOneofCase ContentCase { - get { return contentCase_; } - } - + /// Field number for the "details" field. + public const int DetailsFieldNumber = 2; + private string details_ = ""; + /// + /// Simple formatted string output as result + /// [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void ClearContent() { - contentCase_ = ContentOneofCase.None; - content_ = null; + public string Details { + get { return details_; } + set { + details_ = pb::ProtoPreconditions.CheckNotNull(value, "value"); + } } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] @@ -893,16 +1201,16 @@ public bool Equals(UpResult other) { if (ReferenceEquals(other, this)) { return true; } - if (StringResult != other.StringResult) return false; - if (ContentCase != other.ContentCase) return false; + if (Success != other.Success) return false; + if (Details != other.Details) return false; return Equals(_unknownFields, other._unknownFields); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public override int GetHashCode() { int hash = 1; - if (contentCase_ == ContentOneofCase.StringResult) hash ^= StringResult.GetHashCode(); - hash ^= (int) contentCase_; + if (Success != false) hash ^= Success.GetHashCode(); + if (Details.Length != 0) hash ^= Details.GetHashCode(); if (_unknownFields != null) { hash ^= _unknownFields.GetHashCode(); } @@ -919,9 +1227,13 @@ public void WriteTo(pb::CodedOutputStream output) { #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE output.WriteRawMessage(this); #else - if (contentCase_ == ContentOneofCase.StringResult) { - output.WriteRawTag(10); - output.WriteString(StringResult); + if (Success != false) { + output.WriteRawTag(8); + output.WriteBool(Success); + } + if (Details.Length != 0) { + output.WriteRawTag(18); + output.WriteString(Details); } if (_unknownFields != null) { _unknownFields.WriteTo(output); @@ -932,9 +1244,13 @@ public void WriteTo(pb::CodedOutputStream output) { #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE [global::System.Diagnostics.DebuggerNonUserCodeAttribute] void pb::IBufferMessage.InternalWriteTo(ref pb::WriteContext output) { - if (contentCase_ == ContentOneofCase.StringResult) { - output.WriteRawTag(10); - output.WriteString(StringResult); + if (Success != false) { + output.WriteRawTag(8); + output.WriteBool(Success); + } + if (Details.Length != 0) { + output.WriteRawTag(18); + output.WriteString(Details); } if (_unknownFields != null) { _unknownFields.WriteTo(ref output); @@ -945,8 +1261,11 @@ public void WriteTo(pb::CodedOutputStream output) { [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public int CalculateSize() { int size = 0; - if (contentCase_ == ContentOneofCase.StringResult) { - size += 1 + pb::CodedOutputStream.ComputeStringSize(StringResult); + if (Success != false) { + size += 1 + 1; + } + if (Details.Length != 0) { + size += 1 + pb::CodedOutputStream.ComputeStringSize(Details); } if (_unknownFields != null) { size += _unknownFields.CalculateSize(); @@ -959,12 +1278,12 @@ public void MergeFrom(UpResult other) { if (other == null) { return; } - switch (other.ContentCase) { - case ContentOneofCase.StringResult: - StringResult = other.StringResult; - break; + if (other.Success != false) { + Success = other.Success; + } + if (other.Details.Length != 0) { + Details = other.Details; } - _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields); } @@ -979,8 +1298,12 @@ public void MergeFrom(pb::CodedInputStream input) { default: _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input); break; - case 10: { - StringResult = input.ReadString(); + case 8: { + Success = input.ReadBool(); + break; + } + case 18: { + Details = input.ReadString(); break; } } @@ -997,8 +1320,12 @@ public void MergeFrom(pb::CodedInputStream input) { default: _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, ref input); break; - case 10: { - StringResult = input.ReadString(); + case 8: { + Success = input.ReadBool(); + break; + } + case 18: { + Details = input.ReadString(); break; } } @@ -1008,22 +1335,19 @@ public void MergeFrom(pb::CodedInputStream input) { } - /// - /// Terminal message indicating deployment success - /// - public sealed partial class DeployUpEventResult : pb::IMessage + public sealed partial class DeploymentDownRequest : pb::IMessage #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE , pb::IBufferMessage #endif { - private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new DeployUpEventResult()); + private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new DeploymentDownRequest()); private pb::UnknownFieldSet _unknownFields; [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public static pb::MessageParser Parser { get { return _parser; } } + public static pb::MessageParser Parser { get { return _parser; } } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public static pbr::MessageDescriptor Descriptor { - get { return global::Nitric.Proto.Deploy.v1.DeployReflection.Descriptor.MessageTypes[4]; } + get { return global::Nitric.Proto.Deployments.v1.DeploymentsReflection.Descriptor.MessageTypes[4]; } } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] @@ -1032,76 +1356,77 @@ public sealed partial class DeployUpEventResult : pb::IMessageField number for the "success" field. - public const int SuccessFieldNumber = 1; - private bool success_; + /// Field number for the "attributes" field. + public const int AttributesFieldNumber = 1; + private global::Google.Protobuf.WellKnownTypes.Struct attributes_; /// - /// Indicate the success status + /// A map of attributes related to the deploy request + /// this allows for adding project identifiers etc. /// [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public bool Success { - get { return success_; } + public global::Google.Protobuf.WellKnownTypes.Struct Attributes { + get { return attributes_; } set { - success_ = value; + attributes_ = value; } } - /// Field number for the "result" field. - public const int ResultFieldNumber = 2; - private global::Nitric.Proto.Deploy.v1.UpResult result_; + /// Field number for the "interactive" field. + public const int InteractiveFieldNumber = 2; + private bool interactive_; /// - /// Output state as a struct, this can be provided as an output file - /// or pretty printed for CLI output + /// A hint to the provider of the kind of output that the client can accept + /// This will allow provider developers to provider richer output back to clients. /// [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public global::Nitric.Proto.Deploy.v1.UpResult Result { - get { return result_; } + public bool Interactive { + get { return interactive_; } set { - result_ = value; + interactive_ = value; } } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public override bool Equals(object other) { - return Equals(other as DeployUpEventResult); + return Equals(other as DeploymentDownRequest); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public bool Equals(DeployUpEventResult other) { + public bool Equals(DeploymentDownRequest other) { if (ReferenceEquals(other, null)) { return false; } if (ReferenceEquals(other, this)) { return true; } - if (Success != other.Success) return false; - if (!object.Equals(Result, other.Result)) return false; + if (!object.Equals(Attributes, other.Attributes)) return false; + if (Interactive != other.Interactive) return false; return Equals(_unknownFields, other._unknownFields); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public override int GetHashCode() { int hash = 1; - if (Success != false) hash ^= Success.GetHashCode(); - if (result_ != null) hash ^= Result.GetHashCode(); + if (attributes_ != null) hash ^= Attributes.GetHashCode(); + if (Interactive != false) hash ^= Interactive.GetHashCode(); if (_unknownFields != null) { hash ^= _unknownFields.GetHashCode(); } @@ -1118,13 +1443,13 @@ public void WriteTo(pb::CodedOutputStream output) { #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE output.WriteRawMessage(this); #else - if (Success != false) { - output.WriteRawTag(8); - output.WriteBool(Success); + if (attributes_ != null) { + output.WriteRawTag(10); + output.WriteMessage(Attributes); } - if (result_ != null) { - output.WriteRawTag(18); - output.WriteMessage(Result); + if (Interactive != false) { + output.WriteRawTag(16); + output.WriteBool(Interactive); } if (_unknownFields != null) { _unknownFields.WriteTo(output); @@ -1135,212 +1460,13 @@ public void WriteTo(pb::CodedOutputStream output) { #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE [global::System.Diagnostics.DebuggerNonUserCodeAttribute] void pb::IBufferMessage.InternalWriteTo(ref pb::WriteContext output) { - if (Success != false) { - output.WriteRawTag(8); - output.WriteBool(Success); - } - if (result_ != null) { - output.WriteRawTag(18); - output.WriteMessage(Result); - } - if (_unknownFields != null) { - _unknownFields.WriteTo(ref output); - } - } - #endif - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public int CalculateSize() { - int size = 0; - if (Success != false) { - size += 1 + 1; - } - if (result_ != null) { - size += 1 + pb::CodedOutputStream.ComputeMessageSize(Result); - } - if (_unknownFields != null) { - size += _unknownFields.CalculateSize(); - } - return size; - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void MergeFrom(DeployUpEventResult other) { - if (other == null) { - return; - } - if (other.Success != false) { - Success = other.Success; - } - if (other.result_ != null) { - if (result_ == null) { - Result = new global::Nitric.Proto.Deploy.v1.UpResult(); - } - Result.MergeFrom(other.Result); - } - _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void MergeFrom(pb::CodedInputStream input) { - #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE - input.ReadRawMessage(this); - #else - uint tag; - while ((tag = input.ReadTag()) != 0) { - switch(tag) { - default: - _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input); - break; - case 8: { - Success = input.ReadBool(); - break; - } - case 18: { - if (result_ == null) { - Result = new global::Nitric.Proto.Deploy.v1.UpResult(); - } - input.ReadMessage(Result); - break; - } - } - } - #endif - } - - #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - void pb::IBufferMessage.InternalMergeFrom(ref pb::ParseContext input) { - uint tag; - while ((tag = input.ReadTag()) != 0) { - switch(tag) { - default: - _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, ref input); - break; - case 8: { - Success = input.ReadBool(); - break; - } - case 18: { - if (result_ == null) { - Result = new global::Nitric.Proto.Deploy.v1.UpResult(); - } - input.ReadMessage(Result); - break; - } - } - } - } - #endif - - } - - public sealed partial class DeployDownRequest : pb::IMessage - #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE - , pb::IBufferMessage - #endif - { - private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new DeployDownRequest()); - private pb::UnknownFieldSet _unknownFields; - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public static pb::MessageParser Parser { get { return _parser; } } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public static pbr::MessageDescriptor Descriptor { - get { return global::Nitric.Proto.Deploy.v1.DeployReflection.Descriptor.MessageTypes[5]; } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - pbr::MessageDescriptor pb::IMessage.Descriptor { - get { return Descriptor; } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public DeployDownRequest() { - OnConstruction(); - } - - partial void OnConstruction(); - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public DeployDownRequest(DeployDownRequest other) : this() { - attributes_ = other.attributes_ != null ? other.attributes_.Clone() : null; - _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public DeployDownRequest Clone() { - return new DeployDownRequest(this); - } - - /// Field number for the "attributes" field. - public const int AttributesFieldNumber = 1; - private global::Google.Protobuf.WellKnownTypes.Struct attributes_; - /// - /// A map of attributes related to the deploy request - /// this allows for adding project identifiers etc. - /// - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public global::Google.Protobuf.WellKnownTypes.Struct Attributes { - get { return attributes_; } - set { - attributes_ = value; - } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public override bool Equals(object other) { - return Equals(other as DeployDownRequest); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public bool Equals(DeployDownRequest other) { - if (ReferenceEquals(other, null)) { - return false; - } - if (ReferenceEquals(other, this)) { - return true; - } - if (!object.Equals(Attributes, other.Attributes)) return false; - return Equals(_unknownFields, other._unknownFields); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public override int GetHashCode() { - int hash = 1; - if (attributes_ != null) hash ^= Attributes.GetHashCode(); - if (_unknownFields != null) { - hash ^= _unknownFields.GetHashCode(); - } - return hash; - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public override string ToString() { - return pb::JsonFormatter.ToDiagnosticString(this); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void WriteTo(pb::CodedOutputStream output) { - #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE - output.WriteRawMessage(this); - #else if (attributes_ != null) { output.WriteRawTag(10); output.WriteMessage(Attributes); } - if (_unknownFields != null) { - _unknownFields.WriteTo(output); - } - #endif - } - - #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - void pb::IBufferMessage.InternalWriteTo(ref pb::WriteContext output) { - if (attributes_ != null) { - output.WriteRawTag(10); - output.WriteMessage(Attributes); + if (Interactive != false) { + output.WriteRawTag(16); + output.WriteBool(Interactive); } if (_unknownFields != null) { _unknownFields.WriteTo(ref output); @@ -1354,6 +1480,9 @@ public int CalculateSize() { if (attributes_ != null) { size += 1 + pb::CodedOutputStream.ComputeMessageSize(Attributes); } + if (Interactive != false) { + size += 1 + 1; + } if (_unknownFields != null) { size += _unknownFields.CalculateSize(); } @@ -1361,7 +1490,7 @@ public int CalculateSize() { } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void MergeFrom(DeployDownRequest other) { + public void MergeFrom(DeploymentDownRequest other) { if (other == null) { return; } @@ -1371,6 +1500,9 @@ public void MergeFrom(DeployDownRequest other) { } Attributes.MergeFrom(other.Attributes); } + if (other.Interactive != false) { + Interactive = other.Interactive; + } _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields); } @@ -1392,6 +1524,10 @@ public void MergeFrom(pb::CodedInputStream input) { input.ReadMessage(Attributes); break; } + case 16: { + Interactive = input.ReadBool(); + break; + } } } #endif @@ -1413,6 +1549,10 @@ public void MergeFrom(pb::CodedInputStream input) { input.ReadMessage(Attributes); break; } + case 16: { + Interactive = input.ReadBool(); + break; + } } } } @@ -1420,19 +1560,19 @@ public void MergeFrom(pb::CodedInputStream input) { } - public sealed partial class DeployDownEvent : pb::IMessage + public sealed partial class DeploymentDownEvent : pb::IMessage #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE , pb::IBufferMessage #endif { - private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new DeployDownEvent()); + private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new DeploymentDownEvent()); private pb::UnknownFieldSet _unknownFields; [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public static pb::MessageParser Parser { get { return _parser; } } + public static pb::MessageParser Parser { get { return _parser; } } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public static pbr::MessageDescriptor Descriptor { - get { return global::Nitric.Proto.Deploy.v1.DeployReflection.Descriptor.MessageTypes[6]; } + get { return global::Nitric.Proto.Deployments.v1.DeploymentsReflection.Descriptor.MessageTypes[5]; } } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] @@ -1441,59 +1581,74 @@ public sealed partial class DeployDownEvent : pb::IMessage } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public DeployDownEvent() { + public DeploymentDownEvent() { OnConstruction(); } partial void OnConstruction(); [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public DeployDownEvent(DeployDownEvent other) : this() { + public DeploymentDownEvent(DeploymentDownEvent other) : this() { switch (other.ContentCase) { case ContentOneofCase.Message: - Message = other.Message.Clone(); + Message = other.Message; break; case ContentOneofCase.Result: Result = other.Result.Clone(); break; + case ContentOneofCase.Update: + Update = other.Update.Clone(); + break; } _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public DeployDownEvent Clone() { - return new DeployDownEvent(this); + public DeploymentDownEvent Clone() { + return new DeploymentDownEvent(this); } /// Field number for the "message" field. public const int MessageFieldNumber = 1; [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public global::Nitric.Proto.Deploy.v1.DeployEventMessage Message { - get { return contentCase_ == ContentOneofCase.Message ? (global::Nitric.Proto.Deploy.v1.DeployEventMessage) content_ : null; } + public string Message { + get { return contentCase_ == ContentOneofCase.Message ? (string) content_ : ""; } set { - content_ = value; - contentCase_ = value == null ? ContentOneofCase.None : ContentOneofCase.Message; + content_ = pb::ProtoPreconditions.CheckNotNull(value, "value"); + contentCase_ = ContentOneofCase.Message; } } /// Field number for the "result" field. public const int ResultFieldNumber = 2; [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public global::Nitric.Proto.Deploy.v1.DeployDownEventResult Result { - get { return contentCase_ == ContentOneofCase.Result ? (global::Nitric.Proto.Deploy.v1.DeployDownEventResult) content_ : null; } + public global::Nitric.Proto.Deployments.v1.DownResult Result { + get { return contentCase_ == ContentOneofCase.Result ? (global::Nitric.Proto.Deployments.v1.DownResult) content_ : null; } set { content_ = value; contentCase_ = value == null ? ContentOneofCase.None : ContentOneofCase.Result; } } + /// Field number for the "update" field. + public const int UpdateFieldNumber = 3; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public global::Nitric.Proto.Deployments.v1.ResourceUpdate Update { + get { return contentCase_ == ContentOneofCase.Update ? (global::Nitric.Proto.Deployments.v1.ResourceUpdate) content_ : null; } + set { + content_ = value; + contentCase_ = value == null ? ContentOneofCase.None : ContentOneofCase.Update; + } + } + private object content_; /// Enum of possible cases for the "content" oneof. public enum ContentOneofCase { None = 0, Message = 1, Result = 2, + Update = 3, } private ContentOneofCase contentCase_ = ContentOneofCase.None; [global::System.Diagnostics.DebuggerNonUserCodeAttribute] @@ -1509,19 +1664,20 @@ public void ClearContent() { [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public override bool Equals(object other) { - return Equals(other as DeployDownEvent); + return Equals(other as DeploymentDownEvent); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public bool Equals(DeployDownEvent other) { + public bool Equals(DeploymentDownEvent other) { if (ReferenceEquals(other, null)) { return false; } if (ReferenceEquals(other, this)) { return true; } - if (!object.Equals(Message, other.Message)) return false; + if (Message != other.Message) return false; if (!object.Equals(Result, other.Result)) return false; + if (!object.Equals(Update, other.Update)) return false; if (ContentCase != other.ContentCase) return false; return Equals(_unknownFields, other._unknownFields); } @@ -1531,6 +1687,7 @@ public override int GetHashCode() { int hash = 1; if (contentCase_ == ContentOneofCase.Message) hash ^= Message.GetHashCode(); if (contentCase_ == ContentOneofCase.Result) hash ^= Result.GetHashCode(); + if (contentCase_ == ContentOneofCase.Update) hash ^= Update.GetHashCode(); hash ^= (int) contentCase_; if (_unknownFields != null) { hash ^= _unknownFields.GetHashCode(); @@ -1550,12 +1707,16 @@ public void WriteTo(pb::CodedOutputStream output) { #else if (contentCase_ == ContentOneofCase.Message) { output.WriteRawTag(10); - output.WriteMessage(Message); + output.WriteString(Message); } if (contentCase_ == ContentOneofCase.Result) { output.WriteRawTag(18); output.WriteMessage(Result); } + if (contentCase_ == ContentOneofCase.Update) { + output.WriteRawTag(26); + output.WriteMessage(Update); + } if (_unknownFields != null) { _unknownFields.WriteTo(output); } @@ -1567,12 +1728,16 @@ public void WriteTo(pb::CodedOutputStream output) { void pb::IBufferMessage.InternalWriteTo(ref pb::WriteContext output) { if (contentCase_ == ContentOneofCase.Message) { output.WriteRawTag(10); - output.WriteMessage(Message); + output.WriteString(Message); } if (contentCase_ == ContentOneofCase.Result) { output.WriteRawTag(18); output.WriteMessage(Result); } + if (contentCase_ == ContentOneofCase.Update) { + output.WriteRawTag(26); + output.WriteMessage(Update); + } if (_unknownFields != null) { _unknownFields.WriteTo(ref output); } @@ -1583,11 +1748,14 @@ public void WriteTo(pb::CodedOutputStream output) { public int CalculateSize() { int size = 0; if (contentCase_ == ContentOneofCase.Message) { - size += 1 + pb::CodedOutputStream.ComputeMessageSize(Message); + size += 1 + pb::CodedOutputStream.ComputeStringSize(Message); } if (contentCase_ == ContentOneofCase.Result) { size += 1 + pb::CodedOutputStream.ComputeMessageSize(Result); } + if (contentCase_ == ContentOneofCase.Update) { + size += 1 + pb::CodedOutputStream.ComputeMessageSize(Update); + } if (_unknownFields != null) { size += _unknownFields.CalculateSize(); } @@ -1595,23 +1763,26 @@ public int CalculateSize() { } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void MergeFrom(DeployDownEvent other) { + public void MergeFrom(DeploymentDownEvent other) { if (other == null) { return; } switch (other.ContentCase) { case ContentOneofCase.Message: - if (Message == null) { - Message = new global::Nitric.Proto.Deploy.v1.DeployEventMessage(); - } - Message.MergeFrom(other.Message); + Message = other.Message; break; case ContentOneofCase.Result: if (Result == null) { - Result = new global::Nitric.Proto.Deploy.v1.DeployDownEventResult(); + Result = new global::Nitric.Proto.Deployments.v1.DownResult(); } Result.MergeFrom(other.Result); break; + case ContentOneofCase.Update: + if (Update == null) { + Update = new global::Nitric.Proto.Deployments.v1.ResourceUpdate(); + } + Update.MergeFrom(other.Update); + break; } _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields); @@ -1629,16 +1800,11 @@ public void MergeFrom(pb::CodedInputStream input) { _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input); break; case 10: { - global::Nitric.Proto.Deploy.v1.DeployEventMessage subBuilder = new global::Nitric.Proto.Deploy.v1.DeployEventMessage(); - if (contentCase_ == ContentOneofCase.Message) { - subBuilder.MergeFrom(Message); - } - input.ReadMessage(subBuilder); - Message = subBuilder; + Message = input.ReadString(); break; } case 18: { - global::Nitric.Proto.Deploy.v1.DeployDownEventResult subBuilder = new global::Nitric.Proto.Deploy.v1.DeployDownEventResult(); + global::Nitric.Proto.Deployments.v1.DownResult subBuilder = new global::Nitric.Proto.Deployments.v1.DownResult(); if (contentCase_ == ContentOneofCase.Result) { subBuilder.MergeFrom(Result); } @@ -1646,6 +1812,15 @@ public void MergeFrom(pb::CodedInputStream input) { Result = subBuilder; break; } + case 26: { + global::Nitric.Proto.Deployments.v1.ResourceUpdate subBuilder = new global::Nitric.Proto.Deployments.v1.ResourceUpdate(); + if (contentCase_ == ContentOneofCase.Update) { + subBuilder.MergeFrom(Update); + } + input.ReadMessage(subBuilder); + Update = subBuilder; + break; + } } } #endif @@ -1661,16 +1836,11 @@ public void MergeFrom(pb::CodedInputStream input) { _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, ref input); break; case 10: { - global::Nitric.Proto.Deploy.v1.DeployEventMessage subBuilder = new global::Nitric.Proto.Deploy.v1.DeployEventMessage(); - if (contentCase_ == ContentOneofCase.Message) { - subBuilder.MergeFrom(Message); - } - input.ReadMessage(subBuilder); - Message = subBuilder; + Message = input.ReadString(); break; } case 18: { - global::Nitric.Proto.Deploy.v1.DeployDownEventResult subBuilder = new global::Nitric.Proto.Deploy.v1.DeployDownEventResult(); + global::Nitric.Proto.Deployments.v1.DownResult subBuilder = new global::Nitric.Proto.Deployments.v1.DownResult(); if (contentCase_ == ContentOneofCase.Result) { subBuilder.MergeFrom(Result); } @@ -1678,6 +1848,15 @@ public void MergeFrom(pb::CodedInputStream input) { Result = subBuilder; break; } + case 26: { + global::Nitric.Proto.Deployments.v1.ResourceUpdate subBuilder = new global::Nitric.Proto.Deployments.v1.ResourceUpdate(); + if (contentCase_ == ContentOneofCase.Update) { + subBuilder.MergeFrom(Update); + } + input.ReadMessage(subBuilder); + Update = subBuilder; + break; + } } } } @@ -1688,19 +1867,19 @@ public void MergeFrom(pb::CodedInputStream input) { /// /// Terminal message indicating deployment success /// - public sealed partial class DeployDownEventResult : pb::IMessage + public sealed partial class DownResult : pb::IMessage #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE , pb::IBufferMessage #endif { - private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new DeployDownEventResult()); + private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new DownResult()); private pb::UnknownFieldSet _unknownFields; [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public static pb::MessageParser Parser { get { return _parser; } } + public static pb::MessageParser Parser { get { return _parser; } } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public static pbr::MessageDescriptor Descriptor { - get { return global::Nitric.Proto.Deploy.v1.DeployReflection.Descriptor.MessageTypes[7]; } + get { return global::Nitric.Proto.Deployments.v1.DeploymentsReflection.Descriptor.MessageTypes[6]; } } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] @@ -1709,29 +1888,29 @@ public sealed partial class DeployDownEventResult : pb::IMessage - /// An image source to be used for execution unit deployment + /// An image source to be used for service deployment /// public sealed partial class ImageSource : pb::IMessage #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE @@ -1839,7 +2018,7 @@ public sealed partial class ImageSource : pb::IMessage [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public static pbr::MessageDescriptor Descriptor { - get { return global::Nitric.Proto.Deploy.v1.DeployReflection.Descriptor.MessageTypes[8]; } + get { return global::Nitric.Proto.Deployments.v1.DeploymentsReflection.Descriptor.MessageTypes[7]; } } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] @@ -2004,21 +2183,21 @@ public void MergeFrom(pb::CodedInputStream input) { } /// - /// A unit of execution (i.e. function/container) + /// A unit of service (i.e. function/container) /// - public sealed partial class ExecutionUnit : pb::IMessage + public sealed partial class Service : pb::IMessage #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE , pb::IBufferMessage #endif { - private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new ExecutionUnit()); + private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new Service()); private pb::UnknownFieldSet _unknownFields; [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public static pb::MessageParser Parser { get { return _parser; } } + public static pb::MessageParser Parser { get { return _parser; } } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public static pbr::MessageDescriptor Descriptor { - get { return global::Nitric.Proto.Deploy.v1.DeployReflection.Descriptor.MessageTypes[9]; } + get { return global::Nitric.Proto.Deployments.v1.DeploymentsReflection.Descriptor.MessageTypes[8]; } } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] @@ -2027,14 +2206,14 @@ public sealed partial class ExecutionUnit : pb::IMessage } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public ExecutionUnit() { + public Service() { OnConstruction(); } partial void OnConstruction(); [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public ExecutionUnit(ExecutionUnit other) : this() { + public Service(Service other) : this() { workers_ = other.workers_; timeout_ = other.timeout_; memory_ = other.memory_; @@ -2050,18 +2229,18 @@ public ExecutionUnit(ExecutionUnit other) : this() { } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public ExecutionUnit Clone() { - return new ExecutionUnit(this); + public Service Clone() { + return new Service(this); } /// Field number for the "image" field. public const int ImageFieldNumber = 1; /// - /// Container image as a execution unit + /// Container image as a service /// [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public global::Nitric.Proto.Deploy.v1.ImageSource Image { - get { return sourceCase_ == SourceOneofCase.Image ? (global::Nitric.Proto.Deploy.v1.ImageSource) source_ : null; } + public global::Nitric.Proto.Deployments.v1.ImageSource Image { + get { return sourceCase_ == SourceOneofCase.Image ? (global::Nitric.Proto.Deployments.v1.ImageSource) source_ : null; } set { source_ = value; sourceCase_ = value == null ? SourceOneofCase.None : SourceOneofCase.Image; @@ -2072,7 +2251,7 @@ public ExecutionUnit Clone() { public const int WorkersFieldNumber = 10; private int workers_; /// - /// Expected worker count for this execution unit + /// Expected worker count for this service /// [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public int Workers { @@ -2117,7 +2296,7 @@ public int Memory { private string type_ = ""; /// /// A simple type property - /// describes the requested type of execution unit that this should be + /// describes the requested type of service that this should be /// for this project, a provider can implement how this request is satisfied /// in any way /// @@ -2135,7 +2314,7 @@ public string Type { = new pbc::MapField.Codec(pb::FieldCodec.ForString(10, ""), pb::FieldCodec.ForString(18, ""), 114); private readonly pbc::MapField env_ = new pbc::MapField(); /// - /// Environment variables for this execution unit + /// Environment variables for this service /// [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public pbc::MapField Env { @@ -2162,11 +2341,11 @@ public void ClearSource() { [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public override bool Equals(object other) { - return Equals(other as ExecutionUnit); + return Equals(other as Service); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public bool Equals(ExecutionUnit other) { + public bool Equals(Service other) { if (ReferenceEquals(other, null)) { return false; } @@ -2292,7 +2471,7 @@ public int CalculateSize() { } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void MergeFrom(ExecutionUnit other) { + public void MergeFrom(Service other) { if (other == null) { return; } @@ -2312,7 +2491,7 @@ public void MergeFrom(ExecutionUnit other) { switch (other.SourceCase) { case SourceOneofCase.Image: if (Image == null) { - Image = new global::Nitric.Proto.Deploy.v1.ImageSource(); + Image = new global::Nitric.Proto.Deployments.v1.ImageSource(); } Image.MergeFrom(other.Image); break; @@ -2333,7 +2512,7 @@ public void MergeFrom(pb::CodedInputStream input) { _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input); break; case 10: { - global::Nitric.Proto.Deploy.v1.ImageSource subBuilder = new global::Nitric.Proto.Deploy.v1.ImageSource(); + global::Nitric.Proto.Deployments.v1.ImageSource subBuilder = new global::Nitric.Proto.Deployments.v1.ImageSource(); if (sourceCase_ == SourceOneofCase.Image) { subBuilder.MergeFrom(Image); } @@ -2376,7 +2555,7 @@ public void MergeFrom(pb::CodedInputStream input) { _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, ref input); break; case 10: { - global::Nitric.Proto.Deploy.v1.ImageSource subBuilder = new global::Nitric.Proto.Deploy.v1.ImageSource(); + global::Nitric.Proto.Deployments.v1.ImageSource subBuilder = new global::Nitric.Proto.Deployments.v1.ImageSource(); if (sourceCase_ == SourceOneofCase.Image) { subBuilder.MergeFrom(Image); } @@ -2423,7 +2602,7 @@ public sealed partial class Bucket : pb::IMessage [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public static pbr::MessageDescriptor Descriptor { - get { return global::Nitric.Proto.Deploy.v1.DeployReflection.Descriptor.MessageTypes[10]; } + get { return global::Nitric.Proto.Deployments.v1.DeploymentsReflection.Descriptor.MessageTypes[9]; } } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] @@ -2440,7 +2619,7 @@ public Bucket() { [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public Bucket(Bucket other) : this() { - notifications_ = other.notifications_.Clone(); + listeners_ = other.listeners_.Clone(); _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields); } @@ -2449,14 +2628,14 @@ public Bucket Clone() { return new Bucket(this); } - /// Field number for the "notifications" field. - public const int NotificationsFieldNumber = 1; - private static readonly pb::FieldCodec _repeated_notifications_codec - = pb::FieldCodec.ForMessage(10, global::Nitric.Proto.Deploy.v1.BucketNotificationTarget.Parser); - private readonly pbc::RepeatedField notifications_ = new pbc::RepeatedField(); + /// Field number for the "listeners" field. + public const int ListenersFieldNumber = 1; + private static readonly pb::FieldCodec _repeated_listeners_codec + = pb::FieldCodec.ForMessage(10, global::Nitric.Proto.Deployments.v1.BucketListener.Parser); + private readonly pbc::RepeatedField listeners_ = new pbc::RepeatedField(); [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public pbc::RepeatedField Notifications { - get { return notifications_; } + public pbc::RepeatedField Listeners { + get { return listeners_; } } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] @@ -2472,14 +2651,14 @@ public bool Equals(Bucket other) { if (ReferenceEquals(other, this)) { return true; } - if(!notifications_.Equals(other.notifications_)) return false; + if(!listeners_.Equals(other.listeners_)) return false; return Equals(_unknownFields, other._unknownFields); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public override int GetHashCode() { int hash = 1; - hash ^= notifications_.GetHashCode(); + hash ^= listeners_.GetHashCode(); if (_unknownFields != null) { hash ^= _unknownFields.GetHashCode(); } @@ -2496,7 +2675,7 @@ public void WriteTo(pb::CodedOutputStream output) { #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE output.WriteRawMessage(this); #else - notifications_.WriteTo(output, _repeated_notifications_codec); + listeners_.WriteTo(output, _repeated_listeners_codec); if (_unknownFields != null) { _unknownFields.WriteTo(output); } @@ -2506,7 +2685,7 @@ public void WriteTo(pb::CodedOutputStream output) { #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE [global::System.Diagnostics.DebuggerNonUserCodeAttribute] void pb::IBufferMessage.InternalWriteTo(ref pb::WriteContext output) { - notifications_.WriteTo(ref output, _repeated_notifications_codec); + listeners_.WriteTo(ref output, _repeated_listeners_codec); if (_unknownFields != null) { _unknownFields.WriteTo(ref output); } @@ -2516,7 +2695,7 @@ public void WriteTo(pb::CodedOutputStream output) { [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public int CalculateSize() { int size = 0; - size += notifications_.CalculateSize(_repeated_notifications_codec); + size += listeners_.CalculateSize(_repeated_listeners_codec); if (_unknownFields != null) { size += _unknownFields.CalculateSize(); } @@ -2528,7 +2707,7 @@ public void MergeFrom(Bucket other) { if (other == null) { return; } - notifications_.Add(other.notifications_); + listeners_.Add(other.listeners_); _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields); } @@ -2544,7 +2723,7 @@ public void MergeFrom(pb::CodedInputStream input) { _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input); break; case 10: { - notifications_.AddEntriesFrom(input, _repeated_notifications_codec); + listeners_.AddEntriesFrom(input, _repeated_listeners_codec); break; } } @@ -2562,7 +2741,7 @@ public void MergeFrom(pb::CodedInputStream input) { _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, ref input); break; case 10: { - notifications_.AddEntriesFrom(ref input, _repeated_notifications_codec); + listeners_.AddEntriesFrom(ref input, _repeated_listeners_codec); break; } } @@ -2572,19 +2751,19 @@ public void MergeFrom(pb::CodedInputStream input) { } - public sealed partial class BucketNotificationTarget : pb::IMessage + public sealed partial class BucketListener : pb::IMessage #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE , pb::IBufferMessage #endif { - private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new BucketNotificationTarget()); + private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new BucketListener()); private pb::UnknownFieldSet _unknownFields; [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public static pb::MessageParser Parser { get { return _parser; } } + public static pb::MessageParser Parser { get { return _parser; } } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public static pbr::MessageDescriptor Descriptor { - get { return global::Nitric.Proto.Deploy.v1.DeployReflection.Descriptor.MessageTypes[11]; } + get { return global::Nitric.Proto.Deployments.v1.DeploymentsReflection.Descriptor.MessageTypes[10]; } } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] @@ -2593,18 +2772,18 @@ public sealed partial class BucketNotificationTarget : pb::IMessageField number for the "config" field. public const int ConfigFieldNumber = 1; - private global::Nitric.Proto.Faas.v1.BucketNotificationConfig config_; + private global::Nitric.Proto.Storage.v1.RegistrationRequest config_; [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public global::Nitric.Proto.Faas.v1.BucketNotificationConfig Config { + public global::Nitric.Proto.Storage.v1.RegistrationRequest Config { get { return config_; } set { config_ = value; } } - /// Field number for the "execution_unit" field. - public const int ExecutionUnitFieldNumber = 2; + /// Field number for the "service" field. + public const int ServiceFieldNumber = 2; /// - /// The name of an execution unit to target + /// The name of an service to target /// [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public string ExecutionUnit { - get { return targetCase_ == TargetOneofCase.ExecutionUnit ? (string) target_ : ""; } + public string Service { + get { return targetCase_ == TargetOneofCase.Service ? (string) target_ : ""; } set { target_ = pb::ProtoPreconditions.CheckNotNull(value, "value"); - targetCase_ = TargetOneofCase.ExecutionUnit; + targetCase_ = TargetOneofCase.Service; } } @@ -2645,7 +2824,7 @@ public string ExecutionUnit { /// Enum of possible cases for the "target" oneof. public enum TargetOneofCase { None = 0, - ExecutionUnit = 2, + Service = 2, } private TargetOneofCase targetCase_ = TargetOneofCase.None; [global::System.Diagnostics.DebuggerNonUserCodeAttribute] @@ -2661,11 +2840,11 @@ public void ClearTarget() { [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public override bool Equals(object other) { - return Equals(other as BucketNotificationTarget); + return Equals(other as BucketListener); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public bool Equals(BucketNotificationTarget other) { + public bool Equals(BucketListener other) { if (ReferenceEquals(other, null)) { return false; } @@ -2673,7 +2852,7 @@ public bool Equals(BucketNotificationTarget other) { return true; } if (!object.Equals(Config, other.Config)) return false; - if (ExecutionUnit != other.ExecutionUnit) return false; + if (Service != other.Service) return false; if (TargetCase != other.TargetCase) return false; return Equals(_unknownFields, other._unknownFields); } @@ -2682,7 +2861,7 @@ public bool Equals(BucketNotificationTarget other) { public override int GetHashCode() { int hash = 1; if (config_ != null) hash ^= Config.GetHashCode(); - if (targetCase_ == TargetOneofCase.ExecutionUnit) hash ^= ExecutionUnit.GetHashCode(); + if (targetCase_ == TargetOneofCase.Service) hash ^= Service.GetHashCode(); hash ^= (int) targetCase_; if (_unknownFields != null) { hash ^= _unknownFields.GetHashCode(); @@ -2704,9 +2883,9 @@ public void WriteTo(pb::CodedOutputStream output) { output.WriteRawTag(10); output.WriteMessage(Config); } - if (targetCase_ == TargetOneofCase.ExecutionUnit) { + if (targetCase_ == TargetOneofCase.Service) { output.WriteRawTag(18); - output.WriteString(ExecutionUnit); + output.WriteString(Service); } if (_unknownFields != null) { _unknownFields.WriteTo(output); @@ -2721,9 +2900,9 @@ public void WriteTo(pb::CodedOutputStream output) { output.WriteRawTag(10); output.WriteMessage(Config); } - if (targetCase_ == TargetOneofCase.ExecutionUnit) { + if (targetCase_ == TargetOneofCase.Service) { output.WriteRawTag(18); - output.WriteString(ExecutionUnit); + output.WriteString(Service); } if (_unknownFields != null) { _unknownFields.WriteTo(ref output); @@ -2737,8 +2916,8 @@ public int CalculateSize() { if (config_ != null) { size += 1 + pb::CodedOutputStream.ComputeMessageSize(Config); } - if (targetCase_ == TargetOneofCase.ExecutionUnit) { - size += 1 + pb::CodedOutputStream.ComputeStringSize(ExecutionUnit); + if (targetCase_ == TargetOneofCase.Service) { + size += 1 + pb::CodedOutputStream.ComputeStringSize(Service); } if (_unknownFields != null) { size += _unknownFields.CalculateSize(); @@ -2747,19 +2926,19 @@ public int CalculateSize() { } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void MergeFrom(BucketNotificationTarget other) { + public void MergeFrom(BucketListener other) { if (other == null) { return; } if (other.config_ != null) { if (config_ == null) { - Config = new global::Nitric.Proto.Faas.v1.BucketNotificationConfig(); + Config = new global::Nitric.Proto.Storage.v1.RegistrationRequest(); } Config.MergeFrom(other.Config); } switch (other.TargetCase) { - case TargetOneofCase.ExecutionUnit: - ExecutionUnit = other.ExecutionUnit; + case TargetOneofCase.Service: + Service = other.Service; break; } @@ -2779,13 +2958,13 @@ public void MergeFrom(pb::CodedInputStream input) { break; case 10: { if (config_ == null) { - Config = new global::Nitric.Proto.Faas.v1.BucketNotificationConfig(); + Config = new global::Nitric.Proto.Storage.v1.RegistrationRequest(); } input.ReadMessage(Config); break; } case 18: { - ExecutionUnit = input.ReadString(); + Service = input.ReadString(); break; } } @@ -2804,13 +2983,13 @@ public void MergeFrom(pb::CodedInputStream input) { break; case 10: { if (config_ == null) { - Config = new global::Nitric.Proto.Faas.v1.BucketNotificationConfig(); + Config = new global::Nitric.Proto.Storage.v1.RegistrationRequest(); } input.ReadMessage(Config); break; } case 18: { - ExecutionUnit = input.ReadString(); + Service = input.ReadString(); break; } } @@ -2832,7 +3011,7 @@ public sealed partial class Topic : pb::IMessage [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public static pbr::MessageDescriptor Descriptor { - get { return global::Nitric.Proto.Deploy.v1.DeployReflection.Descriptor.MessageTypes[12]; } + get { return global::Nitric.Proto.Deployments.v1.DeploymentsReflection.Descriptor.MessageTypes[11]; } } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] @@ -2860,14 +3039,11 @@ public Topic Clone() { /// Field number for the "subscriptions" field. public const int SubscriptionsFieldNumber = 1; - private static readonly pb::FieldCodec _repeated_subscriptions_codec - = pb::FieldCodec.ForMessage(10, global::Nitric.Proto.Deploy.v1.SubscriptionTarget.Parser); - private readonly pbc::RepeatedField subscriptions_ = new pbc::RepeatedField(); - /// - /// TODO: Include topic specifications here - /// + private static readonly pb::FieldCodec _repeated_subscriptions_codec + = pb::FieldCodec.ForMessage(10, global::Nitric.Proto.Deployments.v1.SubscriptionTarget.Parser); + private readonly pbc::RepeatedField subscriptions_ = new pbc::RepeatedField(); [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public pbc::RepeatedField Subscriptions { + public pbc::RepeatedField Subscriptions { get { return subscriptions_; } } @@ -2984,9 +3160,6 @@ public void MergeFrom(pb::CodedInputStream input) { } - /// - /// TODO: Include queue specifications here - /// public sealed partial class Queue : pb::IMessage #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE , pb::IBufferMessage @@ -2999,7 +3172,7 @@ public sealed partial class Queue : pb::IMessage [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public static pbr::MessageDescriptor Descriptor { - get { return global::Nitric.Proto.Deploy.v1.DeployReflection.Descriptor.MessageTypes[13]; } + get { return global::Nitric.Proto.Deployments.v1.DeploymentsReflection.Descriptor.MessageTypes[12]; } } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] @@ -3123,19 +3296,19 @@ public void MergeFrom(pb::CodedInputStream input) { } - public sealed partial class Collection : pb::IMessage + public sealed partial class KeyValueStore : pb::IMessage #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE , pb::IBufferMessage #endif { - private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new Collection()); + private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new KeyValueStore()); private pb::UnknownFieldSet _unknownFields; [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public static pb::MessageParser Parser { get { return _parser; } } + public static pb::MessageParser Parser { get { return _parser; } } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public static pbr::MessageDescriptor Descriptor { - get { return global::Nitric.Proto.Deploy.v1.DeployReflection.Descriptor.MessageTypes[14]; } + get { return global::Nitric.Proto.Deployments.v1.DeploymentsReflection.Descriptor.MessageTypes[13]; } } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] @@ -3144,29 +3317,29 @@ public sealed partial class Collection : pb::IMessage } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public Collection() { + public KeyValueStore() { OnConstruction(); } partial void OnConstruction(); [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public Collection(Collection other) : this() { + public KeyValueStore(KeyValueStore other) : this() { _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public Collection Clone() { - return new Collection(this); + public KeyValueStore Clone() { + return new KeyValueStore(this); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public override bool Equals(object other) { - return Equals(other as Collection); + return Equals(other as KeyValueStore); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public bool Equals(Collection other) { + public bool Equals(KeyValueStore other) { if (ReferenceEquals(other, null)) { return false; } @@ -3220,7 +3393,7 @@ public int CalculateSize() { } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void MergeFrom(Collection other) { + public void MergeFrom(KeyValueStore other) { if (other == null) { return; } @@ -3271,7 +3444,7 @@ public sealed partial class Secret : pb::IMessage [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public static pbr::MessageDescriptor Descriptor { - get { return global::Nitric.Proto.Deploy.v1.DeployReflection.Descriptor.MessageTypes[15]; } + get { return global::Nitric.Proto.Deployments.v1.DeploymentsReflection.Descriptor.MessageTypes[14]; } } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] @@ -3407,7 +3580,7 @@ public sealed partial class SubscriptionTarget : pb::IMessageField number for the "execution_unit" field. - public const int ExecutionUnitFieldNumber = 1; + /// Field number for the "service" field. + public const int ServiceFieldNumber = 1; /// - /// The name of an execution unit to target + /// The name of an service to target /// [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public string ExecutionUnit { - get { return targetCase_ == TargetOneofCase.ExecutionUnit ? (string) target_ : ""; } + public string Service { + get { return targetCase_ == TargetOneofCase.Service ? (string) target_ : ""; } set { target_ = pb::ProtoPreconditions.CheckNotNull(value, "value"); - targetCase_ = TargetOneofCase.ExecutionUnit; + targetCase_ = TargetOneofCase.Service; } } @@ -3456,7 +3629,7 @@ public string ExecutionUnit { /// Enum of possible cases for the "target" oneof. public enum TargetOneofCase { None = 0, - ExecutionUnit = 1, + Service = 1, } private TargetOneofCase targetCase_ = TargetOneofCase.None; [global::System.Diagnostics.DebuggerNonUserCodeAttribute] @@ -3483,7 +3656,7 @@ public bool Equals(SubscriptionTarget other) { if (ReferenceEquals(other, this)) { return true; } - if (ExecutionUnit != other.ExecutionUnit) return false; + if (Service != other.Service) return false; if (TargetCase != other.TargetCase) return false; return Equals(_unknownFields, other._unknownFields); } @@ -3491,7 +3664,7 @@ public bool Equals(SubscriptionTarget other) { [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public override int GetHashCode() { int hash = 1; - if (targetCase_ == TargetOneofCase.ExecutionUnit) hash ^= ExecutionUnit.GetHashCode(); + if (targetCase_ == TargetOneofCase.Service) hash ^= Service.GetHashCode(); hash ^= (int) targetCase_; if (_unknownFields != null) { hash ^= _unknownFields.GetHashCode(); @@ -3509,9 +3682,9 @@ public void WriteTo(pb::CodedOutputStream output) { #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE output.WriteRawMessage(this); #else - if (targetCase_ == TargetOneofCase.ExecutionUnit) { + if (targetCase_ == TargetOneofCase.Service) { output.WriteRawTag(10); - output.WriteString(ExecutionUnit); + output.WriteString(Service); } if (_unknownFields != null) { _unknownFields.WriteTo(output); @@ -3522,9 +3695,9 @@ public void WriteTo(pb::CodedOutputStream output) { #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE [global::System.Diagnostics.DebuggerNonUserCodeAttribute] void pb::IBufferMessage.InternalWriteTo(ref pb::WriteContext output) { - if (targetCase_ == TargetOneofCase.ExecutionUnit) { + if (targetCase_ == TargetOneofCase.Service) { output.WriteRawTag(10); - output.WriteString(ExecutionUnit); + output.WriteString(Service); } if (_unknownFields != null) { _unknownFields.WriteTo(ref output); @@ -3535,8 +3708,8 @@ public void WriteTo(pb::CodedOutputStream output) { [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public int CalculateSize() { int size = 0; - if (targetCase_ == TargetOneofCase.ExecutionUnit) { - size += 1 + pb::CodedOutputStream.ComputeStringSize(ExecutionUnit); + if (targetCase_ == TargetOneofCase.Service) { + size += 1 + pb::CodedOutputStream.ComputeStringSize(Service); } if (_unknownFields != null) { size += _unknownFields.CalculateSize(); @@ -3550,8 +3723,8 @@ public void MergeFrom(SubscriptionTarget other) { return; } switch (other.TargetCase) { - case TargetOneofCase.ExecutionUnit: - ExecutionUnit = other.ExecutionUnit; + case TargetOneofCase.Service: + Service = other.Service; break; } @@ -3570,7 +3743,7 @@ public void MergeFrom(pb::CodedInputStream input) { _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input); break; case 10: { - ExecutionUnit = input.ReadString(); + Service = input.ReadString(); break; } } @@ -3588,7 +3761,7 @@ public void MergeFrom(pb::CodedInputStream input) { _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, ref input); break; case 10: { - ExecutionUnit = input.ReadString(); + Service = input.ReadString(); break; } } @@ -3610,7 +3783,7 @@ public sealed partial class TopicSubscription : pb::IMessage [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public static pbr::MessageDescriptor Descriptor { - get { return global::Nitric.Proto.Deploy.v1.DeployReflection.Descriptor.MessageTypes[17]; } + get { return global::Nitric.Proto.Deployments.v1.DeploymentsReflection.Descriptor.MessageTypes[16]; } } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] @@ -3638,9 +3811,9 @@ public TopicSubscription Clone() { /// Field number for the "target" field. public const int TargetFieldNumber = 1; - private global::Nitric.Proto.Deploy.v1.SubscriptionTarget target_; + private global::Nitric.Proto.Deployments.v1.SubscriptionTarget target_; [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public global::Nitric.Proto.Deploy.v1.SubscriptionTarget Target { + public global::Nitric.Proto.Deployments.v1.SubscriptionTarget Target { get { return target_; } set { target_ = value; @@ -3726,7 +3899,7 @@ public void MergeFrom(TopicSubscription other) { } if (other.target_ != null) { if (target_ == null) { - Target = new global::Nitric.Proto.Deploy.v1.SubscriptionTarget(); + Target = new global::Nitric.Proto.Deployments.v1.SubscriptionTarget(); } Target.MergeFrom(other.Target); } @@ -3746,7 +3919,7 @@ public void MergeFrom(pb::CodedInputStream input) { break; case 10: { if (target_ == null) { - Target = new global::Nitric.Proto.Deploy.v1.SubscriptionTarget(); + Target = new global::Nitric.Proto.Deployments.v1.SubscriptionTarget(); } input.ReadMessage(Target); break; @@ -3767,7 +3940,7 @@ public void MergeFrom(pb::CodedInputStream input) { break; case 10: { if (target_ == null) { - Target = new global::Nitric.Proto.Deploy.v1.SubscriptionTarget(); + Target = new global::Nitric.Proto.Deployments.v1.SubscriptionTarget(); } input.ReadMessage(Target); break; @@ -3791,7 +3964,7 @@ public sealed partial class HttpTarget : pb::IMessage [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public static pbr::MessageDescriptor Descriptor { - get { return global::Nitric.Proto.Deploy.v1.DeployReflection.Descriptor.MessageTypes[18]; } + get { return global::Nitric.Proto.Deployments.v1.DeploymentsReflection.Descriptor.MessageTypes[17]; } } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] @@ -3809,8 +3982,8 @@ public HttpTarget() { [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public HttpTarget(HttpTarget other) : this() { switch (other.TargetCase) { - case TargetOneofCase.ExecutionUnit: - ExecutionUnit = other.ExecutionUnit; + case TargetOneofCase.Service: + Service = other.Service; break; } @@ -3822,17 +3995,17 @@ public HttpTarget Clone() { return new HttpTarget(this); } - /// Field number for the "execution_unit" field. - public const int ExecutionUnitFieldNumber = 1; + /// Field number for the "service" field. + public const int ServiceFieldNumber = 1; /// - /// The name of an execution unit to target + /// The name of an service to target /// [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public string ExecutionUnit { - get { return targetCase_ == TargetOneofCase.ExecutionUnit ? (string) target_ : ""; } + public string Service { + get { return targetCase_ == TargetOneofCase.Service ? (string) target_ : ""; } set { target_ = pb::ProtoPreconditions.CheckNotNull(value, "value"); - targetCase_ = TargetOneofCase.ExecutionUnit; + targetCase_ = TargetOneofCase.Service; } } @@ -3840,7 +4013,7 @@ public string ExecutionUnit { /// Enum of possible cases for the "target" oneof. public enum TargetOneofCase { None = 0, - ExecutionUnit = 1, + Service = 1, } private TargetOneofCase targetCase_ = TargetOneofCase.None; [global::System.Diagnostics.DebuggerNonUserCodeAttribute] @@ -3867,7 +4040,7 @@ public bool Equals(HttpTarget other) { if (ReferenceEquals(other, this)) { return true; } - if (ExecutionUnit != other.ExecutionUnit) return false; + if (Service != other.Service) return false; if (TargetCase != other.TargetCase) return false; return Equals(_unknownFields, other._unknownFields); } @@ -3875,7 +4048,7 @@ public bool Equals(HttpTarget other) { [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public override int GetHashCode() { int hash = 1; - if (targetCase_ == TargetOneofCase.ExecutionUnit) hash ^= ExecutionUnit.GetHashCode(); + if (targetCase_ == TargetOneofCase.Service) hash ^= Service.GetHashCode(); hash ^= (int) targetCase_; if (_unknownFields != null) { hash ^= _unknownFields.GetHashCode(); @@ -3893,9 +4066,9 @@ public void WriteTo(pb::CodedOutputStream output) { #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE output.WriteRawMessage(this); #else - if (targetCase_ == TargetOneofCase.ExecutionUnit) { + if (targetCase_ == TargetOneofCase.Service) { output.WriteRawTag(10); - output.WriteString(ExecutionUnit); + output.WriteString(Service); } if (_unknownFields != null) { _unknownFields.WriteTo(output); @@ -3906,9 +4079,9 @@ public void WriteTo(pb::CodedOutputStream output) { #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE [global::System.Diagnostics.DebuggerNonUserCodeAttribute] void pb::IBufferMessage.InternalWriteTo(ref pb::WriteContext output) { - if (targetCase_ == TargetOneofCase.ExecutionUnit) { + if (targetCase_ == TargetOneofCase.Service) { output.WriteRawTag(10); - output.WriteString(ExecutionUnit); + output.WriteString(Service); } if (_unknownFields != null) { _unknownFields.WriteTo(ref output); @@ -3919,8 +4092,8 @@ public void WriteTo(pb::CodedOutputStream output) { [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public int CalculateSize() { int size = 0; - if (targetCase_ == TargetOneofCase.ExecutionUnit) { - size += 1 + pb::CodedOutputStream.ComputeStringSize(ExecutionUnit); + if (targetCase_ == TargetOneofCase.Service) { + size += 1 + pb::CodedOutputStream.ComputeStringSize(Service); } if (_unknownFields != null) { size += _unknownFields.CalculateSize(); @@ -3934,8 +4107,8 @@ public void MergeFrom(HttpTarget other) { return; } switch (other.TargetCase) { - case TargetOneofCase.ExecutionUnit: - ExecutionUnit = other.ExecutionUnit; + case TargetOneofCase.Service: + Service = other.Service; break; } @@ -3954,7 +4127,7 @@ public void MergeFrom(pb::CodedInputStream input) { _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input); break; case 10: { - ExecutionUnit = input.ReadString(); + Service = input.ReadString(); break; } } @@ -3972,7 +4145,7 @@ public void MergeFrom(pb::CodedInputStream input) { _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, ref input); break; case 10: { - ExecutionUnit = input.ReadString(); + Service = input.ReadString(); break; } } @@ -3997,7 +4170,7 @@ public sealed partial class Http : pb::IMessage [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public static pbr::MessageDescriptor Descriptor { - get { return global::Nitric.Proto.Deploy.v1.DeployReflection.Descriptor.MessageTypes[19]; } + get { return global::Nitric.Proto.Deployments.v1.DeploymentsReflection.Descriptor.MessageTypes[18]; } } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] @@ -4025,9 +4198,9 @@ public Http Clone() { /// Field number for the "target" field. public const int TargetFieldNumber = 1; - private global::Nitric.Proto.Deploy.v1.HttpTarget target_; + private global::Nitric.Proto.Deployments.v1.HttpTarget target_; [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public global::Nitric.Proto.Deploy.v1.HttpTarget Target { + public global::Nitric.Proto.Deployments.v1.HttpTarget Target { get { return target_; } set { target_ = value; @@ -4113,7 +4286,7 @@ public void MergeFrom(Http other) { } if (other.target_ != null) { if (target_ == null) { - Target = new global::Nitric.Proto.Deploy.v1.HttpTarget(); + Target = new global::Nitric.Proto.Deployments.v1.HttpTarget(); } Target.MergeFrom(other.Target); } @@ -4133,7 +4306,7 @@ public void MergeFrom(pb::CodedInputStream input) { break; case 10: { if (target_ == null) { - Target = new global::Nitric.Proto.Deploy.v1.HttpTarget(); + Target = new global::Nitric.Proto.Deployments.v1.HttpTarget(); } input.ReadMessage(Target); break; @@ -4154,7 +4327,7 @@ public void MergeFrom(pb::CodedInputStream input) { break; case 10: { if (target_ == null) { - Target = new global::Nitric.Proto.Deploy.v1.HttpTarget(); + Target = new global::Nitric.Proto.Deployments.v1.HttpTarget(); } input.ReadMessage(Target); break; @@ -4178,7 +4351,7 @@ public sealed partial class Api : pb::IMessage [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public static pbr::MessageDescriptor Descriptor { - get { return global::Nitric.Proto.Deploy.v1.DeployReflection.Descriptor.MessageTypes[20]; } + get { return global::Nitric.Proto.Deployments.v1.DeploymentsReflection.Descriptor.MessageTypes[19]; } } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] @@ -4213,7 +4386,7 @@ public Api Clone() { public const int OpenapiFieldNumber = 1; /// /// An OpenAPI document for deployment - /// This document will contain extensions that hint of execution units that should be targeted as part of the deployment + /// This document will contain extensions that hint of services that should be targeted as part of the deployment /// [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public string Openapi { @@ -4385,7 +4558,7 @@ public sealed partial class Websocket : pb::IMessage [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public static pbr::MessageDescriptor Descriptor { - get { return global::Nitric.Proto.Deploy.v1.DeployReflection.Descriptor.MessageTypes[21]; } + get { return global::Nitric.Proto.Deployments.v1.DeploymentsReflection.Descriptor.MessageTypes[20]; } } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] @@ -4415,12 +4588,12 @@ public Websocket Clone() { /// Field number for the "connect_target" field. public const int ConnectTargetFieldNumber = 1; - private global::Nitric.Proto.Deploy.v1.WebsocketTarget connectTarget_; + private global::Nitric.Proto.Deployments.v1.WebsocketTarget connectTarget_; /// /// Target for handling new client connections /// [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public global::Nitric.Proto.Deploy.v1.WebsocketTarget ConnectTarget { + public global::Nitric.Proto.Deployments.v1.WebsocketTarget ConnectTarget { get { return connectTarget_; } set { connectTarget_ = value; @@ -4429,12 +4602,12 @@ public Websocket Clone() { /// Field number for the "disconnect_target" field. public const int DisconnectTargetFieldNumber = 2; - private global::Nitric.Proto.Deploy.v1.WebsocketTarget disconnectTarget_; + private global::Nitric.Proto.Deployments.v1.WebsocketTarget disconnectTarget_; /// /// Target for handling client disconnections /// [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public global::Nitric.Proto.Deploy.v1.WebsocketTarget DisconnectTarget { + public global::Nitric.Proto.Deployments.v1.WebsocketTarget DisconnectTarget { get { return disconnectTarget_; } set { disconnectTarget_ = value; @@ -4443,12 +4616,12 @@ public Websocket Clone() { /// Field number for the "message_target" field. public const int MessageTargetFieldNumber = 3; - private global::Nitric.Proto.Deploy.v1.WebsocketTarget messageTarget_; + private global::Nitric.Proto.Deployments.v1.WebsocketTarget messageTarget_; /// /// Target for handling all other message types /// [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public global::Nitric.Proto.Deploy.v1.WebsocketTarget MessageTarget { + public global::Nitric.Proto.Deployments.v1.WebsocketTarget MessageTarget { get { return messageTarget_; } set { messageTarget_ = value; @@ -4560,19 +4733,19 @@ public void MergeFrom(Websocket other) { } if (other.connectTarget_ != null) { if (connectTarget_ == null) { - ConnectTarget = new global::Nitric.Proto.Deploy.v1.WebsocketTarget(); + ConnectTarget = new global::Nitric.Proto.Deployments.v1.WebsocketTarget(); } ConnectTarget.MergeFrom(other.ConnectTarget); } if (other.disconnectTarget_ != null) { if (disconnectTarget_ == null) { - DisconnectTarget = new global::Nitric.Proto.Deploy.v1.WebsocketTarget(); + DisconnectTarget = new global::Nitric.Proto.Deployments.v1.WebsocketTarget(); } DisconnectTarget.MergeFrom(other.DisconnectTarget); } if (other.messageTarget_ != null) { if (messageTarget_ == null) { - MessageTarget = new global::Nitric.Proto.Deploy.v1.WebsocketTarget(); + MessageTarget = new global::Nitric.Proto.Deployments.v1.WebsocketTarget(); } MessageTarget.MergeFrom(other.MessageTarget); } @@ -4592,21 +4765,21 @@ public void MergeFrom(pb::CodedInputStream input) { break; case 10: { if (connectTarget_ == null) { - ConnectTarget = new global::Nitric.Proto.Deploy.v1.WebsocketTarget(); + ConnectTarget = new global::Nitric.Proto.Deployments.v1.WebsocketTarget(); } input.ReadMessage(ConnectTarget); break; } case 18: { if (disconnectTarget_ == null) { - DisconnectTarget = new global::Nitric.Proto.Deploy.v1.WebsocketTarget(); + DisconnectTarget = new global::Nitric.Proto.Deployments.v1.WebsocketTarget(); } input.ReadMessage(DisconnectTarget); break; } case 26: { if (messageTarget_ == null) { - MessageTarget = new global::Nitric.Proto.Deploy.v1.WebsocketTarget(); + MessageTarget = new global::Nitric.Proto.Deployments.v1.WebsocketTarget(); } input.ReadMessage(MessageTarget); break; @@ -4627,21 +4800,21 @@ public void MergeFrom(pb::CodedInputStream input) { break; case 10: { if (connectTarget_ == null) { - ConnectTarget = new global::Nitric.Proto.Deploy.v1.WebsocketTarget(); + ConnectTarget = new global::Nitric.Proto.Deployments.v1.WebsocketTarget(); } input.ReadMessage(ConnectTarget); break; } case 18: { if (disconnectTarget_ == null) { - DisconnectTarget = new global::Nitric.Proto.Deploy.v1.WebsocketTarget(); + DisconnectTarget = new global::Nitric.Proto.Deployments.v1.WebsocketTarget(); } input.ReadMessage(DisconnectTarget); break; } case 26: { if (messageTarget_ == null) { - MessageTarget = new global::Nitric.Proto.Deploy.v1.WebsocketTarget(); + MessageTarget = new global::Nitric.Proto.Deployments.v1.WebsocketTarget(); } input.ReadMessage(MessageTarget); break; @@ -4665,7 +4838,7 @@ public sealed partial class WebsocketTarget : pb::IMessage [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public static pbr::MessageDescriptor Descriptor { - get { return global::Nitric.Proto.Deploy.v1.DeployReflection.Descriptor.MessageTypes[22]; } + get { return global::Nitric.Proto.Deployments.v1.DeploymentsReflection.Descriptor.MessageTypes[21]; } } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] @@ -4683,8 +4856,8 @@ public WebsocketTarget() { [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public WebsocketTarget(WebsocketTarget other) : this() { switch (other.TargetCase) { - case TargetOneofCase.ExecutionUnit: - ExecutionUnit = other.ExecutionUnit; + case TargetOneofCase.Service: + Service = other.Service; break; } @@ -4696,17 +4869,17 @@ public WebsocketTarget Clone() { return new WebsocketTarget(this); } - /// Field number for the "execution_unit" field. - public const int ExecutionUnitFieldNumber = 1; + /// Field number for the "service" field. + public const int ServiceFieldNumber = 1; /// - /// The name of an execution unit to target + /// The name of an service to target /// [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public string ExecutionUnit { - get { return targetCase_ == TargetOneofCase.ExecutionUnit ? (string) target_ : ""; } + public string Service { + get { return targetCase_ == TargetOneofCase.Service ? (string) target_ : ""; } set { target_ = pb::ProtoPreconditions.CheckNotNull(value, "value"); - targetCase_ = TargetOneofCase.ExecutionUnit; + targetCase_ = TargetOneofCase.Service; } } @@ -4714,7 +4887,7 @@ public string ExecutionUnit { /// Enum of possible cases for the "target" oneof. public enum TargetOneofCase { None = 0, - ExecutionUnit = 1, + Service = 1, } private TargetOneofCase targetCase_ = TargetOneofCase.None; [global::System.Diagnostics.DebuggerNonUserCodeAttribute] @@ -4741,7 +4914,7 @@ public bool Equals(WebsocketTarget other) { if (ReferenceEquals(other, this)) { return true; } - if (ExecutionUnit != other.ExecutionUnit) return false; + if (Service != other.Service) return false; if (TargetCase != other.TargetCase) return false; return Equals(_unknownFields, other._unknownFields); } @@ -4749,7 +4922,7 @@ public bool Equals(WebsocketTarget other) { [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public override int GetHashCode() { int hash = 1; - if (targetCase_ == TargetOneofCase.ExecutionUnit) hash ^= ExecutionUnit.GetHashCode(); + if (targetCase_ == TargetOneofCase.Service) hash ^= Service.GetHashCode(); hash ^= (int) targetCase_; if (_unknownFields != null) { hash ^= _unknownFields.GetHashCode(); @@ -4767,9 +4940,9 @@ public void WriteTo(pb::CodedOutputStream output) { #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE output.WriteRawMessage(this); #else - if (targetCase_ == TargetOneofCase.ExecutionUnit) { + if (targetCase_ == TargetOneofCase.Service) { output.WriteRawTag(10); - output.WriteString(ExecutionUnit); + output.WriteString(Service); } if (_unknownFields != null) { _unknownFields.WriteTo(output); @@ -4780,9 +4953,9 @@ public void WriteTo(pb::CodedOutputStream output) { #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE [global::System.Diagnostics.DebuggerNonUserCodeAttribute] void pb::IBufferMessage.InternalWriteTo(ref pb::WriteContext output) { - if (targetCase_ == TargetOneofCase.ExecutionUnit) { + if (targetCase_ == TargetOneofCase.Service) { output.WriteRawTag(10); - output.WriteString(ExecutionUnit); + output.WriteString(Service); } if (_unknownFields != null) { _unknownFields.WriteTo(ref output); @@ -4793,8 +4966,8 @@ public void WriteTo(pb::CodedOutputStream output) { [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public int CalculateSize() { int size = 0; - if (targetCase_ == TargetOneofCase.ExecutionUnit) { - size += 1 + pb::CodedOutputStream.ComputeStringSize(ExecutionUnit); + if (targetCase_ == TargetOneofCase.Service) { + size += 1 + pb::CodedOutputStream.ComputeStringSize(Service); } if (_unknownFields != null) { size += _unknownFields.CalculateSize(); @@ -4808,8 +4981,8 @@ public void MergeFrom(WebsocketTarget other) { return; } switch (other.TargetCase) { - case TargetOneofCase.ExecutionUnit: - ExecutionUnit = other.ExecutionUnit; + case TargetOneofCase.Service: + Service = other.Service; break; } @@ -4828,7 +5001,7 @@ public void MergeFrom(pb::CodedInputStream input) { _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input); break; case 10: { - ExecutionUnit = input.ReadString(); + Service = input.ReadString(); break; } } @@ -4846,7 +5019,520 @@ public void MergeFrom(pb::CodedInputStream input) { _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, ref input); break; case 10: { - ExecutionUnit = input.ReadString(); + Service = input.ReadString(); + break; + } + } + } + } + #endif + + } + + public sealed partial class ScheduleTarget : pb::IMessage + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + , pb::IBufferMessage + #endif + { + private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new ScheduleTarget()); + private pb::UnknownFieldSet _unknownFields; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public static pb::MessageParser Parser { get { return _parser; } } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public static pbr::MessageDescriptor Descriptor { + get { return global::Nitric.Proto.Deployments.v1.DeploymentsReflection.Descriptor.MessageTypes[22]; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + pbr::MessageDescriptor pb::IMessage.Descriptor { + get { return Descriptor; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public ScheduleTarget() { + OnConstruction(); + } + + partial void OnConstruction(); + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public ScheduleTarget(ScheduleTarget other) : this() { + switch (other.TargetCase) { + case TargetOneofCase.Service: + Service = other.Service; + break; + } + + _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public ScheduleTarget Clone() { + return new ScheduleTarget(this); + } + + /// Field number for the "service" field. + public const int ServiceFieldNumber = 1; + /// + /// The name of an service to target + /// + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public string Service { + get { return targetCase_ == TargetOneofCase.Service ? (string) target_ : ""; } + set { + target_ = pb::ProtoPreconditions.CheckNotNull(value, "value"); + targetCase_ = TargetOneofCase.Service; + } + } + + private object target_; + /// Enum of possible cases for the "target" oneof. + public enum TargetOneofCase { + None = 0, + Service = 1, + } + private TargetOneofCase targetCase_ = TargetOneofCase.None; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public TargetOneofCase TargetCase { + get { return targetCase_; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public void ClearTarget() { + targetCase_ = TargetOneofCase.None; + target_ = null; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public override bool Equals(object other) { + return Equals(other as ScheduleTarget); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public bool Equals(ScheduleTarget other) { + if (ReferenceEquals(other, null)) { + return false; + } + if (ReferenceEquals(other, this)) { + return true; + } + if (Service != other.Service) return false; + if (TargetCase != other.TargetCase) return false; + return Equals(_unknownFields, other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public override int GetHashCode() { + int hash = 1; + if (targetCase_ == TargetOneofCase.Service) hash ^= Service.GetHashCode(); + hash ^= (int) targetCase_; + if (_unknownFields != null) { + hash ^= _unknownFields.GetHashCode(); + } + return hash; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public override string ToString() { + return pb::JsonFormatter.ToDiagnosticString(this); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public void WriteTo(pb::CodedOutputStream output) { + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + output.WriteRawMessage(this); + #else + if (targetCase_ == TargetOneofCase.Service) { + output.WriteRawTag(10); + output.WriteString(Service); + } + if (_unknownFields != null) { + _unknownFields.WriteTo(output); + } + #endif + } + + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + void pb::IBufferMessage.InternalWriteTo(ref pb::WriteContext output) { + if (targetCase_ == TargetOneofCase.Service) { + output.WriteRawTag(10); + output.WriteString(Service); + } + if (_unknownFields != null) { + _unknownFields.WriteTo(ref output); + } + } + #endif + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public int CalculateSize() { + int size = 0; + if (targetCase_ == TargetOneofCase.Service) { + size += 1 + pb::CodedOutputStream.ComputeStringSize(Service); + } + if (_unknownFields != null) { + size += _unknownFields.CalculateSize(); + } + return size; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public void MergeFrom(ScheduleTarget other) { + if (other == null) { + return; + } + switch (other.TargetCase) { + case TargetOneofCase.Service: + Service = other.Service; + break; + } + + _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public void MergeFrom(pb::CodedInputStream input) { + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + input.ReadRawMessage(this); + #else + uint tag; + while ((tag = input.ReadTag()) != 0) { + switch(tag) { + default: + _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input); + break; + case 10: { + Service = input.ReadString(); + break; + } + } + } + #endif + } + + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + void pb::IBufferMessage.InternalMergeFrom(ref pb::ParseContext input) { + uint tag; + while ((tag = input.ReadTag()) != 0) { + switch(tag) { + default: + _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, ref input); + break; + case 10: { + Service = input.ReadString(); + break; + } + } + } + } + #endif + + } + + public sealed partial class Schedule : pb::IMessage + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + , pb::IBufferMessage + #endif + { + private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new Schedule()); + private pb::UnknownFieldSet _unknownFields; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public static pb::MessageParser Parser { get { return _parser; } } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public static pbr::MessageDescriptor Descriptor { + get { return global::Nitric.Proto.Deployments.v1.DeploymentsReflection.Descriptor.MessageTypes[23]; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + pbr::MessageDescriptor pb::IMessage.Descriptor { + get { return Descriptor; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public Schedule() { + OnConstruction(); + } + + partial void OnConstruction(); + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public Schedule(Schedule other) : this() { + target_ = other.target_ != null ? other.target_.Clone() : null; + switch (other.CadenceCase) { + case CadenceOneofCase.Every: + Every = other.Every.Clone(); + break; + case CadenceOneofCase.Cron: + Cron = other.Cron.Clone(); + break; + } + + _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public Schedule Clone() { + return new Schedule(this); + } + + /// Field number for the "target" field. + public const int TargetFieldNumber = 1; + private global::Nitric.Proto.Deployments.v1.ScheduleTarget target_; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public global::Nitric.Proto.Deployments.v1.ScheduleTarget Target { + get { return target_; } + set { + target_ = value; + } + } + + /// Field number for the "every" field. + public const int EveryFieldNumber = 10; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public global::Nitric.Proto.Deployments.v1.ScheduleEvery Every { + get { return cadenceCase_ == CadenceOneofCase.Every ? (global::Nitric.Proto.Deployments.v1.ScheduleEvery) cadence_ : null; } + set { + cadence_ = value; + cadenceCase_ = value == null ? CadenceOneofCase.None : CadenceOneofCase.Every; + } + } + + /// Field number for the "cron" field. + public const int CronFieldNumber = 11; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public global::Nitric.Proto.Deployments.v1.ScheduleCron Cron { + get { return cadenceCase_ == CadenceOneofCase.Cron ? (global::Nitric.Proto.Deployments.v1.ScheduleCron) cadence_ : null; } + set { + cadence_ = value; + cadenceCase_ = value == null ? CadenceOneofCase.None : CadenceOneofCase.Cron; + } + } + + private object cadence_; + /// Enum of possible cases for the "cadence" oneof. + public enum CadenceOneofCase { + None = 0, + Every = 10, + Cron = 11, + } + private CadenceOneofCase cadenceCase_ = CadenceOneofCase.None; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public CadenceOneofCase CadenceCase { + get { return cadenceCase_; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public void ClearCadence() { + cadenceCase_ = CadenceOneofCase.None; + cadence_ = null; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public override bool Equals(object other) { + return Equals(other as Schedule); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public bool Equals(Schedule other) { + if (ReferenceEquals(other, null)) { + return false; + } + if (ReferenceEquals(other, this)) { + return true; + } + if (!object.Equals(Target, other.Target)) return false; + if (!object.Equals(Every, other.Every)) return false; + if (!object.Equals(Cron, other.Cron)) return false; + if (CadenceCase != other.CadenceCase) return false; + return Equals(_unknownFields, other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public override int GetHashCode() { + int hash = 1; + if (target_ != null) hash ^= Target.GetHashCode(); + if (cadenceCase_ == CadenceOneofCase.Every) hash ^= Every.GetHashCode(); + if (cadenceCase_ == CadenceOneofCase.Cron) hash ^= Cron.GetHashCode(); + hash ^= (int) cadenceCase_; + if (_unknownFields != null) { + hash ^= _unknownFields.GetHashCode(); + } + return hash; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public override string ToString() { + return pb::JsonFormatter.ToDiagnosticString(this); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public void WriteTo(pb::CodedOutputStream output) { + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + output.WriteRawMessage(this); + #else + if (target_ != null) { + output.WriteRawTag(10); + output.WriteMessage(Target); + } + if (cadenceCase_ == CadenceOneofCase.Every) { + output.WriteRawTag(82); + output.WriteMessage(Every); + } + if (cadenceCase_ == CadenceOneofCase.Cron) { + output.WriteRawTag(90); + output.WriteMessage(Cron); + } + if (_unknownFields != null) { + _unknownFields.WriteTo(output); + } + #endif + } + + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + void pb::IBufferMessage.InternalWriteTo(ref pb::WriteContext output) { + if (target_ != null) { + output.WriteRawTag(10); + output.WriteMessage(Target); + } + if (cadenceCase_ == CadenceOneofCase.Every) { + output.WriteRawTag(82); + output.WriteMessage(Every); + } + if (cadenceCase_ == CadenceOneofCase.Cron) { + output.WriteRawTag(90); + output.WriteMessage(Cron); + } + if (_unknownFields != null) { + _unknownFields.WriteTo(ref output); + } + } + #endif + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public int CalculateSize() { + int size = 0; + if (target_ != null) { + size += 1 + pb::CodedOutputStream.ComputeMessageSize(Target); + } + if (cadenceCase_ == CadenceOneofCase.Every) { + size += 1 + pb::CodedOutputStream.ComputeMessageSize(Every); + } + if (cadenceCase_ == CadenceOneofCase.Cron) { + size += 1 + pb::CodedOutputStream.ComputeMessageSize(Cron); + } + if (_unknownFields != null) { + size += _unknownFields.CalculateSize(); + } + return size; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public void MergeFrom(Schedule other) { + if (other == null) { + return; + } + if (other.target_ != null) { + if (target_ == null) { + Target = new global::Nitric.Proto.Deployments.v1.ScheduleTarget(); + } + Target.MergeFrom(other.Target); + } + switch (other.CadenceCase) { + case CadenceOneofCase.Every: + if (Every == null) { + Every = new global::Nitric.Proto.Deployments.v1.ScheduleEvery(); + } + Every.MergeFrom(other.Every); + break; + case CadenceOneofCase.Cron: + if (Cron == null) { + Cron = new global::Nitric.Proto.Deployments.v1.ScheduleCron(); + } + Cron.MergeFrom(other.Cron); + break; + } + + _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public void MergeFrom(pb::CodedInputStream input) { + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + input.ReadRawMessage(this); + #else + uint tag; + while ((tag = input.ReadTag()) != 0) { + switch(tag) { + default: + _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input); + break; + case 10: { + if (target_ == null) { + Target = new global::Nitric.Proto.Deployments.v1.ScheduleTarget(); + } + input.ReadMessage(Target); + break; + } + case 82: { + global::Nitric.Proto.Deployments.v1.ScheduleEvery subBuilder = new global::Nitric.Proto.Deployments.v1.ScheduleEvery(); + if (cadenceCase_ == CadenceOneofCase.Every) { + subBuilder.MergeFrom(Every); + } + input.ReadMessage(subBuilder); + Every = subBuilder; + break; + } + case 90: { + global::Nitric.Proto.Deployments.v1.ScheduleCron subBuilder = new global::Nitric.Proto.Deployments.v1.ScheduleCron(); + if (cadenceCase_ == CadenceOneofCase.Cron) { + subBuilder.MergeFrom(Cron); + } + input.ReadMessage(subBuilder); + Cron = subBuilder; + break; + } + } + } + #endif + } + + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + void pb::IBufferMessage.InternalMergeFrom(ref pb::ParseContext input) { + uint tag; + while ((tag = input.ReadTag()) != 0) { + switch(tag) { + default: + _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, ref input); + break; + case 10: { + if (target_ == null) { + Target = new global::Nitric.Proto.Deployments.v1.ScheduleTarget(); + } + input.ReadMessage(Target); + break; + } + case 82: { + global::Nitric.Proto.Deployments.v1.ScheduleEvery subBuilder = new global::Nitric.Proto.Deployments.v1.ScheduleEvery(); + if (cadenceCase_ == CadenceOneofCase.Every) { + subBuilder.MergeFrom(Every); + } + input.ReadMessage(subBuilder); + Every = subBuilder; + break; + } + case 90: { + global::Nitric.Proto.Deployments.v1.ScheduleCron subBuilder = new global::Nitric.Proto.Deployments.v1.ScheduleCron(); + if (cadenceCase_ == CadenceOneofCase.Cron) { + subBuilder.MergeFrom(Cron); + } + input.ReadMessage(subBuilder); + Cron = subBuilder; break; } } @@ -4856,19 +5542,19 @@ public void MergeFrom(pb::CodedInputStream input) { } - public sealed partial class ScheduleTarget : pb::IMessage + public sealed partial class ScheduleEvery : pb::IMessage #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE , pb::IBufferMessage #endif { - private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new ScheduleTarget()); + private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new ScheduleEvery()); private pb::UnknownFieldSet _unknownFields; [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public static pb::MessageParser Parser { get { return _parser; } } + public static pb::MessageParser Parser { get { return _parser; } } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public static pbr::MessageDescriptor Descriptor { - get { return global::Nitric.Proto.Deploy.v1.DeployReflection.Descriptor.MessageTypes[23]; } + get { return global::Nitric.Proto.Deployments.v1.DeploymentsReflection.Descriptor.MessageTypes[24]; } } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] @@ -4877,83 +5563,58 @@ public sealed partial class ScheduleTarget : pb::IMessage } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public ScheduleTarget() { + public ScheduleEvery() { OnConstruction(); } partial void OnConstruction(); [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public ScheduleTarget(ScheduleTarget other) : this() { - switch (other.TargetCase) { - case TargetOneofCase.ExecutionUnit: - ExecutionUnit = other.ExecutionUnit; - break; - } - + public ScheduleEvery(ScheduleEvery other) : this() { + rate_ = other.rate_; _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public ScheduleTarget Clone() { - return new ScheduleTarget(this); + public ScheduleEvery Clone() { + return new ScheduleEvery(this); } - /// Field number for the "execution_unit" field. - public const int ExecutionUnitFieldNumber = 1; + /// Field number for the "rate" field. + public const int RateFieldNumber = 1; + private string rate_ = ""; /// - /// The name of an execution unit to target + /// rate string e.g. '5 minutes'. Value frequencies are 'minutes', 'hours', 'days'. /// [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public string ExecutionUnit { - get { return targetCase_ == TargetOneofCase.ExecutionUnit ? (string) target_ : ""; } + public string Rate { + get { return rate_; } set { - target_ = pb::ProtoPreconditions.CheckNotNull(value, "value"); - targetCase_ = TargetOneofCase.ExecutionUnit; + rate_ = pb::ProtoPreconditions.CheckNotNull(value, "value"); } } - private object target_; - /// Enum of possible cases for the "target" oneof. - public enum TargetOneofCase { - None = 0, - ExecutionUnit = 1, - } - private TargetOneofCase targetCase_ = TargetOneofCase.None; - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public TargetOneofCase TargetCase { - get { return targetCase_; } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void ClearTarget() { - targetCase_ = TargetOneofCase.None; - target_ = null; - } - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public override bool Equals(object other) { - return Equals(other as ScheduleTarget); + return Equals(other as ScheduleEvery); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public bool Equals(ScheduleTarget other) { + public bool Equals(ScheduleEvery other) { if (ReferenceEquals(other, null)) { return false; } if (ReferenceEquals(other, this)) { return true; } - if (ExecutionUnit != other.ExecutionUnit) return false; - if (TargetCase != other.TargetCase) return false; + if (Rate != other.Rate) return false; return Equals(_unknownFields, other._unknownFields); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public override int GetHashCode() { int hash = 1; - if (targetCase_ == TargetOneofCase.ExecutionUnit) hash ^= ExecutionUnit.GetHashCode(); - hash ^= (int) targetCase_; + if (Rate.Length != 0) hash ^= Rate.GetHashCode(); if (_unknownFields != null) { hash ^= _unknownFields.GetHashCode(); } @@ -4970,9 +5631,9 @@ public void WriteTo(pb::CodedOutputStream output) { #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE output.WriteRawMessage(this); #else - if (targetCase_ == TargetOneofCase.ExecutionUnit) { + if (Rate.Length != 0) { output.WriteRawTag(10); - output.WriteString(ExecutionUnit); + output.WriteString(Rate); } if (_unknownFields != null) { _unknownFields.WriteTo(output); @@ -4983,9 +5644,9 @@ public void WriteTo(pb::CodedOutputStream output) { #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE [global::System.Diagnostics.DebuggerNonUserCodeAttribute] void pb::IBufferMessage.InternalWriteTo(ref pb::WriteContext output) { - if (targetCase_ == TargetOneofCase.ExecutionUnit) { + if (Rate.Length != 0) { output.WriteRawTag(10); - output.WriteString(ExecutionUnit); + output.WriteString(Rate); } if (_unknownFields != null) { _unknownFields.WriteTo(ref output); @@ -4996,8 +5657,8 @@ public void WriteTo(pb::CodedOutputStream output) { [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public int CalculateSize() { int size = 0; - if (targetCase_ == TargetOneofCase.ExecutionUnit) { - size += 1 + pb::CodedOutputStream.ComputeStringSize(ExecutionUnit); + if (Rate.Length != 0) { + size += 1 + pb::CodedOutputStream.ComputeStringSize(Rate); } if (_unknownFields != null) { size += _unknownFields.CalculateSize(); @@ -5006,16 +5667,13 @@ public int CalculateSize() { } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void MergeFrom(ScheduleTarget other) { + public void MergeFrom(ScheduleEvery other) { if (other == null) { return; } - switch (other.TargetCase) { - case TargetOneofCase.ExecutionUnit: - ExecutionUnit = other.ExecutionUnit; - break; + if (other.Rate.Length != 0) { + Rate = other.Rate; } - _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields); } @@ -5031,7 +5689,7 @@ public void MergeFrom(pb::CodedInputStream input) { _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input); break; case 10: { - ExecutionUnit = input.ReadString(); + Rate = input.ReadString(); break; } } @@ -5049,7 +5707,7 @@ public void MergeFrom(pb::CodedInputStream input) { _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, ref input); break; case 10: { - ExecutionUnit = input.ReadString(); + Rate = input.ReadString(); break; } } @@ -5059,19 +5717,19 @@ public void MergeFrom(pb::CodedInputStream input) { } - public sealed partial class Schedule : pb::IMessage + public sealed partial class ScheduleCron : pb::IMessage #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE , pb::IBufferMessage #endif { - private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new Schedule()); + private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new ScheduleCron()); private pb::UnknownFieldSet _unknownFields; [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public static pb::MessageParser Parser { get { return _parser; } } + public static pb::MessageParser Parser { get { return _parser; } } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public static pbr::MessageDescriptor Descriptor { - get { return global::Nitric.Proto.Deploy.v1.DeployReflection.Descriptor.MessageTypes[24]; } + get { return global::Nitric.Proto.Deployments.v1.DeploymentsReflection.Descriptor.MessageTypes[25]; } } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] @@ -5080,69 +5738,58 @@ public sealed partial class Schedule : pb::IMessage } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public Schedule() { + public ScheduleCron() { OnConstruction(); } partial void OnConstruction(); [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public Schedule(Schedule other) : this() { - cron_ = other.cron_; - target_ = other.target_ != null ? other.target_.Clone() : null; + public ScheduleCron(ScheduleCron other) : this() { + expression_ = other.expression_; _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public Schedule Clone() { - return new Schedule(this); - } - - /// Field number for the "cron" field. - public const int CronFieldNumber = 1; - private string cron_ = ""; - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public string Cron { - get { return cron_; } - set { - cron_ = pb::ProtoPreconditions.CheckNotNull(value, "value"); - } + public ScheduleCron Clone() { + return new ScheduleCron(this); } - /// Field number for the "target" field. - public const int TargetFieldNumber = 2; - private global::Nitric.Proto.Deploy.v1.ScheduleTarget target_; + /// Field number for the "expression" field. + public const int ExpressionFieldNumber = 1; + private string expression_ = ""; + /// + /// standard unix cron expression + /// [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public global::Nitric.Proto.Deploy.v1.ScheduleTarget Target { - get { return target_; } + public string Expression { + get { return expression_; } set { - target_ = value; + expression_ = pb::ProtoPreconditions.CheckNotNull(value, "value"); } } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public override bool Equals(object other) { - return Equals(other as Schedule); + return Equals(other as ScheduleCron); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public bool Equals(Schedule other) { + public bool Equals(ScheduleCron other) { if (ReferenceEquals(other, null)) { return false; } if (ReferenceEquals(other, this)) { return true; } - if (Cron != other.Cron) return false; - if (!object.Equals(Target, other.Target)) return false; + if (Expression != other.Expression) return false; return Equals(_unknownFields, other._unknownFields); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public override int GetHashCode() { int hash = 1; - if (Cron.Length != 0) hash ^= Cron.GetHashCode(); - if (target_ != null) hash ^= Target.GetHashCode(); + if (Expression.Length != 0) hash ^= Expression.GetHashCode(); if (_unknownFields != null) { hash ^= _unknownFields.GetHashCode(); } @@ -5159,13 +5806,9 @@ public void WriteTo(pb::CodedOutputStream output) { #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE output.WriteRawMessage(this); #else - if (Cron.Length != 0) { + if (Expression.Length != 0) { output.WriteRawTag(10); - output.WriteString(Cron); - } - if (target_ != null) { - output.WriteRawTag(18); - output.WriteMessage(Target); + output.WriteString(Expression); } if (_unknownFields != null) { _unknownFields.WriteTo(output); @@ -5176,13 +5819,9 @@ public void WriteTo(pb::CodedOutputStream output) { #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE [global::System.Diagnostics.DebuggerNonUserCodeAttribute] void pb::IBufferMessage.InternalWriteTo(ref pb::WriteContext output) { - if (Cron.Length != 0) { + if (Expression.Length != 0) { output.WriteRawTag(10); - output.WriteString(Cron); - } - if (target_ != null) { - output.WriteRawTag(18); - output.WriteMessage(Target); + output.WriteString(Expression); } if (_unknownFields != null) { _unknownFields.WriteTo(ref output); @@ -5193,11 +5832,8 @@ public void WriteTo(pb::CodedOutputStream output) { [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public int CalculateSize() { int size = 0; - if (Cron.Length != 0) { - size += 1 + pb::CodedOutputStream.ComputeStringSize(Cron); - } - if (target_ != null) { - size += 1 + pb::CodedOutputStream.ComputeMessageSize(Target); + if (Expression.Length != 0) { + size += 1 + pb::CodedOutputStream.ComputeStringSize(Expression); } if (_unknownFields != null) { size += _unknownFields.CalculateSize(); @@ -5206,18 +5842,12 @@ public int CalculateSize() { } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void MergeFrom(Schedule other) { + public void MergeFrom(ScheduleCron other) { if (other == null) { return; } - if (other.Cron.Length != 0) { - Cron = other.Cron; - } - if (other.target_ != null) { - if (target_ == null) { - Target = new global::Nitric.Proto.Deploy.v1.ScheduleTarget(); - } - Target.MergeFrom(other.Target); + if (other.Expression.Length != 0) { + Expression = other.Expression; } _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields); } @@ -5234,14 +5864,7 @@ public void MergeFrom(pb::CodedInputStream input) { _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input); break; case 10: { - Cron = input.ReadString(); - break; - } - case 18: { - if (target_ == null) { - Target = new global::Nitric.Proto.Deploy.v1.ScheduleTarget(); - } - input.ReadMessage(Target); + Expression = input.ReadString(); break; } } @@ -5259,14 +5882,7 @@ public void MergeFrom(pb::CodedInputStream input) { _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, ref input); break; case 10: { - Cron = input.ReadString(); - break; - } - case 18: { - if (target_ == null) { - Target = new global::Nitric.Proto.Deploy.v1.ScheduleTarget(); - } - input.ReadMessage(Target); + Expression = input.ReadString(); break; } } @@ -5288,7 +5904,7 @@ public sealed partial class Resource : pb::IMessage [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public static pbr::MessageDescriptor Descriptor { - get { return global::Nitric.Proto.Deploy.v1.DeployReflection.Descriptor.MessageTypes[25]; } + get { return global::Nitric.Proto.Deployments.v1.DeploymentsReflection.Descriptor.MessageTypes[26]; } } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] @@ -5305,11 +5921,10 @@ public Resource() { [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public Resource(Resource other) : this() { - name_ = other.name_; - type_ = other.type_; + id_ = other.id_ != null ? other.id_.Clone() : null; switch (other.ConfigCase) { - case ConfigOneofCase.ExecutionUnit: - ExecutionUnit = other.ExecutionUnit.Clone(); + case ConfigOneofCase.Service: + Service = other.Service.Clone(); break; case ConfigOneofCase.Bucket: Bucket = other.Bucket.Clone(); @@ -5317,9 +5932,6 @@ public Resource(Resource other) : this() { case ConfigOneofCase.Topic: Topic = other.Topic.Clone(); break; - case ConfigOneofCase.Queue: - Queue = other.Queue.Clone(); - break; case ConfigOneofCase.Api: Api = other.Api.Clone(); break; @@ -5329,8 +5941,8 @@ public Resource(Resource other) : this() { case ConfigOneofCase.Schedule: Schedule = other.Schedule.Clone(); break; - case ConfigOneofCase.Collection: - Collection = other.Collection.Clone(); + case ConfigOneofCase.KeyValueStore: + KeyValueStore = other.KeyValueStore.Clone(); break; case ConfigOneofCase.Secret: Secret = other.Secret.Clone(); @@ -5341,6 +5953,9 @@ public Resource(Resource other) : this() { case ConfigOneofCase.Http: Http = other.Http.Clone(); break; + case ConfigOneofCase.Queue: + Queue = other.Queue.Clone(); + break; } _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields); @@ -5351,44 +5966,33 @@ public Resource Clone() { return new Resource(this); } - /// Field number for the "name" field. - public const int NameFieldNumber = 1; - private string name_ = ""; - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public string Name { - get { return name_; } - set { - name_ = pb::ProtoPreconditions.CheckNotNull(value, "value"); - } - } - - /// Field number for the "type" field. - public const int TypeFieldNumber = 2; - private global::Nitric.Proto.Resource.v1.ResourceType type_ = global::Nitric.Proto.Resource.v1.ResourceType.Api; + /// Field number for the "id" field. + public const int IdFieldNumber = 1; + private global::Nitric.Proto.Resources.v1.ResourceIdentifier id_; [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public global::Nitric.Proto.Resource.v1.ResourceType Type { - get { return type_; } + public global::Nitric.Proto.Resources.v1.ResourceIdentifier Id { + get { return id_; } set { - type_ = value; + id_ = value; } } - /// Field number for the "execution_unit" field. - public const int ExecutionUnitFieldNumber = 10; + /// Field number for the "service" field. + public const int ServiceFieldNumber = 10; [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public global::Nitric.Proto.Deploy.v1.ExecutionUnit ExecutionUnit { - get { return configCase_ == ConfigOneofCase.ExecutionUnit ? (global::Nitric.Proto.Deploy.v1.ExecutionUnit) config_ : null; } + public global::Nitric.Proto.Deployments.v1.Service Service { + get { return configCase_ == ConfigOneofCase.Service ? (global::Nitric.Proto.Deployments.v1.Service) config_ : null; } set { config_ = value; - configCase_ = value == null ? ConfigOneofCase.None : ConfigOneofCase.ExecutionUnit; + configCase_ = value == null ? ConfigOneofCase.None : ConfigOneofCase.Service; } } /// Field number for the "bucket" field. public const int BucketFieldNumber = 11; [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public global::Nitric.Proto.Deploy.v1.Bucket Bucket { - get { return configCase_ == ConfigOneofCase.Bucket ? (global::Nitric.Proto.Deploy.v1.Bucket) config_ : null; } + public global::Nitric.Proto.Deployments.v1.Bucket Bucket { + get { return configCase_ == ConfigOneofCase.Bucket ? (global::Nitric.Proto.Deployments.v1.Bucket) config_ : null; } set { config_ = value; configCase_ = value == null ? ConfigOneofCase.None : ConfigOneofCase.Bucket; @@ -5398,30 +6002,19 @@ public string Name { /// Field number for the "topic" field. public const int TopicFieldNumber = 12; [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public global::Nitric.Proto.Deploy.v1.Topic Topic { - get { return configCase_ == ConfigOneofCase.Topic ? (global::Nitric.Proto.Deploy.v1.Topic) config_ : null; } + public global::Nitric.Proto.Deployments.v1.Topic Topic { + get { return configCase_ == ConfigOneofCase.Topic ? (global::Nitric.Proto.Deployments.v1.Topic) config_ : null; } set { config_ = value; configCase_ = value == null ? ConfigOneofCase.None : ConfigOneofCase.Topic; } } - /// Field number for the "queue" field. - public const int QueueFieldNumber = 13; - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public global::Nitric.Proto.Deploy.v1.Queue Queue { - get { return configCase_ == ConfigOneofCase.Queue ? (global::Nitric.Proto.Deploy.v1.Queue) config_ : null; } - set { - config_ = value; - configCase_ = value == null ? ConfigOneofCase.None : ConfigOneofCase.Queue; - } - } - /// Field number for the "api" field. - public const int ApiFieldNumber = 14; + public const int ApiFieldNumber = 13; [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public global::Nitric.Proto.Deploy.v1.Api Api { - get { return configCase_ == ConfigOneofCase.Api ? (global::Nitric.Proto.Deploy.v1.Api) config_ : null; } + public global::Nitric.Proto.Deployments.v1.Api Api { + get { return configCase_ == ConfigOneofCase.Api ? (global::Nitric.Proto.Deployments.v1.Api) config_ : null; } set { config_ = value; configCase_ = value == null ? ConfigOneofCase.None : ConfigOneofCase.Api; @@ -5429,10 +6022,10 @@ public string Name { } /// Field number for the "policy" field. - public const int PolicyFieldNumber = 15; + public const int PolicyFieldNumber = 14; [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public global::Nitric.Proto.Deploy.v1.Policy Policy { - get { return configCase_ == ConfigOneofCase.Policy ? (global::Nitric.Proto.Deploy.v1.Policy) config_ : null; } + public global::Nitric.Proto.Deployments.v1.Policy Policy { + get { return configCase_ == ConfigOneofCase.Policy ? (global::Nitric.Proto.Deployments.v1.Policy) config_ : null; } set { config_ = value; configCase_ = value == null ? ConfigOneofCase.None : ConfigOneofCase.Policy; @@ -5440,32 +6033,32 @@ public string Name { } /// Field number for the "schedule" field. - public const int ScheduleFieldNumber = 16; + public const int ScheduleFieldNumber = 15; [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public global::Nitric.Proto.Deploy.v1.Schedule Schedule { - get { return configCase_ == ConfigOneofCase.Schedule ? (global::Nitric.Proto.Deploy.v1.Schedule) config_ : null; } + public global::Nitric.Proto.Deployments.v1.Schedule Schedule { + get { return configCase_ == ConfigOneofCase.Schedule ? (global::Nitric.Proto.Deployments.v1.Schedule) config_ : null; } set { config_ = value; configCase_ = value == null ? ConfigOneofCase.None : ConfigOneofCase.Schedule; } } - /// Field number for the "collection" field. - public const int CollectionFieldNumber = 17; + /// Field number for the "key_value_store" field. + public const int KeyValueStoreFieldNumber = 16; [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public global::Nitric.Proto.Deploy.v1.Collection Collection { - get { return configCase_ == ConfigOneofCase.Collection ? (global::Nitric.Proto.Deploy.v1.Collection) config_ : null; } + public global::Nitric.Proto.Deployments.v1.KeyValueStore KeyValueStore { + get { return configCase_ == ConfigOneofCase.KeyValueStore ? (global::Nitric.Proto.Deployments.v1.KeyValueStore) config_ : null; } set { config_ = value; - configCase_ = value == null ? ConfigOneofCase.None : ConfigOneofCase.Collection; + configCase_ = value == null ? ConfigOneofCase.None : ConfigOneofCase.KeyValueStore; } } /// Field number for the "secret" field. - public const int SecretFieldNumber = 18; + public const int SecretFieldNumber = 17; [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public global::Nitric.Proto.Deploy.v1.Secret Secret { - get { return configCase_ == ConfigOneofCase.Secret ? (global::Nitric.Proto.Deploy.v1.Secret) config_ : null; } + public global::Nitric.Proto.Deployments.v1.Secret Secret { + get { return configCase_ == ConfigOneofCase.Secret ? (global::Nitric.Proto.Deployments.v1.Secret) config_ : null; } set { config_ = value; configCase_ = value == null ? ConfigOneofCase.None : ConfigOneofCase.Secret; @@ -5473,10 +6066,10 @@ public string Name { } /// Field number for the "websocket" field. - public const int WebsocketFieldNumber = 19; + public const int WebsocketFieldNumber = 18; [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public global::Nitric.Proto.Deploy.v1.Websocket Websocket { - get { return configCase_ == ConfigOneofCase.Websocket ? (global::Nitric.Proto.Deploy.v1.Websocket) config_ : null; } + public global::Nitric.Proto.Deployments.v1.Websocket Websocket { + get { return configCase_ == ConfigOneofCase.Websocket ? (global::Nitric.Proto.Deployments.v1.Websocket) config_ : null; } set { config_ = value; configCase_ = value == null ? ConfigOneofCase.None : ConfigOneofCase.Websocket; @@ -5484,31 +6077,42 @@ public string Name { } /// Field number for the "http" field. - public const int HttpFieldNumber = 20; + public const int HttpFieldNumber = 19; [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public global::Nitric.Proto.Deploy.v1.Http Http { - get { return configCase_ == ConfigOneofCase.Http ? (global::Nitric.Proto.Deploy.v1.Http) config_ : null; } + public global::Nitric.Proto.Deployments.v1.Http Http { + get { return configCase_ == ConfigOneofCase.Http ? (global::Nitric.Proto.Deployments.v1.Http) config_ : null; } set { config_ = value; configCase_ = value == null ? ConfigOneofCase.None : ConfigOneofCase.Http; } } + /// Field number for the "queue" field. + public const int QueueFieldNumber = 20; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public global::Nitric.Proto.Deployments.v1.Queue Queue { + get { return configCase_ == ConfigOneofCase.Queue ? (global::Nitric.Proto.Deployments.v1.Queue) config_ : null; } + set { + config_ = value; + configCase_ = value == null ? ConfigOneofCase.None : ConfigOneofCase.Queue; + } + } + private object config_; /// Enum of possible cases for the "config" oneof. public enum ConfigOneofCase { None = 0, - ExecutionUnit = 10, + Service = 10, Bucket = 11, Topic = 12, - Queue = 13, - Api = 14, - Policy = 15, - Schedule = 16, - Collection = 17, - Secret = 18, - Websocket = 19, - Http = 20, + Api = 13, + Policy = 14, + Schedule = 15, + KeyValueStore = 16, + Secret = 17, + Websocket = 18, + Http = 19, + Queue = 20, } private ConfigOneofCase configCase_ = ConfigOneofCase.None; [global::System.Diagnostics.DebuggerNonUserCodeAttribute] @@ -5535,19 +6139,18 @@ public bool Equals(Resource other) { if (ReferenceEquals(other, this)) { return true; } - if (Name != other.Name) return false; - if (Type != other.Type) return false; - if (!object.Equals(ExecutionUnit, other.ExecutionUnit)) return false; + if (!object.Equals(Id, other.Id)) return false; + if (!object.Equals(Service, other.Service)) return false; if (!object.Equals(Bucket, other.Bucket)) return false; if (!object.Equals(Topic, other.Topic)) return false; - if (!object.Equals(Queue, other.Queue)) return false; if (!object.Equals(Api, other.Api)) return false; if (!object.Equals(Policy, other.Policy)) return false; if (!object.Equals(Schedule, other.Schedule)) return false; - if (!object.Equals(Collection, other.Collection)) return false; + if (!object.Equals(KeyValueStore, other.KeyValueStore)) return false; if (!object.Equals(Secret, other.Secret)) return false; if (!object.Equals(Websocket, other.Websocket)) return false; if (!object.Equals(Http, other.Http)) return false; + if (!object.Equals(Queue, other.Queue)) return false; if (ConfigCase != other.ConfigCase) return false; return Equals(_unknownFields, other._unknownFields); } @@ -5555,19 +6158,18 @@ public bool Equals(Resource other) { [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public override int GetHashCode() { int hash = 1; - if (Name.Length != 0) hash ^= Name.GetHashCode(); - if (Type != global::Nitric.Proto.Resource.v1.ResourceType.Api) hash ^= Type.GetHashCode(); - if (configCase_ == ConfigOneofCase.ExecutionUnit) hash ^= ExecutionUnit.GetHashCode(); + if (id_ != null) hash ^= Id.GetHashCode(); + if (configCase_ == ConfigOneofCase.Service) hash ^= Service.GetHashCode(); if (configCase_ == ConfigOneofCase.Bucket) hash ^= Bucket.GetHashCode(); if (configCase_ == ConfigOneofCase.Topic) hash ^= Topic.GetHashCode(); - if (configCase_ == ConfigOneofCase.Queue) hash ^= Queue.GetHashCode(); if (configCase_ == ConfigOneofCase.Api) hash ^= Api.GetHashCode(); if (configCase_ == ConfigOneofCase.Policy) hash ^= Policy.GetHashCode(); if (configCase_ == ConfigOneofCase.Schedule) hash ^= Schedule.GetHashCode(); - if (configCase_ == ConfigOneofCase.Collection) hash ^= Collection.GetHashCode(); + if (configCase_ == ConfigOneofCase.KeyValueStore) hash ^= KeyValueStore.GetHashCode(); if (configCase_ == ConfigOneofCase.Secret) hash ^= Secret.GetHashCode(); if (configCase_ == ConfigOneofCase.Websocket) hash ^= Websocket.GetHashCode(); if (configCase_ == ConfigOneofCase.Http) hash ^= Http.GetHashCode(); + if (configCase_ == ConfigOneofCase.Queue) hash ^= Queue.GetHashCode(); hash ^= (int) configCase_; if (_unknownFields != null) { hash ^= _unknownFields.GetHashCode(); @@ -5585,17 +6187,13 @@ public void WriteTo(pb::CodedOutputStream output) { #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE output.WriteRawMessage(this); #else - if (Name.Length != 0) { + if (id_ != null) { output.WriteRawTag(10); - output.WriteString(Name); - } - if (Type != global::Nitric.Proto.Resource.v1.ResourceType.Api) { - output.WriteRawTag(16); - output.WriteEnum((int) Type); + output.WriteMessage(Id); } - if (configCase_ == ConfigOneofCase.ExecutionUnit) { + if (configCase_ == ConfigOneofCase.Service) { output.WriteRawTag(82); - output.WriteMessage(ExecutionUnit); + output.WriteMessage(Service); } if (configCase_ == ConfigOneofCase.Bucket) { output.WriteRawTag(90); @@ -5605,38 +6203,38 @@ public void WriteTo(pb::CodedOutputStream output) { output.WriteRawTag(98); output.WriteMessage(Topic); } - if (configCase_ == ConfigOneofCase.Queue) { - output.WriteRawTag(106); - output.WriteMessage(Queue); - } if (configCase_ == ConfigOneofCase.Api) { - output.WriteRawTag(114); + output.WriteRawTag(106); output.WriteMessage(Api); } if (configCase_ == ConfigOneofCase.Policy) { - output.WriteRawTag(122); + output.WriteRawTag(114); output.WriteMessage(Policy); } if (configCase_ == ConfigOneofCase.Schedule) { - output.WriteRawTag(130, 1); + output.WriteRawTag(122); output.WriteMessage(Schedule); } - if (configCase_ == ConfigOneofCase.Collection) { - output.WriteRawTag(138, 1); - output.WriteMessage(Collection); + if (configCase_ == ConfigOneofCase.KeyValueStore) { + output.WriteRawTag(130, 1); + output.WriteMessage(KeyValueStore); } if (configCase_ == ConfigOneofCase.Secret) { - output.WriteRawTag(146, 1); + output.WriteRawTag(138, 1); output.WriteMessage(Secret); } if (configCase_ == ConfigOneofCase.Websocket) { - output.WriteRawTag(154, 1); + output.WriteRawTag(146, 1); output.WriteMessage(Websocket); } if (configCase_ == ConfigOneofCase.Http) { - output.WriteRawTag(162, 1); + output.WriteRawTag(154, 1); output.WriteMessage(Http); } + if (configCase_ == ConfigOneofCase.Queue) { + output.WriteRawTag(162, 1); + output.WriteMessage(Queue); + } if (_unknownFields != null) { _unknownFields.WriteTo(output); } @@ -5646,17 +6244,13 @@ public void WriteTo(pb::CodedOutputStream output) { #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE [global::System.Diagnostics.DebuggerNonUserCodeAttribute] void pb::IBufferMessage.InternalWriteTo(ref pb::WriteContext output) { - if (Name.Length != 0) { + if (id_ != null) { output.WriteRawTag(10); - output.WriteString(Name); - } - if (Type != global::Nitric.Proto.Resource.v1.ResourceType.Api) { - output.WriteRawTag(16); - output.WriteEnum((int) Type); + output.WriteMessage(Id); } - if (configCase_ == ConfigOneofCase.ExecutionUnit) { + if (configCase_ == ConfigOneofCase.Service) { output.WriteRawTag(82); - output.WriteMessage(ExecutionUnit); + output.WriteMessage(Service); } if (configCase_ == ConfigOneofCase.Bucket) { output.WriteRawTag(90); @@ -5666,38 +6260,38 @@ public void WriteTo(pb::CodedOutputStream output) { output.WriteRawTag(98); output.WriteMessage(Topic); } - if (configCase_ == ConfigOneofCase.Queue) { - output.WriteRawTag(106); - output.WriteMessage(Queue); - } if (configCase_ == ConfigOneofCase.Api) { - output.WriteRawTag(114); + output.WriteRawTag(106); output.WriteMessage(Api); } if (configCase_ == ConfigOneofCase.Policy) { - output.WriteRawTag(122); + output.WriteRawTag(114); output.WriteMessage(Policy); } if (configCase_ == ConfigOneofCase.Schedule) { - output.WriteRawTag(130, 1); + output.WriteRawTag(122); output.WriteMessage(Schedule); } - if (configCase_ == ConfigOneofCase.Collection) { - output.WriteRawTag(138, 1); - output.WriteMessage(Collection); + if (configCase_ == ConfigOneofCase.KeyValueStore) { + output.WriteRawTag(130, 1); + output.WriteMessage(KeyValueStore); } if (configCase_ == ConfigOneofCase.Secret) { - output.WriteRawTag(146, 1); + output.WriteRawTag(138, 1); output.WriteMessage(Secret); } if (configCase_ == ConfigOneofCase.Websocket) { - output.WriteRawTag(154, 1); + output.WriteRawTag(146, 1); output.WriteMessage(Websocket); } if (configCase_ == ConfigOneofCase.Http) { - output.WriteRawTag(162, 1); + output.WriteRawTag(154, 1); output.WriteMessage(Http); } + if (configCase_ == ConfigOneofCase.Queue) { + output.WriteRawTag(162, 1); + output.WriteMessage(Queue); + } if (_unknownFields != null) { _unknownFields.WriteTo(ref output); } @@ -5707,14 +6301,11 @@ public void WriteTo(pb::CodedOutputStream output) { [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public int CalculateSize() { int size = 0; - if (Name.Length != 0) { - size += 1 + pb::CodedOutputStream.ComputeStringSize(Name); + if (id_ != null) { + size += 1 + pb::CodedOutputStream.ComputeMessageSize(Id); } - if (Type != global::Nitric.Proto.Resource.v1.ResourceType.Api) { - size += 1 + pb::CodedOutputStream.ComputeEnumSize((int) Type); - } - if (configCase_ == ConfigOneofCase.ExecutionUnit) { - size += 1 + pb::CodedOutputStream.ComputeMessageSize(ExecutionUnit); + if (configCase_ == ConfigOneofCase.Service) { + size += 1 + pb::CodedOutputStream.ComputeMessageSize(Service); } if (configCase_ == ConfigOneofCase.Bucket) { size += 1 + pb::CodedOutputStream.ComputeMessageSize(Bucket); @@ -5722,9 +6313,6 @@ public int CalculateSize() { if (configCase_ == ConfigOneofCase.Topic) { size += 1 + pb::CodedOutputStream.ComputeMessageSize(Topic); } - if (configCase_ == ConfigOneofCase.Queue) { - size += 1 + pb::CodedOutputStream.ComputeMessageSize(Queue); - } if (configCase_ == ConfigOneofCase.Api) { size += 1 + pb::CodedOutputStream.ComputeMessageSize(Api); } @@ -5732,10 +6320,10 @@ public int CalculateSize() { size += 1 + pb::CodedOutputStream.ComputeMessageSize(Policy); } if (configCase_ == ConfigOneofCase.Schedule) { - size += 2 + pb::CodedOutputStream.ComputeMessageSize(Schedule); + size += 1 + pb::CodedOutputStream.ComputeMessageSize(Schedule); } - if (configCase_ == ConfigOneofCase.Collection) { - size += 2 + pb::CodedOutputStream.ComputeMessageSize(Collection); + if (configCase_ == ConfigOneofCase.KeyValueStore) { + size += 2 + pb::CodedOutputStream.ComputeMessageSize(KeyValueStore); } if (configCase_ == ConfigOneofCase.Secret) { size += 2 + pb::CodedOutputStream.ComputeMessageSize(Secret); @@ -5746,6 +6334,9 @@ public int CalculateSize() { if (configCase_ == ConfigOneofCase.Http) { size += 2 + pb::CodedOutputStream.ComputeMessageSize(Http); } + if (configCase_ == ConfigOneofCase.Queue) { + size += 2 + pb::CodedOutputStream.ComputeMessageSize(Queue); + } if (_unknownFields != null) { size += _unknownFields.CalculateSize(); } @@ -5757,79 +6348,79 @@ public void MergeFrom(Resource other) { if (other == null) { return; } - if (other.Name.Length != 0) { - Name = other.Name; - } - if (other.Type != global::Nitric.Proto.Resource.v1.ResourceType.Api) { - Type = other.Type; + if (other.id_ != null) { + if (id_ == null) { + Id = new global::Nitric.Proto.Resources.v1.ResourceIdentifier(); + } + Id.MergeFrom(other.Id); } switch (other.ConfigCase) { - case ConfigOneofCase.ExecutionUnit: - if (ExecutionUnit == null) { - ExecutionUnit = new global::Nitric.Proto.Deploy.v1.ExecutionUnit(); + case ConfigOneofCase.Service: + if (Service == null) { + Service = new global::Nitric.Proto.Deployments.v1.Service(); } - ExecutionUnit.MergeFrom(other.ExecutionUnit); + Service.MergeFrom(other.Service); break; case ConfigOneofCase.Bucket: if (Bucket == null) { - Bucket = new global::Nitric.Proto.Deploy.v1.Bucket(); + Bucket = new global::Nitric.Proto.Deployments.v1.Bucket(); } Bucket.MergeFrom(other.Bucket); break; case ConfigOneofCase.Topic: if (Topic == null) { - Topic = new global::Nitric.Proto.Deploy.v1.Topic(); + Topic = new global::Nitric.Proto.Deployments.v1.Topic(); } Topic.MergeFrom(other.Topic); break; - case ConfigOneofCase.Queue: - if (Queue == null) { - Queue = new global::Nitric.Proto.Deploy.v1.Queue(); - } - Queue.MergeFrom(other.Queue); - break; case ConfigOneofCase.Api: if (Api == null) { - Api = new global::Nitric.Proto.Deploy.v1.Api(); + Api = new global::Nitric.Proto.Deployments.v1.Api(); } Api.MergeFrom(other.Api); break; case ConfigOneofCase.Policy: if (Policy == null) { - Policy = new global::Nitric.Proto.Deploy.v1.Policy(); + Policy = new global::Nitric.Proto.Deployments.v1.Policy(); } Policy.MergeFrom(other.Policy); break; case ConfigOneofCase.Schedule: if (Schedule == null) { - Schedule = new global::Nitric.Proto.Deploy.v1.Schedule(); + Schedule = new global::Nitric.Proto.Deployments.v1.Schedule(); } Schedule.MergeFrom(other.Schedule); break; - case ConfigOneofCase.Collection: - if (Collection == null) { - Collection = new global::Nitric.Proto.Deploy.v1.Collection(); + case ConfigOneofCase.KeyValueStore: + if (KeyValueStore == null) { + KeyValueStore = new global::Nitric.Proto.Deployments.v1.KeyValueStore(); } - Collection.MergeFrom(other.Collection); + KeyValueStore.MergeFrom(other.KeyValueStore); break; case ConfigOneofCase.Secret: if (Secret == null) { - Secret = new global::Nitric.Proto.Deploy.v1.Secret(); + Secret = new global::Nitric.Proto.Deployments.v1.Secret(); } Secret.MergeFrom(other.Secret); break; case ConfigOneofCase.Websocket: if (Websocket == null) { - Websocket = new global::Nitric.Proto.Deploy.v1.Websocket(); + Websocket = new global::Nitric.Proto.Deployments.v1.Websocket(); } Websocket.MergeFrom(other.Websocket); break; case ConfigOneofCase.Http: if (Http == null) { - Http = new global::Nitric.Proto.Deploy.v1.Http(); + Http = new global::Nitric.Proto.Deployments.v1.Http(); } Http.MergeFrom(other.Http); break; + case ConfigOneofCase.Queue: + if (Queue == null) { + Queue = new global::Nitric.Proto.Deployments.v1.Queue(); + } + Queue.MergeFrom(other.Queue); + break; } _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields); @@ -5847,24 +6438,23 @@ public void MergeFrom(pb::CodedInputStream input) { _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input); break; case 10: { - Name = input.ReadString(); - break; - } - case 16: { - Type = (global::Nitric.Proto.Resource.v1.ResourceType) input.ReadEnum(); + if (id_ == null) { + Id = new global::Nitric.Proto.Resources.v1.ResourceIdentifier(); + } + input.ReadMessage(Id); break; } case 82: { - global::Nitric.Proto.Deploy.v1.ExecutionUnit subBuilder = new global::Nitric.Proto.Deploy.v1.ExecutionUnit(); - if (configCase_ == ConfigOneofCase.ExecutionUnit) { - subBuilder.MergeFrom(ExecutionUnit); + global::Nitric.Proto.Deployments.v1.Service subBuilder = new global::Nitric.Proto.Deployments.v1.Service(); + if (configCase_ == ConfigOneofCase.Service) { + subBuilder.MergeFrom(Service); } input.ReadMessage(subBuilder); - ExecutionUnit = subBuilder; + Service = subBuilder; break; } case 90: { - global::Nitric.Proto.Deploy.v1.Bucket subBuilder = new global::Nitric.Proto.Deploy.v1.Bucket(); + global::Nitric.Proto.Deployments.v1.Bucket subBuilder = new global::Nitric.Proto.Deployments.v1.Bucket(); if (configCase_ == ConfigOneofCase.Bucket) { subBuilder.MergeFrom(Bucket); } @@ -5873,7 +6463,7 @@ public void MergeFrom(pb::CodedInputStream input) { break; } case 98: { - global::Nitric.Proto.Deploy.v1.Topic subBuilder = new global::Nitric.Proto.Deploy.v1.Topic(); + global::Nitric.Proto.Deployments.v1.Topic subBuilder = new global::Nitric.Proto.Deployments.v1.Topic(); if (configCase_ == ConfigOneofCase.Topic) { subBuilder.MergeFrom(Topic); } @@ -5882,16 +6472,7 @@ public void MergeFrom(pb::CodedInputStream input) { break; } case 106: { - global::Nitric.Proto.Deploy.v1.Queue subBuilder = new global::Nitric.Proto.Deploy.v1.Queue(); - if (configCase_ == ConfigOneofCase.Queue) { - subBuilder.MergeFrom(Queue); - } - input.ReadMessage(subBuilder); - Queue = subBuilder; - break; - } - case 114: { - global::Nitric.Proto.Deploy.v1.Api subBuilder = new global::Nitric.Proto.Deploy.v1.Api(); + global::Nitric.Proto.Deployments.v1.Api subBuilder = new global::Nitric.Proto.Deployments.v1.Api(); if (configCase_ == ConfigOneofCase.Api) { subBuilder.MergeFrom(Api); } @@ -5899,8 +6480,8 @@ public void MergeFrom(pb::CodedInputStream input) { Api = subBuilder; break; } - case 122: { - global::Nitric.Proto.Deploy.v1.Policy subBuilder = new global::Nitric.Proto.Deploy.v1.Policy(); + case 114: { + global::Nitric.Proto.Deployments.v1.Policy subBuilder = new global::Nitric.Proto.Deployments.v1.Policy(); if (configCase_ == ConfigOneofCase.Policy) { subBuilder.MergeFrom(Policy); } @@ -5908,8 +6489,8 @@ public void MergeFrom(pb::CodedInputStream input) { Policy = subBuilder; break; } - case 130: { - global::Nitric.Proto.Deploy.v1.Schedule subBuilder = new global::Nitric.Proto.Deploy.v1.Schedule(); + case 122: { + global::Nitric.Proto.Deployments.v1.Schedule subBuilder = new global::Nitric.Proto.Deployments.v1.Schedule(); if (configCase_ == ConfigOneofCase.Schedule) { subBuilder.MergeFrom(Schedule); } @@ -5917,17 +6498,17 @@ public void MergeFrom(pb::CodedInputStream input) { Schedule = subBuilder; break; } - case 138: { - global::Nitric.Proto.Deploy.v1.Collection subBuilder = new global::Nitric.Proto.Deploy.v1.Collection(); - if (configCase_ == ConfigOneofCase.Collection) { - subBuilder.MergeFrom(Collection); + case 130: { + global::Nitric.Proto.Deployments.v1.KeyValueStore subBuilder = new global::Nitric.Proto.Deployments.v1.KeyValueStore(); + if (configCase_ == ConfigOneofCase.KeyValueStore) { + subBuilder.MergeFrom(KeyValueStore); } input.ReadMessage(subBuilder); - Collection = subBuilder; + KeyValueStore = subBuilder; break; } - case 146: { - global::Nitric.Proto.Deploy.v1.Secret subBuilder = new global::Nitric.Proto.Deploy.v1.Secret(); + case 138: { + global::Nitric.Proto.Deployments.v1.Secret subBuilder = new global::Nitric.Proto.Deployments.v1.Secret(); if (configCase_ == ConfigOneofCase.Secret) { subBuilder.MergeFrom(Secret); } @@ -5935,8 +6516,8 @@ public void MergeFrom(pb::CodedInputStream input) { Secret = subBuilder; break; } - case 154: { - global::Nitric.Proto.Deploy.v1.Websocket subBuilder = new global::Nitric.Proto.Deploy.v1.Websocket(); + case 146: { + global::Nitric.Proto.Deployments.v1.Websocket subBuilder = new global::Nitric.Proto.Deployments.v1.Websocket(); if (configCase_ == ConfigOneofCase.Websocket) { subBuilder.MergeFrom(Websocket); } @@ -5944,8 +6525,8 @@ public void MergeFrom(pb::CodedInputStream input) { Websocket = subBuilder; break; } - case 162: { - global::Nitric.Proto.Deploy.v1.Http subBuilder = new global::Nitric.Proto.Deploy.v1.Http(); + case 154: { + global::Nitric.Proto.Deployments.v1.Http subBuilder = new global::Nitric.Proto.Deployments.v1.Http(); if (configCase_ == ConfigOneofCase.Http) { subBuilder.MergeFrom(Http); } @@ -5953,6 +6534,15 @@ public void MergeFrom(pb::CodedInputStream input) { Http = subBuilder; break; } + case 162: { + global::Nitric.Proto.Deployments.v1.Queue subBuilder = new global::Nitric.Proto.Deployments.v1.Queue(); + if (configCase_ == ConfigOneofCase.Queue) { + subBuilder.MergeFrom(Queue); + } + input.ReadMessage(subBuilder); + Queue = subBuilder; + break; + } } } #endif @@ -5968,24 +6558,23 @@ public void MergeFrom(pb::CodedInputStream input) { _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, ref input); break; case 10: { - Name = input.ReadString(); - break; - } - case 16: { - Type = (global::Nitric.Proto.Resource.v1.ResourceType) input.ReadEnum(); + if (id_ == null) { + Id = new global::Nitric.Proto.Resources.v1.ResourceIdentifier(); + } + input.ReadMessage(Id); break; } case 82: { - global::Nitric.Proto.Deploy.v1.ExecutionUnit subBuilder = new global::Nitric.Proto.Deploy.v1.ExecutionUnit(); - if (configCase_ == ConfigOneofCase.ExecutionUnit) { - subBuilder.MergeFrom(ExecutionUnit); + global::Nitric.Proto.Deployments.v1.Service subBuilder = new global::Nitric.Proto.Deployments.v1.Service(); + if (configCase_ == ConfigOneofCase.Service) { + subBuilder.MergeFrom(Service); } input.ReadMessage(subBuilder); - ExecutionUnit = subBuilder; + Service = subBuilder; break; } case 90: { - global::Nitric.Proto.Deploy.v1.Bucket subBuilder = new global::Nitric.Proto.Deploy.v1.Bucket(); + global::Nitric.Proto.Deployments.v1.Bucket subBuilder = new global::Nitric.Proto.Deployments.v1.Bucket(); if (configCase_ == ConfigOneofCase.Bucket) { subBuilder.MergeFrom(Bucket); } @@ -5994,7 +6583,7 @@ public void MergeFrom(pb::CodedInputStream input) { break; } case 98: { - global::Nitric.Proto.Deploy.v1.Topic subBuilder = new global::Nitric.Proto.Deploy.v1.Topic(); + global::Nitric.Proto.Deployments.v1.Topic subBuilder = new global::Nitric.Proto.Deployments.v1.Topic(); if (configCase_ == ConfigOneofCase.Topic) { subBuilder.MergeFrom(Topic); } @@ -6003,16 +6592,7 @@ public void MergeFrom(pb::CodedInputStream input) { break; } case 106: { - global::Nitric.Proto.Deploy.v1.Queue subBuilder = new global::Nitric.Proto.Deploy.v1.Queue(); - if (configCase_ == ConfigOneofCase.Queue) { - subBuilder.MergeFrom(Queue); - } - input.ReadMessage(subBuilder); - Queue = subBuilder; - break; - } - case 114: { - global::Nitric.Proto.Deploy.v1.Api subBuilder = new global::Nitric.Proto.Deploy.v1.Api(); + global::Nitric.Proto.Deployments.v1.Api subBuilder = new global::Nitric.Proto.Deployments.v1.Api(); if (configCase_ == ConfigOneofCase.Api) { subBuilder.MergeFrom(Api); } @@ -6020,8 +6600,8 @@ public void MergeFrom(pb::CodedInputStream input) { Api = subBuilder; break; } - case 122: { - global::Nitric.Proto.Deploy.v1.Policy subBuilder = new global::Nitric.Proto.Deploy.v1.Policy(); + case 114: { + global::Nitric.Proto.Deployments.v1.Policy subBuilder = new global::Nitric.Proto.Deployments.v1.Policy(); if (configCase_ == ConfigOneofCase.Policy) { subBuilder.MergeFrom(Policy); } @@ -6029,8 +6609,8 @@ public void MergeFrom(pb::CodedInputStream input) { Policy = subBuilder; break; } - case 130: { - global::Nitric.Proto.Deploy.v1.Schedule subBuilder = new global::Nitric.Proto.Deploy.v1.Schedule(); + case 122: { + global::Nitric.Proto.Deployments.v1.Schedule subBuilder = new global::Nitric.Proto.Deployments.v1.Schedule(); if (configCase_ == ConfigOneofCase.Schedule) { subBuilder.MergeFrom(Schedule); } @@ -6038,17 +6618,17 @@ public void MergeFrom(pb::CodedInputStream input) { Schedule = subBuilder; break; } - case 138: { - global::Nitric.Proto.Deploy.v1.Collection subBuilder = new global::Nitric.Proto.Deploy.v1.Collection(); - if (configCase_ == ConfigOneofCase.Collection) { - subBuilder.MergeFrom(Collection); + case 130: { + global::Nitric.Proto.Deployments.v1.KeyValueStore subBuilder = new global::Nitric.Proto.Deployments.v1.KeyValueStore(); + if (configCase_ == ConfigOneofCase.KeyValueStore) { + subBuilder.MergeFrom(KeyValueStore); } input.ReadMessage(subBuilder); - Collection = subBuilder; + KeyValueStore = subBuilder; break; } - case 146: { - global::Nitric.Proto.Deploy.v1.Secret subBuilder = new global::Nitric.Proto.Deploy.v1.Secret(); + case 138: { + global::Nitric.Proto.Deployments.v1.Secret subBuilder = new global::Nitric.Proto.Deployments.v1.Secret(); if (configCase_ == ConfigOneofCase.Secret) { subBuilder.MergeFrom(Secret); } @@ -6056,8 +6636,8 @@ public void MergeFrom(pb::CodedInputStream input) { Secret = subBuilder; break; } - case 154: { - global::Nitric.Proto.Deploy.v1.Websocket subBuilder = new global::Nitric.Proto.Deploy.v1.Websocket(); + case 146: { + global::Nitric.Proto.Deployments.v1.Websocket subBuilder = new global::Nitric.Proto.Deployments.v1.Websocket(); if (configCase_ == ConfigOneofCase.Websocket) { subBuilder.MergeFrom(Websocket); } @@ -6065,8 +6645,8 @@ public void MergeFrom(pb::CodedInputStream input) { Websocket = subBuilder; break; } - case 162: { - global::Nitric.Proto.Deploy.v1.Http subBuilder = new global::Nitric.Proto.Deploy.v1.Http(); + case 154: { + global::Nitric.Proto.Deployments.v1.Http subBuilder = new global::Nitric.Proto.Deployments.v1.Http(); if (configCase_ == ConfigOneofCase.Http) { subBuilder.MergeFrom(Http); } @@ -6074,6 +6654,15 @@ public void MergeFrom(pb::CodedInputStream input) { Http = subBuilder; break; } + case 162: { + global::Nitric.Proto.Deployments.v1.Queue subBuilder = new global::Nitric.Proto.Deployments.v1.Queue(); + if (configCase_ == ConfigOneofCase.Queue) { + subBuilder.MergeFrom(Queue); + } + input.ReadMessage(subBuilder); + Queue = subBuilder; + break; + } } } } @@ -6082,7 +6671,7 @@ public void MergeFrom(pb::CodedInputStream input) { } /// - /// TODO: This is already defined in our resource contracts... + /// This is already defined in the resource contracts... /// Need to determine if it's worth re-using /// unfortunately there are parts we don't want to duplicate, such as API config /// @@ -6098,7 +6687,7 @@ public sealed partial class Policy : pb::IMessage [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public static pbr::MessageDescriptor Descriptor { - get { return global::Nitric.Proto.Deploy.v1.DeployReflection.Descriptor.MessageTypes[26]; } + get { return global::Nitric.Proto.Deployments.v1.DeploymentsReflection.Descriptor.MessageTypes[27]; } } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] @@ -6128,36 +6717,36 @@ public Policy Clone() { /// Field number for the "principals" field. public const int PrincipalsFieldNumber = 1; - private static readonly pb::FieldCodec _repeated_principals_codec - = pb::FieldCodec.ForMessage(10, global::Nitric.Proto.Deploy.v1.Resource.Parser); - private readonly pbc::RepeatedField principals_ = new pbc::RepeatedField(); + private static readonly pb::FieldCodec _repeated_principals_codec + = pb::FieldCodec.ForMessage(10, global::Nitric.Proto.Deployments.v1.Resource.Parser); + private readonly pbc::RepeatedField principals_ = new pbc::RepeatedField(); [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public pbc::RepeatedField Principals { + public pbc::RepeatedField Principals { get { return principals_; } } /// Field number for the "actions" field. public const int ActionsFieldNumber = 2; - private static readonly pb::FieldCodec _repeated_actions_codec - = pb::FieldCodec.ForEnum(18, x => (int) x, x => (global::Nitric.Proto.Resource.v1.Action) x); - private readonly pbc::RepeatedField actions_ = new pbc::RepeatedField(); + private static readonly pb::FieldCodec _repeated_actions_codec + = pb::FieldCodec.ForEnum(18, x => (int) x, x => (global::Nitric.Proto.Resources.v1.Action) x); + private readonly pbc::RepeatedField actions_ = new pbc::RepeatedField(); /// /// TODO: Split out discrete action definitions from resources /// Also need to allow custom action types as well /// Should incorporate action re-use here... /// [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public pbc::RepeatedField Actions { + public pbc::RepeatedField Actions { get { return actions_; } } /// Field number for the "resources" field. public const int ResourcesFieldNumber = 3; - private static readonly pb::FieldCodec _repeated_resources_codec - = pb::FieldCodec.ForMessage(26, global::Nitric.Proto.Deploy.v1.Resource.Parser); - private readonly pbc::RepeatedField resources_ = new pbc::RepeatedField(); + private static readonly pb::FieldCodec _repeated_resources_codec + = pb::FieldCodec.ForMessage(26, global::Nitric.Proto.Deployments.v1.Resource.Parser); + private readonly pbc::RepeatedField resources_ = new pbc::RepeatedField(); [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public pbc::RepeatedField Resources { + public pbc::RepeatedField Resources { get { return resources_; } } @@ -6316,7 +6905,7 @@ public sealed partial class Spec : pb::IMessage [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public static pbr::MessageDescriptor Descriptor { - get { return global::Nitric.Proto.Deploy.v1.DeployReflection.Descriptor.MessageTypes[27]; } + get { return global::Nitric.Proto.Deployments.v1.DeploymentsReflection.Descriptor.MessageTypes[28]; } } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] @@ -6344,14 +6933,14 @@ public Spec Clone() { /// Field number for the "resources" field. public const int ResourcesFieldNumber = 1; - private static readonly pb::FieldCodec _repeated_resources_codec - = pb::FieldCodec.ForMessage(10, global::Nitric.Proto.Deploy.v1.Resource.Parser); - private readonly pbc::RepeatedField resources_ = new pbc::RepeatedField(); + private static readonly pb::FieldCodec _repeated_resources_codec + = pb::FieldCodec.ForMessage(10, global::Nitric.Proto.Deployments.v1.Resource.Parser); + private readonly pbc::RepeatedField resources_ = new pbc::RepeatedField(); /// /// list of resources to deploy /// [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public pbc::RepeatedField Resources { + public pbc::RepeatedField Resources { get { return resources_; } } diff --git a/src/Nitric.Sdk/Proto/proto/deploy/v1/DeployGrpc.cs b/src/Nitric.Sdk/Proto/nitric/proto/deployments/v1/DeploymentsGrpc.cs similarity index 63% rename from src/Nitric.Sdk/Proto/proto/deploy/v1/DeployGrpc.cs rename to src/Nitric.Sdk/Proto/nitric/proto/deployments/v1/DeploymentsGrpc.cs index f586e23..1d38c22 100644 --- a/src/Nitric.Sdk/Proto/proto/deploy/v1/DeployGrpc.cs +++ b/src/Nitric.Sdk/Proto/nitric/proto/deployments/v1/DeploymentsGrpc.cs @@ -1,19 +1,19 @@ // // Generated by the protocol buffer compiler. DO NOT EDIT! -// source: proto/deploy/v1/deploy.proto +// source: nitric/proto/deployments/v1/deployments.proto // #pragma warning disable 0414, 1591 #region Designer generated code using grpc = global::Grpc.Core; -namespace Nitric.Proto.Deploy.v1 { +namespace Nitric.Proto.Deployments.v1 { /// /// The Nitric Deloyment Service contract /// - public static partial class DeployService + public static partial class Deployment { - static readonly string __ServiceName = "nitric.deploy.v1.DeployService"; + static readonly string __ServiceName = "nitric.proto.deployments.v1.Deployment"; static void __Helper_SerializeMessage(global::Google.Protobuf.IMessage message, grpc::SerializationContext context) { @@ -45,34 +45,34 @@ static T __Helper_DeserializeMessage(grpc::DeserializationContext context, gl return parser.ParseFrom(context.PayloadAsNewBuffer()); } - static readonly grpc::Marshaller __Marshaller_nitric_deploy_v1_DeployUpRequest = grpc::Marshallers.Create(__Helper_SerializeMessage, context => __Helper_DeserializeMessage(context, global::Nitric.Proto.Deploy.v1.DeployUpRequest.Parser)); - static readonly grpc::Marshaller __Marshaller_nitric_deploy_v1_DeployUpEvent = grpc::Marshallers.Create(__Helper_SerializeMessage, context => __Helper_DeserializeMessage(context, global::Nitric.Proto.Deploy.v1.DeployUpEvent.Parser)); - static readonly grpc::Marshaller __Marshaller_nitric_deploy_v1_DeployDownRequest = grpc::Marshallers.Create(__Helper_SerializeMessage, context => __Helper_DeserializeMessage(context, global::Nitric.Proto.Deploy.v1.DeployDownRequest.Parser)); - static readonly grpc::Marshaller __Marshaller_nitric_deploy_v1_DeployDownEvent = grpc::Marshallers.Create(__Helper_SerializeMessage, context => __Helper_DeserializeMessage(context, global::Nitric.Proto.Deploy.v1.DeployDownEvent.Parser)); + static readonly grpc::Marshaller __Marshaller_nitric_proto_deployments_v1_DeploymentUpRequest = grpc::Marshallers.Create(__Helper_SerializeMessage, context => __Helper_DeserializeMessage(context, global::Nitric.Proto.Deployments.v1.DeploymentUpRequest.Parser)); + static readonly grpc::Marshaller __Marshaller_nitric_proto_deployments_v1_DeploymentUpEvent = grpc::Marshallers.Create(__Helper_SerializeMessage, context => __Helper_DeserializeMessage(context, global::Nitric.Proto.Deployments.v1.DeploymentUpEvent.Parser)); + static readonly grpc::Marshaller __Marshaller_nitric_proto_deployments_v1_DeploymentDownRequest = grpc::Marshallers.Create(__Helper_SerializeMessage, context => __Helper_DeserializeMessage(context, global::Nitric.Proto.Deployments.v1.DeploymentDownRequest.Parser)); + static readonly grpc::Marshaller __Marshaller_nitric_proto_deployments_v1_DeploymentDownEvent = grpc::Marshallers.Create(__Helper_SerializeMessage, context => __Helper_DeserializeMessage(context, global::Nitric.Proto.Deployments.v1.DeploymentDownEvent.Parser)); - static readonly grpc::Method __Method_Up = new grpc::Method( + static readonly grpc::Method __Method_Up = new grpc::Method( grpc::MethodType.ServerStreaming, __ServiceName, "Up", - __Marshaller_nitric_deploy_v1_DeployUpRequest, - __Marshaller_nitric_deploy_v1_DeployUpEvent); + __Marshaller_nitric_proto_deployments_v1_DeploymentUpRequest, + __Marshaller_nitric_proto_deployments_v1_DeploymentUpEvent); - static readonly grpc::Method __Method_Down = new grpc::Method( + static readonly grpc::Method __Method_Down = new grpc::Method( grpc::MethodType.ServerStreaming, __ServiceName, "Down", - __Marshaller_nitric_deploy_v1_DeployDownRequest, - __Marshaller_nitric_deploy_v1_DeployDownEvent); + __Marshaller_nitric_proto_deployments_v1_DeploymentDownRequest, + __Marshaller_nitric_proto_deployments_v1_DeploymentDownEvent); /// Service descriptor public static global::Google.Protobuf.Reflection.ServiceDescriptor Descriptor { - get { return global::Nitric.Proto.Deploy.v1.DeployReflection.Descriptor.Services[0]; } + get { return global::Nitric.Proto.Deployments.v1.DeploymentsReflection.Descriptor.Services[0]; } } - /// Base class for server-side implementations of DeployService - [grpc::BindServiceMethod(typeof(DeployService), "BindService")] - public abstract partial class DeployServiceBase + /// Base class for server-side implementations of Deployment + [grpc::BindServiceMethod(typeof(Deployment), "BindService")] + public abstract partial class DeploymentBase { /// /// Begins a new deployment @@ -83,7 +83,7 @@ public abstract partial class DeployServiceBase /// Used for sending responses back to the client. /// The context of the server-side call handler being invoked. /// A task indicating completion of the handler. - public virtual global::System.Threading.Tasks.Task Up(global::Nitric.Proto.Deploy.v1.DeployUpRequest request, grpc::IServerStreamWriter responseStream, grpc::ServerCallContext context) + public virtual global::System.Threading.Tasks.Task Up(global::Nitric.Proto.Deployments.v1.DeploymentUpRequest request, grpc::IServerStreamWriter responseStream, grpc::ServerCallContext context) { throw new grpc::RpcException(new grpc::Status(grpc::StatusCode.Unimplemented, "")); } @@ -97,33 +97,33 @@ public abstract partial class DeployServiceBase /// Used for sending responses back to the client. /// The context of the server-side call handler being invoked. /// A task indicating completion of the handler. - public virtual global::System.Threading.Tasks.Task Down(global::Nitric.Proto.Deploy.v1.DeployDownRequest request, grpc::IServerStreamWriter responseStream, grpc::ServerCallContext context) + public virtual global::System.Threading.Tasks.Task Down(global::Nitric.Proto.Deployments.v1.DeploymentDownRequest request, grpc::IServerStreamWriter responseStream, grpc::ServerCallContext context) { throw new grpc::RpcException(new grpc::Status(grpc::StatusCode.Unimplemented, "")); } } - /// Client for DeployService - public partial class DeployServiceClient : grpc::ClientBase + /// Client for Deployment + public partial class DeploymentClient : grpc::ClientBase { - /// Creates a new client for DeployService + /// Creates a new client for Deployment /// The channel to use to make remote calls. - public DeployServiceClient(grpc::ChannelBase channel) : base(channel) + public DeploymentClient(grpc::ChannelBase channel) : base(channel) { } - /// Creates a new client for DeployService that uses a custom CallInvoker. + /// Creates a new client for Deployment that uses a custom CallInvoker. /// The callInvoker to use to make remote calls. - public DeployServiceClient(grpc::CallInvoker callInvoker) : base(callInvoker) + public DeploymentClient(grpc::CallInvoker callInvoker) : base(callInvoker) { } /// Protected parameterless constructor to allow creation of test doubles. - protected DeployServiceClient() : base() + protected DeploymentClient() : base() { } /// Protected constructor to allow creation of configured clients. /// The client configuration. - protected DeployServiceClient(ClientBaseConfiguration configuration) : base(configuration) + protected DeploymentClient(ClientBaseConfiguration configuration) : base(configuration) { } @@ -137,7 +137,7 @@ protected DeployServiceClient(ClientBaseConfiguration configuration) : base(conf /// An optional deadline for the call. The call will be cancelled if deadline is hit. /// An optional token for canceling the call. /// The call object. - public virtual grpc::AsyncServerStreamingCall Up(global::Nitric.Proto.Deploy.v1.DeployUpRequest request, grpc::Metadata headers = null, global::System.DateTime? deadline = null, global::System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken)) + public virtual grpc::AsyncServerStreamingCall Up(global::Nitric.Proto.Deployments.v1.DeploymentUpRequest request, grpc::Metadata headers = null, global::System.DateTime? deadline = null, global::System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken)) { return Up(request, new grpc::CallOptions(headers, deadline, cancellationToken)); } @@ -149,7 +149,7 @@ protected DeployServiceClient(ClientBaseConfiguration configuration) : base(conf /// The request to send to the server. /// The options for the call. /// The call object. - public virtual grpc::AsyncServerStreamingCall Up(global::Nitric.Proto.Deploy.v1.DeployUpRequest request, grpc::CallOptions options) + public virtual grpc::AsyncServerStreamingCall Up(global::Nitric.Proto.Deployments.v1.DeploymentUpRequest request, grpc::CallOptions options) { return CallInvoker.AsyncServerStreamingCall(__Method_Up, null, options, request); } @@ -163,7 +163,7 @@ protected DeployServiceClient(ClientBaseConfiguration configuration) : base(conf /// An optional deadline for the call. The call will be cancelled if deadline is hit. /// An optional token for canceling the call. /// The call object. - public virtual grpc::AsyncServerStreamingCall Down(global::Nitric.Proto.Deploy.v1.DeployDownRequest request, grpc::Metadata headers = null, global::System.DateTime? deadline = null, global::System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken)) + public virtual grpc::AsyncServerStreamingCall Down(global::Nitric.Proto.Deployments.v1.DeploymentDownRequest request, grpc::Metadata headers = null, global::System.DateTime? deadline = null, global::System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken)) { return Down(request, new grpc::CallOptions(headers, deadline, cancellationToken)); } @@ -175,20 +175,20 @@ protected DeployServiceClient(ClientBaseConfiguration configuration) : base(conf /// The request to send to the server. /// The options for the call. /// The call object. - public virtual grpc::AsyncServerStreamingCall Down(global::Nitric.Proto.Deploy.v1.DeployDownRequest request, grpc::CallOptions options) + public virtual grpc::AsyncServerStreamingCall Down(global::Nitric.Proto.Deployments.v1.DeploymentDownRequest request, grpc::CallOptions options) { return CallInvoker.AsyncServerStreamingCall(__Method_Down, null, options, request); } /// Creates a new instance of client from given ClientBaseConfiguration. - protected override DeployServiceClient NewInstance(ClientBaseConfiguration configuration) + protected override DeploymentClient NewInstance(ClientBaseConfiguration configuration) { - return new DeployServiceClient(configuration); + return new DeploymentClient(configuration); } } /// Creates service definition that can be registered with a server /// An object implementing the server-side handling logic. - public static grpc::ServerServiceDefinition BindService(DeployServiceBase serviceImpl) + public static grpc::ServerServiceDefinition BindService(DeploymentBase serviceImpl) { return grpc::ServerServiceDefinition.CreateBuilder() .AddMethod(__Method_Up, serviceImpl.Up) @@ -199,10 +199,10 @@ protected override DeployServiceClient NewInstance(ClientBaseConfiguration confi /// Note: this method is part of an experimental API that can change or be removed without any prior notice. /// Service methods will be bound by calling AddMethod on this object. /// An object implementing the server-side handling logic. - public static void BindService(grpc::ServiceBinderBase serviceBinder, DeployServiceBase serviceImpl) + public static void BindService(grpc::ServiceBinderBase serviceBinder, DeploymentBase serviceImpl) { - serviceBinder.AddMethod(__Method_Up, serviceImpl == null ? null : new grpc::ServerStreamingServerMethod(serviceImpl.Up)); - serviceBinder.AddMethod(__Method_Down, serviceImpl == null ? null : new grpc::ServerStreamingServerMethod(serviceImpl.Down)); + serviceBinder.AddMethod(__Method_Up, serviceImpl == null ? null : new grpc::ServerStreamingServerMethod(serviceImpl.Up)); + serviceBinder.AddMethod(__Method_Down, serviceImpl == null ? null : new grpc::ServerStreamingServerMethod(serviceImpl.Down)); } } diff --git a/src/Nitric.Sdk/Proto/proto/error/v1/Error.cs b/src/Nitric.Sdk/Proto/nitric/proto/http/v1/Http.cs similarity index 50% rename from src/Nitric.Sdk/Proto/proto/error/v1/Error.cs rename to src/Nitric.Sdk/Proto/nitric/proto/http/v1/Http.cs index f325a96..6b3de25 100644 --- a/src/Nitric.Sdk/Proto/proto/error/v1/Error.cs +++ b/src/Nitric.Sdk/Proto/nitric/proto/http/v1/Http.cs @@ -1,6 +1,6 @@ // // Generated by the protocol buffer compiler. DO NOT EDIT! -// source: proto/error/v1/error.proto +// source: nitric/proto/http/v1/http.proto // #pragma warning disable 1591, 0612, 3021 #region Designer generated code @@ -9,55 +9,56 @@ using pbc = global::Google.Protobuf.Collections; using pbr = global::Google.Protobuf.Reflection; using scg = global::System.Collections.Generic; -namespace Nitric.Proto.Error.v1 { +namespace Nitric.Proto.Http.v1 { - /// Holder for reflection information generated from proto/error/v1/error.proto - public static partial class ErrorReflection { + /// Holder for reflection information generated from nitric/proto/http/v1/http.proto + public static partial class HttpReflection { #region Descriptor - /// File descriptor for proto/error/v1/error.proto + /// File descriptor for nitric/proto/http/v1/http.proto public static pbr::FileDescriptor Descriptor { get { return descriptor; } } private static pbr::FileDescriptor descriptor; - static ErrorReflection() { + static HttpReflection() { byte[] descriptorData = global::System.Convert.FromBase64String( string.Concat( - "Chpwcm90by9lcnJvci92MS9lcnJvci5wcm90bxIPbml0cmljLmVycm9yLnYx", - "Io8BCgpFcnJvclNjb3BlEg8KB3NlcnZpY2UYASABKAkSDgoGcGx1Z2luGAIg", - "ASgJEjMKBGFyZ3MYAyADKAsyJS5uaXRyaWMuZXJyb3IudjEuRXJyb3JTY29w", - "ZS5BcmdzRW50cnkaKwoJQXJnc0VudHJ5EgsKA2tleRgBIAEoCRINCgV2YWx1", - "ZRgCIAEoCToCOAEiWgoMRXJyb3JEZXRhaWxzEg8KB21lc3NhZ2UYASABKAkS", - "DQoFY2F1c2UYAiABKAkSKgoFc2NvcGUYAyABKAsyGy5uaXRyaWMuZXJyb3Iu", - "djEuRXJyb3JTY29wZUKJAQoYaW8ubml0cmljLnByb3RvLmVycm9yLnYxQgZF", - "cnJvcnNQAVozZ2l0aHViLmNvbS9uaXRyaWN0ZWNoL25pdHJpYy9jb3JlL3Br", - "Zy9hcGkvbml0cmljL3YxqgIVTml0cmljLlByb3RvLkVycm9yLnYxygIVTml0", - "cmljXFByb3RvXEVycm9yXFYxYgZwcm90bzM=")); + "Ch9uaXRyaWMvcHJvdG8vaHR0cC92MS9odHRwLnByb3RvEhRuaXRyaWMucHJv", + "dG8uaHR0cC52MSJICg1DbGllbnRNZXNzYWdlEjcKB3JlcXVlc3QYASABKAsy", + "Ji5uaXRyaWMucHJvdG8uaHR0cC52MS5IdHRwUHJveHlSZXF1ZXN0Ig8KDVNl", + "cnZlck1lc3NhZ2UiIAoQSHR0cFByb3h5UmVxdWVzdBIMCgRob3N0GAEgASgJ", + "Ml0KBEh0dHASVQoFUHJveHkSIy5uaXRyaWMucHJvdG8uaHR0cC52MS5DbGll", + "bnRNZXNzYWdlGiMubml0cmljLnByb3RvLmh0dHAudjEuU2VydmVyTWVzc2Fn", + "ZSgBMAFCjAEKF2lvLm5pdHJpYy5wcm90by5odHRwLnYxQgVIdHRwc1ABWjpn", + "aXRodWIuY29tL25pdHJpY3RlY2gvbml0cmljL2NvcmUvcGtnL3Byb3RvL2h0", + "dHAvdjE7aHR0cHBiqgIUTml0cmljLlByb3RvLkh0dHAudjHKAhROaXRyaWNc", + "UHJvdG9cSHR0cFxWMWIGcHJvdG8z")); descriptor = pbr::FileDescriptor.FromGeneratedCode(descriptorData, new pbr::FileDescriptor[] { }, new pbr::GeneratedClrTypeInfo(null, null, new pbr::GeneratedClrTypeInfo[] { - new pbr::GeneratedClrTypeInfo(typeof(global::Nitric.Proto.Error.v1.ErrorScope), global::Nitric.Proto.Error.v1.ErrorScope.Parser, new[]{ "Service", "Plugin", "Args" }, null, null, null, new pbr::GeneratedClrTypeInfo[] { null, }), - new pbr::GeneratedClrTypeInfo(typeof(global::Nitric.Proto.Error.v1.ErrorDetails), global::Nitric.Proto.Error.v1.ErrorDetails.Parser, new[]{ "Message", "Cause", "Scope" }, null, null, null, null) + new pbr::GeneratedClrTypeInfo(typeof(global::Nitric.Proto.Http.v1.ClientMessage), global::Nitric.Proto.Http.v1.ClientMessage.Parser, new[]{ "Request" }, null, null, null, null), + new pbr::GeneratedClrTypeInfo(typeof(global::Nitric.Proto.Http.v1.ServerMessage), global::Nitric.Proto.Http.v1.ServerMessage.Parser, null, null, null, null, null), + new pbr::GeneratedClrTypeInfo(typeof(global::Nitric.Proto.Http.v1.HttpProxyRequest), global::Nitric.Proto.Http.v1.HttpProxyRequest.Parser, new[]{ "Host" }, null, null, null, null) })); } #endregion } #region Messages - public sealed partial class ErrorScope : pb::IMessage + public sealed partial class ClientMessage : pb::IMessage #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE , pb::IBufferMessage #endif { - private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new ErrorScope()); + private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new ClientMessage()); private pb::UnknownFieldSet _unknownFields; [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public static pb::MessageParser Parser { get { return _parser; } } + public static pb::MessageParser Parser { get { return _parser; } } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public static pbr::MessageDescriptor Descriptor { - get { return global::Nitric.Proto.Error.v1.ErrorReflection.Descriptor.MessageTypes[0]; } + get { return global::Nitric.Proto.Http.v1.HttpReflection.Descriptor.MessageTypes[0]; } } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] @@ -66,91 +67,58 @@ public sealed partial class ErrorScope : pb::IMessage } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public ErrorScope() { + public ClientMessage() { OnConstruction(); } partial void OnConstruction(); [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public ErrorScope(ErrorScope other) : this() { - service_ = other.service_; - plugin_ = other.plugin_; - args_ = other.args_.Clone(); + public ClientMessage(ClientMessage other) : this() { + request_ = other.request_ != null ? other.request_.Clone() : null; _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public ErrorScope Clone() { - return new ErrorScope(this); + public ClientMessage Clone() { + return new ClientMessage(this); } - /// Field number for the "service" field. - public const int ServiceFieldNumber = 1; - private string service_ = ""; + /// Field number for the "request" field. + public const int RequestFieldNumber = 1; + private global::Nitric.Proto.Http.v1.HttpProxyRequest request_; /// - /// The API service invoked, e.g. 'Service.Method'. + /// Details of the HTTP server to proxy /// [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public string Service { - get { return service_; } + public global::Nitric.Proto.Http.v1.HttpProxyRequest Request { + get { return request_; } set { - service_ = pb::ProtoPreconditions.CheckNotNull(value, "value"); + request_ = value; } } - /// Field number for the "plugin" field. - public const int PluginFieldNumber = 2; - private string plugin_ = ""; - /// - /// The plugin method invoked, e.g. 'PluginService.Method'. - /// - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public string Plugin { - get { return plugin_; } - set { - plugin_ = pb::ProtoPreconditions.CheckNotNull(value, "value"); - } - } - - /// Field number for the "args" field. - public const int ArgsFieldNumber = 3; - private static readonly pbc::MapField.Codec _map_args_codec - = new pbc::MapField.Codec(pb::FieldCodec.ForString(10, ""), pb::FieldCodec.ForString(18, ""), 26); - private readonly pbc::MapField args_ = new pbc::MapField(); - /// - /// The plugin method arguments, ensure only non-sensitive data is specified. - /// - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public pbc::MapField Args { - get { return args_; } - } - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public override bool Equals(object other) { - return Equals(other as ErrorScope); + return Equals(other as ClientMessage); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public bool Equals(ErrorScope other) { + public bool Equals(ClientMessage other) { if (ReferenceEquals(other, null)) { return false; } if (ReferenceEquals(other, this)) { return true; } - if (Service != other.Service) return false; - if (Plugin != other.Plugin) return false; - if (!Args.Equals(other.Args)) return false; + if (!object.Equals(Request, other.Request)) return false; return Equals(_unknownFields, other._unknownFields); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public override int GetHashCode() { int hash = 1; - if (Service.Length != 0) hash ^= Service.GetHashCode(); - if (Plugin.Length != 0) hash ^= Plugin.GetHashCode(); - hash ^= Args.GetHashCode(); + if (request_ != null) hash ^= Request.GetHashCode(); if (_unknownFields != null) { hash ^= _unknownFields.GetHashCode(); } @@ -167,15 +135,10 @@ public void WriteTo(pb::CodedOutputStream output) { #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE output.WriteRawMessage(this); #else - if (Service.Length != 0) { + if (request_ != null) { output.WriteRawTag(10); - output.WriteString(Service); - } - if (Plugin.Length != 0) { - output.WriteRawTag(18); - output.WriteString(Plugin); + output.WriteMessage(Request); } - args_.WriteTo(output, _map_args_codec); if (_unknownFields != null) { _unknownFields.WriteTo(output); } @@ -185,15 +148,10 @@ public void WriteTo(pb::CodedOutputStream output) { #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE [global::System.Diagnostics.DebuggerNonUserCodeAttribute] void pb::IBufferMessage.InternalWriteTo(ref pb::WriteContext output) { - if (Service.Length != 0) { + if (request_ != null) { output.WriteRawTag(10); - output.WriteString(Service); - } - if (Plugin.Length != 0) { - output.WriteRawTag(18); - output.WriteString(Plugin); + output.WriteMessage(Request); } - args_.WriteTo(ref output, _map_args_codec); if (_unknownFields != null) { _unknownFields.WriteTo(ref output); } @@ -203,13 +161,9 @@ public void WriteTo(pb::CodedOutputStream output) { [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public int CalculateSize() { int size = 0; - if (Service.Length != 0) { - size += 1 + pb::CodedOutputStream.ComputeStringSize(Service); + if (request_ != null) { + size += 1 + pb::CodedOutputStream.ComputeMessageSize(Request); } - if (Plugin.Length != 0) { - size += 1 + pb::CodedOutputStream.ComputeStringSize(Plugin); - } - size += args_.CalculateSize(_map_args_codec); if (_unknownFields != null) { size += _unknownFields.CalculateSize(); } @@ -217,17 +171,16 @@ public int CalculateSize() { } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void MergeFrom(ErrorScope other) { + public void MergeFrom(ClientMessage other) { if (other == null) { return; } - if (other.Service.Length != 0) { - Service = other.Service; - } - if (other.Plugin.Length != 0) { - Plugin = other.Plugin; + if (other.request_ != null) { + if (request_ == null) { + Request = new global::Nitric.Proto.Http.v1.HttpProxyRequest(); + } + Request.MergeFrom(other.Request); } - args_.Add(other.args_); _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields); } @@ -243,15 +196,10 @@ public void MergeFrom(pb::CodedInputStream input) { _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input); break; case 10: { - Service = input.ReadString(); - break; - } - case 18: { - Plugin = input.ReadString(); - break; - } - case 26: { - args_.AddEntriesFrom(input, _map_args_codec); + if (request_ == null) { + Request = new global::Nitric.Proto.Http.v1.HttpProxyRequest(); + } + input.ReadMessage(Request); break; } } @@ -269,15 +217,10 @@ public void MergeFrom(pb::CodedInputStream input) { _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, ref input); break; case 10: { - Service = input.ReadString(); - break; - } - case 18: { - Plugin = input.ReadString(); - break; - } - case 26: { - args_.AddEntriesFrom(ref input, _map_args_codec); + if (request_ == null) { + Request = new global::Nitric.Proto.Http.v1.HttpProxyRequest(); + } + input.ReadMessage(Request); break; } } @@ -287,19 +230,19 @@ public void MergeFrom(pb::CodedInputStream input) { } - public sealed partial class ErrorDetails : pb::IMessage + public sealed partial class ServerMessage : pb::IMessage #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE , pb::IBufferMessage #endif { - private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new ErrorDetails()); + private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new ServerMessage()); private pb::UnknownFieldSet _unknownFields; [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public static pb::MessageParser Parser { get { return _parser; } } + public static pb::MessageParser Parser { get { return _parser; } } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public static pbr::MessageDescriptor Descriptor { - get { return global::Nitric.Proto.Error.v1.ErrorReflection.Descriptor.MessageTypes[1]; } + get { return global::Nitric.Proto.Http.v1.HttpReflection.Descriptor.MessageTypes[1]; } } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] @@ -308,92 +251,194 @@ public sealed partial class ErrorDetails : pb::IMessage } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public ErrorDetails() { + public ServerMessage() { OnConstruction(); } partial void OnConstruction(); [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public ErrorDetails(ErrorDetails other) : this() { - message_ = other.message_; - cause_ = other.cause_; - scope_ = other.scope_ != null ? other.scope_.Clone() : null; + public ServerMessage(ServerMessage other) : this() { _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public ErrorDetails Clone() { - return new ErrorDetails(this); + public ServerMessage Clone() { + return new ServerMessage(this); } - /// Field number for the "message" field. - public const int MessageFieldNumber = 1; - private string message_ = ""; - /// - /// The developer error message, explaining the error and ideally solution. - /// [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public string Message { - get { return message_; } - set { - message_ = pb::ProtoPreconditions.CheckNotNull(value, "value"); + public override bool Equals(object other) { + return Equals(other as ServerMessage); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public bool Equals(ServerMessage other) { + if (ReferenceEquals(other, null)) { + return false; + } + if (ReferenceEquals(other, this)) { + return true; } + return Equals(_unknownFields, other._unknownFields); } - /// Field number for the "cause" field. - public const int CauseFieldNumber = 2; - private string cause_ = ""; - /// - /// The error root cause. - /// [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public string Cause { - get { return cause_; } - set { - cause_ = pb::ProtoPreconditions.CheckNotNull(value, "value"); + public override int GetHashCode() { + int hash = 1; + if (_unknownFields != null) { + hash ^= _unknownFields.GetHashCode(); + } + return hash; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public override string ToString() { + return pb::JsonFormatter.ToDiagnosticString(this); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public void WriteTo(pb::CodedOutputStream output) { + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + output.WriteRawMessage(this); + #else + if (_unknownFields != null) { + _unknownFields.WriteTo(output); + } + #endif + } + + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + void pb::IBufferMessage.InternalWriteTo(ref pb::WriteContext output) { + if (_unknownFields != null) { + _unknownFields.WriteTo(ref output); } } + #endif - /// Field number for the "scope" field. - public const int ScopeFieldNumber = 3; - private global::Nitric.Proto.Error.v1.ErrorScope scope_; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public int CalculateSize() { + int size = 0; + if (_unknownFields != null) { + size += _unknownFields.CalculateSize(); + } + return size; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public void MergeFrom(ServerMessage other) { + if (other == null) { + return; + } + _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public void MergeFrom(pb::CodedInputStream input) { + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + input.ReadRawMessage(this); + #else + uint tag; + while ((tag = input.ReadTag()) != 0) { + switch(tag) { + default: + _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input); + break; + } + } + #endif + } + + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + void pb::IBufferMessage.InternalMergeFrom(ref pb::ParseContext input) { + uint tag; + while ((tag = input.ReadTag()) != 0) { + switch(tag) { + default: + _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, ref input); + break; + } + } + } + #endif + + } + + public sealed partial class HttpProxyRequest : pb::IMessage + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + , pb::IBufferMessage + #endif + { + private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new HttpProxyRequest()); + private pb::UnknownFieldSet _unknownFields; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public static pb::MessageParser Parser { get { return _parser; } } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public static pbr::MessageDescriptor Descriptor { + get { return global::Nitric.Proto.Http.v1.HttpReflection.Descriptor.MessageTypes[2]; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + pbr::MessageDescriptor pb::IMessage.Descriptor { + get { return Descriptor; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public HttpProxyRequest() { + OnConstruction(); + } + + partial void OnConstruction(); + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public HttpProxyRequest(HttpProxyRequest other) : this() { + host_ = other.host_; + _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public HttpProxyRequest Clone() { + return new HttpProxyRequest(this); + } + + /// Field number for the "host" field. + public const int HostFieldNumber = 1; + private string host_ = ""; /// - /// The scope of the error. + /// The local port the server can be accessed on /// [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public global::Nitric.Proto.Error.v1.ErrorScope Scope { - get { return scope_; } + public string Host { + get { return host_; } set { - scope_ = value; + host_ = pb::ProtoPreconditions.CheckNotNull(value, "value"); } } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public override bool Equals(object other) { - return Equals(other as ErrorDetails); + return Equals(other as HttpProxyRequest); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public bool Equals(ErrorDetails other) { + public bool Equals(HttpProxyRequest other) { if (ReferenceEquals(other, null)) { return false; } if (ReferenceEquals(other, this)) { return true; } - if (Message != other.Message) return false; - if (Cause != other.Cause) return false; - if (!object.Equals(Scope, other.Scope)) return false; + if (Host != other.Host) return false; return Equals(_unknownFields, other._unknownFields); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public override int GetHashCode() { int hash = 1; - if (Message.Length != 0) hash ^= Message.GetHashCode(); - if (Cause.Length != 0) hash ^= Cause.GetHashCode(); - if (scope_ != null) hash ^= Scope.GetHashCode(); + if (Host.Length != 0) hash ^= Host.GetHashCode(); if (_unknownFields != null) { hash ^= _unknownFields.GetHashCode(); } @@ -410,17 +455,9 @@ public void WriteTo(pb::CodedOutputStream output) { #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE output.WriteRawMessage(this); #else - if (Message.Length != 0) { + if (Host.Length != 0) { output.WriteRawTag(10); - output.WriteString(Message); - } - if (Cause.Length != 0) { - output.WriteRawTag(18); - output.WriteString(Cause); - } - if (scope_ != null) { - output.WriteRawTag(26); - output.WriteMessage(Scope); + output.WriteString(Host); } if (_unknownFields != null) { _unknownFields.WriteTo(output); @@ -431,17 +468,9 @@ public void WriteTo(pb::CodedOutputStream output) { #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE [global::System.Diagnostics.DebuggerNonUserCodeAttribute] void pb::IBufferMessage.InternalWriteTo(ref pb::WriteContext output) { - if (Message.Length != 0) { + if (Host.Length != 0) { output.WriteRawTag(10); - output.WriteString(Message); - } - if (Cause.Length != 0) { - output.WriteRawTag(18); - output.WriteString(Cause); - } - if (scope_ != null) { - output.WriteRawTag(26); - output.WriteMessage(Scope); + output.WriteString(Host); } if (_unknownFields != null) { _unknownFields.WriteTo(ref output); @@ -452,14 +481,8 @@ public void WriteTo(pb::CodedOutputStream output) { [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public int CalculateSize() { int size = 0; - if (Message.Length != 0) { - size += 1 + pb::CodedOutputStream.ComputeStringSize(Message); - } - if (Cause.Length != 0) { - size += 1 + pb::CodedOutputStream.ComputeStringSize(Cause); - } - if (scope_ != null) { - size += 1 + pb::CodedOutputStream.ComputeMessageSize(Scope); + if (Host.Length != 0) { + size += 1 + pb::CodedOutputStream.ComputeStringSize(Host); } if (_unknownFields != null) { size += _unknownFields.CalculateSize(); @@ -468,21 +491,12 @@ public int CalculateSize() { } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void MergeFrom(ErrorDetails other) { + public void MergeFrom(HttpProxyRequest other) { if (other == null) { return; } - if (other.Message.Length != 0) { - Message = other.Message; - } - if (other.Cause.Length != 0) { - Cause = other.Cause; - } - if (other.scope_ != null) { - if (scope_ == null) { - Scope = new global::Nitric.Proto.Error.v1.ErrorScope(); - } - Scope.MergeFrom(other.Scope); + if (other.Host.Length != 0) { + Host = other.Host; } _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields); } @@ -499,18 +513,7 @@ public void MergeFrom(pb::CodedInputStream input) { _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input); break; case 10: { - Message = input.ReadString(); - break; - } - case 18: { - Cause = input.ReadString(); - break; - } - case 26: { - if (scope_ == null) { - Scope = new global::Nitric.Proto.Error.v1.ErrorScope(); - } - input.ReadMessage(Scope); + Host = input.ReadString(); break; } } @@ -528,18 +531,7 @@ public void MergeFrom(pb::CodedInputStream input) { _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, ref input); break; case 10: { - Message = input.ReadString(); - break; - } - case 18: { - Cause = input.ReadString(); - break; - } - case 26: { - if (scope_ == null) { - Scope = new global::Nitric.Proto.Error.v1.ErrorScope(); - } - input.ReadMessage(Scope); + Host = input.ReadString(); break; } } diff --git a/src/Nitric.Sdk/Proto/proto/faas/v1/FaasGrpc.cs b/src/Nitric.Sdk/Proto/nitric/proto/http/v1/HttpGrpc.cs similarity index 54% rename from src/Nitric.Sdk/Proto/proto/faas/v1/FaasGrpc.cs rename to src/Nitric.Sdk/Proto/nitric/proto/http/v1/HttpGrpc.cs index 8e784e6..bd5f7c3 100644 --- a/src/Nitric.Sdk/Proto/proto/faas/v1/FaasGrpc.cs +++ b/src/Nitric.Sdk/Proto/nitric/proto/http/v1/HttpGrpc.cs @@ -1,19 +1,19 @@ // // Generated by the protocol buffer compiler. DO NOT EDIT! -// source: proto/faas/v1/faas.proto +// source: nitric/proto/http/v1/http.proto // #pragma warning disable 0414, 1591 #region Designer generated code using grpc = global::Grpc.Core; -namespace Nitric.Proto.Faas.v1 { +namespace Nitric.Proto.Http.v1 { /// - /// Service for streaming communication with gRPC FaaS implementations + /// Service for publishing asynchronous messages /// - public static partial class FaasService + public static partial class Http { - static readonly string __ServiceName = "nitric.faas.v1.FaasService"; + static readonly string __ServiceName = "nitric.proto.http.v1.Http"; static void __Helper_SerializeMessage(global::Google.Protobuf.IMessage message, grpc::SerializationContext context) { @@ -45,105 +45,105 @@ static T __Helper_DeserializeMessage(grpc::DeserializationContext context, gl return parser.ParseFrom(context.PayloadAsNewBuffer()); } - static readonly grpc::Marshaller __Marshaller_nitric_faas_v1_ClientMessage = grpc::Marshallers.Create(__Helper_SerializeMessage, context => __Helper_DeserializeMessage(context, global::Nitric.Proto.Faas.v1.ClientMessage.Parser)); - static readonly grpc::Marshaller __Marshaller_nitric_faas_v1_ServerMessage = grpc::Marshallers.Create(__Helper_SerializeMessage, context => __Helper_DeserializeMessage(context, global::Nitric.Proto.Faas.v1.ServerMessage.Parser)); + static readonly grpc::Marshaller __Marshaller_nitric_proto_http_v1_ClientMessage = grpc::Marshallers.Create(__Helper_SerializeMessage, context => __Helper_DeserializeMessage(context, global::Nitric.Proto.Http.v1.ClientMessage.Parser)); + static readonly grpc::Marshaller __Marshaller_nitric_proto_http_v1_ServerMessage = grpc::Marshallers.Create(__Helper_SerializeMessage, context => __Helper_DeserializeMessage(context, global::Nitric.Proto.Http.v1.ServerMessage.Parser)); - static readonly grpc::Method __Method_TriggerStream = new grpc::Method( + static readonly grpc::Method __Method_Proxy = new grpc::Method( grpc::MethodType.DuplexStreaming, __ServiceName, - "TriggerStream", - __Marshaller_nitric_faas_v1_ClientMessage, - __Marshaller_nitric_faas_v1_ServerMessage); + "Proxy", + __Marshaller_nitric_proto_http_v1_ClientMessage, + __Marshaller_nitric_proto_http_v1_ServerMessage); /// Service descriptor public static global::Google.Protobuf.Reflection.ServiceDescriptor Descriptor { - get { return global::Nitric.Proto.Faas.v1.FaasReflection.Descriptor.Services[0]; } + get { return global::Nitric.Proto.Http.v1.HttpReflection.Descriptor.Services[0]; } } - /// Base class for server-side implementations of FaasService - [grpc::BindServiceMethod(typeof(FaasService), "BindService")] - public abstract partial class FaasServiceBase + /// Base class for server-side implementations of Http + [grpc::BindServiceMethod(typeof(Http), "BindService")] + public abstract partial class HttpBase { /// - /// Begin streaming triggers/response to/from the membrane + /// Proxy an HTTP server /// /// Used for reading requests from the client. /// Used for sending responses back to the client. /// The context of the server-side call handler being invoked. /// A task indicating completion of the handler. - public virtual global::System.Threading.Tasks.Task TriggerStream(grpc::IAsyncStreamReader requestStream, grpc::IServerStreamWriter responseStream, grpc::ServerCallContext context) + public virtual global::System.Threading.Tasks.Task Proxy(grpc::IAsyncStreamReader requestStream, grpc::IServerStreamWriter responseStream, grpc::ServerCallContext context) { throw new grpc::RpcException(new grpc::Status(grpc::StatusCode.Unimplemented, "")); } } - /// Client for FaasService - public partial class FaasServiceClient : grpc::ClientBase + /// Client for Http + public partial class HttpClient : grpc::ClientBase { - /// Creates a new client for FaasService + /// Creates a new client for Http /// The channel to use to make remote calls. - public FaasServiceClient(grpc::ChannelBase channel) : base(channel) + public HttpClient(grpc::ChannelBase channel) : base(channel) { } - /// Creates a new client for FaasService that uses a custom CallInvoker. + /// Creates a new client for Http that uses a custom CallInvoker. /// The callInvoker to use to make remote calls. - public FaasServiceClient(grpc::CallInvoker callInvoker) : base(callInvoker) + public HttpClient(grpc::CallInvoker callInvoker) : base(callInvoker) { } /// Protected parameterless constructor to allow creation of test doubles. - protected FaasServiceClient() : base() + protected HttpClient() : base() { } /// Protected constructor to allow creation of configured clients. /// The client configuration. - protected FaasServiceClient(ClientBaseConfiguration configuration) : base(configuration) + protected HttpClient(ClientBaseConfiguration configuration) : base(configuration) { } /// - /// Begin streaming triggers/response to/from the membrane + /// Proxy an HTTP server /// /// The initial metadata to send with the call. This parameter is optional. /// An optional deadline for the call. The call will be cancelled if deadline is hit. /// An optional token for canceling the call. /// The call object. - public virtual grpc::AsyncDuplexStreamingCall TriggerStream(grpc::Metadata headers = null, global::System.DateTime? deadline = null, global::System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken)) + public virtual grpc::AsyncDuplexStreamingCall Proxy(grpc::Metadata headers = null, global::System.DateTime? deadline = null, global::System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken)) { - return TriggerStream(new grpc::CallOptions(headers, deadline, cancellationToken)); + return Proxy(new grpc::CallOptions(headers, deadline, cancellationToken)); } /// - /// Begin streaming triggers/response to/from the membrane + /// Proxy an HTTP server /// /// The options for the call. /// The call object. - public virtual grpc::AsyncDuplexStreamingCall TriggerStream(grpc::CallOptions options) + public virtual grpc::AsyncDuplexStreamingCall Proxy(grpc::CallOptions options) { - return CallInvoker.AsyncDuplexStreamingCall(__Method_TriggerStream, null, options); + return CallInvoker.AsyncDuplexStreamingCall(__Method_Proxy, null, options); } /// Creates a new instance of client from given ClientBaseConfiguration. - protected override FaasServiceClient NewInstance(ClientBaseConfiguration configuration) + protected override HttpClient NewInstance(ClientBaseConfiguration configuration) { - return new FaasServiceClient(configuration); + return new HttpClient(configuration); } } /// Creates service definition that can be registered with a server /// An object implementing the server-side handling logic. - public static grpc::ServerServiceDefinition BindService(FaasServiceBase serviceImpl) + public static grpc::ServerServiceDefinition BindService(HttpBase serviceImpl) { return grpc::ServerServiceDefinition.CreateBuilder() - .AddMethod(__Method_TriggerStream, serviceImpl.TriggerStream).Build(); + .AddMethod(__Method_Proxy, serviceImpl.Proxy).Build(); } /// Register service method with a service binder with or without implementation. Useful when customizing the service binding logic. /// Note: this method is part of an experimental API that can change or be removed without any prior notice. /// Service methods will be bound by calling AddMethod on this object. /// An object implementing the server-side handling logic. - public static void BindService(grpc::ServiceBinderBase serviceBinder, FaasServiceBase serviceImpl) + public static void BindService(grpc::ServiceBinderBase serviceBinder, HttpBase serviceImpl) { - serviceBinder.AddMethod(__Method_TriggerStream, serviceImpl == null ? null : new grpc::DuplexStreamingServerMethod(serviceImpl.TriggerStream)); + serviceBinder.AddMethod(__Method_Proxy, serviceImpl == null ? null : new grpc::DuplexStreamingServerMethod(serviceImpl.Proxy)); } } diff --git a/src/Nitric.Sdk/Proto/nitric/proto/keyvalue/v1/Keyvalue.cs b/src/Nitric.Sdk/Proto/nitric/proto/keyvalue/v1/Keyvalue.cs new file mode 100644 index 0000000..203d0f6 --- /dev/null +++ b/src/Nitric.Sdk/Proto/nitric/proto/keyvalue/v1/Keyvalue.cs @@ -0,0 +1,1761 @@ +// +// Generated by the protocol buffer compiler. DO NOT EDIT! +// source: nitric/proto/keyvalue/v1/keyvalue.proto +// +#pragma warning disable 1591, 0612, 3021 +#region Designer generated code + +using pb = global::Google.Protobuf; +using pbc = global::Google.Protobuf.Collections; +using pbr = global::Google.Protobuf.Reflection; +using scg = global::System.Collections.Generic; +namespace Nitric.Proto.KeyValue.v1 { + + /// Holder for reflection information generated from nitric/proto/keyvalue/v1/keyvalue.proto + public static partial class KeyvalueReflection { + + #region Descriptor + /// File descriptor for nitric/proto/keyvalue/v1/keyvalue.proto + public static pbr::FileDescriptor Descriptor { + get { return descriptor; } + } + private static pbr::FileDescriptor descriptor; + + static KeyvalueReflection() { + byte[] descriptorData = global::System.Convert.FromBase64String( + string.Concat( + "CiduaXRyaWMvcHJvdG8va2V5dmFsdWUvdjEva2V5dmFsdWUucHJvdG8SGG5p", + "dHJpYy5wcm90by5LZXlWYWx1ZS52MRocZ29vZ2xlL3Byb3RvYnVmL3N0cnVj", + "dC5wcm90byIVCgVTdG9yZRIMCgRuYW1lGAEgASgJIiYKCFZhbHVlUmVmEg0K", + "BXN0b3JlGAEgASgJEgsKA2tleRgCIAEoCSJiCgVWYWx1ZRIvCgNyZWYYASAB", + "KAsyIi5uaXRyaWMucHJvdG8uS2V5VmFsdWUudjEuVmFsdWVSZWYSKAoHY29u", + "dGVudBgCIAEoCzIXLmdvb2dsZS5wcm90b2J1Zi5TdHJ1Y3QiRQoSS2V5VmFs", + "dWVHZXRSZXF1ZXN0Ei8KA3JlZhgBIAEoCzIiLm5pdHJpYy5wcm90by5LZXlW", + "YWx1ZS52MS5WYWx1ZVJlZiJFChNLZXlWYWx1ZUdldFJlc3BvbnNlEi4KBXZh", + "bHVlGAEgASgLMh8ubml0cmljLnByb3RvLktleVZhbHVlLnYxLlZhbHVlIm8K", + "EktleVZhbHVlU2V0UmVxdWVzdBIvCgNyZWYYASABKAsyIi5uaXRyaWMucHJv", + "dG8uS2V5VmFsdWUudjEuVmFsdWVSZWYSKAoHY29udGVudBgDIAEoCzIXLmdv", + "b2dsZS5wcm90b2J1Zi5TdHJ1Y3QiFQoTS2V5VmFsdWVTZXRSZXNwb25zZSJI", + "ChVLZXlWYWx1ZURlbGV0ZVJlcXVlc3QSLwoDcmVmGAEgASgLMiIubml0cmlj", + "LnByb3RvLktleVZhbHVlLnYxLlZhbHVlUmVmIhgKFktleVZhbHVlRGVsZXRl", + "UmVzcG9uc2UyvwIKCEtleVZhbHVlEmIKA0dldBIsLm5pdHJpYy5wcm90by5L", + "ZXlWYWx1ZS52MS5LZXlWYWx1ZUdldFJlcXVlc3QaLS5uaXRyaWMucHJvdG8u", + "S2V5VmFsdWUudjEuS2V5VmFsdWVHZXRSZXNwb25zZRJiCgNTZXQSLC5uaXRy", + "aWMucHJvdG8uS2V5VmFsdWUudjEuS2V5VmFsdWVTZXRSZXF1ZXN0Gi0ubml0", + "cmljLnByb3RvLktleVZhbHVlLnYxLktleVZhbHVlU2V0UmVzcG9uc2USawoG", + "RGVsZXRlEi8ubml0cmljLnByb3RvLktleVZhbHVlLnYxLktleVZhbHVlRGVs", + "ZXRlUmVxdWVzdBowLm5pdHJpYy5wcm90by5LZXlWYWx1ZS52MS5LZXlWYWx1", + "ZURlbGV0ZVJlc3BvbnNlQqMBChtpby5uaXRyaWMucHJvdG8ua2V5dmFsdWUu", + "djFCCEtleVZhbHVlUAFaQmdpdGh1Yi5jb20vbml0cmljdGVjaC9uaXRyaWMv", + "Y29yZS9wa2cvcHJvdG8va2V5dmFsdWUvdjE7S2V5VmFsdWVwYqoCGE5pdHJp", + "Yy5Qcm90by5LZXlWYWx1ZS52McoCGE5pdHJpY1xQcm90b1xLZXlWYWx1ZVxW", + "MWIGcHJvdG8z")); + descriptor = pbr::FileDescriptor.FromGeneratedCode(descriptorData, + new pbr::FileDescriptor[] { global::Google.Protobuf.WellKnownTypes.StructReflection.Descriptor, }, + new pbr::GeneratedClrTypeInfo(null, null, new pbr::GeneratedClrTypeInfo[] { + new pbr::GeneratedClrTypeInfo(typeof(global::Nitric.Proto.KeyValue.v1.Store), global::Nitric.Proto.KeyValue.v1.Store.Parser, new[]{ "Name" }, null, null, null, null), + new pbr::GeneratedClrTypeInfo(typeof(global::Nitric.Proto.KeyValue.v1.ValueRef), global::Nitric.Proto.KeyValue.v1.ValueRef.Parser, new[]{ "Store", "Key" }, null, null, null, null), + new pbr::GeneratedClrTypeInfo(typeof(global::Nitric.Proto.KeyValue.v1.Value), global::Nitric.Proto.KeyValue.v1.Value.Parser, new[]{ "Ref", "Content" }, null, null, null, null), + new pbr::GeneratedClrTypeInfo(typeof(global::Nitric.Proto.KeyValue.v1.KeyValueGetRequest), global::Nitric.Proto.KeyValue.v1.KeyValueGetRequest.Parser, new[]{ "Ref" }, null, null, null, null), + new pbr::GeneratedClrTypeInfo(typeof(global::Nitric.Proto.KeyValue.v1.KeyValueGetResponse), global::Nitric.Proto.KeyValue.v1.KeyValueGetResponse.Parser, new[]{ "Value" }, null, null, null, null), + new pbr::GeneratedClrTypeInfo(typeof(global::Nitric.Proto.KeyValue.v1.KeyValueSetRequest), global::Nitric.Proto.KeyValue.v1.KeyValueSetRequest.Parser, new[]{ "Ref", "Content" }, null, null, null, null), + new pbr::GeneratedClrTypeInfo(typeof(global::Nitric.Proto.KeyValue.v1.KeyValueSetResponse), global::Nitric.Proto.KeyValue.v1.KeyValueSetResponse.Parser, null, null, null, null, null), + new pbr::GeneratedClrTypeInfo(typeof(global::Nitric.Proto.KeyValue.v1.KeyValueDeleteRequest), global::Nitric.Proto.KeyValue.v1.KeyValueDeleteRequest.Parser, new[]{ "Ref" }, null, null, null, null), + new pbr::GeneratedClrTypeInfo(typeof(global::Nitric.Proto.KeyValue.v1.KeyValueDeleteResponse), global::Nitric.Proto.KeyValue.v1.KeyValueDeleteResponse.Parser, null, null, null, null, null) + })); + } + #endregion + + } + #region Messages + /// + /// Provides a Key Value Store type for storing documents + /// + public sealed partial class Store : pb::IMessage + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + , pb::IBufferMessage + #endif + { + private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new Store()); + private pb::UnknownFieldSet _unknownFields; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public static pb::MessageParser Parser { get { return _parser; } } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public static pbr::MessageDescriptor Descriptor { + get { return global::Nitric.Proto.KeyValue.v1.KeyvalueReflection.Descriptor.MessageTypes[0]; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + pbr::MessageDescriptor pb::IMessage.Descriptor { + get { return Descriptor; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public Store() { + OnConstruction(); + } + + partial void OnConstruction(); + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public Store(Store other) : this() { + name_ = other.name_; + _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public Store Clone() { + return new Store(this); + } + + /// Field number for the "name" field. + public const int NameFieldNumber = 1; + private string name_ = ""; + /// + /// The store name + /// + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public string Name { + get { return name_; } + set { + name_ = pb::ProtoPreconditions.CheckNotNull(value, "value"); + } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public override bool Equals(object other) { + return Equals(other as Store); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public bool Equals(Store other) { + if (ReferenceEquals(other, null)) { + return false; + } + if (ReferenceEquals(other, this)) { + return true; + } + if (Name != other.Name) return false; + return Equals(_unknownFields, other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public override int GetHashCode() { + int hash = 1; + if (Name.Length != 0) hash ^= Name.GetHashCode(); + if (_unknownFields != null) { + hash ^= _unknownFields.GetHashCode(); + } + return hash; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public override string ToString() { + return pb::JsonFormatter.ToDiagnosticString(this); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public void WriteTo(pb::CodedOutputStream output) { + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + output.WriteRawMessage(this); + #else + if (Name.Length != 0) { + output.WriteRawTag(10); + output.WriteString(Name); + } + if (_unknownFields != null) { + _unknownFields.WriteTo(output); + } + #endif + } + + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + void pb::IBufferMessage.InternalWriteTo(ref pb::WriteContext output) { + if (Name.Length != 0) { + output.WriteRawTag(10); + output.WriteString(Name); + } + if (_unknownFields != null) { + _unknownFields.WriteTo(ref output); + } + } + #endif + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public int CalculateSize() { + int size = 0; + if (Name.Length != 0) { + size += 1 + pb::CodedOutputStream.ComputeStringSize(Name); + } + if (_unknownFields != null) { + size += _unknownFields.CalculateSize(); + } + return size; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public void MergeFrom(Store other) { + if (other == null) { + return; + } + if (other.Name.Length != 0) { + Name = other.Name; + } + _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public void MergeFrom(pb::CodedInputStream input) { + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + input.ReadRawMessage(this); + #else + uint tag; + while ((tag = input.ReadTag()) != 0) { + switch(tag) { + default: + _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input); + break; + case 10: { + Name = input.ReadString(); + break; + } + } + } + #endif + } + + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + void pb::IBufferMessage.InternalMergeFrom(ref pb::ParseContext input) { + uint tag; + while ((tag = input.ReadTag()) != 0) { + switch(tag) { + default: + _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, ref input); + break; + case 10: { + Name = input.ReadString(); + break; + } + } + } + } + #endif + + } + + /// + /// ValueRef provides a unique identifier for a value + /// + public sealed partial class ValueRef : pb::IMessage + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + , pb::IBufferMessage + #endif + { + private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new ValueRef()); + private pb::UnknownFieldSet _unknownFields; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public static pb::MessageParser Parser { get { return _parser; } } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public static pbr::MessageDescriptor Descriptor { + get { return global::Nitric.Proto.KeyValue.v1.KeyvalueReflection.Descriptor.MessageTypes[1]; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + pbr::MessageDescriptor pb::IMessage.Descriptor { + get { return Descriptor; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public ValueRef() { + OnConstruction(); + } + + partial void OnConstruction(); + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public ValueRef(ValueRef other) : this() { + store_ = other.store_; + key_ = other.key_; + _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public ValueRef Clone() { + return new ValueRef(this); + } + + /// Field number for the "store" field. + public const int StoreFieldNumber = 1; + private string store_ = ""; + /// + /// The key/value store name + /// + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public string Store { + get { return store_; } + set { + store_ = pb::ProtoPreconditions.CheckNotNull(value, "value"); + } + } + + /// Field number for the "key" field. + public const int KeyFieldNumber = 2; + private string key_ = ""; + /// + /// The item's unique key within the store + /// + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public string Key { + get { return key_; } + set { + key_ = pb::ProtoPreconditions.CheckNotNull(value, "value"); + } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public override bool Equals(object other) { + return Equals(other as ValueRef); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public bool Equals(ValueRef other) { + if (ReferenceEquals(other, null)) { + return false; + } + if (ReferenceEquals(other, this)) { + return true; + } + if (Store != other.Store) return false; + if (Key != other.Key) return false; + return Equals(_unknownFields, other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public override int GetHashCode() { + int hash = 1; + if (Store.Length != 0) hash ^= Store.GetHashCode(); + if (Key.Length != 0) hash ^= Key.GetHashCode(); + if (_unknownFields != null) { + hash ^= _unknownFields.GetHashCode(); + } + return hash; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public override string ToString() { + return pb::JsonFormatter.ToDiagnosticString(this); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public void WriteTo(pb::CodedOutputStream output) { + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + output.WriteRawMessage(this); + #else + if (Store.Length != 0) { + output.WriteRawTag(10); + output.WriteString(Store); + } + if (Key.Length != 0) { + output.WriteRawTag(18); + output.WriteString(Key); + } + if (_unknownFields != null) { + _unknownFields.WriteTo(output); + } + #endif + } + + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + void pb::IBufferMessage.InternalWriteTo(ref pb::WriteContext output) { + if (Store.Length != 0) { + output.WriteRawTag(10); + output.WriteString(Store); + } + if (Key.Length != 0) { + output.WriteRawTag(18); + output.WriteString(Key); + } + if (_unknownFields != null) { + _unknownFields.WriteTo(ref output); + } + } + #endif + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public int CalculateSize() { + int size = 0; + if (Store.Length != 0) { + size += 1 + pb::CodedOutputStream.ComputeStringSize(Store); + } + if (Key.Length != 0) { + size += 1 + pb::CodedOutputStream.ComputeStringSize(Key); + } + if (_unknownFields != null) { + size += _unknownFields.CalculateSize(); + } + return size; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public void MergeFrom(ValueRef other) { + if (other == null) { + return; + } + if (other.Store.Length != 0) { + Store = other.Store; + } + if (other.Key.Length != 0) { + Key = other.Key; + } + _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public void MergeFrom(pb::CodedInputStream input) { + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + input.ReadRawMessage(this); + #else + uint tag; + while ((tag = input.ReadTag()) != 0) { + switch(tag) { + default: + _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input); + break; + case 10: { + Store = input.ReadString(); + break; + } + case 18: { + Key = input.ReadString(); + break; + } + } + } + #endif + } + + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + void pb::IBufferMessage.InternalMergeFrom(ref pb::ParseContext input) { + uint tag; + while ((tag = input.ReadTag()) != 0) { + switch(tag) { + default: + _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, ref input); + break; + case 10: { + Store = input.ReadString(); + break; + } + case 18: { + Key = input.ReadString(); + break; + } + } + } + } + #endif + + } + + /// + /// Value provides a return value type + /// + public sealed partial class Value : pb::IMessage + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + , pb::IBufferMessage + #endif + { + private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new Value()); + private pb::UnknownFieldSet _unknownFields; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public static pb::MessageParser Parser { get { return _parser; } } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public static pbr::MessageDescriptor Descriptor { + get { return global::Nitric.Proto.KeyValue.v1.KeyvalueReflection.Descriptor.MessageTypes[2]; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + pbr::MessageDescriptor pb::IMessage.Descriptor { + get { return Descriptor; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public Value() { + OnConstruction(); + } + + partial void OnConstruction(); + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public Value(Value other) : this() { + ref_ = other.ref_ != null ? other.ref_.Clone() : null; + content_ = other.content_ != null ? other.content_.Clone() : null; + _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public Value Clone() { + return new Value(this); + } + + /// Field number for the "ref" field. + public const int RefFieldNumber = 1; + private global::Nitric.Proto.KeyValue.v1.ValueRef ref_; + /// + /// ValueRef of the key/value pair, which includes the store and key + /// + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public global::Nitric.Proto.KeyValue.v1.ValueRef Ref { + get { return ref_; } + set { + ref_ = value; + } + } + + /// Field number for the "content" field. + public const int ContentFieldNumber = 2; + private global::Google.Protobuf.WellKnownTypes.Struct content_; + /// + /// The content (JSON object) + /// + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public global::Google.Protobuf.WellKnownTypes.Struct Content { + get { return content_; } + set { + content_ = value; + } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public override bool Equals(object other) { + return Equals(other as Value); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public bool Equals(Value other) { + if (ReferenceEquals(other, null)) { + return false; + } + if (ReferenceEquals(other, this)) { + return true; + } + if (!object.Equals(Ref, other.Ref)) return false; + if (!object.Equals(Content, other.Content)) return false; + return Equals(_unknownFields, other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public override int GetHashCode() { + int hash = 1; + if (ref_ != null) hash ^= Ref.GetHashCode(); + if (content_ != null) hash ^= Content.GetHashCode(); + if (_unknownFields != null) { + hash ^= _unknownFields.GetHashCode(); + } + return hash; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public override string ToString() { + return pb::JsonFormatter.ToDiagnosticString(this); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public void WriteTo(pb::CodedOutputStream output) { + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + output.WriteRawMessage(this); + #else + if (ref_ != null) { + output.WriteRawTag(10); + output.WriteMessage(Ref); + } + if (content_ != null) { + output.WriteRawTag(18); + output.WriteMessage(Content); + } + if (_unknownFields != null) { + _unknownFields.WriteTo(output); + } + #endif + } + + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + void pb::IBufferMessage.InternalWriteTo(ref pb::WriteContext output) { + if (ref_ != null) { + output.WriteRawTag(10); + output.WriteMessage(Ref); + } + if (content_ != null) { + output.WriteRawTag(18); + output.WriteMessage(Content); + } + if (_unknownFields != null) { + _unknownFields.WriteTo(ref output); + } + } + #endif + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public int CalculateSize() { + int size = 0; + if (ref_ != null) { + size += 1 + pb::CodedOutputStream.ComputeMessageSize(Ref); + } + if (content_ != null) { + size += 1 + pb::CodedOutputStream.ComputeMessageSize(Content); + } + if (_unknownFields != null) { + size += _unknownFields.CalculateSize(); + } + return size; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public void MergeFrom(Value other) { + if (other == null) { + return; + } + if (other.ref_ != null) { + if (ref_ == null) { + Ref = new global::Nitric.Proto.KeyValue.v1.ValueRef(); + } + Ref.MergeFrom(other.Ref); + } + if (other.content_ != null) { + if (content_ == null) { + Content = new global::Google.Protobuf.WellKnownTypes.Struct(); + } + Content.MergeFrom(other.Content); + } + _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public void MergeFrom(pb::CodedInputStream input) { + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + input.ReadRawMessage(this); + #else + uint tag; + while ((tag = input.ReadTag()) != 0) { + switch(tag) { + default: + _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input); + break; + case 10: { + if (ref_ == null) { + Ref = new global::Nitric.Proto.KeyValue.v1.ValueRef(); + } + input.ReadMessage(Ref); + break; + } + case 18: { + if (content_ == null) { + Content = new global::Google.Protobuf.WellKnownTypes.Struct(); + } + input.ReadMessage(Content); + break; + } + } + } + #endif + } + + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + void pb::IBufferMessage.InternalMergeFrom(ref pb::ParseContext input) { + uint tag; + while ((tag = input.ReadTag()) != 0) { + switch(tag) { + default: + _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, ref input); + break; + case 10: { + if (ref_ == null) { + Ref = new global::Nitric.Proto.KeyValue.v1.ValueRef(); + } + input.ReadMessage(Ref); + break; + } + case 18: { + if (content_ == null) { + Content = new global::Google.Protobuf.WellKnownTypes.Struct(); + } + input.ReadMessage(Content); + break; + } + } + } + } + #endif + + } + + public sealed partial class KeyValueGetRequest : pb::IMessage + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + , pb::IBufferMessage + #endif + { + private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new KeyValueGetRequest()); + private pb::UnknownFieldSet _unknownFields; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public static pb::MessageParser Parser { get { return _parser; } } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public static pbr::MessageDescriptor Descriptor { + get { return global::Nitric.Proto.KeyValue.v1.KeyvalueReflection.Descriptor.MessageTypes[3]; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + pbr::MessageDescriptor pb::IMessage.Descriptor { + get { return Descriptor; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public KeyValueGetRequest() { + OnConstruction(); + } + + partial void OnConstruction(); + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public KeyValueGetRequest(KeyValueGetRequest other) : this() { + ref_ = other.ref_ != null ? other.ref_.Clone() : null; + _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public KeyValueGetRequest Clone() { + return new KeyValueGetRequest(this); + } + + /// Field number for the "ref" field. + public const int RefFieldNumber = 1; + private global::Nitric.Proto.KeyValue.v1.ValueRef ref_; + /// + /// ValueRef of the key/value pair to get, which includes the store and key + /// + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public global::Nitric.Proto.KeyValue.v1.ValueRef Ref { + get { return ref_; } + set { + ref_ = value; + } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public override bool Equals(object other) { + return Equals(other as KeyValueGetRequest); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public bool Equals(KeyValueGetRequest other) { + if (ReferenceEquals(other, null)) { + return false; + } + if (ReferenceEquals(other, this)) { + return true; + } + if (!object.Equals(Ref, other.Ref)) return false; + return Equals(_unknownFields, other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public override int GetHashCode() { + int hash = 1; + if (ref_ != null) hash ^= Ref.GetHashCode(); + if (_unknownFields != null) { + hash ^= _unknownFields.GetHashCode(); + } + return hash; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public override string ToString() { + return pb::JsonFormatter.ToDiagnosticString(this); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public void WriteTo(pb::CodedOutputStream output) { + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + output.WriteRawMessage(this); + #else + if (ref_ != null) { + output.WriteRawTag(10); + output.WriteMessage(Ref); + } + if (_unknownFields != null) { + _unknownFields.WriteTo(output); + } + #endif + } + + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + void pb::IBufferMessage.InternalWriteTo(ref pb::WriteContext output) { + if (ref_ != null) { + output.WriteRawTag(10); + output.WriteMessage(Ref); + } + if (_unknownFields != null) { + _unknownFields.WriteTo(ref output); + } + } + #endif + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public int CalculateSize() { + int size = 0; + if (ref_ != null) { + size += 1 + pb::CodedOutputStream.ComputeMessageSize(Ref); + } + if (_unknownFields != null) { + size += _unknownFields.CalculateSize(); + } + return size; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public void MergeFrom(KeyValueGetRequest other) { + if (other == null) { + return; + } + if (other.ref_ != null) { + if (ref_ == null) { + Ref = new global::Nitric.Proto.KeyValue.v1.ValueRef(); + } + Ref.MergeFrom(other.Ref); + } + _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public void MergeFrom(pb::CodedInputStream input) { + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + input.ReadRawMessage(this); + #else + uint tag; + while ((tag = input.ReadTag()) != 0) { + switch(tag) { + default: + _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input); + break; + case 10: { + if (ref_ == null) { + Ref = new global::Nitric.Proto.KeyValue.v1.ValueRef(); + } + input.ReadMessage(Ref); + break; + } + } + } + #endif + } + + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + void pb::IBufferMessage.InternalMergeFrom(ref pb::ParseContext input) { + uint tag; + while ((tag = input.ReadTag()) != 0) { + switch(tag) { + default: + _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, ref input); + break; + case 10: { + if (ref_ == null) { + Ref = new global::Nitric.Proto.KeyValue.v1.ValueRef(); + } + input.ReadMessage(Ref); + break; + } + } + } + } + #endif + + } + + public sealed partial class KeyValueGetResponse : pb::IMessage + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + , pb::IBufferMessage + #endif + { + private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new KeyValueGetResponse()); + private pb::UnknownFieldSet _unknownFields; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public static pb::MessageParser Parser { get { return _parser; } } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public static pbr::MessageDescriptor Descriptor { + get { return global::Nitric.Proto.KeyValue.v1.KeyvalueReflection.Descriptor.MessageTypes[4]; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + pbr::MessageDescriptor pb::IMessage.Descriptor { + get { return Descriptor; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public KeyValueGetResponse() { + OnConstruction(); + } + + partial void OnConstruction(); + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public KeyValueGetResponse(KeyValueGetResponse other) : this() { + value_ = other.value_ != null ? other.value_.Clone() : null; + _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public KeyValueGetResponse Clone() { + return new KeyValueGetResponse(this); + } + + /// Field number for the "value" field. + public const int ValueFieldNumber = 1; + private global::Nitric.Proto.KeyValue.v1.Value value_; + /// + /// The retrieved value + /// + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public global::Nitric.Proto.KeyValue.v1.Value Value { + get { return value_; } + set { + value_ = value; + } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public override bool Equals(object other) { + return Equals(other as KeyValueGetResponse); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public bool Equals(KeyValueGetResponse other) { + if (ReferenceEquals(other, null)) { + return false; + } + if (ReferenceEquals(other, this)) { + return true; + } + if (!object.Equals(Value, other.Value)) return false; + return Equals(_unknownFields, other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public override int GetHashCode() { + int hash = 1; + if (value_ != null) hash ^= Value.GetHashCode(); + if (_unknownFields != null) { + hash ^= _unknownFields.GetHashCode(); + } + return hash; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public override string ToString() { + return pb::JsonFormatter.ToDiagnosticString(this); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public void WriteTo(pb::CodedOutputStream output) { + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + output.WriteRawMessage(this); + #else + if (value_ != null) { + output.WriteRawTag(10); + output.WriteMessage(Value); + } + if (_unknownFields != null) { + _unknownFields.WriteTo(output); + } + #endif + } + + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + void pb::IBufferMessage.InternalWriteTo(ref pb::WriteContext output) { + if (value_ != null) { + output.WriteRawTag(10); + output.WriteMessage(Value); + } + if (_unknownFields != null) { + _unknownFields.WriteTo(ref output); + } + } + #endif + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public int CalculateSize() { + int size = 0; + if (value_ != null) { + size += 1 + pb::CodedOutputStream.ComputeMessageSize(Value); + } + if (_unknownFields != null) { + size += _unknownFields.CalculateSize(); + } + return size; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public void MergeFrom(KeyValueGetResponse other) { + if (other == null) { + return; + } + if (other.value_ != null) { + if (value_ == null) { + Value = new global::Nitric.Proto.KeyValue.v1.Value(); + } + Value.MergeFrom(other.Value); + } + _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public void MergeFrom(pb::CodedInputStream input) { + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + input.ReadRawMessage(this); + #else + uint tag; + while ((tag = input.ReadTag()) != 0) { + switch(tag) { + default: + _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input); + break; + case 10: { + if (value_ == null) { + Value = new global::Nitric.Proto.KeyValue.v1.Value(); + } + input.ReadMessage(Value); + break; + } + } + } + #endif + } + + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + void pb::IBufferMessage.InternalMergeFrom(ref pb::ParseContext input) { + uint tag; + while ((tag = input.ReadTag()) != 0) { + switch(tag) { + default: + _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, ref input); + break; + case 10: { + if (value_ == null) { + Value = new global::Nitric.Proto.KeyValue.v1.Value(); + } + input.ReadMessage(Value); + break; + } + } + } + } + #endif + + } + + public sealed partial class KeyValueSetRequest : pb::IMessage + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + , pb::IBufferMessage + #endif + { + private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new KeyValueSetRequest()); + private pb::UnknownFieldSet _unknownFields; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public static pb::MessageParser Parser { get { return _parser; } } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public static pbr::MessageDescriptor Descriptor { + get { return global::Nitric.Proto.KeyValue.v1.KeyvalueReflection.Descriptor.MessageTypes[5]; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + pbr::MessageDescriptor pb::IMessage.Descriptor { + get { return Descriptor; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public KeyValueSetRequest() { + OnConstruction(); + } + + partial void OnConstruction(); + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public KeyValueSetRequest(KeyValueSetRequest other) : this() { + ref_ = other.ref_ != null ? other.ref_.Clone() : null; + content_ = other.content_ != null ? other.content_.Clone() : null; + _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public KeyValueSetRequest Clone() { + return new KeyValueSetRequest(this); + } + + /// Field number for the "ref" field. + public const int RefFieldNumber = 1; + private global::Nitric.Proto.KeyValue.v1.ValueRef ref_; + /// + /// ValueRef of the key/value pair to set, which includes the store and key + /// + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public global::Nitric.Proto.KeyValue.v1.ValueRef Ref { + get { return ref_; } + set { + ref_ = value; + } + } + + /// Field number for the "content" field. + public const int ContentFieldNumber = 3; + private global::Google.Protobuf.WellKnownTypes.Struct content_; + /// + /// The value content to store (JSON object) + /// + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public global::Google.Protobuf.WellKnownTypes.Struct Content { + get { return content_; } + set { + content_ = value; + } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public override bool Equals(object other) { + return Equals(other as KeyValueSetRequest); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public bool Equals(KeyValueSetRequest other) { + if (ReferenceEquals(other, null)) { + return false; + } + if (ReferenceEquals(other, this)) { + return true; + } + if (!object.Equals(Ref, other.Ref)) return false; + if (!object.Equals(Content, other.Content)) return false; + return Equals(_unknownFields, other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public override int GetHashCode() { + int hash = 1; + if (ref_ != null) hash ^= Ref.GetHashCode(); + if (content_ != null) hash ^= Content.GetHashCode(); + if (_unknownFields != null) { + hash ^= _unknownFields.GetHashCode(); + } + return hash; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public override string ToString() { + return pb::JsonFormatter.ToDiagnosticString(this); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public void WriteTo(pb::CodedOutputStream output) { + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + output.WriteRawMessage(this); + #else + if (ref_ != null) { + output.WriteRawTag(10); + output.WriteMessage(Ref); + } + if (content_ != null) { + output.WriteRawTag(26); + output.WriteMessage(Content); + } + if (_unknownFields != null) { + _unknownFields.WriteTo(output); + } + #endif + } + + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + void pb::IBufferMessage.InternalWriteTo(ref pb::WriteContext output) { + if (ref_ != null) { + output.WriteRawTag(10); + output.WriteMessage(Ref); + } + if (content_ != null) { + output.WriteRawTag(26); + output.WriteMessage(Content); + } + if (_unknownFields != null) { + _unknownFields.WriteTo(ref output); + } + } + #endif + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public int CalculateSize() { + int size = 0; + if (ref_ != null) { + size += 1 + pb::CodedOutputStream.ComputeMessageSize(Ref); + } + if (content_ != null) { + size += 1 + pb::CodedOutputStream.ComputeMessageSize(Content); + } + if (_unknownFields != null) { + size += _unknownFields.CalculateSize(); + } + return size; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public void MergeFrom(KeyValueSetRequest other) { + if (other == null) { + return; + } + if (other.ref_ != null) { + if (ref_ == null) { + Ref = new global::Nitric.Proto.KeyValue.v1.ValueRef(); + } + Ref.MergeFrom(other.Ref); + } + if (other.content_ != null) { + if (content_ == null) { + Content = new global::Google.Protobuf.WellKnownTypes.Struct(); + } + Content.MergeFrom(other.Content); + } + _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public void MergeFrom(pb::CodedInputStream input) { + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + input.ReadRawMessage(this); + #else + uint tag; + while ((tag = input.ReadTag()) != 0) { + switch(tag) { + default: + _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input); + break; + case 10: { + if (ref_ == null) { + Ref = new global::Nitric.Proto.KeyValue.v1.ValueRef(); + } + input.ReadMessage(Ref); + break; + } + case 26: { + if (content_ == null) { + Content = new global::Google.Protobuf.WellKnownTypes.Struct(); + } + input.ReadMessage(Content); + break; + } + } + } + #endif + } + + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + void pb::IBufferMessage.InternalMergeFrom(ref pb::ParseContext input) { + uint tag; + while ((tag = input.ReadTag()) != 0) { + switch(tag) { + default: + _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, ref input); + break; + case 10: { + if (ref_ == null) { + Ref = new global::Nitric.Proto.KeyValue.v1.ValueRef(); + } + input.ReadMessage(Ref); + break; + } + case 26: { + if (content_ == null) { + Content = new global::Google.Protobuf.WellKnownTypes.Struct(); + } + input.ReadMessage(Content); + break; + } + } + } + } + #endif + + } + + public sealed partial class KeyValueSetResponse : pb::IMessage + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + , pb::IBufferMessage + #endif + { + private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new KeyValueSetResponse()); + private pb::UnknownFieldSet _unknownFields; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public static pb::MessageParser Parser { get { return _parser; } } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public static pbr::MessageDescriptor Descriptor { + get { return global::Nitric.Proto.KeyValue.v1.KeyvalueReflection.Descriptor.MessageTypes[6]; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + pbr::MessageDescriptor pb::IMessage.Descriptor { + get { return Descriptor; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public KeyValueSetResponse() { + OnConstruction(); + } + + partial void OnConstruction(); + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public KeyValueSetResponse(KeyValueSetResponse other) : this() { + _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public KeyValueSetResponse Clone() { + return new KeyValueSetResponse(this); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public override bool Equals(object other) { + return Equals(other as KeyValueSetResponse); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public bool Equals(KeyValueSetResponse other) { + if (ReferenceEquals(other, null)) { + return false; + } + if (ReferenceEquals(other, this)) { + return true; + } + return Equals(_unknownFields, other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public override int GetHashCode() { + int hash = 1; + if (_unknownFields != null) { + hash ^= _unknownFields.GetHashCode(); + } + return hash; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public override string ToString() { + return pb::JsonFormatter.ToDiagnosticString(this); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public void WriteTo(pb::CodedOutputStream output) { + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + output.WriteRawMessage(this); + #else + if (_unknownFields != null) { + _unknownFields.WriteTo(output); + } + #endif + } + + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + void pb::IBufferMessage.InternalWriteTo(ref pb::WriteContext output) { + if (_unknownFields != null) { + _unknownFields.WriteTo(ref output); + } + } + #endif + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public int CalculateSize() { + int size = 0; + if (_unknownFields != null) { + size += _unknownFields.CalculateSize(); + } + return size; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public void MergeFrom(KeyValueSetResponse other) { + if (other == null) { + return; + } + _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public void MergeFrom(pb::CodedInputStream input) { + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + input.ReadRawMessage(this); + #else + uint tag; + while ((tag = input.ReadTag()) != 0) { + switch(tag) { + default: + _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input); + break; + } + } + #endif + } + + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + void pb::IBufferMessage.InternalMergeFrom(ref pb::ParseContext input) { + uint tag; + while ((tag = input.ReadTag()) != 0) { + switch(tag) { + default: + _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, ref input); + break; + } + } + } + #endif + + } + + public sealed partial class KeyValueDeleteRequest : pb::IMessage + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + , pb::IBufferMessage + #endif + { + private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new KeyValueDeleteRequest()); + private pb::UnknownFieldSet _unknownFields; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public static pb::MessageParser Parser { get { return _parser; } } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public static pbr::MessageDescriptor Descriptor { + get { return global::Nitric.Proto.KeyValue.v1.KeyvalueReflection.Descriptor.MessageTypes[7]; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + pbr::MessageDescriptor pb::IMessage.Descriptor { + get { return Descriptor; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public KeyValueDeleteRequest() { + OnConstruction(); + } + + partial void OnConstruction(); + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public KeyValueDeleteRequest(KeyValueDeleteRequest other) : this() { + ref_ = other.ref_ != null ? other.ref_.Clone() : null; + _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public KeyValueDeleteRequest Clone() { + return new KeyValueDeleteRequest(this); + } + + /// Field number for the "ref" field. + public const int RefFieldNumber = 1; + private global::Nitric.Proto.KeyValue.v1.ValueRef ref_; + /// + /// ValueRef of the key/value pair to delete, which includes the store and key + /// + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public global::Nitric.Proto.KeyValue.v1.ValueRef Ref { + get { return ref_; } + set { + ref_ = value; + } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public override bool Equals(object other) { + return Equals(other as KeyValueDeleteRequest); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public bool Equals(KeyValueDeleteRequest other) { + if (ReferenceEquals(other, null)) { + return false; + } + if (ReferenceEquals(other, this)) { + return true; + } + if (!object.Equals(Ref, other.Ref)) return false; + return Equals(_unknownFields, other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public override int GetHashCode() { + int hash = 1; + if (ref_ != null) hash ^= Ref.GetHashCode(); + if (_unknownFields != null) { + hash ^= _unknownFields.GetHashCode(); + } + return hash; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public override string ToString() { + return pb::JsonFormatter.ToDiagnosticString(this); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public void WriteTo(pb::CodedOutputStream output) { + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + output.WriteRawMessage(this); + #else + if (ref_ != null) { + output.WriteRawTag(10); + output.WriteMessage(Ref); + } + if (_unknownFields != null) { + _unknownFields.WriteTo(output); + } + #endif + } + + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + void pb::IBufferMessage.InternalWriteTo(ref pb::WriteContext output) { + if (ref_ != null) { + output.WriteRawTag(10); + output.WriteMessage(Ref); + } + if (_unknownFields != null) { + _unknownFields.WriteTo(ref output); + } + } + #endif + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public int CalculateSize() { + int size = 0; + if (ref_ != null) { + size += 1 + pb::CodedOutputStream.ComputeMessageSize(Ref); + } + if (_unknownFields != null) { + size += _unknownFields.CalculateSize(); + } + return size; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public void MergeFrom(KeyValueDeleteRequest other) { + if (other == null) { + return; + } + if (other.ref_ != null) { + if (ref_ == null) { + Ref = new global::Nitric.Proto.KeyValue.v1.ValueRef(); + } + Ref.MergeFrom(other.Ref); + } + _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public void MergeFrom(pb::CodedInputStream input) { + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + input.ReadRawMessage(this); + #else + uint tag; + while ((tag = input.ReadTag()) != 0) { + switch(tag) { + default: + _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input); + break; + case 10: { + if (ref_ == null) { + Ref = new global::Nitric.Proto.KeyValue.v1.ValueRef(); + } + input.ReadMessage(Ref); + break; + } + } + } + #endif + } + + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + void pb::IBufferMessage.InternalMergeFrom(ref pb::ParseContext input) { + uint tag; + while ((tag = input.ReadTag()) != 0) { + switch(tag) { + default: + _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, ref input); + break; + case 10: { + if (ref_ == null) { + Ref = new global::Nitric.Proto.KeyValue.v1.ValueRef(); + } + input.ReadMessage(Ref); + break; + } + } + } + } + #endif + + } + + public sealed partial class KeyValueDeleteResponse : pb::IMessage + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + , pb::IBufferMessage + #endif + { + private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new KeyValueDeleteResponse()); + private pb::UnknownFieldSet _unknownFields; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public static pb::MessageParser Parser { get { return _parser; } } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public static pbr::MessageDescriptor Descriptor { + get { return global::Nitric.Proto.KeyValue.v1.KeyvalueReflection.Descriptor.MessageTypes[8]; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + pbr::MessageDescriptor pb::IMessage.Descriptor { + get { return Descriptor; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public KeyValueDeleteResponse() { + OnConstruction(); + } + + partial void OnConstruction(); + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public KeyValueDeleteResponse(KeyValueDeleteResponse other) : this() { + _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public KeyValueDeleteResponse Clone() { + return new KeyValueDeleteResponse(this); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public override bool Equals(object other) { + return Equals(other as KeyValueDeleteResponse); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public bool Equals(KeyValueDeleteResponse other) { + if (ReferenceEquals(other, null)) { + return false; + } + if (ReferenceEquals(other, this)) { + return true; + } + return Equals(_unknownFields, other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public override int GetHashCode() { + int hash = 1; + if (_unknownFields != null) { + hash ^= _unknownFields.GetHashCode(); + } + return hash; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public override string ToString() { + return pb::JsonFormatter.ToDiagnosticString(this); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public void WriteTo(pb::CodedOutputStream output) { + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + output.WriteRawMessage(this); + #else + if (_unknownFields != null) { + _unknownFields.WriteTo(output); + } + #endif + } + + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + void pb::IBufferMessage.InternalWriteTo(ref pb::WriteContext output) { + if (_unknownFields != null) { + _unknownFields.WriteTo(ref output); + } + } + #endif + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public int CalculateSize() { + int size = 0; + if (_unknownFields != null) { + size += _unknownFields.CalculateSize(); + } + return size; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public void MergeFrom(KeyValueDeleteResponse other) { + if (other == null) { + return; + } + _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public void MergeFrom(pb::CodedInputStream input) { + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + input.ReadRawMessage(this); + #else + uint tag; + while ((tag = input.ReadTag()) != 0) { + switch(tag) { + default: + _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input); + break; + } + } + #endif + } + + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + void pb::IBufferMessage.InternalMergeFrom(ref pb::ParseContext input) { + uint tag; + while ((tag = input.ReadTag()) != 0) { + switch(tag) { + default: + _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, ref input); + break; + } + } + } + #endif + + } + + #endregion + +} + +#endregion Designer generated code diff --git a/src/Nitric.Sdk/Proto/nitric/proto/keyvalue/v1/KeyvalueGrpc.cs b/src/Nitric.Sdk/Proto/nitric/proto/keyvalue/v1/KeyvalueGrpc.cs new file mode 100644 index 0000000..496d26a --- /dev/null +++ b/src/Nitric.Sdk/Proto/nitric/proto/keyvalue/v1/KeyvalueGrpc.cs @@ -0,0 +1,306 @@ +// +// Generated by the protocol buffer compiler. DO NOT EDIT! +// source: nitric/proto/keyvalue/v1/keyvalue.proto +// +#pragma warning disable 0414, 1591 +#region Designer generated code + +using grpc = global::Grpc.Core; + +namespace Nitric.Proto.KeyValue.v1 { + /// + /// Service for storage and retrieval of simple JSON keyValue + /// + public static partial class KeyValue + { + static readonly string __ServiceName = "nitric.proto.KeyValue.v1.KeyValue"; + + static void __Helper_SerializeMessage(global::Google.Protobuf.IMessage message, grpc::SerializationContext context) + { + #if !GRPC_DISABLE_PROTOBUF_BUFFER_SERIALIZATION + if (message is global::Google.Protobuf.IBufferMessage) + { + context.SetPayloadLength(message.CalculateSize()); + global::Google.Protobuf.MessageExtensions.WriteTo(message, context.GetBufferWriter()); + context.Complete(); + return; + } + #endif + context.Complete(global::Google.Protobuf.MessageExtensions.ToByteArray(message)); + } + + static class __Helper_MessageCache + { + public static readonly bool IsBufferMessage = global::System.Reflection.IntrospectionExtensions.GetTypeInfo(typeof(global::Google.Protobuf.IBufferMessage)).IsAssignableFrom(typeof(T)); + } + + static T __Helper_DeserializeMessage(grpc::DeserializationContext context, global::Google.Protobuf.MessageParser parser) where T : global::Google.Protobuf.IMessage + { + #if !GRPC_DISABLE_PROTOBUF_BUFFER_SERIALIZATION + if (__Helper_MessageCache.IsBufferMessage) + { + return parser.ParseFrom(context.PayloadAsReadOnlySequence()); + } + #endif + return parser.ParseFrom(context.PayloadAsNewBuffer()); + } + + static readonly grpc::Marshaller __Marshaller_nitric_proto_KeyValue_v1_KeyValueGetRequest = grpc::Marshallers.Create(__Helper_SerializeMessage, context => __Helper_DeserializeMessage(context, global::Nitric.Proto.KeyValue.v1.KeyValueGetRequest.Parser)); + static readonly grpc::Marshaller __Marshaller_nitric_proto_KeyValue_v1_KeyValueGetResponse = grpc::Marshallers.Create(__Helper_SerializeMessage, context => __Helper_DeserializeMessage(context, global::Nitric.Proto.KeyValue.v1.KeyValueGetResponse.Parser)); + static readonly grpc::Marshaller __Marshaller_nitric_proto_KeyValue_v1_KeyValueSetRequest = grpc::Marshallers.Create(__Helper_SerializeMessage, context => __Helper_DeserializeMessage(context, global::Nitric.Proto.KeyValue.v1.KeyValueSetRequest.Parser)); + static readonly grpc::Marshaller __Marshaller_nitric_proto_KeyValue_v1_KeyValueSetResponse = grpc::Marshallers.Create(__Helper_SerializeMessage, context => __Helper_DeserializeMessage(context, global::Nitric.Proto.KeyValue.v1.KeyValueSetResponse.Parser)); + static readonly grpc::Marshaller __Marshaller_nitric_proto_KeyValue_v1_KeyValueDeleteRequest = grpc::Marshallers.Create(__Helper_SerializeMessage, context => __Helper_DeserializeMessage(context, global::Nitric.Proto.KeyValue.v1.KeyValueDeleteRequest.Parser)); + static readonly grpc::Marshaller __Marshaller_nitric_proto_KeyValue_v1_KeyValueDeleteResponse = grpc::Marshallers.Create(__Helper_SerializeMessage, context => __Helper_DeserializeMessage(context, global::Nitric.Proto.KeyValue.v1.KeyValueDeleteResponse.Parser)); + + static readonly grpc::Method __Method_Get = new grpc::Method( + grpc::MethodType.Unary, + __ServiceName, + "Get", + __Marshaller_nitric_proto_KeyValue_v1_KeyValueGetRequest, + __Marshaller_nitric_proto_KeyValue_v1_KeyValueGetResponse); + + static readonly grpc::Method __Method_Set = new grpc::Method( + grpc::MethodType.Unary, + __ServiceName, + "Set", + __Marshaller_nitric_proto_KeyValue_v1_KeyValueSetRequest, + __Marshaller_nitric_proto_KeyValue_v1_KeyValueSetResponse); + + static readonly grpc::Method __Method_Delete = new grpc::Method( + grpc::MethodType.Unary, + __ServiceName, + "Delete", + __Marshaller_nitric_proto_KeyValue_v1_KeyValueDeleteRequest, + __Marshaller_nitric_proto_KeyValue_v1_KeyValueDeleteResponse); + + /// Service descriptor + public static global::Google.Protobuf.Reflection.ServiceDescriptor Descriptor + { + get { return global::Nitric.Proto.KeyValue.v1.KeyvalueReflection.Descriptor.Services[0]; } + } + + /// Base class for server-side implementations of KeyValue + [grpc::BindServiceMethod(typeof(KeyValue), "BindService")] + public abstract partial class KeyValueBase + { + /// + /// Get an existing document + /// + /// The request received from the client. + /// The context of the server-side call handler being invoked. + /// The response to send back to the client (wrapped by a task). + public virtual global::System.Threading.Tasks.Task Get(global::Nitric.Proto.KeyValue.v1.KeyValueGetRequest request, grpc::ServerCallContext context) + { + throw new grpc::RpcException(new grpc::Status(grpc::StatusCode.Unimplemented, "")); + } + + /// + /// Create a new or overwrite an existing document + /// + /// The request received from the client. + /// The context of the server-side call handler being invoked. + /// The response to send back to the client (wrapped by a task). + public virtual global::System.Threading.Tasks.Task Set(global::Nitric.Proto.KeyValue.v1.KeyValueSetRequest request, grpc::ServerCallContext context) + { + throw new grpc::RpcException(new grpc::Status(grpc::StatusCode.Unimplemented, "")); + } + + /// + /// Delete an existing document + /// + /// The request received from the client. + /// The context of the server-side call handler being invoked. + /// The response to send back to the client (wrapped by a task). + public virtual global::System.Threading.Tasks.Task Delete(global::Nitric.Proto.KeyValue.v1.KeyValueDeleteRequest request, grpc::ServerCallContext context) + { + throw new grpc::RpcException(new grpc::Status(grpc::StatusCode.Unimplemented, "")); + } + + } + + /// Client for KeyValue + public partial class KeyValueClient : grpc::ClientBase + { + /// Creates a new client for KeyValue + /// The channel to use to make remote calls. + public KeyValueClient(grpc::ChannelBase channel) : base(channel) + { + } + /// Creates a new client for KeyValue that uses a custom CallInvoker. + /// The callInvoker to use to make remote calls. + public KeyValueClient(grpc::CallInvoker callInvoker) : base(callInvoker) + { + } + /// Protected parameterless constructor to allow creation of test doubles. + protected KeyValueClient() : base() + { + } + /// Protected constructor to allow creation of configured clients. + /// The client configuration. + protected KeyValueClient(ClientBaseConfiguration configuration) : base(configuration) + { + } + + /// + /// Get an existing document + /// + /// The request to send to the server. + /// The initial metadata to send with the call. This parameter is optional. + /// An optional deadline for the call. The call will be cancelled if deadline is hit. + /// An optional token for canceling the call. + /// The response received from the server. + public virtual global::Nitric.Proto.KeyValue.v1.KeyValueGetResponse Get(global::Nitric.Proto.KeyValue.v1.KeyValueGetRequest request, grpc::Metadata headers = null, global::System.DateTime? deadline = null, global::System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken)) + { + return Get(request, new grpc::CallOptions(headers, deadline, cancellationToken)); + } + /// + /// Get an existing document + /// + /// The request to send to the server. + /// The options for the call. + /// The response received from the server. + public virtual global::Nitric.Proto.KeyValue.v1.KeyValueGetResponse Get(global::Nitric.Proto.KeyValue.v1.KeyValueGetRequest request, grpc::CallOptions options) + { + return CallInvoker.BlockingUnaryCall(__Method_Get, null, options, request); + } + /// + /// Get an existing document + /// + /// The request to send to the server. + /// The initial metadata to send with the call. This parameter is optional. + /// An optional deadline for the call. The call will be cancelled if deadline is hit. + /// An optional token for canceling the call. + /// The call object. + public virtual grpc::AsyncUnaryCall GetAsync(global::Nitric.Proto.KeyValue.v1.KeyValueGetRequest request, grpc::Metadata headers = null, global::System.DateTime? deadline = null, global::System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken)) + { + return GetAsync(request, new grpc::CallOptions(headers, deadline, cancellationToken)); + } + /// + /// Get an existing document + /// + /// The request to send to the server. + /// The options for the call. + /// The call object. + public virtual grpc::AsyncUnaryCall GetAsync(global::Nitric.Proto.KeyValue.v1.KeyValueGetRequest request, grpc::CallOptions options) + { + return CallInvoker.AsyncUnaryCall(__Method_Get, null, options, request); + } + /// + /// Create a new or overwrite an existing document + /// + /// The request to send to the server. + /// The initial metadata to send with the call. This parameter is optional. + /// An optional deadline for the call. The call will be cancelled if deadline is hit. + /// An optional token for canceling the call. + /// The response received from the server. + public virtual global::Nitric.Proto.KeyValue.v1.KeyValueSetResponse Set(global::Nitric.Proto.KeyValue.v1.KeyValueSetRequest request, grpc::Metadata headers = null, global::System.DateTime? deadline = null, global::System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken)) + { + return Set(request, new grpc::CallOptions(headers, deadline, cancellationToken)); + } + /// + /// Create a new or overwrite an existing document + /// + /// The request to send to the server. + /// The options for the call. + /// The response received from the server. + public virtual global::Nitric.Proto.KeyValue.v1.KeyValueSetResponse Set(global::Nitric.Proto.KeyValue.v1.KeyValueSetRequest request, grpc::CallOptions options) + { + return CallInvoker.BlockingUnaryCall(__Method_Set, null, options, request); + } + /// + /// Create a new or overwrite an existing document + /// + /// The request to send to the server. + /// The initial metadata to send with the call. This parameter is optional. + /// An optional deadline for the call. The call will be cancelled if deadline is hit. + /// An optional token for canceling the call. + /// The call object. + public virtual grpc::AsyncUnaryCall SetAsync(global::Nitric.Proto.KeyValue.v1.KeyValueSetRequest request, grpc::Metadata headers = null, global::System.DateTime? deadline = null, global::System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken)) + { + return SetAsync(request, new grpc::CallOptions(headers, deadline, cancellationToken)); + } + /// + /// Create a new or overwrite an existing document + /// + /// The request to send to the server. + /// The options for the call. + /// The call object. + public virtual grpc::AsyncUnaryCall SetAsync(global::Nitric.Proto.KeyValue.v1.KeyValueSetRequest request, grpc::CallOptions options) + { + return CallInvoker.AsyncUnaryCall(__Method_Set, null, options, request); + } + /// + /// Delete an existing document + /// + /// The request to send to the server. + /// The initial metadata to send with the call. This parameter is optional. + /// An optional deadline for the call. The call will be cancelled if deadline is hit. + /// An optional token for canceling the call. + /// The response received from the server. + public virtual global::Nitric.Proto.KeyValue.v1.KeyValueDeleteResponse Delete(global::Nitric.Proto.KeyValue.v1.KeyValueDeleteRequest request, grpc::Metadata headers = null, global::System.DateTime? deadline = null, global::System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken)) + { + return Delete(request, new grpc::CallOptions(headers, deadline, cancellationToken)); + } + /// + /// Delete an existing document + /// + /// The request to send to the server. + /// The options for the call. + /// The response received from the server. + public virtual global::Nitric.Proto.KeyValue.v1.KeyValueDeleteResponse Delete(global::Nitric.Proto.KeyValue.v1.KeyValueDeleteRequest request, grpc::CallOptions options) + { + return CallInvoker.BlockingUnaryCall(__Method_Delete, null, options, request); + } + /// + /// Delete an existing document + /// + /// The request to send to the server. + /// The initial metadata to send with the call. This parameter is optional. + /// An optional deadline for the call. The call will be cancelled if deadline is hit. + /// An optional token for canceling the call. + /// The call object. + public virtual grpc::AsyncUnaryCall DeleteAsync(global::Nitric.Proto.KeyValue.v1.KeyValueDeleteRequest request, grpc::Metadata headers = null, global::System.DateTime? deadline = null, global::System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken)) + { + return DeleteAsync(request, new grpc::CallOptions(headers, deadline, cancellationToken)); + } + /// + /// Delete an existing document + /// + /// The request to send to the server. + /// The options for the call. + /// The call object. + public virtual grpc::AsyncUnaryCall DeleteAsync(global::Nitric.Proto.KeyValue.v1.KeyValueDeleteRequest request, grpc::CallOptions options) + { + return CallInvoker.AsyncUnaryCall(__Method_Delete, null, options, request); + } + /// Creates a new instance of client from given ClientBaseConfiguration. + protected override KeyValueClient NewInstance(ClientBaseConfiguration configuration) + { + return new KeyValueClient(configuration); + } + } + + /// Creates service definition that can be registered with a server + /// An object implementing the server-side handling logic. + public static grpc::ServerServiceDefinition BindService(KeyValueBase serviceImpl) + { + return grpc::ServerServiceDefinition.CreateBuilder() + .AddMethod(__Method_Get, serviceImpl.Get) + .AddMethod(__Method_Set, serviceImpl.Set) + .AddMethod(__Method_Delete, serviceImpl.Delete).Build(); + } + + /// Register service method with a service binder with or without implementation. Useful when customizing the service binding logic. + /// Note: this method is part of an experimental API that can change or be removed without any prior notice. + /// Service methods will be bound by calling AddMethod on this object. + /// An object implementing the server-side handling logic. + public static void BindService(grpc::ServiceBinderBase serviceBinder, KeyValueBase serviceImpl) + { + serviceBinder.AddMethod(__Method_Get, serviceImpl == null ? null : new grpc::UnaryServerMethod(serviceImpl.Get)); + serviceBinder.AddMethod(__Method_Set, serviceImpl == null ? null : new grpc::UnaryServerMethod(serviceImpl.Set)); + serviceBinder.AddMethod(__Method_Delete, serviceImpl == null ? null : new grpc::UnaryServerMethod(serviceImpl.Delete)); + } + + } +} +#endregion diff --git a/src/Nitric.Sdk/Proto/proto/queue/v1/Queue.cs b/src/Nitric.Sdk/Proto/nitric/proto/queues/v1/Queues.cs similarity index 69% rename from src/Nitric.Sdk/Proto/proto/queue/v1/Queue.cs rename to src/Nitric.Sdk/Proto/nitric/proto/queues/v1/Queues.cs index 44bd32a..321042a 100644 --- a/src/Nitric.Sdk/Proto/proto/queue/v1/Queue.cs +++ b/src/Nitric.Sdk/Proto/nitric/proto/queues/v1/Queues.cs @@ -1,6 +1,6 @@ // // Generated by the protocol buffer compiler. DO NOT EDIT! -// source: proto/queue/v1/queue.proto +// source: nitric/proto/queues/v1/queues.proto // #pragma warning disable 1591, 0612, 3021 #region Designer generated code @@ -9,86 +9,80 @@ using pbc = global::Google.Protobuf.Collections; using pbr = global::Google.Protobuf.Reflection; using scg = global::System.Collections.Generic; -namespace Nitric.Proto.Queue.v1 { +namespace Nitric.Proto.Queues.v1 { - /// Holder for reflection information generated from proto/queue/v1/queue.proto - public static partial class QueueReflection { + /// Holder for reflection information generated from nitric/proto/queues/v1/queues.proto + public static partial class QueuesReflection { #region Descriptor - /// File descriptor for proto/queue/v1/queue.proto + /// File descriptor for nitric/proto/queues/v1/queues.proto public static pbr::FileDescriptor Descriptor { get { return descriptor; } } private static pbr::FileDescriptor descriptor; - static QueueReflection() { + static QueuesReflection() { byte[] descriptorData = global::System.Convert.FromBase64String( string.Concat( - "Chpwcm90by9xdWV1ZS92MS9xdWV1ZS5wcm90bxIPbml0cmljLnF1ZXVlLnYx", - "Ghxnb29nbGUvcHJvdG9idWYvc3RydWN0LnByb3RvGhd2YWxpZGF0ZS92YWxp", - "ZGF0ZS5wcm90byJyChBRdWV1ZVNlbmRSZXF1ZXN0EikKBXF1ZXVlGAEgASgJ", - "Qhr6QhdyFSiAAjIQXlx3KyhbLlwtXVx3KykqJBIzCgR0YXNrGAIgASgLMhsu", - "bml0cmljLnF1ZXVlLnYxLk5pdHJpY1Rhc2tCCPpCBYoBAhABIhMKEVF1ZXVl", - "U2VuZFJlc3BvbnNlIlwKFVF1ZXVlU2VuZEJhdGNoUmVxdWVzdBINCgVxdWV1", - "ZRgBIAEoCRI0CgV0YXNrcxgCIAMoCzIbLm5pdHJpYy5xdWV1ZS52MS5OaXRy", - "aWNUYXNrQgj6QgWSAQIIASJKChZRdWV1ZVNlbmRCYXRjaFJlc3BvbnNlEjAK", - "C2ZhaWxlZFRhc2tzGAEgAygLMhsubml0cmljLnF1ZXVlLnYxLkZhaWxlZFRh", - "c2siMwoTUXVldWVSZWNlaXZlUmVxdWVzdBINCgVxdWV1ZRgBIAEoCRINCgVk", - "ZXB0aBgCIAEoBSJCChRRdWV1ZVJlY2VpdmVSZXNwb25zZRIqCgV0YXNrcxgB", - "IAMoCzIbLm5pdHJpYy5xdWV1ZS52MS5OaXRyaWNUYXNrIkAKFFF1ZXVlQ29t", - "cGxldGVSZXF1ZXN0Eg0KBXF1ZXVlGAEgASgJEhkKCGxlYXNlX2lkGAIgASgJ", - "Qgf6QgRyAhABIhcKFVF1ZXVlQ29tcGxldGVSZXNwb25zZSJICgpGYWlsZWRU", - "YXNrEikKBHRhc2sYASABKAsyGy5uaXRyaWMucXVldWUudjEuTml0cmljVGFz", - "axIPCgdtZXNzYWdlGAIgASgJImoKCk5pdHJpY1Rhc2sSCgoCaWQYASABKAkS", - "EAoIbGVhc2VfaWQYAiABKAkSFAoMcGF5bG9hZF90eXBlGAMgASgJEigKB3Bh", - "eWxvYWQYBCABKAsyFy5nb29nbGUucHJvdG9idWYuU3RydWN0Mu4CCgxRdWV1", - "ZVNlcnZpY2USTQoEU2VuZBIhLm5pdHJpYy5xdWV1ZS52MS5RdWV1ZVNlbmRS", - "ZXF1ZXN0GiIubml0cmljLnF1ZXVlLnYxLlF1ZXVlU2VuZFJlc3BvbnNlElwK", - "CVNlbmRCYXRjaBImLm5pdHJpYy5xdWV1ZS52MS5RdWV1ZVNlbmRCYXRjaFJl", - "cXVlc3QaJy5uaXRyaWMucXVldWUudjEuUXVldWVTZW5kQmF0Y2hSZXNwb25z", - "ZRJWCgdSZWNlaXZlEiQubml0cmljLnF1ZXVlLnYxLlF1ZXVlUmVjZWl2ZVJl", - "cXVlc3QaJS5uaXRyaWMucXVldWUudjEuUXVldWVSZWNlaXZlUmVzcG9uc2US", - "WQoIQ29tcGxldGUSJS5uaXRyaWMucXVldWUudjEuUXVldWVDb21wbGV0ZVJl", - "cXVlc3QaJi5uaXRyaWMucXVldWUudjEuUXVldWVDb21wbGV0ZVJlc3BvbnNl", - "QokBChhpby5uaXRyaWMucHJvdG8ucXVldWUudjFCBlF1ZXVlc1ABWjNnaXRo", - "dWIuY29tL25pdHJpY3RlY2gvbml0cmljL2NvcmUvcGtnL2FwaS9uaXRyaWMv", - "djGqAhVOaXRyaWMuUHJvdG8uUXVldWUudjHKAhVOaXRyaWNcUHJvdG9cUXVl", - "dWVcVjFiBnByb3RvMw==")); + "CiNuaXRyaWMvcHJvdG8vcXVldWVzL3YxL3F1ZXVlcy5wcm90bxIWbml0cmlj", + "LnByb3RvLnF1ZXVlcy52MRocZ29vZ2xlL3Byb3RvYnVmL3N0cnVjdC5wcm90", + "byJnChVRdWV1ZVNlbmRSZXF1ZXN0QmF0Y2gSEgoKcXVldWVfbmFtZRgBIAEo", + "CRI6CghyZXF1ZXN0cxgCIAMoCzIoLm5pdHJpYy5wcm90by5xdWV1ZXMudjEu", + "UXVldWVTZW5kUmVxdWVzdCJXChFRdWV1ZVNlbmRSZXNwb25zZRJCCg9mYWls", + "ZWRfcmVxdWVzdHMYASADKAsyKS5uaXRyaWMucHJvdG8ucXVldWVzLnYxLkZh", + "aWxlZFNlbmRSZXF1ZXN0IjgKE1F1ZXVlUmVjZWl2ZVJlcXVlc3QSEgoKcXVl", + "dWVfbmFtZRgBIAEoCRINCgVkZXB0aBgCIAEoBSJLChRRdWV1ZVJlY2VpdmVS", + "ZXNwb25zZRIzCgV0YXNrcxgBIAMoCzIkLm5pdHJpYy5wcm90by5xdWV1ZXMu", + "djEuUmVjZWl2ZWRUYXNrIjwKFFF1ZXVlQ29tcGxldGVSZXF1ZXN0EhIKCnF1", + "ZXVlX25hbWUYASABKAkSEAoIbGVhc2VfaWQYAiABKAkiFwoVUXVldWVDb21w", + "bGV0ZVJlc3BvbnNlIjwKEFF1ZXVlU2VuZFJlcXVlc3QSKAoHcGF5bG9hZBgB", + "IAEoCzIXLmdvb2dsZS5wcm90b2J1Zi5TdHJ1Y3QiSgoMUmVjZWl2ZWRUYXNr", + "EhAKCGxlYXNlX2lkGAEgASgJEigKB3BheWxvYWQYAiABKAsyFy5nb29nbGUu", + "cHJvdG9idWYuU3RydWN0Il8KEUZhaWxlZFNlbmRSZXF1ZXN0EjkKB3JlcXVl", + "c3QYASABKAsyKC5uaXRyaWMucHJvdG8ucXVldWVzLnYxLlF1ZXVlU2VuZFJl", + "cXVlc3QSDwoHbWVzc2FnZRgCIAEoCTK5AgoGUXVldWVzEmAKBFNlbmQSLS5u", + "aXRyaWMucHJvdG8ucXVldWVzLnYxLlF1ZXVlU2VuZFJlcXVlc3RCYXRjaBop", + "Lm5pdHJpYy5wcm90by5xdWV1ZXMudjEuUXVldWVTZW5kUmVzcG9uc2USZAoH", + "UmVjZWl2ZRIrLm5pdHJpYy5wcm90by5xdWV1ZXMudjEuUXVldWVSZWNlaXZl", + "UmVxdWVzdBosLm5pdHJpYy5wcm90by5xdWV1ZXMudjEuUXVldWVSZWNlaXZl", + "UmVzcG9uc2USZwoIQ29tcGxldGUSLC5uaXRyaWMucHJvdG8ucXVldWVzLnYx", + "LlF1ZXVlQ29tcGxldGVSZXF1ZXN0Gi0ubml0cmljLnByb3RvLnF1ZXVlcy52", + "MS5RdWV1ZUNvbXBsZXRlUmVzcG9uc2VCngEKGWlvLm5pdHJpYy5wcm90by5x", + "dWV1ZXMudjFCDVF1ZXVlc1NlcnZpY2VQAVo+Z2l0aHViLmNvbS9uaXRyaWN0", + "ZWNoL25pdHJpYy9jb3JlL3BrZy9wcm90by9xdWV1ZXMvdjE7cXVldWVzcGKq", + "AhZOaXRyaWMuUHJvdG8uUXVldWVzLnYxygIWTml0cmljXFByb3RvXFF1ZXVl", + "c1xWMWIGcHJvdG8z")); descriptor = pbr::FileDescriptor.FromGeneratedCode(descriptorData, - new pbr::FileDescriptor[] { global::Google.Protobuf.WellKnownTypes.StructReflection.Descriptor, global::Validate.ValidateReflection.Descriptor, }, + new pbr::FileDescriptor[] { global::Google.Protobuf.WellKnownTypes.StructReflection.Descriptor, }, new pbr::GeneratedClrTypeInfo(null, null, new pbr::GeneratedClrTypeInfo[] { - new pbr::GeneratedClrTypeInfo(typeof(global::Nitric.Proto.Queue.v1.QueueSendRequest), global::Nitric.Proto.Queue.v1.QueueSendRequest.Parser, new[]{ "Queue", "Task" }, null, null, null, null), - new pbr::GeneratedClrTypeInfo(typeof(global::Nitric.Proto.Queue.v1.QueueSendResponse), global::Nitric.Proto.Queue.v1.QueueSendResponse.Parser, null, null, null, null, null), - new pbr::GeneratedClrTypeInfo(typeof(global::Nitric.Proto.Queue.v1.QueueSendBatchRequest), global::Nitric.Proto.Queue.v1.QueueSendBatchRequest.Parser, new[]{ "Queue", "Tasks" }, null, null, null, null), - new pbr::GeneratedClrTypeInfo(typeof(global::Nitric.Proto.Queue.v1.QueueSendBatchResponse), global::Nitric.Proto.Queue.v1.QueueSendBatchResponse.Parser, new[]{ "FailedTasks" }, null, null, null, null), - new pbr::GeneratedClrTypeInfo(typeof(global::Nitric.Proto.Queue.v1.QueueReceiveRequest), global::Nitric.Proto.Queue.v1.QueueReceiveRequest.Parser, new[]{ "Queue", "Depth" }, null, null, null, null), - new pbr::GeneratedClrTypeInfo(typeof(global::Nitric.Proto.Queue.v1.QueueReceiveResponse), global::Nitric.Proto.Queue.v1.QueueReceiveResponse.Parser, new[]{ "Tasks" }, null, null, null, null), - new pbr::GeneratedClrTypeInfo(typeof(global::Nitric.Proto.Queue.v1.QueueCompleteRequest), global::Nitric.Proto.Queue.v1.QueueCompleteRequest.Parser, new[]{ "Queue", "LeaseId" }, null, null, null, null), - new pbr::GeneratedClrTypeInfo(typeof(global::Nitric.Proto.Queue.v1.QueueCompleteResponse), global::Nitric.Proto.Queue.v1.QueueCompleteResponse.Parser, null, null, null, null, null), - new pbr::GeneratedClrTypeInfo(typeof(global::Nitric.Proto.Queue.v1.FailedTask), global::Nitric.Proto.Queue.v1.FailedTask.Parser, new[]{ "Task", "Message" }, null, null, null, null), - new pbr::GeneratedClrTypeInfo(typeof(global::Nitric.Proto.Queue.v1.NitricTask), global::Nitric.Proto.Queue.v1.NitricTask.Parser, new[]{ "Id", "LeaseId", "PayloadType", "Payload" }, null, null, null, null) + new pbr::GeneratedClrTypeInfo(typeof(global::Nitric.Proto.Queues.v1.QueueSendRequestBatch), global::Nitric.Proto.Queues.v1.QueueSendRequestBatch.Parser, new[]{ "QueueName", "Requests" }, null, null, null, null), + new pbr::GeneratedClrTypeInfo(typeof(global::Nitric.Proto.Queues.v1.QueueSendResponse), global::Nitric.Proto.Queues.v1.QueueSendResponse.Parser, new[]{ "FailedRequests" }, null, null, null, null), + new pbr::GeneratedClrTypeInfo(typeof(global::Nitric.Proto.Queues.v1.QueueReceiveRequest), global::Nitric.Proto.Queues.v1.QueueReceiveRequest.Parser, new[]{ "QueueName", "Depth" }, null, null, null, null), + new pbr::GeneratedClrTypeInfo(typeof(global::Nitric.Proto.Queues.v1.QueueReceiveResponse), global::Nitric.Proto.Queues.v1.QueueReceiveResponse.Parser, new[]{ "Tasks" }, null, null, null, null), + new pbr::GeneratedClrTypeInfo(typeof(global::Nitric.Proto.Queues.v1.QueueCompleteRequest), global::Nitric.Proto.Queues.v1.QueueCompleteRequest.Parser, new[]{ "QueueName", "LeaseId" }, null, null, null, null), + new pbr::GeneratedClrTypeInfo(typeof(global::Nitric.Proto.Queues.v1.QueueCompleteResponse), global::Nitric.Proto.Queues.v1.QueueCompleteResponse.Parser, null, null, null, null, null), + new pbr::GeneratedClrTypeInfo(typeof(global::Nitric.Proto.Queues.v1.QueueSendRequest), global::Nitric.Proto.Queues.v1.QueueSendRequest.Parser, new[]{ "Payload" }, null, null, null, null), + new pbr::GeneratedClrTypeInfo(typeof(global::Nitric.Proto.Queues.v1.ReceivedTask), global::Nitric.Proto.Queues.v1.ReceivedTask.Parser, new[]{ "LeaseId", "Payload" }, null, null, null, null), + new pbr::GeneratedClrTypeInfo(typeof(global::Nitric.Proto.Queues.v1.FailedSendRequest), global::Nitric.Proto.Queues.v1.FailedSendRequest.Parser, new[]{ "Request", "Message" }, null, null, null, null) })); } #endregion } #region Messages - /// - /// Request to push a single event to a queue - /// - public sealed partial class QueueSendRequest : pb::IMessage + public sealed partial class QueueSendRequestBatch : pb::IMessage #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE , pb::IBufferMessage #endif { - private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new QueueSendRequest()); + private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new QueueSendRequestBatch()); private pb::UnknownFieldSet _unknownFields; [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public static pb::MessageParser Parser { get { return _parser; } } + public static pb::MessageParser Parser { get { return _parser; } } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public static pbr::MessageDescriptor Descriptor { - get { return global::Nitric.Proto.Queue.v1.QueueReflection.Descriptor.MessageTypes[0]; } + get { return global::Nitric.Proto.Queues.v1.QueuesReflection.Descriptor.MessageTypes[0]; } } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] @@ -97,76 +91,75 @@ public sealed partial class QueueSendRequest : pb::IMessage } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public QueueSendRequest() { + public QueueSendRequestBatch() { OnConstruction(); } partial void OnConstruction(); [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public QueueSendRequest(QueueSendRequest other) : this() { - queue_ = other.queue_; - task_ = other.task_ != null ? other.task_.Clone() : null; + public QueueSendRequestBatch(QueueSendRequestBatch other) : this() { + queueName_ = other.queueName_; + requests_ = other.requests_.Clone(); _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public QueueSendRequest Clone() { - return new QueueSendRequest(this); + public QueueSendRequestBatch Clone() { + return new QueueSendRequestBatch(this); } - /// Field number for the "queue" field. - public const int QueueFieldNumber = 1; - private string queue_ = ""; + /// Field number for the "queue_name" field. + public const int QueueNameFieldNumber = 1; + private string queueName_ = ""; /// /// The Nitric name for the queue /// this will automatically be resolved to the provider specific queue identifier. /// [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public string Queue { - get { return queue_; } + public string QueueName { + get { return queueName_; } set { - queue_ = pb::ProtoPreconditions.CheckNotNull(value, "value"); + queueName_ = pb::ProtoPreconditions.CheckNotNull(value, "value"); } } - /// Field number for the "task" field. - public const int TaskFieldNumber = 2; - private global::Nitric.Proto.Queue.v1.NitricTask task_; + /// Field number for the "requests" field. + public const int RequestsFieldNumber = 2; + private static readonly pb::FieldCodec _repeated_requests_codec + = pb::FieldCodec.ForMessage(18, global::Nitric.Proto.Queues.v1.QueueSendRequest.Parser); + private readonly pbc::RepeatedField requests_ = new pbc::RepeatedField(); /// - /// The task to push to the queue + /// Array of tasks to push to the queue /// [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public global::Nitric.Proto.Queue.v1.NitricTask Task { - get { return task_; } - set { - task_ = value; - } + public pbc::RepeatedField Requests { + get { return requests_; } } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public override bool Equals(object other) { - return Equals(other as QueueSendRequest); + return Equals(other as QueueSendRequestBatch); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public bool Equals(QueueSendRequest other) { + public bool Equals(QueueSendRequestBatch other) { if (ReferenceEquals(other, null)) { return false; } if (ReferenceEquals(other, this)) { return true; } - if (Queue != other.Queue) return false; - if (!object.Equals(Task, other.Task)) return false; + if (QueueName != other.QueueName) return false; + if(!requests_.Equals(other.requests_)) return false; return Equals(_unknownFields, other._unknownFields); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public override int GetHashCode() { int hash = 1; - if (Queue.Length != 0) hash ^= Queue.GetHashCode(); - if (task_ != null) hash ^= Task.GetHashCode(); + if (QueueName.Length != 0) hash ^= QueueName.GetHashCode(); + hash ^= requests_.GetHashCode(); if (_unknownFields != null) { hash ^= _unknownFields.GetHashCode(); } @@ -183,14 +176,11 @@ public void WriteTo(pb::CodedOutputStream output) { #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE output.WriteRawMessage(this); #else - if (Queue.Length != 0) { + if (QueueName.Length != 0) { output.WriteRawTag(10); - output.WriteString(Queue); - } - if (task_ != null) { - output.WriteRawTag(18); - output.WriteMessage(Task); + output.WriteString(QueueName); } + requests_.WriteTo(output, _repeated_requests_codec); if (_unknownFields != null) { _unknownFields.WriteTo(output); } @@ -200,14 +190,11 @@ public void WriteTo(pb::CodedOutputStream output) { #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE [global::System.Diagnostics.DebuggerNonUserCodeAttribute] void pb::IBufferMessage.InternalWriteTo(ref pb::WriteContext output) { - if (Queue.Length != 0) { + if (QueueName.Length != 0) { output.WriteRawTag(10); - output.WriteString(Queue); - } - if (task_ != null) { - output.WriteRawTag(18); - output.WriteMessage(Task); + output.WriteString(QueueName); } + requests_.WriteTo(ref output, _repeated_requests_codec); if (_unknownFields != null) { _unknownFields.WriteTo(ref output); } @@ -217,12 +204,10 @@ public void WriteTo(pb::CodedOutputStream output) { [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public int CalculateSize() { int size = 0; - if (Queue.Length != 0) { - size += 1 + pb::CodedOutputStream.ComputeStringSize(Queue); - } - if (task_ != null) { - size += 1 + pb::CodedOutputStream.ComputeMessageSize(Task); + if (QueueName.Length != 0) { + size += 1 + pb::CodedOutputStream.ComputeStringSize(QueueName); } + size += requests_.CalculateSize(_repeated_requests_codec); if (_unknownFields != null) { size += _unknownFields.CalculateSize(); } @@ -230,19 +215,14 @@ public int CalculateSize() { } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void MergeFrom(QueueSendRequest other) { + public void MergeFrom(QueueSendRequestBatch other) { if (other == null) { return; } - if (other.Queue.Length != 0) { - Queue = other.Queue; - } - if (other.task_ != null) { - if (task_ == null) { - Task = new global::Nitric.Proto.Queue.v1.NitricTask(); - } - Task.MergeFrom(other.Task); + if (other.QueueName.Length != 0) { + QueueName = other.QueueName; } + requests_.Add(other.requests_); _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields); } @@ -258,14 +238,11 @@ public void MergeFrom(pb::CodedInputStream input) { _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input); break; case 10: { - Queue = input.ReadString(); + QueueName = input.ReadString(); break; } case 18: { - if (task_ == null) { - Task = new global::Nitric.Proto.Queue.v1.NitricTask(); - } - input.ReadMessage(Task); + requests_.AddEntriesFrom(input, _repeated_requests_codec); break; } } @@ -283,14 +260,11 @@ public void MergeFrom(pb::CodedInputStream input) { _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, ref input); break; case 10: { - Queue = input.ReadString(); + QueueName = input.ReadString(); break; } case 18: { - if (task_ == null) { - Task = new global::Nitric.Proto.Queue.v1.NitricTask(); - } - input.ReadMessage(Task); + requests_.AddEntriesFrom(ref input, _repeated_requests_codec); break; } } @@ -301,7 +275,7 @@ public void MergeFrom(pb::CodedInputStream input) { } /// - /// Result of pushing a single task to a queue + /// Response for sending a collection of tasks /// public sealed partial class QueueSendResponse : pb::IMessage #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE @@ -315,7 +289,7 @@ public sealed partial class QueueSendResponse : pb::IMessage [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public static pbr::MessageDescriptor Descriptor { - get { return global::Nitric.Proto.Queue.v1.QueueReflection.Descriptor.MessageTypes[1]; } + get { return global::Nitric.Proto.Queues.v1.QueuesReflection.Descriptor.MessageTypes[1]; } } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] @@ -332,6 +306,7 @@ public QueueSendResponse() { [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public QueueSendResponse(QueueSendResponse other) : this() { + failedRequests_ = other.failedRequests_.Clone(); _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields); } @@ -340,6 +315,19 @@ public QueueSendResponse Clone() { return new QueueSendResponse(this); } + /// Field number for the "failed_requests" field. + public const int FailedRequestsFieldNumber = 1; + private static readonly pb::FieldCodec _repeated_failedRequests_codec + = pb::FieldCodec.ForMessage(10, global::Nitric.Proto.Queues.v1.FailedSendRequest.Parser); + private readonly pbc::RepeatedField failedRequests_ = new pbc::RepeatedField(); + /// + /// A list of tasks that failed to be queued + /// + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public pbc::RepeatedField FailedRequests { + get { return failedRequests_; } + } + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public override bool Equals(object other) { return Equals(other as QueueSendResponse); @@ -353,12 +341,14 @@ public bool Equals(QueueSendResponse other) { if (ReferenceEquals(other, this)) { return true; } + if(!failedRequests_.Equals(other.failedRequests_)) return false; return Equals(_unknownFields, other._unknownFields); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public override int GetHashCode() { int hash = 1; + hash ^= failedRequests_.GetHashCode(); if (_unknownFields != null) { hash ^= _unknownFields.GetHashCode(); } @@ -375,6 +365,7 @@ public void WriteTo(pb::CodedOutputStream output) { #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE output.WriteRawMessage(this); #else + failedRequests_.WriteTo(output, _repeated_failedRequests_codec); if (_unknownFields != null) { _unknownFields.WriteTo(output); } @@ -384,6 +375,7 @@ public void WriteTo(pb::CodedOutputStream output) { #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE [global::System.Diagnostics.DebuggerNonUserCodeAttribute] void pb::IBufferMessage.InternalWriteTo(ref pb::WriteContext output) { + failedRequests_.WriteTo(ref output, _repeated_failedRequests_codec); if (_unknownFields != null) { _unknownFields.WriteTo(ref output); } @@ -393,6 +385,7 @@ public void WriteTo(pb::CodedOutputStream output) { [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public int CalculateSize() { int size = 0; + size += failedRequests_.CalculateSize(_repeated_failedRequests_codec); if (_unknownFields != null) { size += _unknownFields.CalculateSize(); } @@ -404,6 +397,7 @@ public void MergeFrom(QueueSendResponse other) { if (other == null) { return; } + failedRequests_.Add(other.failedRequests_); _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields); } @@ -418,6 +412,10 @@ public void MergeFrom(pb::CodedInputStream input) { default: _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input); break; + case 10: { + failedRequests_.AddEntriesFrom(input, _repeated_failedRequests_codec); + break; + } } } #endif @@ -432,6 +430,10 @@ public void MergeFrom(pb::CodedInputStream input) { default: _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, ref input); break; + case 10: { + failedRequests_.AddEntriesFrom(ref input, _repeated_failedRequests_codec); + break; + } } } } @@ -439,19 +441,19 @@ public void MergeFrom(pb::CodedInputStream input) { } - public sealed partial class QueueSendBatchRequest : pb::IMessage + public sealed partial class QueueReceiveRequest : pb::IMessage #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE , pb::IBufferMessage #endif { - private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new QueueSendBatchRequest()); + private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new QueueReceiveRequest()); private pb::UnknownFieldSet _unknownFields; [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public static pb::MessageParser Parser { get { return _parser; } } + public static pb::MessageParser Parser { get { return _parser; } } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public static pbr::MessageDescriptor Descriptor { - get { return global::Nitric.Proto.Queue.v1.QueueReflection.Descriptor.MessageTypes[2]; } + get { return global::Nitric.Proto.Queues.v1.QueuesReflection.Descriptor.MessageTypes[2]; } } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] @@ -460,75 +462,76 @@ public sealed partial class QueueSendBatchRequest : pb::IMessageField number for the "queue" field. - public const int QueueFieldNumber = 1; - private string queue_ = ""; + /// Field number for the "queue_name" field. + public const int QueueNameFieldNumber = 1; + private string queueName_ = ""; /// - /// The Nitric name for the queue + /// The nitric name for the queue /// this will automatically be resolved to the provider specific queue identifier. /// [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public string Queue { - get { return queue_; } + public string QueueName { + get { return queueName_; } set { - queue_ = pb::ProtoPreconditions.CheckNotNull(value, "value"); + queueName_ = pb::ProtoPreconditions.CheckNotNull(value, "value"); } } - /// Field number for the "tasks" field. - public const int TasksFieldNumber = 2; - private static readonly pb::FieldCodec _repeated_tasks_codec - = pb::FieldCodec.ForMessage(18, global::Nitric.Proto.Queue.v1.NitricTask.Parser); - private readonly pbc::RepeatedField tasks_ = new pbc::RepeatedField(); + /// Field number for the "depth" field. + public const int DepthFieldNumber = 2; + private int depth_; /// - /// Array of tasks to push to the queue + /// The max number of items to pop off the queue, may be capped by provider specific limitations /// [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public pbc::RepeatedField Tasks { - get { return tasks_; } + public int Depth { + get { return depth_; } + set { + depth_ = value; + } } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public override bool Equals(object other) { - return Equals(other as QueueSendBatchRequest); + return Equals(other as QueueReceiveRequest); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public bool Equals(QueueSendBatchRequest other) { + public bool Equals(QueueReceiveRequest other) { if (ReferenceEquals(other, null)) { return false; } if (ReferenceEquals(other, this)) { return true; } - if (Queue != other.Queue) return false; - if(!tasks_.Equals(other.tasks_)) return false; + if (QueueName != other.QueueName) return false; + if (Depth != other.Depth) return false; return Equals(_unknownFields, other._unknownFields); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public override int GetHashCode() { int hash = 1; - if (Queue.Length != 0) hash ^= Queue.GetHashCode(); - hash ^= tasks_.GetHashCode(); + if (QueueName.Length != 0) hash ^= QueueName.GetHashCode(); + if (Depth != 0) hash ^= Depth.GetHashCode(); if (_unknownFields != null) { hash ^= _unknownFields.GetHashCode(); } @@ -545,11 +548,14 @@ public void WriteTo(pb::CodedOutputStream output) { #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE output.WriteRawMessage(this); #else - if (Queue.Length != 0) { + if (QueueName.Length != 0) { output.WriteRawTag(10); - output.WriteString(Queue); + output.WriteString(QueueName); + } + if (Depth != 0) { + output.WriteRawTag(16); + output.WriteInt32(Depth); } - tasks_.WriteTo(output, _repeated_tasks_codec); if (_unknownFields != null) { _unknownFields.WriteTo(output); } @@ -559,11 +565,14 @@ public void WriteTo(pb::CodedOutputStream output) { #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE [global::System.Diagnostics.DebuggerNonUserCodeAttribute] void pb::IBufferMessage.InternalWriteTo(ref pb::WriteContext output) { - if (Queue.Length != 0) { + if (QueueName.Length != 0) { output.WriteRawTag(10); - output.WriteString(Queue); + output.WriteString(QueueName); + } + if (Depth != 0) { + output.WriteRawTag(16); + output.WriteInt32(Depth); } - tasks_.WriteTo(ref output, _repeated_tasks_codec); if (_unknownFields != null) { _unknownFields.WriteTo(ref output); } @@ -573,10 +582,12 @@ public void WriteTo(pb::CodedOutputStream output) { [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public int CalculateSize() { int size = 0; - if (Queue.Length != 0) { - size += 1 + pb::CodedOutputStream.ComputeStringSize(Queue); + if (QueueName.Length != 0) { + size += 1 + pb::CodedOutputStream.ComputeStringSize(QueueName); + } + if (Depth != 0) { + size += 1 + pb::CodedOutputStream.ComputeInt32Size(Depth); } - size += tasks_.CalculateSize(_repeated_tasks_codec); if (_unknownFields != null) { size += _unknownFields.CalculateSize(); } @@ -584,14 +595,16 @@ public int CalculateSize() { } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void MergeFrom(QueueSendBatchRequest other) { + public void MergeFrom(QueueReceiveRequest other) { if (other == null) { return; } - if (other.Queue.Length != 0) { - Queue = other.Queue; + if (other.QueueName.Length != 0) { + QueueName = other.QueueName; + } + if (other.Depth != 0) { + Depth = other.Depth; } - tasks_.Add(other.tasks_); _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields); } @@ -607,11 +620,11 @@ public void MergeFrom(pb::CodedInputStream input) { _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input); break; case 10: { - Queue = input.ReadString(); + QueueName = input.ReadString(); break; } - case 18: { - tasks_.AddEntriesFrom(input, _repeated_tasks_codec); + case 16: { + Depth = input.ReadInt32(); break; } } @@ -629,11 +642,11 @@ public void MergeFrom(pb::CodedInputStream input) { _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, ref input); break; case 10: { - Queue = input.ReadString(); + QueueName = input.ReadString(); break; } - case 18: { - tasks_.AddEntriesFrom(ref input, _repeated_tasks_codec); + case 16: { + Depth = input.ReadInt32(); break; } } @@ -643,22 +656,19 @@ public void MergeFrom(pb::CodedInputStream input) { } - /// - /// Response for sending a collection of tasks - /// - public sealed partial class QueueSendBatchResponse : pb::IMessage + public sealed partial class QueueReceiveResponse : pb::IMessage #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE , pb::IBufferMessage #endif { - private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new QueueSendBatchResponse()); + private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new QueueReceiveResponse()); private pb::UnknownFieldSet _unknownFields; [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public static pb::MessageParser Parser { get { return _parser; } } + public static pb::MessageParser Parser { get { return _parser; } } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public static pbr::MessageDescriptor Descriptor { - get { return global::Nitric.Proto.Queue.v1.QueueReflection.Descriptor.MessageTypes[3]; } + get { return global::Nitric.Proto.Queues.v1.QueuesReflection.Descriptor.MessageTypes[3]; } } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] @@ -667,57 +677,57 @@ public sealed partial class QueueSendBatchResponse : pb::IMessageField number for the "failedTasks" field. - public const int FailedTasksFieldNumber = 1; - private static readonly pb::FieldCodec _repeated_failedTasks_codec - = pb::FieldCodec.ForMessage(10, global::Nitric.Proto.Queue.v1.FailedTask.Parser); - private readonly pbc::RepeatedField failedTasks_ = new pbc::RepeatedField(); + /// Field number for the "tasks" field. + public const int TasksFieldNumber = 1; + private static readonly pb::FieldCodec _repeated_tasks_codec + = pb::FieldCodec.ForMessage(10, global::Nitric.Proto.Queues.v1.ReceivedTask.Parser); + private readonly pbc::RepeatedField tasks_ = new pbc::RepeatedField(); /// - /// A list of tasks that failed to be queued + /// Array of tasks popped off the queue /// [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public pbc::RepeatedField FailedTasks { - get { return failedTasks_; } + public pbc::RepeatedField Tasks { + get { return tasks_; } } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public override bool Equals(object other) { - return Equals(other as QueueSendBatchResponse); + return Equals(other as QueueReceiveResponse); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public bool Equals(QueueSendBatchResponse other) { + public bool Equals(QueueReceiveResponse other) { if (ReferenceEquals(other, null)) { return false; } if (ReferenceEquals(other, this)) { return true; } - if(!failedTasks_.Equals(other.failedTasks_)) return false; + if(!tasks_.Equals(other.tasks_)) return false; return Equals(_unknownFields, other._unknownFields); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public override int GetHashCode() { int hash = 1; - hash ^= failedTasks_.GetHashCode(); + hash ^= tasks_.GetHashCode(); if (_unknownFields != null) { hash ^= _unknownFields.GetHashCode(); } @@ -734,7 +744,7 @@ public void WriteTo(pb::CodedOutputStream output) { #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE output.WriteRawMessage(this); #else - failedTasks_.WriteTo(output, _repeated_failedTasks_codec); + tasks_.WriteTo(output, _repeated_tasks_codec); if (_unknownFields != null) { _unknownFields.WriteTo(output); } @@ -744,7 +754,7 @@ public void WriteTo(pb::CodedOutputStream output) { #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE [global::System.Diagnostics.DebuggerNonUserCodeAttribute] void pb::IBufferMessage.InternalWriteTo(ref pb::WriteContext output) { - failedTasks_.WriteTo(ref output, _repeated_failedTasks_codec); + tasks_.WriteTo(ref output, _repeated_tasks_codec); if (_unknownFields != null) { _unknownFields.WriteTo(ref output); } @@ -754,7 +764,7 @@ public void WriteTo(pb::CodedOutputStream output) { [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public int CalculateSize() { int size = 0; - size += failedTasks_.CalculateSize(_repeated_failedTasks_codec); + size += tasks_.CalculateSize(_repeated_tasks_codec); if (_unknownFields != null) { size += _unknownFields.CalculateSize(); } @@ -762,11 +772,11 @@ public int CalculateSize() { } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void MergeFrom(QueueSendBatchResponse other) { + public void MergeFrom(QueueReceiveResponse other) { if (other == null) { return; } - failedTasks_.Add(other.failedTasks_); + tasks_.Add(other.tasks_); _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields); } @@ -782,7 +792,7 @@ public void MergeFrom(pb::CodedInputStream input) { _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input); break; case 10: { - failedTasks_.AddEntriesFrom(input, _repeated_failedTasks_codec); + tasks_.AddEntriesFrom(input, _repeated_tasks_codec); break; } } @@ -800,7 +810,7 @@ public void MergeFrom(pb::CodedInputStream input) { _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, ref input); break; case 10: { - failedTasks_.AddEntriesFrom(ref input, _repeated_failedTasks_codec); + tasks_.AddEntriesFrom(ref input, _repeated_tasks_codec); break; } } @@ -810,19 +820,19 @@ public void MergeFrom(pb::CodedInputStream input) { } - public sealed partial class QueueReceiveRequest : pb::IMessage + public sealed partial class QueueCompleteRequest : pb::IMessage #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE , pb::IBufferMessage #endif { - private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new QueueReceiveRequest()); + private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new QueueCompleteRequest()); private pb::UnknownFieldSet _unknownFields; [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public static pb::MessageParser Parser { get { return _parser; } } + public static pb::MessageParser Parser { get { return _parser; } } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public static pbr::MessageDescriptor Descriptor { - get { return global::Nitric.Proto.Queue.v1.QueueReflection.Descriptor.MessageTypes[4]; } + get { return global::Nitric.Proto.Queues.v1.QueuesReflection.Descriptor.MessageTypes[4]; } } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] @@ -831,76 +841,76 @@ public sealed partial class QueueReceiveRequest : pb::IMessageField number for the "queue" field. - public const int QueueFieldNumber = 1; - private string queue_ = ""; + /// Field number for the "queue_name" field. + public const int QueueNameFieldNumber = 1; + private string queueName_ = ""; /// /// The nitric name for the queue - /// this will automatically be resolved to the provider specific queue identifier. + /// this will automatically be resolved to the provider specific queue identifier. /// [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public string Queue { - get { return queue_; } + public string QueueName { + get { return queueName_; } set { - queue_ = pb::ProtoPreconditions.CheckNotNull(value, "value"); + queueName_ = pb::ProtoPreconditions.CheckNotNull(value, "value"); } } - /// Field number for the "depth" field. - public const int DepthFieldNumber = 2; - private int depth_; + /// Field number for the "lease_id" field. + public const int LeaseIdFieldNumber = 2; + private string leaseId_ = ""; /// - /// The max number of items to pop off the queue, may be capped by provider specific limitations + /// Lease id of the task to be completed /// [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public int Depth { - get { return depth_; } + public string LeaseId { + get { return leaseId_; } set { - depth_ = value; + leaseId_ = pb::ProtoPreconditions.CheckNotNull(value, "value"); } } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public override bool Equals(object other) { - return Equals(other as QueueReceiveRequest); + return Equals(other as QueueCompleteRequest); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public bool Equals(QueueReceiveRequest other) { + public bool Equals(QueueCompleteRequest other) { if (ReferenceEquals(other, null)) { return false; } if (ReferenceEquals(other, this)) { return true; } - if (Queue != other.Queue) return false; - if (Depth != other.Depth) return false; + if (QueueName != other.QueueName) return false; + if (LeaseId != other.LeaseId) return false; return Equals(_unknownFields, other._unknownFields); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public override int GetHashCode() { int hash = 1; - if (Queue.Length != 0) hash ^= Queue.GetHashCode(); - if (Depth != 0) hash ^= Depth.GetHashCode(); + if (QueueName.Length != 0) hash ^= QueueName.GetHashCode(); + if (LeaseId.Length != 0) hash ^= LeaseId.GetHashCode(); if (_unknownFields != null) { hash ^= _unknownFields.GetHashCode(); } @@ -917,13 +927,13 @@ public void WriteTo(pb::CodedOutputStream output) { #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE output.WriteRawMessage(this); #else - if (Queue.Length != 0) { + if (QueueName.Length != 0) { output.WriteRawTag(10); - output.WriteString(Queue); + output.WriteString(QueueName); } - if (Depth != 0) { - output.WriteRawTag(16); - output.WriteInt32(Depth); + if (LeaseId.Length != 0) { + output.WriteRawTag(18); + output.WriteString(LeaseId); } if (_unknownFields != null) { _unknownFields.WriteTo(output); @@ -934,13 +944,13 @@ public void WriteTo(pb::CodedOutputStream output) { #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE [global::System.Diagnostics.DebuggerNonUserCodeAttribute] void pb::IBufferMessage.InternalWriteTo(ref pb::WriteContext output) { - if (Queue.Length != 0) { + if (QueueName.Length != 0) { output.WriteRawTag(10); - output.WriteString(Queue); + output.WriteString(QueueName); } - if (Depth != 0) { - output.WriteRawTag(16); - output.WriteInt32(Depth); + if (LeaseId.Length != 0) { + output.WriteRawTag(18); + output.WriteString(LeaseId); } if (_unknownFields != null) { _unknownFields.WriteTo(ref output); @@ -951,11 +961,11 @@ public void WriteTo(pb::CodedOutputStream output) { [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public int CalculateSize() { int size = 0; - if (Queue.Length != 0) { - size += 1 + pb::CodedOutputStream.ComputeStringSize(Queue); + if (QueueName.Length != 0) { + size += 1 + pb::CodedOutputStream.ComputeStringSize(QueueName); } - if (Depth != 0) { - size += 1 + pb::CodedOutputStream.ComputeInt32Size(Depth); + if (LeaseId.Length != 0) { + size += 1 + pb::CodedOutputStream.ComputeStringSize(LeaseId); } if (_unknownFields != null) { size += _unknownFields.CalculateSize(); @@ -964,15 +974,15 @@ public int CalculateSize() { } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void MergeFrom(QueueReceiveRequest other) { + public void MergeFrom(QueueCompleteRequest other) { if (other == null) { return; } - if (other.Queue.Length != 0) { - Queue = other.Queue; + if (other.QueueName.Length != 0) { + QueueName = other.QueueName; } - if (other.Depth != 0) { - Depth = other.Depth; + if (other.LeaseId.Length != 0) { + LeaseId = other.LeaseId; } _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields); } @@ -989,11 +999,11 @@ public void MergeFrom(pb::CodedInputStream input) { _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input); break; case 10: { - Queue = input.ReadString(); + QueueName = input.ReadString(); break; } - case 16: { - Depth = input.ReadInt32(); + case 18: { + LeaseId = input.ReadString(); break; } } @@ -1011,11 +1021,11 @@ public void MergeFrom(pb::CodedInputStream input) { _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, ref input); break; case 10: { - Queue = input.ReadString(); + QueueName = input.ReadString(); break; } - case 16: { - Depth = input.ReadInt32(); + case 18: { + LeaseId = input.ReadString(); break; } } @@ -1025,19 +1035,19 @@ public void MergeFrom(pb::CodedInputStream input) { } - public sealed partial class QueueReceiveResponse : pb::IMessage + public sealed partial class QueueCompleteResponse : pb::IMessage #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE , pb::IBufferMessage #endif { - private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new QueueReceiveResponse()); + private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new QueueCompleteResponse()); private pb::UnknownFieldSet _unknownFields; [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public static pb::MessageParser Parser { get { return _parser; } } + public static pb::MessageParser Parser { get { return _parser; } } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public static pbr::MessageDescriptor Descriptor { - get { return global::Nitric.Proto.Queue.v1.QueueReflection.Descriptor.MessageTypes[5]; } + get { return global::Nitric.Proto.Queues.v1.QueuesReflection.Descriptor.MessageTypes[5]; } } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] @@ -1046,57 +1056,41 @@ public sealed partial class QueueReceiveResponse : pb::IMessageField number for the "tasks" field. - public const int TasksFieldNumber = 1; - private static readonly pb::FieldCodec _repeated_tasks_codec - = pb::FieldCodec.ForMessage(10, global::Nitric.Proto.Queue.v1.NitricTask.Parser); - private readonly pbc::RepeatedField tasks_ = new pbc::RepeatedField(); - /// - /// Array of tasks popped off the queue - /// - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public pbc::RepeatedField Tasks { - get { return tasks_; } + public QueueCompleteResponse Clone() { + return new QueueCompleteResponse(this); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public override bool Equals(object other) { - return Equals(other as QueueReceiveResponse); + return Equals(other as QueueCompleteResponse); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public bool Equals(QueueReceiveResponse other) { + public bool Equals(QueueCompleteResponse other) { if (ReferenceEquals(other, null)) { return false; } if (ReferenceEquals(other, this)) { return true; } - if(!tasks_.Equals(other.tasks_)) return false; return Equals(_unknownFields, other._unknownFields); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public override int GetHashCode() { int hash = 1; - hash ^= tasks_.GetHashCode(); if (_unknownFields != null) { hash ^= _unknownFields.GetHashCode(); } @@ -1113,7 +1107,6 @@ public void WriteTo(pb::CodedOutputStream output) { #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE output.WriteRawMessage(this); #else - tasks_.WriteTo(output, _repeated_tasks_codec); if (_unknownFields != null) { _unknownFields.WriteTo(output); } @@ -1123,7 +1116,6 @@ public void WriteTo(pb::CodedOutputStream output) { #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE [global::System.Diagnostics.DebuggerNonUserCodeAttribute] void pb::IBufferMessage.InternalWriteTo(ref pb::WriteContext output) { - tasks_.WriteTo(ref output, _repeated_tasks_codec); if (_unknownFields != null) { _unknownFields.WriteTo(ref output); } @@ -1133,7 +1125,6 @@ public void WriteTo(pb::CodedOutputStream output) { [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public int CalculateSize() { int size = 0; - size += tasks_.CalculateSize(_repeated_tasks_codec); if (_unknownFields != null) { size += _unknownFields.CalculateSize(); } @@ -1141,11 +1132,10 @@ public int CalculateSize() { } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void MergeFrom(QueueReceiveResponse other) { + public void MergeFrom(QueueCompleteResponse other) { if (other == null) { return; } - tasks_.Add(other.tasks_); _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields); } @@ -1160,10 +1150,6 @@ public void MergeFrom(pb::CodedInputStream input) { default: _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input); break; - case 10: { - tasks_.AddEntriesFrom(input, _repeated_tasks_codec); - break; - } } } #endif @@ -1178,10 +1164,6 @@ public void MergeFrom(pb::CodedInputStream input) { default: _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, ref input); break; - case 10: { - tasks_.AddEntriesFrom(ref input, _repeated_tasks_codec); - break; - } } } } @@ -1189,19 +1171,22 @@ public void MergeFrom(pb::CodedInputStream input) { } - public sealed partial class QueueCompleteRequest : pb::IMessage + /// + /// A task to be sent to a queue. + /// + public sealed partial class QueueSendRequest : pb::IMessage #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE , pb::IBufferMessage #endif { - private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new QueueCompleteRequest()); + private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new QueueSendRequest()); private pb::UnknownFieldSet _unknownFields; [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public static pb::MessageParser Parser { get { return _parser; } } + public static pb::MessageParser Parser { get { return _parser; } } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public static pbr::MessageDescriptor Descriptor { - get { return global::Nitric.Proto.Queue.v1.QueueReflection.Descriptor.MessageTypes[6]; } + get { return global::Nitric.Proto.Queues.v1.QueuesReflection.Descriptor.MessageTypes[6]; } } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] @@ -1210,76 +1195,58 @@ public sealed partial class QueueCompleteRequest : pb::IMessageField number for the "queue" field. - public const int QueueFieldNumber = 1; - private string queue_ = ""; + /// Field number for the "payload" field. + public const int PayloadFieldNumber = 1; + private global::Google.Protobuf.WellKnownTypes.Struct payload_; /// - /// The nitric name for the queue - /// this will automatically be resolved to the provider specific queue identifier. - /// - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public string Queue { - get { return queue_; } - set { - queue_ = pb::ProtoPreconditions.CheckNotNull(value, "value"); - } - } - - /// Field number for the "lease_id" field. - public const int LeaseIdFieldNumber = 2; - private string leaseId_ = ""; - /// - /// Lease id of the task to be completed + /// The payload of the task /// [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public string LeaseId { - get { return leaseId_; } + public global::Google.Protobuf.WellKnownTypes.Struct Payload { + get { return payload_; } set { - leaseId_ = pb::ProtoPreconditions.CheckNotNull(value, "value"); + payload_ = value; } } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public override bool Equals(object other) { - return Equals(other as QueueCompleteRequest); + return Equals(other as QueueSendRequest); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public bool Equals(QueueCompleteRequest other) { + public bool Equals(QueueSendRequest other) { if (ReferenceEquals(other, null)) { return false; } if (ReferenceEquals(other, this)) { return true; } - if (Queue != other.Queue) return false; - if (LeaseId != other.LeaseId) return false; + if (!object.Equals(Payload, other.Payload)) return false; return Equals(_unknownFields, other._unknownFields); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public override int GetHashCode() { int hash = 1; - if (Queue.Length != 0) hash ^= Queue.GetHashCode(); - if (LeaseId.Length != 0) hash ^= LeaseId.GetHashCode(); + if (payload_ != null) hash ^= Payload.GetHashCode(); if (_unknownFields != null) { hash ^= _unknownFields.GetHashCode(); } @@ -1296,13 +1263,9 @@ public void WriteTo(pb::CodedOutputStream output) { #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE output.WriteRawMessage(this); #else - if (Queue.Length != 0) { + if (payload_ != null) { output.WriteRawTag(10); - output.WriteString(Queue); - } - if (LeaseId.Length != 0) { - output.WriteRawTag(18); - output.WriteString(LeaseId); + output.WriteMessage(Payload); } if (_unknownFields != null) { _unknownFields.WriteTo(output); @@ -1313,13 +1276,9 @@ public void WriteTo(pb::CodedOutputStream output) { #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE [global::System.Diagnostics.DebuggerNonUserCodeAttribute] void pb::IBufferMessage.InternalWriteTo(ref pb::WriteContext output) { - if (Queue.Length != 0) { + if (payload_ != null) { output.WriteRawTag(10); - output.WriteString(Queue); - } - if (LeaseId.Length != 0) { - output.WriteRawTag(18); - output.WriteString(LeaseId); + output.WriteMessage(Payload); } if (_unknownFields != null) { _unknownFields.WriteTo(ref output); @@ -1330,11 +1289,8 @@ public void WriteTo(pb::CodedOutputStream output) { [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public int CalculateSize() { int size = 0; - if (Queue.Length != 0) { - size += 1 + pb::CodedOutputStream.ComputeStringSize(Queue); - } - if (LeaseId.Length != 0) { - size += 1 + pb::CodedOutputStream.ComputeStringSize(LeaseId); + if (payload_ != null) { + size += 1 + pb::CodedOutputStream.ComputeMessageSize(Payload); } if (_unknownFields != null) { size += _unknownFields.CalculateSize(); @@ -1343,15 +1299,15 @@ public int CalculateSize() { } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void MergeFrom(QueueCompleteRequest other) { + public void MergeFrom(QueueSendRequest other) { if (other == null) { return; } - if (other.Queue.Length != 0) { - Queue = other.Queue; - } - if (other.LeaseId.Length != 0) { - LeaseId = other.LeaseId; + if (other.payload_ != null) { + if (payload_ == null) { + Payload = new global::Google.Protobuf.WellKnownTypes.Struct(); + } + Payload.MergeFrom(other.Payload); } _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields); } @@ -1368,11 +1324,10 @@ public void MergeFrom(pb::CodedInputStream input) { _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input); break; case 10: { - Queue = input.ReadString(); - break; - } - case 18: { - LeaseId = input.ReadString(); + if (payload_ == null) { + Payload = new global::Google.Protobuf.WellKnownTypes.Struct(); + } + input.ReadMessage(Payload); break; } } @@ -1390,11 +1345,10 @@ public void MergeFrom(pb::CodedInputStream input) { _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, ref input); break; case 10: { - Queue = input.ReadString(); - break; - } - case 18: { - LeaseId = input.ReadString(); + if (payload_ == null) { + Payload = new global::Google.Protobuf.WellKnownTypes.Struct(); + } + input.ReadMessage(Payload); break; } } @@ -1404,155 +1358,19 @@ public void MergeFrom(pb::CodedInputStream input) { } - public sealed partial class QueueCompleteResponse : pb::IMessage - #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE - , pb::IBufferMessage - #endif - { - private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new QueueCompleteResponse()); - private pb::UnknownFieldSet _unknownFields; - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public static pb::MessageParser Parser { get { return _parser; } } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public static pbr::MessageDescriptor Descriptor { - get { return global::Nitric.Proto.Queue.v1.QueueReflection.Descriptor.MessageTypes[7]; } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - pbr::MessageDescriptor pb::IMessage.Descriptor { - get { return Descriptor; } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public QueueCompleteResponse() { - OnConstruction(); - } - - partial void OnConstruction(); - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public QueueCompleteResponse(QueueCompleteResponse other) : this() { - _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public QueueCompleteResponse Clone() { - return new QueueCompleteResponse(this); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public override bool Equals(object other) { - return Equals(other as QueueCompleteResponse); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public bool Equals(QueueCompleteResponse other) { - if (ReferenceEquals(other, null)) { - return false; - } - if (ReferenceEquals(other, this)) { - return true; - } - return Equals(_unknownFields, other._unknownFields); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public override int GetHashCode() { - int hash = 1; - if (_unknownFields != null) { - hash ^= _unknownFields.GetHashCode(); - } - return hash; - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public override string ToString() { - return pb::JsonFormatter.ToDiagnosticString(this); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void WriteTo(pb::CodedOutputStream output) { - #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE - output.WriteRawMessage(this); - #else - if (_unknownFields != null) { - _unknownFields.WriteTo(output); - } - #endif - } - - #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - void pb::IBufferMessage.InternalWriteTo(ref pb::WriteContext output) { - if (_unknownFields != null) { - _unknownFields.WriteTo(ref output); - } - } - #endif - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public int CalculateSize() { - int size = 0; - if (_unknownFields != null) { - size += _unknownFields.CalculateSize(); - } - return size; - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void MergeFrom(QueueCompleteResponse other) { - if (other == null) { - return; - } - _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void MergeFrom(pb::CodedInputStream input) { - #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE - input.ReadRawMessage(this); - #else - uint tag; - while ((tag = input.ReadTag()) != 0) { - switch(tag) { - default: - _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input); - break; - } - } - #endif - } - - #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - void pb::IBufferMessage.InternalMergeFrom(ref pb::ParseContext input) { - uint tag; - while ((tag = input.ReadTag()) != 0) { - switch(tag) { - default: - _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, ref input); - break; - } - } - } - #endif - - } - - public sealed partial class FailedTask : pb::IMessage + public sealed partial class ReceivedTask : pb::IMessage #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE , pb::IBufferMessage #endif { - private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new FailedTask()); + private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new ReceivedTask()); private pb::UnknownFieldSet _unknownFields; [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public static pb::MessageParser Parser { get { return _parser; } } + public static pb::MessageParser Parser { get { return _parser; } } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public static pbr::MessageDescriptor Descriptor { - get { return global::Nitric.Proto.Queue.v1.QueueReflection.Descriptor.MessageTypes[8]; } + get { return global::Nitric.Proto.Queues.v1.QueuesReflection.Descriptor.MessageTypes[7]; } } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] @@ -1561,75 +1379,69 @@ public sealed partial class FailedTask : pb::IMessage } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public FailedTask() { + public ReceivedTask() { OnConstruction(); } partial void OnConstruction(); [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public FailedTask(FailedTask other) : this() { - task_ = other.task_ != null ? other.task_.Clone() : null; - message_ = other.message_; + public ReceivedTask(ReceivedTask other) : this() { + leaseId_ = other.leaseId_; + payload_ = other.payload_ != null ? other.payload_.Clone() : null; _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public FailedTask Clone() { - return new FailedTask(this); + public ReceivedTask Clone() { + return new ReceivedTask(this); } - /// Field number for the "task" field. - public const int TaskFieldNumber = 1; - private global::Nitric.Proto.Queue.v1.NitricTask task_; - /// - /// The task that failed to be pushed - /// + /// Field number for the "lease_id" field. + public const int LeaseIdFieldNumber = 1; + private string leaseId_ = ""; [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public global::Nitric.Proto.Queue.v1.NitricTask Task { - get { return task_; } + public string LeaseId { + get { return leaseId_; } set { - task_ = value; + leaseId_ = pb::ProtoPreconditions.CheckNotNull(value, "value"); } } - /// Field number for the "message" field. - public const int MessageFieldNumber = 2; - private string message_ = ""; - /// - /// A message describing the failure - /// + /// Field number for the "payload" field. + public const int PayloadFieldNumber = 2; + private global::Google.Protobuf.WellKnownTypes.Struct payload_; [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public string Message { - get { return message_; } + public global::Google.Protobuf.WellKnownTypes.Struct Payload { + get { return payload_; } set { - message_ = pb::ProtoPreconditions.CheckNotNull(value, "value"); + payload_ = value; } } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public override bool Equals(object other) { - return Equals(other as FailedTask); + return Equals(other as ReceivedTask); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public bool Equals(FailedTask other) { + public bool Equals(ReceivedTask other) { if (ReferenceEquals(other, null)) { return false; } if (ReferenceEquals(other, this)) { return true; } - if (!object.Equals(Task, other.Task)) return false; - if (Message != other.Message) return false; + if (LeaseId != other.LeaseId) return false; + if (!object.Equals(Payload, other.Payload)) return false; return Equals(_unknownFields, other._unknownFields); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public override int GetHashCode() { int hash = 1; - if (task_ != null) hash ^= Task.GetHashCode(); - if (Message.Length != 0) hash ^= Message.GetHashCode(); + if (LeaseId.Length != 0) hash ^= LeaseId.GetHashCode(); + if (payload_ != null) hash ^= Payload.GetHashCode(); if (_unknownFields != null) { hash ^= _unknownFields.GetHashCode(); } @@ -1646,13 +1458,13 @@ public void WriteTo(pb::CodedOutputStream output) { #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE output.WriteRawMessage(this); #else - if (task_ != null) { + if (LeaseId.Length != 0) { output.WriteRawTag(10); - output.WriteMessage(Task); + output.WriteString(LeaseId); } - if (Message.Length != 0) { + if (payload_ != null) { output.WriteRawTag(18); - output.WriteString(Message); + output.WriteMessage(Payload); } if (_unknownFields != null) { _unknownFields.WriteTo(output); @@ -1663,13 +1475,13 @@ public void WriteTo(pb::CodedOutputStream output) { #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE [global::System.Diagnostics.DebuggerNonUserCodeAttribute] void pb::IBufferMessage.InternalWriteTo(ref pb::WriteContext output) { - if (task_ != null) { + if (LeaseId.Length != 0) { output.WriteRawTag(10); - output.WriteMessage(Task); + output.WriteString(LeaseId); } - if (Message.Length != 0) { + if (payload_ != null) { output.WriteRawTag(18); - output.WriteString(Message); + output.WriteMessage(Payload); } if (_unknownFields != null) { _unknownFields.WriteTo(ref output); @@ -1680,11 +1492,11 @@ public void WriteTo(pb::CodedOutputStream output) { [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public int CalculateSize() { int size = 0; - if (task_ != null) { - size += 1 + pb::CodedOutputStream.ComputeMessageSize(Task); + if (LeaseId.Length != 0) { + size += 1 + pb::CodedOutputStream.ComputeStringSize(LeaseId); } - if (Message.Length != 0) { - size += 1 + pb::CodedOutputStream.ComputeStringSize(Message); + if (payload_ != null) { + size += 1 + pb::CodedOutputStream.ComputeMessageSize(Payload); } if (_unknownFields != null) { size += _unknownFields.CalculateSize(); @@ -1693,18 +1505,18 @@ public int CalculateSize() { } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void MergeFrom(FailedTask other) { + public void MergeFrom(ReceivedTask other) { if (other == null) { return; } - if (other.task_ != null) { - if (task_ == null) { - Task = new global::Nitric.Proto.Queue.v1.NitricTask(); - } - Task.MergeFrom(other.Task); + if (other.LeaseId.Length != 0) { + LeaseId = other.LeaseId; } - if (other.Message.Length != 0) { - Message = other.Message; + if (other.payload_ != null) { + if (payload_ == null) { + Payload = new global::Google.Protobuf.WellKnownTypes.Struct(); + } + Payload.MergeFrom(other.Payload); } _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields); } @@ -1721,14 +1533,14 @@ public void MergeFrom(pb::CodedInputStream input) { _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input); break; case 10: { - if (task_ == null) { - Task = new global::Nitric.Proto.Queue.v1.NitricTask(); - } - input.ReadMessage(Task); + LeaseId = input.ReadString(); break; } case 18: { - Message = input.ReadString(); + if (payload_ == null) { + Payload = new global::Google.Protobuf.WellKnownTypes.Struct(); + } + input.ReadMessage(Payload); break; } } @@ -1746,14 +1558,14 @@ public void MergeFrom(pb::CodedInputStream input) { _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, ref input); break; case 10: { - if (task_ == null) { - Task = new global::Nitric.Proto.Queue.v1.NitricTask(); - } - input.ReadMessage(Task); + LeaseId = input.ReadString(); break; } case 18: { - Message = input.ReadString(); + if (payload_ == null) { + Payload = new global::Google.Protobuf.WellKnownTypes.Struct(); + } + input.ReadMessage(Payload); break; } } @@ -1763,22 +1575,19 @@ public void MergeFrom(pb::CodedInputStream input) { } - /// - /// A task to be sent or received from a queue. - /// - public sealed partial class NitricTask : pb::IMessage + public sealed partial class FailedSendRequest : pb::IMessage #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE , pb::IBufferMessage #endif { - private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new NitricTask()); + private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new FailedSendRequest()); private pb::UnknownFieldSet _unknownFields; [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public static pb::MessageParser Parser { get { return _parser; } } + public static pb::MessageParser Parser { get { return _parser; } } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public static pbr::MessageDescriptor Descriptor { - get { return global::Nitric.Proto.Queue.v1.QueueReflection.Descriptor.MessageTypes[9]; } + get { return global::Nitric.Proto.Queues.v1.QueuesReflection.Descriptor.MessageTypes[8]; } } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] @@ -1787,109 +1596,75 @@ public sealed partial class NitricTask : pb::IMessage } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public NitricTask() { + public FailedSendRequest() { OnConstruction(); } partial void OnConstruction(); [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public NitricTask(NitricTask other) : this() { - id_ = other.id_; - leaseId_ = other.leaseId_; - payloadType_ = other.payloadType_; - payload_ = other.payload_ != null ? other.payload_.Clone() : null; + public FailedSendRequest(FailedSendRequest other) : this() { + request_ = other.request_ != null ? other.request_.Clone() : null; + message_ = other.message_; _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public NitricTask Clone() { - return new NitricTask(this); - } - - /// Field number for the "id" field. - public const int IdFieldNumber = 1; - private string id_ = ""; - /// - /// A unique id for the task - /// - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public string Id { - get { return id_; } - set { - id_ = pb::ProtoPreconditions.CheckNotNull(value, "value"); - } - } - - /// Field number for the "lease_id" field. - public const int LeaseIdFieldNumber = 2; - private string leaseId_ = ""; - /// - /// The lease id unique to the pop request, this must be used to complete, extend the lease or release the task. - /// - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public string LeaseId { - get { return leaseId_; } - set { - leaseId_ = pb::ProtoPreconditions.CheckNotNull(value, "value"); - } + public FailedSendRequest Clone() { + return new FailedSendRequest(this); } - /// Field number for the "payload_type" field. - public const int PayloadTypeFieldNumber = 3; - private string payloadType_ = ""; + /// Field number for the "request" field. + public const int RequestFieldNumber = 1; + private global::Nitric.Proto.Queues.v1.QueueSendRequest request_; /// - /// A content hint for the tasks payload + /// The task that failed to be pushed /// [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public string PayloadType { - get { return payloadType_; } + public global::Nitric.Proto.Queues.v1.QueueSendRequest Request { + get { return request_; } set { - payloadType_ = pb::ProtoPreconditions.CheckNotNull(value, "value"); + request_ = value; } } - /// Field number for the "payload" field. - public const int PayloadFieldNumber = 4; - private global::Google.Protobuf.WellKnownTypes.Struct payload_; + /// Field number for the "message" field. + public const int MessageFieldNumber = 2; + private string message_ = ""; /// - /// The payload of the task + /// A message describing the failure /// [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public global::Google.Protobuf.WellKnownTypes.Struct Payload { - get { return payload_; } + public string Message { + get { return message_; } set { - payload_ = value; + message_ = pb::ProtoPreconditions.CheckNotNull(value, "value"); } } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public override bool Equals(object other) { - return Equals(other as NitricTask); + return Equals(other as FailedSendRequest); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public bool Equals(NitricTask other) { + public bool Equals(FailedSendRequest other) { if (ReferenceEquals(other, null)) { return false; } if (ReferenceEquals(other, this)) { return true; } - if (Id != other.Id) return false; - if (LeaseId != other.LeaseId) return false; - if (PayloadType != other.PayloadType) return false; - if (!object.Equals(Payload, other.Payload)) return false; + if (!object.Equals(Request, other.Request)) return false; + if (Message != other.Message) return false; return Equals(_unknownFields, other._unknownFields); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public override int GetHashCode() { int hash = 1; - if (Id.Length != 0) hash ^= Id.GetHashCode(); - if (LeaseId.Length != 0) hash ^= LeaseId.GetHashCode(); - if (PayloadType.Length != 0) hash ^= PayloadType.GetHashCode(); - if (payload_ != null) hash ^= Payload.GetHashCode(); + if (request_ != null) hash ^= Request.GetHashCode(); + if (Message.Length != 0) hash ^= Message.GetHashCode(); if (_unknownFields != null) { hash ^= _unknownFields.GetHashCode(); } @@ -1906,21 +1681,13 @@ public void WriteTo(pb::CodedOutputStream output) { #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE output.WriteRawMessage(this); #else - if (Id.Length != 0) { + if (request_ != null) { output.WriteRawTag(10); - output.WriteString(Id); + output.WriteMessage(Request); } - if (LeaseId.Length != 0) { + if (Message.Length != 0) { output.WriteRawTag(18); - output.WriteString(LeaseId); - } - if (PayloadType.Length != 0) { - output.WriteRawTag(26); - output.WriteString(PayloadType); - } - if (payload_ != null) { - output.WriteRawTag(34); - output.WriteMessage(Payload); + output.WriteString(Message); } if (_unknownFields != null) { _unknownFields.WriteTo(output); @@ -1931,21 +1698,13 @@ public void WriteTo(pb::CodedOutputStream output) { #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE [global::System.Diagnostics.DebuggerNonUserCodeAttribute] void pb::IBufferMessage.InternalWriteTo(ref pb::WriteContext output) { - if (Id.Length != 0) { + if (request_ != null) { output.WriteRawTag(10); - output.WriteString(Id); + output.WriteMessage(Request); } - if (LeaseId.Length != 0) { + if (Message.Length != 0) { output.WriteRawTag(18); - output.WriteString(LeaseId); - } - if (PayloadType.Length != 0) { - output.WriteRawTag(26); - output.WriteString(PayloadType); - } - if (payload_ != null) { - output.WriteRawTag(34); - output.WriteMessage(Payload); + output.WriteString(Message); } if (_unknownFields != null) { _unknownFields.WriteTo(ref output); @@ -1956,17 +1715,11 @@ public void WriteTo(pb::CodedOutputStream output) { [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public int CalculateSize() { int size = 0; - if (Id.Length != 0) { - size += 1 + pb::CodedOutputStream.ComputeStringSize(Id); - } - if (LeaseId.Length != 0) { - size += 1 + pb::CodedOutputStream.ComputeStringSize(LeaseId); - } - if (PayloadType.Length != 0) { - size += 1 + pb::CodedOutputStream.ComputeStringSize(PayloadType); + if (request_ != null) { + size += 1 + pb::CodedOutputStream.ComputeMessageSize(Request); } - if (payload_ != null) { - size += 1 + pb::CodedOutputStream.ComputeMessageSize(Payload); + if (Message.Length != 0) { + size += 1 + pb::CodedOutputStream.ComputeStringSize(Message); } if (_unknownFields != null) { size += _unknownFields.CalculateSize(); @@ -1975,24 +1728,18 @@ public int CalculateSize() { } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void MergeFrom(NitricTask other) { + public void MergeFrom(FailedSendRequest other) { if (other == null) { return; } - if (other.Id.Length != 0) { - Id = other.Id; - } - if (other.LeaseId.Length != 0) { - LeaseId = other.LeaseId; - } - if (other.PayloadType.Length != 0) { - PayloadType = other.PayloadType; - } - if (other.payload_ != null) { - if (payload_ == null) { - Payload = new global::Google.Protobuf.WellKnownTypes.Struct(); + if (other.request_ != null) { + if (request_ == null) { + Request = new global::Nitric.Proto.Queues.v1.QueueSendRequest(); } - Payload.MergeFrom(other.Payload); + Request.MergeFrom(other.Request); + } + if (other.Message.Length != 0) { + Message = other.Message; } _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields); } @@ -2009,22 +1756,14 @@ public void MergeFrom(pb::CodedInputStream input) { _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input); break; case 10: { - Id = input.ReadString(); + if (request_ == null) { + Request = new global::Nitric.Proto.Queues.v1.QueueSendRequest(); + } + input.ReadMessage(Request); break; } case 18: { - LeaseId = input.ReadString(); - break; - } - case 26: { - PayloadType = input.ReadString(); - break; - } - case 34: { - if (payload_ == null) { - Payload = new global::Google.Protobuf.WellKnownTypes.Struct(); - } - input.ReadMessage(Payload); + Message = input.ReadString(); break; } } @@ -2042,22 +1781,14 @@ public void MergeFrom(pb::CodedInputStream input) { _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, ref input); break; case 10: { - Id = input.ReadString(); + if (request_ == null) { + Request = new global::Nitric.Proto.Queues.v1.QueueSendRequest(); + } + input.ReadMessage(Request); break; } case 18: { - LeaseId = input.ReadString(); - break; - } - case 26: { - PayloadType = input.ReadString(); - break; - } - case 34: { - if (payload_ == null) { - Payload = new global::Google.Protobuf.WellKnownTypes.Struct(); - } - input.ReadMessage(Payload); + Message = input.ReadString(); break; } } diff --git a/src/Nitric.Sdk/Proto/nitric/proto/queues/v1/QueuesGrpc.cs b/src/Nitric.Sdk/Proto/nitric/proto/queues/v1/QueuesGrpc.cs new file mode 100644 index 0000000..a38fe43 --- /dev/null +++ b/src/Nitric.Sdk/Proto/nitric/proto/queues/v1/QueuesGrpc.cs @@ -0,0 +1,306 @@ +// +// Generated by the protocol buffer compiler. DO NOT EDIT! +// source: nitric/proto/queues/v1/queues.proto +// +#pragma warning disable 0414, 1591 +#region Designer generated code + +using grpc = global::Grpc.Core; + +namespace Nitric.Proto.Queues.v1 { + /// + /// The Nitric Queue Service contract + /// + public static partial class Queues + { + static readonly string __ServiceName = "nitric.proto.queues.v1.Queues"; + + static void __Helper_SerializeMessage(global::Google.Protobuf.IMessage message, grpc::SerializationContext context) + { + #if !GRPC_DISABLE_PROTOBUF_BUFFER_SERIALIZATION + if (message is global::Google.Protobuf.IBufferMessage) + { + context.SetPayloadLength(message.CalculateSize()); + global::Google.Protobuf.MessageExtensions.WriteTo(message, context.GetBufferWriter()); + context.Complete(); + return; + } + #endif + context.Complete(global::Google.Protobuf.MessageExtensions.ToByteArray(message)); + } + + static class __Helper_MessageCache + { + public static readonly bool IsBufferMessage = global::System.Reflection.IntrospectionExtensions.GetTypeInfo(typeof(global::Google.Protobuf.IBufferMessage)).IsAssignableFrom(typeof(T)); + } + + static T __Helper_DeserializeMessage(grpc::DeserializationContext context, global::Google.Protobuf.MessageParser parser) where T : global::Google.Protobuf.IMessage + { + #if !GRPC_DISABLE_PROTOBUF_BUFFER_SERIALIZATION + if (__Helper_MessageCache.IsBufferMessage) + { + return parser.ParseFrom(context.PayloadAsReadOnlySequence()); + } + #endif + return parser.ParseFrom(context.PayloadAsNewBuffer()); + } + + static readonly grpc::Marshaller __Marshaller_nitric_proto_queues_v1_QueueSendRequestBatch = grpc::Marshallers.Create(__Helper_SerializeMessage, context => __Helper_DeserializeMessage(context, global::Nitric.Proto.Queues.v1.QueueSendRequestBatch.Parser)); + static readonly grpc::Marshaller __Marshaller_nitric_proto_queues_v1_QueueSendResponse = grpc::Marshallers.Create(__Helper_SerializeMessage, context => __Helper_DeserializeMessage(context, global::Nitric.Proto.Queues.v1.QueueSendResponse.Parser)); + static readonly grpc::Marshaller __Marshaller_nitric_proto_queues_v1_QueueReceiveRequest = grpc::Marshallers.Create(__Helper_SerializeMessage, context => __Helper_DeserializeMessage(context, global::Nitric.Proto.Queues.v1.QueueReceiveRequest.Parser)); + static readonly grpc::Marshaller __Marshaller_nitric_proto_queues_v1_QueueReceiveResponse = grpc::Marshallers.Create(__Helper_SerializeMessage, context => __Helper_DeserializeMessage(context, global::Nitric.Proto.Queues.v1.QueueReceiveResponse.Parser)); + static readonly grpc::Marshaller __Marshaller_nitric_proto_queues_v1_QueueCompleteRequest = grpc::Marshallers.Create(__Helper_SerializeMessage, context => __Helper_DeserializeMessage(context, global::Nitric.Proto.Queues.v1.QueueCompleteRequest.Parser)); + static readonly grpc::Marshaller __Marshaller_nitric_proto_queues_v1_QueueCompleteResponse = grpc::Marshallers.Create(__Helper_SerializeMessage, context => __Helper_DeserializeMessage(context, global::Nitric.Proto.Queues.v1.QueueCompleteResponse.Parser)); + + static readonly grpc::Method __Method_Send = new grpc::Method( + grpc::MethodType.Unary, + __ServiceName, + "Send", + __Marshaller_nitric_proto_queues_v1_QueueSendRequestBatch, + __Marshaller_nitric_proto_queues_v1_QueueSendResponse); + + static readonly grpc::Method __Method_Receive = new grpc::Method( + grpc::MethodType.Unary, + __ServiceName, + "Receive", + __Marshaller_nitric_proto_queues_v1_QueueReceiveRequest, + __Marshaller_nitric_proto_queues_v1_QueueReceiveResponse); + + static readonly grpc::Method __Method_Complete = new grpc::Method( + grpc::MethodType.Unary, + __ServiceName, + "Complete", + __Marshaller_nitric_proto_queues_v1_QueueCompleteRequest, + __Marshaller_nitric_proto_queues_v1_QueueCompleteResponse); + + /// Service descriptor + public static global::Google.Protobuf.Reflection.ServiceDescriptor Descriptor + { + get { return global::Nitric.Proto.Queues.v1.QueuesReflection.Descriptor.Services[0]; } + } + + /// Base class for server-side implementations of Queues + [grpc::BindServiceMethod(typeof(Queues), "BindService")] + public abstract partial class QueuesBase + { + /// + /// Send messages to a queue + /// + /// The request received from the client. + /// The context of the server-side call handler being invoked. + /// The response to send back to the client (wrapped by a task). + public virtual global::System.Threading.Tasks.Task Send(global::Nitric.Proto.Queues.v1.QueueSendRequestBatch request, grpc::ServerCallContext context) + { + throw new grpc::RpcException(new grpc::Status(grpc::StatusCode.Unimplemented, "")); + } + + /// + /// Receive message(s) from a queue + /// + /// The request received from the client. + /// The context of the server-side call handler being invoked. + /// The response to send back to the client (wrapped by a task). + public virtual global::System.Threading.Tasks.Task Receive(global::Nitric.Proto.Queues.v1.QueueReceiveRequest request, grpc::ServerCallContext context) + { + throw new grpc::RpcException(new grpc::Status(grpc::StatusCode.Unimplemented, "")); + } + + /// + /// Complete an item previously popped from a queue + /// + /// The request received from the client. + /// The context of the server-side call handler being invoked. + /// The response to send back to the client (wrapped by a task). + public virtual global::System.Threading.Tasks.Task Complete(global::Nitric.Proto.Queues.v1.QueueCompleteRequest request, grpc::ServerCallContext context) + { + throw new grpc::RpcException(new grpc::Status(grpc::StatusCode.Unimplemented, "")); + } + + } + + /// Client for Queues + public partial class QueuesClient : grpc::ClientBase + { + /// Creates a new client for Queues + /// The channel to use to make remote calls. + public QueuesClient(grpc::ChannelBase channel) : base(channel) + { + } + /// Creates a new client for Queues that uses a custom CallInvoker. + /// The callInvoker to use to make remote calls. + public QueuesClient(grpc::CallInvoker callInvoker) : base(callInvoker) + { + } + /// Protected parameterless constructor to allow creation of test doubles. + protected QueuesClient() : base() + { + } + /// Protected constructor to allow creation of configured clients. + /// The client configuration. + protected QueuesClient(ClientBaseConfiguration configuration) : base(configuration) + { + } + + /// + /// Send messages to a queue + /// + /// The request to send to the server. + /// The initial metadata to send with the call. This parameter is optional. + /// An optional deadline for the call. The call will be cancelled if deadline is hit. + /// An optional token for canceling the call. + /// The response received from the server. + public virtual global::Nitric.Proto.Queues.v1.QueueSendResponse Send(global::Nitric.Proto.Queues.v1.QueueSendRequestBatch request, grpc::Metadata headers = null, global::System.DateTime? deadline = null, global::System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken)) + { + return Send(request, new grpc::CallOptions(headers, deadline, cancellationToken)); + } + /// + /// Send messages to a queue + /// + /// The request to send to the server. + /// The options for the call. + /// The response received from the server. + public virtual global::Nitric.Proto.Queues.v1.QueueSendResponse Send(global::Nitric.Proto.Queues.v1.QueueSendRequestBatch request, grpc::CallOptions options) + { + return CallInvoker.BlockingUnaryCall(__Method_Send, null, options, request); + } + /// + /// Send messages to a queue + /// + /// The request to send to the server. + /// The initial metadata to send with the call. This parameter is optional. + /// An optional deadline for the call. The call will be cancelled if deadline is hit. + /// An optional token for canceling the call. + /// The call object. + public virtual grpc::AsyncUnaryCall SendAsync(global::Nitric.Proto.Queues.v1.QueueSendRequestBatch request, grpc::Metadata headers = null, global::System.DateTime? deadline = null, global::System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken)) + { + return SendAsync(request, new grpc::CallOptions(headers, deadline, cancellationToken)); + } + /// + /// Send messages to a queue + /// + /// The request to send to the server. + /// The options for the call. + /// The call object. + public virtual grpc::AsyncUnaryCall SendAsync(global::Nitric.Proto.Queues.v1.QueueSendRequestBatch request, grpc::CallOptions options) + { + return CallInvoker.AsyncUnaryCall(__Method_Send, null, options, request); + } + /// + /// Receive message(s) from a queue + /// + /// The request to send to the server. + /// The initial metadata to send with the call. This parameter is optional. + /// An optional deadline for the call. The call will be cancelled if deadline is hit. + /// An optional token for canceling the call. + /// The response received from the server. + public virtual global::Nitric.Proto.Queues.v1.QueueReceiveResponse Receive(global::Nitric.Proto.Queues.v1.QueueReceiveRequest request, grpc::Metadata headers = null, global::System.DateTime? deadline = null, global::System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken)) + { + return Receive(request, new grpc::CallOptions(headers, deadline, cancellationToken)); + } + /// + /// Receive message(s) from a queue + /// + /// The request to send to the server. + /// The options for the call. + /// The response received from the server. + public virtual global::Nitric.Proto.Queues.v1.QueueReceiveResponse Receive(global::Nitric.Proto.Queues.v1.QueueReceiveRequest request, grpc::CallOptions options) + { + return CallInvoker.BlockingUnaryCall(__Method_Receive, null, options, request); + } + /// + /// Receive message(s) from a queue + /// + /// The request to send to the server. + /// The initial metadata to send with the call. This parameter is optional. + /// An optional deadline for the call. The call will be cancelled if deadline is hit. + /// An optional token for canceling the call. + /// The call object. + public virtual grpc::AsyncUnaryCall ReceiveAsync(global::Nitric.Proto.Queues.v1.QueueReceiveRequest request, grpc::Metadata headers = null, global::System.DateTime? deadline = null, global::System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken)) + { + return ReceiveAsync(request, new grpc::CallOptions(headers, deadline, cancellationToken)); + } + /// + /// Receive message(s) from a queue + /// + /// The request to send to the server. + /// The options for the call. + /// The call object. + public virtual grpc::AsyncUnaryCall ReceiveAsync(global::Nitric.Proto.Queues.v1.QueueReceiveRequest request, grpc::CallOptions options) + { + return CallInvoker.AsyncUnaryCall(__Method_Receive, null, options, request); + } + /// + /// Complete an item previously popped from a queue + /// + /// The request to send to the server. + /// The initial metadata to send with the call. This parameter is optional. + /// An optional deadline for the call. The call will be cancelled if deadline is hit. + /// An optional token for canceling the call. + /// The response received from the server. + public virtual global::Nitric.Proto.Queues.v1.QueueCompleteResponse Complete(global::Nitric.Proto.Queues.v1.QueueCompleteRequest request, grpc::Metadata headers = null, global::System.DateTime? deadline = null, global::System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken)) + { + return Complete(request, new grpc::CallOptions(headers, deadline, cancellationToken)); + } + /// + /// Complete an item previously popped from a queue + /// + /// The request to send to the server. + /// The options for the call. + /// The response received from the server. + public virtual global::Nitric.Proto.Queues.v1.QueueCompleteResponse Complete(global::Nitric.Proto.Queues.v1.QueueCompleteRequest request, grpc::CallOptions options) + { + return CallInvoker.BlockingUnaryCall(__Method_Complete, null, options, request); + } + /// + /// Complete an item previously popped from a queue + /// + /// The request to send to the server. + /// The initial metadata to send with the call. This parameter is optional. + /// An optional deadline for the call. The call will be cancelled if deadline is hit. + /// An optional token for canceling the call. + /// The call object. + public virtual grpc::AsyncUnaryCall CompleteAsync(global::Nitric.Proto.Queues.v1.QueueCompleteRequest request, grpc::Metadata headers = null, global::System.DateTime? deadline = null, global::System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken)) + { + return CompleteAsync(request, new grpc::CallOptions(headers, deadline, cancellationToken)); + } + /// + /// Complete an item previously popped from a queue + /// + /// The request to send to the server. + /// The options for the call. + /// The call object. + public virtual grpc::AsyncUnaryCall CompleteAsync(global::Nitric.Proto.Queues.v1.QueueCompleteRequest request, grpc::CallOptions options) + { + return CallInvoker.AsyncUnaryCall(__Method_Complete, null, options, request); + } + /// Creates a new instance of client from given ClientBaseConfiguration. + protected override QueuesClient NewInstance(ClientBaseConfiguration configuration) + { + return new QueuesClient(configuration); + } + } + + /// Creates service definition that can be registered with a server + /// An object implementing the server-side handling logic. + public static grpc::ServerServiceDefinition BindService(QueuesBase serviceImpl) + { + return grpc::ServerServiceDefinition.CreateBuilder() + .AddMethod(__Method_Send, serviceImpl.Send) + .AddMethod(__Method_Receive, serviceImpl.Receive) + .AddMethod(__Method_Complete, serviceImpl.Complete).Build(); + } + + /// Register service method with a service binder with or without implementation. Useful when customizing the service binding logic. + /// Note: this method is part of an experimental API that can change or be removed without any prior notice. + /// Service methods will be bound by calling AddMethod on this object. + /// An object implementing the server-side handling logic. + public static void BindService(grpc::ServiceBinderBase serviceBinder, QueuesBase serviceImpl) + { + serviceBinder.AddMethod(__Method_Send, serviceImpl == null ? null : new grpc::UnaryServerMethod(serviceImpl.Send)); + serviceBinder.AddMethod(__Method_Receive, serviceImpl == null ? null : new grpc::UnaryServerMethod(serviceImpl.Receive)); + serviceBinder.AddMethod(__Method_Complete, serviceImpl == null ? null : new grpc::UnaryServerMethod(serviceImpl.Complete)); + } + + } +} +#endregion diff --git a/src/Nitric.Sdk/Proto/proto/resource/v1/Resource.cs b/src/Nitric.Sdk/Proto/nitric/proto/resources/v1/Resources.cs similarity index 59% rename from src/Nitric.Sdk/Proto/proto/resource/v1/Resource.cs rename to src/Nitric.Sdk/Proto/nitric/proto/resources/v1/Resources.cs index 618071c..725bb81 100644 --- a/src/Nitric.Sdk/Proto/proto/resource/v1/Resource.cs +++ b/src/Nitric.Sdk/Proto/nitric/proto/resources/v1/Resources.cs @@ -1,6 +1,6 @@ // // Generated by the protocol buffer compiler. DO NOT EDIT! -// source: proto/resource/v1/resource.proto +// source: nitric/proto/resources/v1/resources.proto // #pragma warning disable 1591, 0612, 3021 #region Designer generated code @@ -9,103 +9,91 @@ using pbc = global::Google.Protobuf.Collections; using pbr = global::Google.Protobuf.Reflection; using scg = global::System.Collections.Generic; -namespace Nitric.Proto.Resource.v1 { +namespace Nitric.Proto.Resources.v1 { - /// Holder for reflection information generated from proto/resource/v1/resource.proto - public static partial class ResourceReflection { + /// Holder for reflection information generated from nitric/proto/resources/v1/resources.proto + public static partial class ResourcesReflection { #region Descriptor - /// File descriptor for proto/resource/v1/resource.proto + /// File descriptor for nitric/proto/resources/v1/resources.proto public static pbr::FileDescriptor Descriptor { get { return descriptor; } } private static pbr::FileDescriptor descriptor; - static ResourceReflection() { + static ResourcesReflection() { byte[] descriptorData = global::System.Convert.FromBase64String( string.Concat( - "CiBwcm90by9yZXNvdXJjZS92MS9yZXNvdXJjZS5wcm90bxISbml0cmljLnJl", - "c291cmNlLnYxIqABCg5Qb2xpY3lSZXNvdXJjZRIwCgpwcmluY2lwYWxzGAEg", - "AygLMhwubml0cmljLnJlc291cmNlLnYxLlJlc291cmNlEisKB2FjdGlvbnMY", - "AiADKA4yGi5uaXRyaWMucmVzb3VyY2UudjEuQWN0aW9uEi8KCXJlc291cmNl", - "cxgDIAMoCzIcLm5pdHJpYy5yZXNvdXJjZS52MS5SZXNvdXJjZSJICghSZXNv", - "dXJjZRIuCgR0eXBlGAEgASgOMiAubml0cmljLnJlc291cmNlLnYxLlJlc291", - "cmNlVHlwZRIMCgRuYW1lGAIgASgJIsoDChZSZXNvdXJjZURlY2xhcmVSZXF1", - "ZXN0Ei4KCHJlc291cmNlGAEgASgLMhwubml0cmljLnJlc291cmNlLnYxLlJl", - "c291cmNlEjQKBnBvbGljeRgKIAEoCzIiLm5pdHJpYy5yZXNvdXJjZS52MS5Q", - "b2xpY3lSZXNvdXJjZUgAEjQKBmJ1Y2tldBgLIAEoCzIiLm5pdHJpYy5yZXNv", - "dXJjZS52MS5CdWNrZXRSZXNvdXJjZUgAEjIKBXF1ZXVlGAwgASgLMiEubml0", - "cmljLnJlc291cmNlLnYxLlF1ZXVlUmVzb3VyY2VIABIyCgV0b3BpYxgNIAEo", - "CzIhLm5pdHJpYy5yZXNvdXJjZS52MS5Ub3BpY1Jlc291cmNlSAASPAoKY29s", - "bGVjdGlvbhgOIAEoCzImLm5pdHJpYy5yZXNvdXJjZS52MS5Db2xsZWN0aW9u", - "UmVzb3VyY2VIABI0CgZzZWNyZXQYDyABKAsyIi5uaXRyaWMucmVzb3VyY2Uu", - "djEuU2VjcmV0UmVzb3VyY2VIABIuCgNhcGkYECABKAsyHy5uaXRyaWMucmVz", - "b3VyY2UudjEuQXBpUmVzb3VyY2VIAEIICgZjb25maWciEAoOQnVja2V0UmVz", - "b3VyY2UiDwoNUXVldWVSZXNvdXJjZSIPCg1Ub3BpY1Jlc291cmNlIhQKEkNv", - "bGxlY3Rpb25SZXNvdXJjZSIQCg5TZWNyZXRSZXNvdXJjZSI9ChhBcGlTZWN1", - "cml0eURlZmluaXRpb25Kd3QSDgoGaXNzdWVyGAEgASgJEhEKCWF1ZGllbmNl", - "cxgCIAMoCSJiChVBcGlTZWN1cml0eURlZmluaXRpb24SOwoDand0GAEgASgL", - "Miwubml0cmljLnJlc291cmNlLnYxLkFwaVNlY3VyaXR5RGVmaW5pdGlvbkp3", - "dEgAQgwKCmRlZmluaXRpb24iGwoJQXBpU2NvcGVzEg4KBnNjb3BlcxgBIAMo", - "CSLdAgoLQXBpUmVzb3VyY2USVgoUc2VjdXJpdHlfZGVmaW5pdGlvbnMYASAD", - "KAsyOC5uaXRyaWMucmVzb3VyY2UudjEuQXBpUmVzb3VyY2UuU2VjdXJpdHlE", - "ZWZpbml0aW9uc0VudHJ5Ej8KCHNlY3VyaXR5GAIgAygLMi0ubml0cmljLnJl", - "c291cmNlLnYxLkFwaVJlc291cmNlLlNlY3VyaXR5RW50cnkaZQoYU2VjdXJp", - "dHlEZWZpbml0aW9uc0VudHJ5EgsKA2tleRgBIAEoCRI4CgV2YWx1ZRgCIAEo", - "CzIpLm5pdHJpYy5yZXNvdXJjZS52MS5BcGlTZWN1cml0eURlZmluaXRpb246", - "AjgBGk4KDVNlY3VyaXR5RW50cnkSCwoDa2V5GAEgASgJEiwKBXZhbHVlGAIg", - "ASgLMh0ubml0cmljLnJlc291cmNlLnYxLkFwaVNjb3BlczoCOAEiGQoXUmVz", - "b3VyY2VEZWNsYXJlUmVzcG9uc2UiIQoSQXBpUmVzb3VyY2VEZXRhaWxzEgsK", - "A3VybBgBIAEoCSInChhXZWJzb2NrZXRSZXNvdXJjZURldGFpbHMSCwoDdXJs", - "GAEgASgJIkgKFlJlc291cmNlRGV0YWlsc1JlcXVlc3QSLgoIcmVzb3VyY2UY", - "ASABKAsyHC5uaXRyaWMucmVzb3VyY2UudjEuUmVzb3VyY2UizQEKF1Jlc291", - "cmNlRGV0YWlsc1Jlc3BvbnNlEgoKAmlkGAEgASgJEhAKCHByb3ZpZGVyGAIg", - "ASgJEg8KB3NlcnZpY2UYAyABKAkSNQoDYXBpGAogASgLMiYubml0cmljLnJl", - "c291cmNlLnYxLkFwaVJlc291cmNlRGV0YWlsc0gAEkEKCXdlYnNvY2tldBgL", - "IAEoCzIsLm5pdHJpYy5yZXNvdXJjZS52MS5XZWJzb2NrZXRSZXNvdXJjZURl", - "dGFpbHNIAEIJCgdkZXRhaWxzKroBCgxSZXNvdXJjZVR5cGUSBwoDQXBpEAAS", - "DAoIRnVuY3Rpb24QARIKCgZCdWNrZXQQAhIJCgVRdWV1ZRADEgkKBVRvcGlj", - "EAQSDAoIU2NoZWR1bGUQBRIQCgxTdWJzY3JpcHRpb24QBhIOCgpDb2xsZWN0", - "aW9uEAcSCgoGUG9saWN5EAgSCgoGU2VjcmV0EAkSEAoMTm90aWZpY2F0aW9u", - "EAoSDQoJV2Vic29ja2V0EAsSCAoESHR0cBAMKpUDCgZBY3Rpb24SEgoOQnVj", - "a2V0RmlsZUxpc3QQABIRCg1CdWNrZXRGaWxlR2V0EAESEQoNQnVja2V0Rmls", - "ZVB1dBACEhQKEEJ1Y2tldEZpbGVEZWxldGUQAxIOCglUb3BpY0xpc3QQyAES", - "EAoLVG9waWNEZXRhaWwQyQESFgoRVG9waWNFdmVudFB1Ymxpc2gQygESDgoJ", - "UXVldWVTZW5kEKwCEhEKDFF1ZXVlUmVjZWl2ZRCtAhIOCglRdWV1ZUxpc3QQ", - "rgISEAoLUXVldWVEZXRhaWwQrwISGwoWQ29sbGVjdGlvbkRvY3VtZW50UmVh", - "ZBCQAxIcChdDb2xsZWN0aW9uRG9jdW1lbnRXcml0ZRCRAxIdChhDb2xsZWN0", - "aW9uRG9jdW1lbnREZWxldGUQkgMSFAoPQ29sbGVjdGlvblF1ZXJ5EJMDEhMK", - "DkNvbGxlY3Rpb25MaXN0EJQDEg4KCVNlY3JldFB1dBD0AxIRCgxTZWNyZXRB", - "Y2Nlc3MQ9QMSFAoPV2Vic29ja2V0TWFuYWdlENgEMtkBCg9SZXNvdXJjZVNl", - "cnZpY2USYgoHRGVjbGFyZRIqLm5pdHJpYy5yZXNvdXJjZS52MS5SZXNvdXJj", - "ZURlY2xhcmVSZXF1ZXN0Gisubml0cmljLnJlc291cmNlLnYxLlJlc291cmNl", - "RGVjbGFyZVJlc3BvbnNlEmIKB0RldGFpbHMSKi5uaXRyaWMucmVzb3VyY2Uu", - "djEuUmVzb3VyY2VEZXRhaWxzUmVxdWVzdBorLm5pdHJpYy5yZXNvdXJjZS52", - "MS5SZXNvdXJjZURldGFpbHNSZXNwb25zZUKVAQobaW8ubml0cmljLnByb3Rv", - "LnJlc291cmNlLnYxQglSZXNvdXJjZXNQAVozZ2l0aHViLmNvbS9uaXRyaWN0", - "ZWNoL25pdHJpYy9jb3JlL3BrZy9hcGkvbml0cmljL3YxqgIYTml0cmljLlBy", - "b3RvLlJlc291cmNlLnYxygIYTml0cmljXFByb3RvXFJlc291cmNlXFYxYgZw", - "cm90bzM=")); + "CiluaXRyaWMvcHJvdG8vcmVzb3VyY2VzL3YxL3Jlc291cmNlcy5wcm90bxIZ", + "bml0cmljLnByb3RvLnJlc291cmNlcy52MSLJAQoOUG9saWN5UmVzb3VyY2US", + "QQoKcHJpbmNpcGFscxgBIAMoCzItLm5pdHJpYy5wcm90by5yZXNvdXJjZXMu", + "djEuUmVzb3VyY2VJZGVudGlmaWVyEjIKB2FjdGlvbnMYAiADKA4yIS5uaXRy", + "aWMucHJvdG8ucmVzb3VyY2VzLnYxLkFjdGlvbhJACglyZXNvdXJjZXMYAyAD", + "KAsyLS5uaXRyaWMucHJvdG8ucmVzb3VyY2VzLnYxLlJlc291cmNlSWRlbnRp", + "ZmllciJZChJSZXNvdXJjZUlkZW50aWZpZXISNQoEdHlwZRgBIAEoDjInLm5p", + "dHJpYy5wcm90by5yZXNvdXJjZXMudjEuUmVzb3VyY2VUeXBlEgwKBG5hbWUY", + "AiABKAki6wQKFlJlc291cmNlRGVjbGFyZVJlcXVlc3QSOQoCaWQYASABKAsy", + "LS5uaXRyaWMucHJvdG8ucmVzb3VyY2VzLnYxLlJlc291cmNlSWRlbnRpZmll", + "chI7CgZwb2xpY3kYCiABKAsyKS5uaXRyaWMucHJvdG8ucmVzb3VyY2VzLnYx", + "LlBvbGljeVJlc291cmNlSAASOwoGYnVja2V0GAsgASgLMikubml0cmljLnBy", + "b3RvLnJlc291cmNlcy52MS5CdWNrZXRSZXNvdXJjZUgAEjkKBXRvcGljGAwg", + "ASgLMigubml0cmljLnByb3RvLnJlc291cmNlcy52MS5Ub3BpY1Jlc291cmNl", + "SAASSwoPa2V5X3ZhbHVlX3N0b3JlGA0gASgLMjAubml0cmljLnByb3RvLnJl", + "c291cmNlcy52MS5LZXlWYWx1ZVN0b3JlUmVzb3VyY2VIABI7CgZzZWNyZXQY", + "DiABKAsyKS5uaXRyaWMucHJvdG8ucmVzb3VyY2VzLnYxLlNlY3JldFJlc291", + "cmNlSAASNQoDYXBpGA8gASgLMiYubml0cmljLnByb3RvLnJlc291cmNlcy52", + "MS5BcGlSZXNvdXJjZUgAElsKF2FwaV9zZWN1cml0eV9kZWZpbml0aW9uGBAg", + "ASgLMjgubml0cmljLnByb3RvLnJlc291cmNlcy52MS5BcGlTZWN1cml0eURl", + "ZmluaXRpb25SZXNvdXJjZUgAEjkKBXF1ZXVlGBEgASgLMigubml0cmljLnBy", + "b3RvLnJlc291cmNlcy52MS5RdWV1ZVJlc291cmNlSABCCAoGY29uZmlnIhAK", + "DkJ1Y2tldFJlc291cmNlIg8KDVRvcGljUmVzb3VyY2UiDwoNUXVldWVSZXNv", + "dXJjZSIXChVLZXlWYWx1ZVN0b3JlUmVzb3VyY2UiEAoOU2VjcmV0UmVzb3Vy", + "Y2UiQgodQXBpT3BlbklkQ29ubmVjdGlvbkRlZmluaXRpb24SDgoGaXNzdWVy", + "GAEgASgJEhEKCWF1ZGllbmNlcxgCIAMoCSKJAQodQXBpU2VjdXJpdHlEZWZp", + "bml0aW9uUmVzb3VyY2USEAoIYXBpX25hbWUYASABKAkSSAoEb2lkYxgCIAEo", + "CzI4Lm5pdHJpYy5wcm90by5yZXNvdXJjZXMudjEuQXBpT3BlbklkQ29ubmVj", + "dGlvbkRlZmluaXRpb25IAEIMCgpkZWZpbml0aW9uIhsKCUFwaVNjb3BlcxIO", + "CgZzY29wZXMYASADKAkirAEKC0FwaVJlc291cmNlEkYKCHNlY3VyaXR5GAEg", + "AygLMjQubml0cmljLnByb3RvLnJlc291cmNlcy52MS5BcGlSZXNvdXJjZS5T", + "ZWN1cml0eUVudHJ5GlUKDVNlY3VyaXR5RW50cnkSCwoDa2V5GAEgASgJEjMK", + "BXZhbHVlGAIgASgLMiQubml0cmljLnByb3RvLnJlc291cmNlcy52MS5BcGlT", + "Y29wZXM6AjgBIhkKF1Jlc291cmNlRGVjbGFyZVJlc3BvbnNlKtkBCgxSZXNv", + "dXJjZVR5cGUSBwoDQXBpEAASCwoHU2VydmljZRABEgoKBkJ1Y2tldBACEgkK", + "BVRvcGljEAMSDAoIU2NoZWR1bGUQBBIQCgxTdWJzY3JpcHRpb24QBRIRCg1L", + "ZXlWYWx1ZVN0b3JlEAYSCgoGUG9saWN5EAcSCgoGU2VjcmV0EAgSEgoOQnVj", + "a2V0TGlzdGVuZXIQCRINCglXZWJzb2NrZXQQChIICgRIdHRwEAsSGQoVQXBp", + "U2VjdXJpdHlEZWZpbml0aW9uEAwSCQoFUXVldWUQDSrbAgoGQWN0aW9uEhIK", + "DkJ1Y2tldEZpbGVMaXN0EAASEQoNQnVja2V0RmlsZUdldBABEhEKDUJ1Y2tl", + "dEZpbGVQdXQQAhIUChBCdWNrZXRGaWxlRGVsZXRlEAMSDgoJVG9waWNMaXN0", + "EMgBEhAKC1RvcGljRGV0YWlsEMkBEhYKEVRvcGljRXZlbnRQdWJsaXNoEMoB", + "EhYKEUtleVZhbHVlU3RvcmVSZWFkEKwCEhcKEktleVZhbHVlU3RvcmVXcml0", + "ZRCtAhIYChNLZXlWYWx1ZVN0b3JlRGVsZXRlEK4CEg4KCVNlY3JldFB1dBCQ", + "AxIRCgxTZWNyZXRBY2Nlc3MQkQMSFAoPV2Vic29ja2V0TWFuYWdlEPQDEg4K", + "CVF1ZXVlU2VuZBDYBBIRCgxRdWV1ZVJlY2VpdmUQ2QQSDgoJUXVldWVMaXN0", + "ENoEEhAKC1F1ZXVlRGV0YWlsENsEMn0KCVJlc291cmNlcxJwCgdEZWNsYXJl", + "EjEubml0cmljLnByb3RvLnJlc291cmNlcy52MS5SZXNvdXJjZURlY2xhcmVS", + "ZXF1ZXN0GjIubml0cmljLnByb3RvLnJlc291cmNlcy52MS5SZXNvdXJjZURl", + "Y2xhcmVSZXNwb25zZUKpAQocaW8ubml0cmljLnByb3RvLnJlc291cmNlcy52", + "MUIJUmVzb3VyY2VzUAFaRGdpdGh1Yi5jb20vbml0cmljdGVjaC9uaXRyaWMv", + "Y29yZS9wa2cvcHJvdG8vcmVzb3VyY2VzL3YxO3Jlc291cmNlc3BiqgIZTml0", + "cmljLlByb3RvLlJlc291cmNlcy52McoCGU5pdHJpY1xQcm90b1xSZXNvdXJj", + "ZXNcVjFiBnByb3RvMw==")); descriptor = pbr::FileDescriptor.FromGeneratedCode(descriptorData, new pbr::FileDescriptor[] { }, - new pbr::GeneratedClrTypeInfo(new[] {typeof(global::Nitric.Proto.Resource.v1.ResourceType), typeof(global::Nitric.Proto.Resource.v1.Action), }, null, new pbr::GeneratedClrTypeInfo[] { - new pbr::GeneratedClrTypeInfo(typeof(global::Nitric.Proto.Resource.v1.PolicyResource), global::Nitric.Proto.Resource.v1.PolicyResource.Parser, new[]{ "Principals", "Actions", "Resources" }, null, null, null, null), - new pbr::GeneratedClrTypeInfo(typeof(global::Nitric.Proto.Resource.v1.Resource), global::Nitric.Proto.Resource.v1.Resource.Parser, new[]{ "Type", "Name" }, null, null, null, null), - new pbr::GeneratedClrTypeInfo(typeof(global::Nitric.Proto.Resource.v1.ResourceDeclareRequest), global::Nitric.Proto.Resource.v1.ResourceDeclareRequest.Parser, new[]{ "Resource", "Policy", "Bucket", "Queue", "Topic", "Collection", "Secret", "Api" }, new[]{ "Config" }, null, null, null), - new pbr::GeneratedClrTypeInfo(typeof(global::Nitric.Proto.Resource.v1.BucketResource), global::Nitric.Proto.Resource.v1.BucketResource.Parser, null, null, null, null, null), - new pbr::GeneratedClrTypeInfo(typeof(global::Nitric.Proto.Resource.v1.QueueResource), global::Nitric.Proto.Resource.v1.QueueResource.Parser, null, null, null, null, null), - new pbr::GeneratedClrTypeInfo(typeof(global::Nitric.Proto.Resource.v1.TopicResource), global::Nitric.Proto.Resource.v1.TopicResource.Parser, null, null, null, null, null), - new pbr::GeneratedClrTypeInfo(typeof(global::Nitric.Proto.Resource.v1.CollectionResource), global::Nitric.Proto.Resource.v1.CollectionResource.Parser, null, null, null, null, null), - new pbr::GeneratedClrTypeInfo(typeof(global::Nitric.Proto.Resource.v1.SecretResource), global::Nitric.Proto.Resource.v1.SecretResource.Parser, null, null, null, null, null), - new pbr::GeneratedClrTypeInfo(typeof(global::Nitric.Proto.Resource.v1.ApiSecurityDefinitionJwt), global::Nitric.Proto.Resource.v1.ApiSecurityDefinitionJwt.Parser, new[]{ "Issuer", "Audiences" }, null, null, null, null), - new pbr::GeneratedClrTypeInfo(typeof(global::Nitric.Proto.Resource.v1.ApiSecurityDefinition), global::Nitric.Proto.Resource.v1.ApiSecurityDefinition.Parser, new[]{ "Jwt" }, new[]{ "Definition" }, null, null, null), - new pbr::GeneratedClrTypeInfo(typeof(global::Nitric.Proto.Resource.v1.ApiScopes), global::Nitric.Proto.Resource.v1.ApiScopes.Parser, new[]{ "Scopes" }, null, null, null, null), - new pbr::GeneratedClrTypeInfo(typeof(global::Nitric.Proto.Resource.v1.ApiResource), global::Nitric.Proto.Resource.v1.ApiResource.Parser, new[]{ "SecurityDefinitions", "Security" }, null, null, null, new pbr::GeneratedClrTypeInfo[] { null, null, }), - new pbr::GeneratedClrTypeInfo(typeof(global::Nitric.Proto.Resource.v1.ResourceDeclareResponse), global::Nitric.Proto.Resource.v1.ResourceDeclareResponse.Parser, null, null, null, null, null), - new pbr::GeneratedClrTypeInfo(typeof(global::Nitric.Proto.Resource.v1.ApiResourceDetails), global::Nitric.Proto.Resource.v1.ApiResourceDetails.Parser, new[]{ "Url" }, null, null, null, null), - new pbr::GeneratedClrTypeInfo(typeof(global::Nitric.Proto.Resource.v1.WebsocketResourceDetails), global::Nitric.Proto.Resource.v1.WebsocketResourceDetails.Parser, new[]{ "Url" }, null, null, null, null), - new pbr::GeneratedClrTypeInfo(typeof(global::Nitric.Proto.Resource.v1.ResourceDetailsRequest), global::Nitric.Proto.Resource.v1.ResourceDetailsRequest.Parser, new[]{ "Resource" }, null, null, null, null), - new pbr::GeneratedClrTypeInfo(typeof(global::Nitric.Proto.Resource.v1.ResourceDetailsResponse), global::Nitric.Proto.Resource.v1.ResourceDetailsResponse.Parser, new[]{ "Id", "Provider", "Service", "Api", "Websocket" }, new[]{ "Details" }, null, null, null) + new pbr::GeneratedClrTypeInfo(new[] {typeof(global::Nitric.Proto.Resources.v1.ResourceType), typeof(global::Nitric.Proto.Resources.v1.Action), }, null, new pbr::GeneratedClrTypeInfo[] { + new pbr::GeneratedClrTypeInfo(typeof(global::Nitric.Proto.Resources.v1.PolicyResource), global::Nitric.Proto.Resources.v1.PolicyResource.Parser, new[]{ "Principals", "Actions", "Resources" }, null, null, null, null), + new pbr::GeneratedClrTypeInfo(typeof(global::Nitric.Proto.Resources.v1.ResourceIdentifier), global::Nitric.Proto.Resources.v1.ResourceIdentifier.Parser, new[]{ "Type", "Name" }, null, null, null, null), + new pbr::GeneratedClrTypeInfo(typeof(global::Nitric.Proto.Resources.v1.ResourceDeclareRequest), global::Nitric.Proto.Resources.v1.ResourceDeclareRequest.Parser, new[]{ "Id", "Policy", "Bucket", "Topic", "KeyValueStore", "Secret", "Api", "ApiSecurityDefinition", "Queue" }, new[]{ "Config" }, null, null, null), + new pbr::GeneratedClrTypeInfo(typeof(global::Nitric.Proto.Resources.v1.BucketResource), global::Nitric.Proto.Resources.v1.BucketResource.Parser, null, null, null, null, null), + new pbr::GeneratedClrTypeInfo(typeof(global::Nitric.Proto.Resources.v1.TopicResource), global::Nitric.Proto.Resources.v1.TopicResource.Parser, null, null, null, null, null), + new pbr::GeneratedClrTypeInfo(typeof(global::Nitric.Proto.Resources.v1.QueueResource), global::Nitric.Proto.Resources.v1.QueueResource.Parser, null, null, null, null, null), + new pbr::GeneratedClrTypeInfo(typeof(global::Nitric.Proto.Resources.v1.KeyValueStoreResource), global::Nitric.Proto.Resources.v1.KeyValueStoreResource.Parser, null, null, null, null, null), + new pbr::GeneratedClrTypeInfo(typeof(global::Nitric.Proto.Resources.v1.SecretResource), global::Nitric.Proto.Resources.v1.SecretResource.Parser, null, null, null, null, null), + new pbr::GeneratedClrTypeInfo(typeof(global::Nitric.Proto.Resources.v1.ApiOpenIdConnectionDefinition), global::Nitric.Proto.Resources.v1.ApiOpenIdConnectionDefinition.Parser, new[]{ "Issuer", "Audiences" }, null, null, null, null), + new pbr::GeneratedClrTypeInfo(typeof(global::Nitric.Proto.Resources.v1.ApiSecurityDefinitionResource), global::Nitric.Proto.Resources.v1.ApiSecurityDefinitionResource.Parser, new[]{ "ApiName", "Oidc" }, new[]{ "Definition" }, null, null, null), + new pbr::GeneratedClrTypeInfo(typeof(global::Nitric.Proto.Resources.v1.ApiScopes), global::Nitric.Proto.Resources.v1.ApiScopes.Parser, new[]{ "Scopes" }, null, null, null, null), + new pbr::GeneratedClrTypeInfo(typeof(global::Nitric.Proto.Resources.v1.ApiResource), global::Nitric.Proto.Resources.v1.ApiResource.Parser, new[]{ "Security" }, null, null, null, new pbr::GeneratedClrTypeInfo[] { null, }), + new pbr::GeneratedClrTypeInfo(typeof(global::Nitric.Proto.Resources.v1.ResourceDeclareResponse), global::Nitric.Proto.Resources.v1.ResourceDeclareResponse.Parser, null, null, null, null, null) })); } #endregion @@ -114,18 +102,19 @@ static ResourceReflection() { #region Enums public enum ResourceType { [pbr::OriginalName("Api")] Api = 0, - [pbr::OriginalName("Function")] Function = 1, + [pbr::OriginalName("Service")] Service = 1, [pbr::OriginalName("Bucket")] Bucket = 2, - [pbr::OriginalName("Queue")] Queue = 3, - [pbr::OriginalName("Topic")] Topic = 4, - [pbr::OriginalName("Schedule")] Schedule = 5, - [pbr::OriginalName("Subscription")] Subscription = 6, - [pbr::OriginalName("Collection")] Collection = 7, - [pbr::OriginalName("Policy")] Policy = 8, - [pbr::OriginalName("Secret")] Secret = 9, - [pbr::OriginalName("Notification")] Notification = 10, - [pbr::OriginalName("Websocket")] Websocket = 11, - [pbr::OriginalName("Http")] Http = 12, + [pbr::OriginalName("Topic")] Topic = 3, + [pbr::OriginalName("Schedule")] Schedule = 4, + [pbr::OriginalName("Subscription")] Subscription = 5, + [pbr::OriginalName("KeyValueStore")] KeyValueStore = 6, + [pbr::OriginalName("Policy")] Policy = 7, + [pbr::OriginalName("Secret")] Secret = 8, + [pbr::OriginalName("BucketListener")] BucketListener = 9, + [pbr::OriginalName("Websocket")] Websocket = 10, + [pbr::OriginalName("Http")] Http = 11, + [pbr::OriginalName("ApiSecurityDefinition")] ApiSecurityDefinition = 12, + [pbr::OriginalName("Queue")] Queue = 13, } public enum Action { @@ -143,29 +132,27 @@ public enum Action { [pbr::OriginalName("TopicDetail")] TopicDetail = 201, [pbr::OriginalName("TopicEventPublish")] TopicEventPublish = 202, /// - /// Queue Permissions: 3XX + /// Collection Permissions: 3XX /// - [pbr::OriginalName("QueueSend")] QueueSend = 300, - [pbr::OriginalName("QueueReceive")] QueueReceive = 301, - [pbr::OriginalName("QueueList")] QueueList = 302, - [pbr::OriginalName("QueueDetail")] QueueDetail = 303, + [pbr::OriginalName("KeyValueStoreRead")] KeyValueStoreRead = 300, + [pbr::OriginalName("KeyValueStoreWrite")] KeyValueStoreWrite = 301, + [pbr::OriginalName("KeyValueStoreDelete")] KeyValueStoreDelete = 302, /// - /// Collection Permissions: 4XX + /// Secret Permissions: 4XX /// - [pbr::OriginalName("CollectionDocumentRead")] CollectionDocumentRead = 400, - [pbr::OriginalName("CollectionDocumentWrite")] CollectionDocumentWrite = 401, - [pbr::OriginalName("CollectionDocumentDelete")] CollectionDocumentDelete = 402, - [pbr::OriginalName("CollectionQuery")] CollectionQuery = 403, - [pbr::OriginalName("CollectionList")] CollectionList = 404, + [pbr::OriginalName("SecretPut")] SecretPut = 400, + [pbr::OriginalName("SecretAccess")] SecretAccess = 401, /// - /// Secret Permissions: 5XX + /// Websocket Permissions: 5XX /// - [pbr::OriginalName("SecretPut")] SecretPut = 500, - [pbr::OriginalName("SecretAccess")] SecretAccess = 501, + [pbr::OriginalName("WebsocketManage")] WebsocketManage = 500, /// - /// Websocket Permissions: 6XX + /// Queue Permissions: 6XX /// - [pbr::OriginalName("WebsocketManage")] WebsocketManage = 600, + [pbr::OriginalName("QueueSend")] QueueSend = 600, + [pbr::OriginalName("QueueReceive")] QueueReceive = 601, + [pbr::OriginalName("QueueList")] QueueList = 602, + [pbr::OriginalName("QueueDetail")] QueueDetail = 603, } #endregion @@ -183,7 +170,7 @@ public sealed partial class PolicyResource : pb::IMessage [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public static pbr::MessageDescriptor Descriptor { - get { return global::Nitric.Proto.Resource.v1.ResourceReflection.Descriptor.MessageTypes[0]; } + get { return global::Nitric.Proto.Resources.v1.ResourcesReflection.Descriptor.MessageTypes[0]; } } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] @@ -213,31 +200,31 @@ public PolicyResource Clone() { /// Field number for the "principals" field. public const int PrincipalsFieldNumber = 1; - private static readonly pb::FieldCodec _repeated_principals_codec - = pb::FieldCodec.ForMessage(10, global::Nitric.Proto.Resource.v1.Resource.Parser); - private readonly pbc::RepeatedField principals_ = new pbc::RepeatedField(); + private static readonly pb::FieldCodec _repeated_principals_codec + = pb::FieldCodec.ForMessage(10, global::Nitric.Proto.Resources.v1.ResourceIdentifier.Parser); + private readonly pbc::RepeatedField principals_ = new pbc::RepeatedField(); [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public pbc::RepeatedField Principals { + public pbc::RepeatedField Principals { get { return principals_; } } /// Field number for the "actions" field. public const int ActionsFieldNumber = 2; - private static readonly pb::FieldCodec _repeated_actions_codec - = pb::FieldCodec.ForEnum(18, x => (int) x, x => (global::Nitric.Proto.Resource.v1.Action) x); - private readonly pbc::RepeatedField actions_ = new pbc::RepeatedField(); + private static readonly pb::FieldCodec _repeated_actions_codec + = pb::FieldCodec.ForEnum(18, x => (int) x, x => (global::Nitric.Proto.Resources.v1.Action) x); + private readonly pbc::RepeatedField actions_ = new pbc::RepeatedField(); [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public pbc::RepeatedField Actions { + public pbc::RepeatedField Actions { get { return actions_; } } /// Field number for the "resources" field. public const int ResourcesFieldNumber = 3; - private static readonly pb::FieldCodec _repeated_resources_codec - = pb::FieldCodec.ForMessage(26, global::Nitric.Proto.Resource.v1.Resource.Parser); - private readonly pbc::RepeatedField resources_ = new pbc::RepeatedField(); + private static readonly pb::FieldCodec _repeated_resources_codec + = pb::FieldCodec.ForMessage(26, global::Nitric.Proto.Resources.v1.ResourceIdentifier.Parser); + private readonly pbc::RepeatedField resources_ = new pbc::RepeatedField(); [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public pbc::RepeatedField Resources { + public pbc::RepeatedField Resources { get { return resources_; } } @@ -384,19 +371,22 @@ public void MergeFrom(pb::CodedInputStream input) { } - public sealed partial class Resource : pb::IMessage + /// + /// Unique identifier for a resource within a nitric application. + /// + public sealed partial class ResourceIdentifier : pb::IMessage #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE , pb::IBufferMessage #endif { - private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new Resource()); + private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new ResourceIdentifier()); private pb::UnknownFieldSet _unknownFields; [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public static pb::MessageParser Parser { get { return _parser; } } + public static pb::MessageParser Parser { get { return _parser; } } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public static pbr::MessageDescriptor Descriptor { - get { return global::Nitric.Proto.Resource.v1.ResourceReflection.Descriptor.MessageTypes[1]; } + get { return global::Nitric.Proto.Resources.v1.ResourcesReflection.Descriptor.MessageTypes[1]; } } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] @@ -405,29 +395,29 @@ public sealed partial class Resource : pb::IMessage } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public Resource() { + public ResourceIdentifier() { OnConstruction(); } partial void OnConstruction(); [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public Resource(Resource other) : this() { + public ResourceIdentifier(ResourceIdentifier other) : this() { type_ = other.type_; name_ = other.name_; _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public Resource Clone() { - return new Resource(this); + public ResourceIdentifier Clone() { + return new ResourceIdentifier(this); } /// Field number for the "type" field. public const int TypeFieldNumber = 1; - private global::Nitric.Proto.Resource.v1.ResourceType type_ = global::Nitric.Proto.Resource.v1.ResourceType.Api; + private global::Nitric.Proto.Resources.v1.ResourceType type_ = global::Nitric.Proto.Resources.v1.ResourceType.Api; [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public global::Nitric.Proto.Resource.v1.ResourceType Type { + public global::Nitric.Proto.Resources.v1.ResourceType Type { get { return type_; } set { type_ = value; @@ -447,11 +437,11 @@ public string Name { [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public override bool Equals(object other) { - return Equals(other as Resource); + return Equals(other as ResourceIdentifier); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public bool Equals(Resource other) { + public bool Equals(ResourceIdentifier other) { if (ReferenceEquals(other, null)) { return false; } @@ -466,7 +456,7 @@ public bool Equals(Resource other) { [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public override int GetHashCode() { int hash = 1; - if (Type != global::Nitric.Proto.Resource.v1.ResourceType.Api) hash ^= Type.GetHashCode(); + if (Type != global::Nitric.Proto.Resources.v1.ResourceType.Api) hash ^= Type.GetHashCode(); if (Name.Length != 0) hash ^= Name.GetHashCode(); if (_unknownFields != null) { hash ^= _unknownFields.GetHashCode(); @@ -484,7 +474,7 @@ public void WriteTo(pb::CodedOutputStream output) { #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE output.WriteRawMessage(this); #else - if (Type != global::Nitric.Proto.Resource.v1.ResourceType.Api) { + if (Type != global::Nitric.Proto.Resources.v1.ResourceType.Api) { output.WriteRawTag(8); output.WriteEnum((int) Type); } @@ -501,7 +491,7 @@ public void WriteTo(pb::CodedOutputStream output) { #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE [global::System.Diagnostics.DebuggerNonUserCodeAttribute] void pb::IBufferMessage.InternalWriteTo(ref pb::WriteContext output) { - if (Type != global::Nitric.Proto.Resource.v1.ResourceType.Api) { + if (Type != global::Nitric.Proto.Resources.v1.ResourceType.Api) { output.WriteRawTag(8); output.WriteEnum((int) Type); } @@ -518,7 +508,7 @@ public void WriteTo(pb::CodedOutputStream output) { [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public int CalculateSize() { int size = 0; - if (Type != global::Nitric.Proto.Resource.v1.ResourceType.Api) { + if (Type != global::Nitric.Proto.Resources.v1.ResourceType.Api) { size += 1 + pb::CodedOutputStream.ComputeEnumSize((int) Type); } if (Name.Length != 0) { @@ -531,11 +521,11 @@ public int CalculateSize() { } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void MergeFrom(Resource other) { + public void MergeFrom(ResourceIdentifier other) { if (other == null) { return; } - if (other.Type != global::Nitric.Proto.Resource.v1.ResourceType.Api) { + if (other.Type != global::Nitric.Proto.Resources.v1.ResourceType.Api) { Type = other.Type; } if (other.Name.Length != 0) { @@ -556,7 +546,7 @@ public void MergeFrom(pb::CodedInputStream input) { _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input); break; case 8: { - Type = (global::Nitric.Proto.Resource.v1.ResourceType) input.ReadEnum(); + Type = (global::Nitric.Proto.Resources.v1.ResourceType) input.ReadEnum(); break; } case 18: { @@ -578,7 +568,7 @@ public void MergeFrom(pb::CodedInputStream input) { _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, ref input); break; case 8: { - Type = (global::Nitric.Proto.Resource.v1.ResourceType) input.ReadEnum(); + Type = (global::Nitric.Proto.Resources.v1.ResourceType) input.ReadEnum(); break; } case 18: { @@ -604,7 +594,7 @@ public sealed partial class ResourceDeclareRequest : pb::IMessageField number for the "resource" field. - public const int ResourceFieldNumber = 1; - private global::Nitric.Proto.Resource.v1.Resource resource_; + /// Field number for the "id" field. + public const int IdFieldNumber = 1; + private global::Nitric.Proto.Resources.v1.ResourceIdentifier id_; [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public global::Nitric.Proto.Resource.v1.Resource Resource { - get { return resource_; } + public global::Nitric.Proto.Resources.v1.ResourceIdentifier Id { + get { return id_; } set { - resource_ = value; + id_ = value; } } /// Field number for the "policy" field. public const int PolicyFieldNumber = 10; [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public global::Nitric.Proto.Resource.v1.PolicyResource Policy { - get { return configCase_ == ConfigOneofCase.Policy ? (global::Nitric.Proto.Resource.v1.PolicyResource) config_ : null; } + public global::Nitric.Proto.Resources.v1.PolicyResource Policy { + get { return configCase_ == ConfigOneofCase.Policy ? (global::Nitric.Proto.Resources.v1.PolicyResource) config_ : null; } set { config_ = value; configCase_ = value == null ? ConfigOneofCase.None : ConfigOneofCase.Policy; @@ -679,52 +672,41 @@ public ResourceDeclareRequest Clone() { /// Field number for the "bucket" field. public const int BucketFieldNumber = 11; [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public global::Nitric.Proto.Resource.v1.BucketResource Bucket { - get { return configCase_ == ConfigOneofCase.Bucket ? (global::Nitric.Proto.Resource.v1.BucketResource) config_ : null; } + public global::Nitric.Proto.Resources.v1.BucketResource Bucket { + get { return configCase_ == ConfigOneofCase.Bucket ? (global::Nitric.Proto.Resources.v1.BucketResource) config_ : null; } set { config_ = value; configCase_ = value == null ? ConfigOneofCase.None : ConfigOneofCase.Bucket; } } - /// Field number for the "queue" field. - public const int QueueFieldNumber = 12; - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public global::Nitric.Proto.Resource.v1.QueueResource Queue { - get { return configCase_ == ConfigOneofCase.Queue ? (global::Nitric.Proto.Resource.v1.QueueResource) config_ : null; } - set { - config_ = value; - configCase_ = value == null ? ConfigOneofCase.None : ConfigOneofCase.Queue; - } - } - /// Field number for the "topic" field. - public const int TopicFieldNumber = 13; + public const int TopicFieldNumber = 12; [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public global::Nitric.Proto.Resource.v1.TopicResource Topic { - get { return configCase_ == ConfigOneofCase.Topic ? (global::Nitric.Proto.Resource.v1.TopicResource) config_ : null; } + public global::Nitric.Proto.Resources.v1.TopicResource Topic { + get { return configCase_ == ConfigOneofCase.Topic ? (global::Nitric.Proto.Resources.v1.TopicResource) config_ : null; } set { config_ = value; configCase_ = value == null ? ConfigOneofCase.None : ConfigOneofCase.Topic; } } - /// Field number for the "collection" field. - public const int CollectionFieldNumber = 14; + /// Field number for the "key_value_store" field. + public const int KeyValueStoreFieldNumber = 13; [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public global::Nitric.Proto.Resource.v1.CollectionResource Collection { - get { return configCase_ == ConfigOneofCase.Collection ? (global::Nitric.Proto.Resource.v1.CollectionResource) config_ : null; } + public global::Nitric.Proto.Resources.v1.KeyValueStoreResource KeyValueStore { + get { return configCase_ == ConfigOneofCase.KeyValueStore ? (global::Nitric.Proto.Resources.v1.KeyValueStoreResource) config_ : null; } set { config_ = value; - configCase_ = value == null ? ConfigOneofCase.None : ConfigOneofCase.Collection; + configCase_ = value == null ? ConfigOneofCase.None : ConfigOneofCase.KeyValueStore; } } /// Field number for the "secret" field. - public const int SecretFieldNumber = 15; + public const int SecretFieldNumber = 14; [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public global::Nitric.Proto.Resource.v1.SecretResource Secret { - get { return configCase_ == ConfigOneofCase.Secret ? (global::Nitric.Proto.Resource.v1.SecretResource) config_ : null; } + public global::Nitric.Proto.Resources.v1.SecretResource Secret { + get { return configCase_ == ConfigOneofCase.Secret ? (global::Nitric.Proto.Resources.v1.SecretResource) config_ : null; } set { config_ = value; configCase_ = value == null ? ConfigOneofCase.None : ConfigOneofCase.Secret; @@ -732,27 +714,50 @@ public ResourceDeclareRequest Clone() { } /// Field number for the "api" field. - public const int ApiFieldNumber = 16; + public const int ApiFieldNumber = 15; [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public global::Nitric.Proto.Resource.v1.ApiResource Api { - get { return configCase_ == ConfigOneofCase.Api ? (global::Nitric.Proto.Resource.v1.ApiResource) config_ : null; } + public global::Nitric.Proto.Resources.v1.ApiResource Api { + get { return configCase_ == ConfigOneofCase.Api ? (global::Nitric.Proto.Resources.v1.ApiResource) config_ : null; } set { config_ = value; configCase_ = value == null ? ConfigOneofCase.None : ConfigOneofCase.Api; } } + /// Field number for the "api_security_definition" field. + public const int ApiSecurityDefinitionFieldNumber = 16; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public global::Nitric.Proto.Resources.v1.ApiSecurityDefinitionResource ApiSecurityDefinition { + get { return configCase_ == ConfigOneofCase.ApiSecurityDefinition ? (global::Nitric.Proto.Resources.v1.ApiSecurityDefinitionResource) config_ : null; } + set { + config_ = value; + configCase_ = value == null ? ConfigOneofCase.None : ConfigOneofCase.ApiSecurityDefinition; + } + } + + /// Field number for the "queue" field. + public const int QueueFieldNumber = 17; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public global::Nitric.Proto.Resources.v1.QueueResource Queue { + get { return configCase_ == ConfigOneofCase.Queue ? (global::Nitric.Proto.Resources.v1.QueueResource) config_ : null; } + set { + config_ = value; + configCase_ = value == null ? ConfigOneofCase.None : ConfigOneofCase.Queue; + } + } + private object config_; /// Enum of possible cases for the "config" oneof. public enum ConfigOneofCase { None = 0, Policy = 10, Bucket = 11, - Queue = 12, - Topic = 13, - Collection = 14, - Secret = 15, - Api = 16, + Topic = 12, + KeyValueStore = 13, + Secret = 14, + Api = 15, + ApiSecurityDefinition = 16, + Queue = 17, } private ConfigOneofCase configCase_ = ConfigOneofCase.None; [global::System.Diagnostics.DebuggerNonUserCodeAttribute] @@ -779,14 +784,15 @@ public bool Equals(ResourceDeclareRequest other) { if (ReferenceEquals(other, this)) { return true; } - if (!object.Equals(Resource, other.Resource)) return false; + if (!object.Equals(Id, other.Id)) return false; if (!object.Equals(Policy, other.Policy)) return false; if (!object.Equals(Bucket, other.Bucket)) return false; - if (!object.Equals(Queue, other.Queue)) return false; if (!object.Equals(Topic, other.Topic)) return false; - if (!object.Equals(Collection, other.Collection)) return false; + if (!object.Equals(KeyValueStore, other.KeyValueStore)) return false; if (!object.Equals(Secret, other.Secret)) return false; if (!object.Equals(Api, other.Api)) return false; + if (!object.Equals(ApiSecurityDefinition, other.ApiSecurityDefinition)) return false; + if (!object.Equals(Queue, other.Queue)) return false; if (ConfigCase != other.ConfigCase) return false; return Equals(_unknownFields, other._unknownFields); } @@ -794,14 +800,15 @@ public bool Equals(ResourceDeclareRequest other) { [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public override int GetHashCode() { int hash = 1; - if (resource_ != null) hash ^= Resource.GetHashCode(); + if (id_ != null) hash ^= Id.GetHashCode(); if (configCase_ == ConfigOneofCase.Policy) hash ^= Policy.GetHashCode(); if (configCase_ == ConfigOneofCase.Bucket) hash ^= Bucket.GetHashCode(); - if (configCase_ == ConfigOneofCase.Queue) hash ^= Queue.GetHashCode(); if (configCase_ == ConfigOneofCase.Topic) hash ^= Topic.GetHashCode(); - if (configCase_ == ConfigOneofCase.Collection) hash ^= Collection.GetHashCode(); + if (configCase_ == ConfigOneofCase.KeyValueStore) hash ^= KeyValueStore.GetHashCode(); if (configCase_ == ConfigOneofCase.Secret) hash ^= Secret.GetHashCode(); if (configCase_ == ConfigOneofCase.Api) hash ^= Api.GetHashCode(); + if (configCase_ == ConfigOneofCase.ApiSecurityDefinition) hash ^= ApiSecurityDefinition.GetHashCode(); + if (configCase_ == ConfigOneofCase.Queue) hash ^= Queue.GetHashCode(); hash ^= (int) configCase_; if (_unknownFields != null) { hash ^= _unknownFields.GetHashCode(); @@ -819,9 +826,9 @@ public void WriteTo(pb::CodedOutputStream output) { #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE output.WriteRawMessage(this); #else - if (resource_ != null) { + if (id_ != null) { output.WriteRawTag(10); - output.WriteMessage(Resource); + output.WriteMessage(Id); } if (configCase_ == ConfigOneofCase.Policy) { output.WriteRawTag(82); @@ -831,26 +838,30 @@ public void WriteTo(pb::CodedOutputStream output) { output.WriteRawTag(90); output.WriteMessage(Bucket); } - if (configCase_ == ConfigOneofCase.Queue) { - output.WriteRawTag(98); - output.WriteMessage(Queue); - } if (configCase_ == ConfigOneofCase.Topic) { - output.WriteRawTag(106); + output.WriteRawTag(98); output.WriteMessage(Topic); } - if (configCase_ == ConfigOneofCase.Collection) { - output.WriteRawTag(114); - output.WriteMessage(Collection); + if (configCase_ == ConfigOneofCase.KeyValueStore) { + output.WriteRawTag(106); + output.WriteMessage(KeyValueStore); } if (configCase_ == ConfigOneofCase.Secret) { - output.WriteRawTag(122); + output.WriteRawTag(114); output.WriteMessage(Secret); } if (configCase_ == ConfigOneofCase.Api) { - output.WriteRawTag(130, 1); + output.WriteRawTag(122); output.WriteMessage(Api); } + if (configCase_ == ConfigOneofCase.ApiSecurityDefinition) { + output.WriteRawTag(130, 1); + output.WriteMessage(ApiSecurityDefinition); + } + if (configCase_ == ConfigOneofCase.Queue) { + output.WriteRawTag(138, 1); + output.WriteMessage(Queue); + } if (_unknownFields != null) { _unknownFields.WriteTo(output); } @@ -860,9 +871,9 @@ public void WriteTo(pb::CodedOutputStream output) { #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE [global::System.Diagnostics.DebuggerNonUserCodeAttribute] void pb::IBufferMessage.InternalWriteTo(ref pb::WriteContext output) { - if (resource_ != null) { + if (id_ != null) { output.WriteRawTag(10); - output.WriteMessage(Resource); + output.WriteMessage(Id); } if (configCase_ == ConfigOneofCase.Policy) { output.WriteRawTag(82); @@ -872,26 +883,30 @@ public void WriteTo(pb::CodedOutputStream output) { output.WriteRawTag(90); output.WriteMessage(Bucket); } - if (configCase_ == ConfigOneofCase.Queue) { - output.WriteRawTag(98); - output.WriteMessage(Queue); - } if (configCase_ == ConfigOneofCase.Topic) { - output.WriteRawTag(106); + output.WriteRawTag(98); output.WriteMessage(Topic); } - if (configCase_ == ConfigOneofCase.Collection) { - output.WriteRawTag(114); - output.WriteMessage(Collection); + if (configCase_ == ConfigOneofCase.KeyValueStore) { + output.WriteRawTag(106); + output.WriteMessage(KeyValueStore); } if (configCase_ == ConfigOneofCase.Secret) { - output.WriteRawTag(122); + output.WriteRawTag(114); output.WriteMessage(Secret); } if (configCase_ == ConfigOneofCase.Api) { - output.WriteRawTag(130, 1); + output.WriteRawTag(122); output.WriteMessage(Api); } + if (configCase_ == ConfigOneofCase.ApiSecurityDefinition) { + output.WriteRawTag(130, 1); + output.WriteMessage(ApiSecurityDefinition); + } + if (configCase_ == ConfigOneofCase.Queue) { + output.WriteRawTag(138, 1); + output.WriteMessage(Queue); + } if (_unknownFields != null) { _unknownFields.WriteTo(ref output); } @@ -901,8 +916,8 @@ public void WriteTo(pb::CodedOutputStream output) { [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public int CalculateSize() { int size = 0; - if (resource_ != null) { - size += 1 + pb::CodedOutputStream.ComputeMessageSize(Resource); + if (id_ != null) { + size += 1 + pb::CodedOutputStream.ComputeMessageSize(Id); } if (configCase_ == ConfigOneofCase.Policy) { size += 1 + pb::CodedOutputStream.ComputeMessageSize(Policy); @@ -910,20 +925,23 @@ public int CalculateSize() { if (configCase_ == ConfigOneofCase.Bucket) { size += 1 + pb::CodedOutputStream.ComputeMessageSize(Bucket); } - if (configCase_ == ConfigOneofCase.Queue) { - size += 1 + pb::CodedOutputStream.ComputeMessageSize(Queue); - } if (configCase_ == ConfigOneofCase.Topic) { size += 1 + pb::CodedOutputStream.ComputeMessageSize(Topic); } - if (configCase_ == ConfigOneofCase.Collection) { - size += 1 + pb::CodedOutputStream.ComputeMessageSize(Collection); + if (configCase_ == ConfigOneofCase.KeyValueStore) { + size += 1 + pb::CodedOutputStream.ComputeMessageSize(KeyValueStore); } if (configCase_ == ConfigOneofCase.Secret) { size += 1 + pb::CodedOutputStream.ComputeMessageSize(Secret); } if (configCase_ == ConfigOneofCase.Api) { - size += 2 + pb::CodedOutputStream.ComputeMessageSize(Api); + size += 1 + pb::CodedOutputStream.ComputeMessageSize(Api); + } + if (configCase_ == ConfigOneofCase.ApiSecurityDefinition) { + size += 2 + pb::CodedOutputStream.ComputeMessageSize(ApiSecurityDefinition); + } + if (configCase_ == ConfigOneofCase.Queue) { + size += 2 + pb::CodedOutputStream.ComputeMessageSize(Queue); } if (_unknownFields != null) { size += _unknownFields.CalculateSize(); @@ -936,55 +954,61 @@ public void MergeFrom(ResourceDeclareRequest other) { if (other == null) { return; } - if (other.resource_ != null) { - if (resource_ == null) { - Resource = new global::Nitric.Proto.Resource.v1.Resource(); + if (other.id_ != null) { + if (id_ == null) { + Id = new global::Nitric.Proto.Resources.v1.ResourceIdentifier(); } - Resource.MergeFrom(other.Resource); + Id.MergeFrom(other.Id); } switch (other.ConfigCase) { case ConfigOneofCase.Policy: if (Policy == null) { - Policy = new global::Nitric.Proto.Resource.v1.PolicyResource(); + Policy = new global::Nitric.Proto.Resources.v1.PolicyResource(); } Policy.MergeFrom(other.Policy); break; case ConfigOneofCase.Bucket: if (Bucket == null) { - Bucket = new global::Nitric.Proto.Resource.v1.BucketResource(); + Bucket = new global::Nitric.Proto.Resources.v1.BucketResource(); } Bucket.MergeFrom(other.Bucket); break; - case ConfigOneofCase.Queue: - if (Queue == null) { - Queue = new global::Nitric.Proto.Resource.v1.QueueResource(); - } - Queue.MergeFrom(other.Queue); - break; case ConfigOneofCase.Topic: if (Topic == null) { - Topic = new global::Nitric.Proto.Resource.v1.TopicResource(); + Topic = new global::Nitric.Proto.Resources.v1.TopicResource(); } Topic.MergeFrom(other.Topic); break; - case ConfigOneofCase.Collection: - if (Collection == null) { - Collection = new global::Nitric.Proto.Resource.v1.CollectionResource(); + case ConfigOneofCase.KeyValueStore: + if (KeyValueStore == null) { + KeyValueStore = new global::Nitric.Proto.Resources.v1.KeyValueStoreResource(); } - Collection.MergeFrom(other.Collection); + KeyValueStore.MergeFrom(other.KeyValueStore); break; case ConfigOneofCase.Secret: if (Secret == null) { - Secret = new global::Nitric.Proto.Resource.v1.SecretResource(); + Secret = new global::Nitric.Proto.Resources.v1.SecretResource(); } Secret.MergeFrom(other.Secret); break; case ConfigOneofCase.Api: if (Api == null) { - Api = new global::Nitric.Proto.Resource.v1.ApiResource(); + Api = new global::Nitric.Proto.Resources.v1.ApiResource(); } Api.MergeFrom(other.Api); break; + case ConfigOneofCase.ApiSecurityDefinition: + if (ApiSecurityDefinition == null) { + ApiSecurityDefinition = new global::Nitric.Proto.Resources.v1.ApiSecurityDefinitionResource(); + } + ApiSecurityDefinition.MergeFrom(other.ApiSecurityDefinition); + break; + case ConfigOneofCase.Queue: + if (Queue == null) { + Queue = new global::Nitric.Proto.Resources.v1.QueueResource(); + } + Queue.MergeFrom(other.Queue); + break; } _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields); @@ -1002,14 +1026,14 @@ public void MergeFrom(pb::CodedInputStream input) { _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input); break; case 10: { - if (resource_ == null) { - Resource = new global::Nitric.Proto.Resource.v1.Resource(); + if (id_ == null) { + Id = new global::Nitric.Proto.Resources.v1.ResourceIdentifier(); } - input.ReadMessage(Resource); + input.ReadMessage(Id); break; } case 82: { - global::Nitric.Proto.Resource.v1.PolicyResource subBuilder = new global::Nitric.Proto.Resource.v1.PolicyResource(); + global::Nitric.Proto.Resources.v1.PolicyResource subBuilder = new global::Nitric.Proto.Resources.v1.PolicyResource(); if (configCase_ == ConfigOneofCase.Policy) { subBuilder.MergeFrom(Policy); } @@ -1018,7 +1042,7 @@ public void MergeFrom(pb::CodedInputStream input) { break; } case 90: { - global::Nitric.Proto.Resource.v1.BucketResource subBuilder = new global::Nitric.Proto.Resource.v1.BucketResource(); + global::Nitric.Proto.Resources.v1.BucketResource subBuilder = new global::Nitric.Proto.Resources.v1.BucketResource(); if (configCase_ == ConfigOneofCase.Bucket) { subBuilder.MergeFrom(Bucket); } @@ -1027,16 +1051,7 @@ public void MergeFrom(pb::CodedInputStream input) { break; } case 98: { - global::Nitric.Proto.Resource.v1.QueueResource subBuilder = new global::Nitric.Proto.Resource.v1.QueueResource(); - if (configCase_ == ConfigOneofCase.Queue) { - subBuilder.MergeFrom(Queue); - } - input.ReadMessage(subBuilder); - Queue = subBuilder; - break; - } - case 106: { - global::Nitric.Proto.Resource.v1.TopicResource subBuilder = new global::Nitric.Proto.Resource.v1.TopicResource(); + global::Nitric.Proto.Resources.v1.TopicResource subBuilder = new global::Nitric.Proto.Resources.v1.TopicResource(); if (configCase_ == ConfigOneofCase.Topic) { subBuilder.MergeFrom(Topic); } @@ -1044,17 +1059,17 @@ public void MergeFrom(pb::CodedInputStream input) { Topic = subBuilder; break; } - case 114: { - global::Nitric.Proto.Resource.v1.CollectionResource subBuilder = new global::Nitric.Proto.Resource.v1.CollectionResource(); - if (configCase_ == ConfigOneofCase.Collection) { - subBuilder.MergeFrom(Collection); + case 106: { + global::Nitric.Proto.Resources.v1.KeyValueStoreResource subBuilder = new global::Nitric.Proto.Resources.v1.KeyValueStoreResource(); + if (configCase_ == ConfigOneofCase.KeyValueStore) { + subBuilder.MergeFrom(KeyValueStore); } input.ReadMessage(subBuilder); - Collection = subBuilder; + KeyValueStore = subBuilder; break; } - case 122: { - global::Nitric.Proto.Resource.v1.SecretResource subBuilder = new global::Nitric.Proto.Resource.v1.SecretResource(); + case 114: { + global::Nitric.Proto.Resources.v1.SecretResource subBuilder = new global::Nitric.Proto.Resources.v1.SecretResource(); if (configCase_ == ConfigOneofCase.Secret) { subBuilder.MergeFrom(Secret); } @@ -1062,8 +1077,8 @@ public void MergeFrom(pb::CodedInputStream input) { Secret = subBuilder; break; } - case 130: { - global::Nitric.Proto.Resource.v1.ApiResource subBuilder = new global::Nitric.Proto.Resource.v1.ApiResource(); + case 122: { + global::Nitric.Proto.Resources.v1.ApiResource subBuilder = new global::Nitric.Proto.Resources.v1.ApiResource(); if (configCase_ == ConfigOneofCase.Api) { subBuilder.MergeFrom(Api); } @@ -1071,6 +1086,24 @@ public void MergeFrom(pb::CodedInputStream input) { Api = subBuilder; break; } + case 130: { + global::Nitric.Proto.Resources.v1.ApiSecurityDefinitionResource subBuilder = new global::Nitric.Proto.Resources.v1.ApiSecurityDefinitionResource(); + if (configCase_ == ConfigOneofCase.ApiSecurityDefinition) { + subBuilder.MergeFrom(ApiSecurityDefinition); + } + input.ReadMessage(subBuilder); + ApiSecurityDefinition = subBuilder; + break; + } + case 138: { + global::Nitric.Proto.Resources.v1.QueueResource subBuilder = new global::Nitric.Proto.Resources.v1.QueueResource(); + if (configCase_ == ConfigOneofCase.Queue) { + subBuilder.MergeFrom(Queue); + } + input.ReadMessage(subBuilder); + Queue = subBuilder; + break; + } } } #endif @@ -1086,14 +1119,14 @@ public void MergeFrom(pb::CodedInputStream input) { _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, ref input); break; case 10: { - if (resource_ == null) { - Resource = new global::Nitric.Proto.Resource.v1.Resource(); + if (id_ == null) { + Id = new global::Nitric.Proto.Resources.v1.ResourceIdentifier(); } - input.ReadMessage(Resource); + input.ReadMessage(Id); break; } case 82: { - global::Nitric.Proto.Resource.v1.PolicyResource subBuilder = new global::Nitric.Proto.Resource.v1.PolicyResource(); + global::Nitric.Proto.Resources.v1.PolicyResource subBuilder = new global::Nitric.Proto.Resources.v1.PolicyResource(); if (configCase_ == ConfigOneofCase.Policy) { subBuilder.MergeFrom(Policy); } @@ -1102,7 +1135,7 @@ public void MergeFrom(pb::CodedInputStream input) { break; } case 90: { - global::Nitric.Proto.Resource.v1.BucketResource subBuilder = new global::Nitric.Proto.Resource.v1.BucketResource(); + global::Nitric.Proto.Resources.v1.BucketResource subBuilder = new global::Nitric.Proto.Resources.v1.BucketResource(); if (configCase_ == ConfigOneofCase.Bucket) { subBuilder.MergeFrom(Bucket); } @@ -1111,16 +1144,7 @@ public void MergeFrom(pb::CodedInputStream input) { break; } case 98: { - global::Nitric.Proto.Resource.v1.QueueResource subBuilder = new global::Nitric.Proto.Resource.v1.QueueResource(); - if (configCase_ == ConfigOneofCase.Queue) { - subBuilder.MergeFrom(Queue); - } - input.ReadMessage(subBuilder); - Queue = subBuilder; - break; - } - case 106: { - global::Nitric.Proto.Resource.v1.TopicResource subBuilder = new global::Nitric.Proto.Resource.v1.TopicResource(); + global::Nitric.Proto.Resources.v1.TopicResource subBuilder = new global::Nitric.Proto.Resources.v1.TopicResource(); if (configCase_ == ConfigOneofCase.Topic) { subBuilder.MergeFrom(Topic); } @@ -1128,17 +1152,17 @@ public void MergeFrom(pb::CodedInputStream input) { Topic = subBuilder; break; } - case 114: { - global::Nitric.Proto.Resource.v1.CollectionResource subBuilder = new global::Nitric.Proto.Resource.v1.CollectionResource(); - if (configCase_ == ConfigOneofCase.Collection) { - subBuilder.MergeFrom(Collection); + case 106: { + global::Nitric.Proto.Resources.v1.KeyValueStoreResource subBuilder = new global::Nitric.Proto.Resources.v1.KeyValueStoreResource(); + if (configCase_ == ConfigOneofCase.KeyValueStore) { + subBuilder.MergeFrom(KeyValueStore); } input.ReadMessage(subBuilder); - Collection = subBuilder; + KeyValueStore = subBuilder; break; } - case 122: { - global::Nitric.Proto.Resource.v1.SecretResource subBuilder = new global::Nitric.Proto.Resource.v1.SecretResource(); + case 114: { + global::Nitric.Proto.Resources.v1.SecretResource subBuilder = new global::Nitric.Proto.Resources.v1.SecretResource(); if (configCase_ == ConfigOneofCase.Secret) { subBuilder.MergeFrom(Secret); } @@ -1146,8 +1170,8 @@ public void MergeFrom(pb::CodedInputStream input) { Secret = subBuilder; break; } - case 130: { - global::Nitric.Proto.Resource.v1.ApiResource subBuilder = new global::Nitric.Proto.Resource.v1.ApiResource(); + case 122: { + global::Nitric.Proto.Resources.v1.ApiResource subBuilder = new global::Nitric.Proto.Resources.v1.ApiResource(); if (configCase_ == ConfigOneofCase.Api) { subBuilder.MergeFrom(Api); } @@ -1155,6 +1179,24 @@ public void MergeFrom(pb::CodedInputStream input) { Api = subBuilder; break; } + case 130: { + global::Nitric.Proto.Resources.v1.ApiSecurityDefinitionResource subBuilder = new global::Nitric.Proto.Resources.v1.ApiSecurityDefinitionResource(); + if (configCase_ == ConfigOneofCase.ApiSecurityDefinition) { + subBuilder.MergeFrom(ApiSecurityDefinition); + } + input.ReadMessage(subBuilder); + ApiSecurityDefinition = subBuilder; + break; + } + case 138: { + global::Nitric.Proto.Resources.v1.QueueResource subBuilder = new global::Nitric.Proto.Resources.v1.QueueResource(); + if (configCase_ == ConfigOneofCase.Queue) { + subBuilder.MergeFrom(Queue); + } + input.ReadMessage(subBuilder); + Queue = subBuilder; + break; + } } } } @@ -1174,7 +1216,7 @@ public sealed partial class BucketResource : pb::IMessage [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public static pbr::MessageDescriptor Descriptor { - get { return global::Nitric.Proto.Resource.v1.ResourceReflection.Descriptor.MessageTypes[3]; } + get { return global::Nitric.Proto.Resources.v1.ResourcesReflection.Descriptor.MessageTypes[3]; } } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] @@ -1298,19 +1340,19 @@ public void MergeFrom(pb::CodedInputStream input) { } - public sealed partial class QueueResource : pb::IMessage + public sealed partial class TopicResource : pb::IMessage #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE , pb::IBufferMessage #endif { - private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new QueueResource()); + private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new TopicResource()); private pb::UnknownFieldSet _unknownFields; [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public static pb::MessageParser Parser { get { return _parser; } } + public static pb::MessageParser Parser { get { return _parser; } } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public static pbr::MessageDescriptor Descriptor { - get { return global::Nitric.Proto.Resource.v1.ResourceReflection.Descriptor.MessageTypes[4]; } + get { return global::Nitric.Proto.Resources.v1.ResourcesReflection.Descriptor.MessageTypes[4]; } } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] @@ -1319,29 +1361,29 @@ public sealed partial class QueueResource : pb::IMessage } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public QueueResource() { + public TopicResource() { OnConstruction(); } partial void OnConstruction(); [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public QueueResource(QueueResource other) : this() { + public TopicResource(TopicResource other) : this() { _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public QueueResource Clone() { - return new QueueResource(this); + public TopicResource Clone() { + return new TopicResource(this); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public override bool Equals(object other) { - return Equals(other as QueueResource); + return Equals(other as TopicResource); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public bool Equals(QueueResource other) { + public bool Equals(TopicResource other) { if (ReferenceEquals(other, null)) { return false; } @@ -1395,7 +1437,7 @@ public int CalculateSize() { } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void MergeFrom(QueueResource other) { + public void MergeFrom(TopicResource other) { if (other == null) { return; } @@ -1434,19 +1476,19 @@ public void MergeFrom(pb::CodedInputStream input) { } - public sealed partial class TopicResource : pb::IMessage + public sealed partial class QueueResource : pb::IMessage #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE , pb::IBufferMessage #endif { - private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new TopicResource()); + private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new QueueResource()); private pb::UnknownFieldSet _unknownFields; [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public static pb::MessageParser Parser { get { return _parser; } } + public static pb::MessageParser Parser { get { return _parser; } } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public static pbr::MessageDescriptor Descriptor { - get { return global::Nitric.Proto.Resource.v1.ResourceReflection.Descriptor.MessageTypes[5]; } + get { return global::Nitric.Proto.Resources.v1.ResourcesReflection.Descriptor.MessageTypes[5]; } } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] @@ -1455,29 +1497,29 @@ public sealed partial class TopicResource : pb::IMessage } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public TopicResource() { + public QueueResource() { OnConstruction(); } partial void OnConstruction(); [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public TopicResource(TopicResource other) : this() { + public QueueResource(QueueResource other) : this() { _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public TopicResource Clone() { - return new TopicResource(this); + public QueueResource Clone() { + return new QueueResource(this); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public override bool Equals(object other) { - return Equals(other as TopicResource); + return Equals(other as QueueResource); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public bool Equals(TopicResource other) { + public bool Equals(QueueResource other) { if (ReferenceEquals(other, null)) { return false; } @@ -1531,7 +1573,7 @@ public int CalculateSize() { } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void MergeFrom(TopicResource other) { + public void MergeFrom(QueueResource other) { if (other == null) { return; } @@ -1570,19 +1612,19 @@ public void MergeFrom(pb::CodedInputStream input) { } - public sealed partial class CollectionResource : pb::IMessage + public sealed partial class KeyValueStoreResource : pb::IMessage #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE , pb::IBufferMessage #endif { - private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new CollectionResource()); + private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new KeyValueStoreResource()); private pb::UnknownFieldSet _unknownFields; [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public static pb::MessageParser Parser { get { return _parser; } } + public static pb::MessageParser Parser { get { return _parser; } } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public static pbr::MessageDescriptor Descriptor { - get { return global::Nitric.Proto.Resource.v1.ResourceReflection.Descriptor.MessageTypes[6]; } + get { return global::Nitric.Proto.Resources.v1.ResourcesReflection.Descriptor.MessageTypes[6]; } } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] @@ -1591,29 +1633,29 @@ public sealed partial class CollectionResource : pb::IMessage [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public static pbr::MessageDescriptor Descriptor { - get { return global::Nitric.Proto.Resource.v1.ResourceReflection.Descriptor.MessageTypes[7]; } + get { return global::Nitric.Proto.Resources.v1.ResourcesReflection.Descriptor.MessageTypes[7]; } } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] @@ -1842,22 +1884,19 @@ public void MergeFrom(pb::CodedInputStream input) { } - /// - /// protect your API with JWT authentication - /// - public sealed partial class ApiSecurityDefinitionJwt : pb::IMessage + public sealed partial class ApiOpenIdConnectionDefinition : pb::IMessage #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE , pb::IBufferMessage #endif { - private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new ApiSecurityDefinitionJwt()); + private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new ApiOpenIdConnectionDefinition()); private pb::UnknownFieldSet _unknownFields; [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public static pb::MessageParser Parser { get { return _parser; } } + public static pb::MessageParser Parser { get { return _parser; } } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public static pbr::MessageDescriptor Descriptor { - get { return global::Nitric.Proto.Resource.v1.ResourceReflection.Descriptor.MessageTypes[8]; } + get { return global::Nitric.Proto.Resources.v1.ResourcesReflection.Descriptor.MessageTypes[8]; } } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] @@ -1866,22 +1905,22 @@ public sealed partial class ApiSecurityDefinitionJwt : pb::IMessageField number for the "issuer" field. @@ -1907,11 +1946,11 @@ public string Issuer { [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public override bool Equals(object other) { - return Equals(other as ApiSecurityDefinitionJwt); + return Equals(other as ApiOpenIdConnectionDefinition); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public bool Equals(ApiSecurityDefinitionJwt other) { + public bool Equals(ApiOpenIdConnectionDefinition other) { if (ReferenceEquals(other, null)) { return false; } @@ -1983,7 +2022,7 @@ public int CalculateSize() { } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void MergeFrom(ApiSecurityDefinitionJwt other) { + public void MergeFrom(ApiOpenIdConnectionDefinition other) { if (other == null) { return; } @@ -2042,19 +2081,19 @@ public void MergeFrom(pb::CodedInputStream input) { } - public sealed partial class ApiSecurityDefinition : pb::IMessage + public sealed partial class ApiSecurityDefinitionResource : pb::IMessage #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE , pb::IBufferMessage #endif { - private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new ApiSecurityDefinition()); + private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new ApiSecurityDefinitionResource()); private pb::UnknownFieldSet _unknownFields; [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public static pb::MessageParser Parser { get { return _parser; } } + public static pb::MessageParser Parser { get { return _parser; } } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public static pbr::MessageDescriptor Descriptor { - get { return global::Nitric.Proto.Resource.v1.ResourceReflection.Descriptor.MessageTypes[9]; } + get { return global::Nitric.Proto.Resources.v1.ResourcesReflection.Descriptor.MessageTypes[9]; } } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] @@ -2063,17 +2102,18 @@ public sealed partial class ApiSecurityDefinition : pb::IMessageField number for the "jwt" field. - public const int JwtFieldNumber = 1; + /// Field number for the "api_name" field. + public const int ApiNameFieldNumber = 1; + private string apiName_ = ""; [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public global::Nitric.Proto.Resource.v1.ApiSecurityDefinitionJwt Jwt { - get { return definitionCase_ == DefinitionOneofCase.Jwt ? (global::Nitric.Proto.Resource.v1.ApiSecurityDefinitionJwt) definition_ : null; } + public string ApiName { + get { return apiName_; } + set { + apiName_ = pb::ProtoPreconditions.CheckNotNull(value, "value"); + } + } + + /// Field number for the "oidc" field. + public const int OidcFieldNumber = 2; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public global::Nitric.Proto.Resources.v1.ApiOpenIdConnectionDefinition Oidc { + get { return definitionCase_ == DefinitionOneofCase.Oidc ? (global::Nitric.Proto.Resources.v1.ApiOpenIdConnectionDefinition) definition_ : null; } set { definition_ = value; - definitionCase_ = value == null ? DefinitionOneofCase.None : DefinitionOneofCase.Jwt; + definitionCase_ = value == null ? DefinitionOneofCase.None : DefinitionOneofCase.Oidc; } } @@ -2100,7 +2151,7 @@ public ApiSecurityDefinition Clone() { /// Enum of possible cases for the "definition" oneof. public enum DefinitionOneofCase { None = 0, - Jwt = 1, + Oidc = 2, } private DefinitionOneofCase definitionCase_ = DefinitionOneofCase.None; [global::System.Diagnostics.DebuggerNonUserCodeAttribute] @@ -2116,18 +2167,19 @@ public void ClearDefinition() { [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public override bool Equals(object other) { - return Equals(other as ApiSecurityDefinition); + return Equals(other as ApiSecurityDefinitionResource); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public bool Equals(ApiSecurityDefinition other) { + public bool Equals(ApiSecurityDefinitionResource other) { if (ReferenceEquals(other, null)) { return false; } if (ReferenceEquals(other, this)) { return true; } - if (!object.Equals(Jwt, other.Jwt)) return false; + if (ApiName != other.ApiName) return false; + if (!object.Equals(Oidc, other.Oidc)) return false; if (DefinitionCase != other.DefinitionCase) return false; return Equals(_unknownFields, other._unknownFields); } @@ -2135,7 +2187,8 @@ public bool Equals(ApiSecurityDefinition other) { [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public override int GetHashCode() { int hash = 1; - if (definitionCase_ == DefinitionOneofCase.Jwt) hash ^= Jwt.GetHashCode(); + if (ApiName.Length != 0) hash ^= ApiName.GetHashCode(); + if (definitionCase_ == DefinitionOneofCase.Oidc) hash ^= Oidc.GetHashCode(); hash ^= (int) definitionCase_; if (_unknownFields != null) { hash ^= _unknownFields.GetHashCode(); @@ -2153,9 +2206,13 @@ public void WriteTo(pb::CodedOutputStream output) { #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE output.WriteRawMessage(this); #else - if (definitionCase_ == DefinitionOneofCase.Jwt) { + if (ApiName.Length != 0) { output.WriteRawTag(10); - output.WriteMessage(Jwt); + output.WriteString(ApiName); + } + if (definitionCase_ == DefinitionOneofCase.Oidc) { + output.WriteRawTag(18); + output.WriteMessage(Oidc); } if (_unknownFields != null) { _unknownFields.WriteTo(output); @@ -2166,9 +2223,13 @@ public void WriteTo(pb::CodedOutputStream output) { #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE [global::System.Diagnostics.DebuggerNonUserCodeAttribute] void pb::IBufferMessage.InternalWriteTo(ref pb::WriteContext output) { - if (definitionCase_ == DefinitionOneofCase.Jwt) { + if (ApiName.Length != 0) { output.WriteRawTag(10); - output.WriteMessage(Jwt); + output.WriteString(ApiName); + } + if (definitionCase_ == DefinitionOneofCase.Oidc) { + output.WriteRawTag(18); + output.WriteMessage(Oidc); } if (_unknownFields != null) { _unknownFields.WriteTo(ref output); @@ -2179,8 +2240,11 @@ public void WriteTo(pb::CodedOutputStream output) { [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public int CalculateSize() { int size = 0; - if (definitionCase_ == DefinitionOneofCase.Jwt) { - size += 1 + pb::CodedOutputStream.ComputeMessageSize(Jwt); + if (ApiName.Length != 0) { + size += 1 + pb::CodedOutputStream.ComputeStringSize(ApiName); + } + if (definitionCase_ == DefinitionOneofCase.Oidc) { + size += 1 + pb::CodedOutputStream.ComputeMessageSize(Oidc); } if (_unknownFields != null) { size += _unknownFields.CalculateSize(); @@ -2189,16 +2253,19 @@ public int CalculateSize() { } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void MergeFrom(ApiSecurityDefinition other) { + public void MergeFrom(ApiSecurityDefinitionResource other) { if (other == null) { return; } + if (other.ApiName.Length != 0) { + ApiName = other.ApiName; + } switch (other.DefinitionCase) { - case DefinitionOneofCase.Jwt: - if (Jwt == null) { - Jwt = new global::Nitric.Proto.Resource.v1.ApiSecurityDefinitionJwt(); + case DefinitionOneofCase.Oidc: + if (Oidc == null) { + Oidc = new global::Nitric.Proto.Resources.v1.ApiOpenIdConnectionDefinition(); } - Jwt.MergeFrom(other.Jwt); + Oidc.MergeFrom(other.Oidc); break; } @@ -2217,12 +2284,16 @@ public void MergeFrom(pb::CodedInputStream input) { _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input); break; case 10: { - global::Nitric.Proto.Resource.v1.ApiSecurityDefinitionJwt subBuilder = new global::Nitric.Proto.Resource.v1.ApiSecurityDefinitionJwt(); - if (definitionCase_ == DefinitionOneofCase.Jwt) { - subBuilder.MergeFrom(Jwt); + ApiName = input.ReadString(); + break; + } + case 18: { + global::Nitric.Proto.Resources.v1.ApiOpenIdConnectionDefinition subBuilder = new global::Nitric.Proto.Resources.v1.ApiOpenIdConnectionDefinition(); + if (definitionCase_ == DefinitionOneofCase.Oidc) { + subBuilder.MergeFrom(Oidc); } input.ReadMessage(subBuilder); - Jwt = subBuilder; + Oidc = subBuilder; break; } } @@ -2240,12 +2311,16 @@ public void MergeFrom(pb::CodedInputStream input) { _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, ref input); break; case 10: { - global::Nitric.Proto.Resource.v1.ApiSecurityDefinitionJwt subBuilder = new global::Nitric.Proto.Resource.v1.ApiSecurityDefinitionJwt(); - if (definitionCase_ == DefinitionOneofCase.Jwt) { - subBuilder.MergeFrom(Jwt); + ApiName = input.ReadString(); + break; + } + case 18: { + global::Nitric.Proto.Resources.v1.ApiOpenIdConnectionDefinition subBuilder = new global::Nitric.Proto.Resources.v1.ApiOpenIdConnectionDefinition(); + if (definitionCase_ == DefinitionOneofCase.Oidc) { + subBuilder.MergeFrom(Oidc); } input.ReadMessage(subBuilder); - Jwt = subBuilder; + Oidc = subBuilder; break; } } @@ -2267,7 +2342,7 @@ public sealed partial class ApiScopes : pb::IMessage [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public static pbr::MessageDescriptor Descriptor { - get { return global::Nitric.Proto.Resource.v1.ResourceReflection.Descriptor.MessageTypes[10]; } + get { return global::Nitric.Proto.Resources.v1.ResourcesReflection.Descriptor.MessageTypes[10]; } } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] @@ -2428,7 +2503,7 @@ public sealed partial class ApiResource : pb::IMessage [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public static pbr::MessageDescriptor Descriptor { - get { return global::Nitric.Proto.Resource.v1.ResourceReflection.Descriptor.MessageTypes[11]; } + get { return global::Nitric.Proto.Resources.v1.ResourcesReflection.Descriptor.MessageTypes[11]; } } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] @@ -2445,7 +2520,6 @@ public ApiResource() { [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public ApiResource(ApiResource other) : this() { - securityDefinitions_ = other.securityDefinitions_.Clone(); security_ = other.security_.Clone(); _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields); } @@ -2455,30 +2529,17 @@ public ApiResource Clone() { return new ApiResource(this); } - /// Field number for the "security_definitions" field. - public const int SecurityDefinitionsFieldNumber = 1; - private static readonly pbc::MapField.Codec _map_securityDefinitions_codec - = new pbc::MapField.Codec(pb::FieldCodec.ForString(10, ""), pb::FieldCodec.ForMessage(18, global::Nitric.Proto.Resource.v1.ApiSecurityDefinition.Parser), 10); - private readonly pbc::MapField securityDefinitions_ = new pbc::MapField(); - /// - /// Security definitions for the api - /// These may be used by registered routes and operations on the API - /// - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public pbc::MapField SecurityDefinitions { - get { return securityDefinitions_; } - } - /// Field number for the "security" field. - public const int SecurityFieldNumber = 2; - private static readonly pbc::MapField.Codec _map_security_codec - = new pbc::MapField.Codec(pb::FieldCodec.ForString(10, ""), pb::FieldCodec.ForMessage(18, global::Nitric.Proto.Resource.v1.ApiScopes.Parser), 18); - private readonly pbc::MapField security_ = new pbc::MapField(); + public const int SecurityFieldNumber = 1; + private static readonly pbc::MapField.Codec _map_security_codec + = new pbc::MapField.Codec(pb::FieldCodec.ForString(10, ""), pb::FieldCodec.ForMessage(18, global::Nitric.Proto.Resources.v1.ApiScopes.Parser), 10); + private readonly pbc::MapField security_ = new pbc::MapField(); /// - /// root level security for this api + /// root level security map for this api + /// references ApiSecurityDefinitionResource(s) /// [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public pbc::MapField Security { + public pbc::MapField Security { get { return security_; } } @@ -2495,7 +2556,6 @@ public bool Equals(ApiResource other) { if (ReferenceEquals(other, this)) { return true; } - if (!SecurityDefinitions.Equals(other.SecurityDefinitions)) return false; if (!Security.Equals(other.Security)) return false; return Equals(_unknownFields, other._unknownFields); } @@ -2503,7 +2563,6 @@ public bool Equals(ApiResource other) { [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public override int GetHashCode() { int hash = 1; - hash ^= SecurityDefinitions.GetHashCode(); hash ^= Security.GetHashCode(); if (_unknownFields != null) { hash ^= _unknownFields.GetHashCode(); @@ -2521,7 +2580,6 @@ public void WriteTo(pb::CodedOutputStream output) { #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE output.WriteRawMessage(this); #else - securityDefinitions_.WriteTo(output, _map_securityDefinitions_codec); security_.WriteTo(output, _map_security_codec); if (_unknownFields != null) { _unknownFields.WriteTo(output); @@ -2532,7 +2590,6 @@ public void WriteTo(pb::CodedOutputStream output) { #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE [global::System.Diagnostics.DebuggerNonUserCodeAttribute] void pb::IBufferMessage.InternalWriteTo(ref pb::WriteContext output) { - securityDefinitions_.WriteTo(ref output, _map_securityDefinitions_codec); security_.WriteTo(ref output, _map_security_codec); if (_unknownFields != null) { _unknownFields.WriteTo(ref output); @@ -2543,7 +2600,6 @@ public void WriteTo(pb::CodedOutputStream output) { [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public int CalculateSize() { int size = 0; - size += securityDefinitions_.CalculateSize(_map_securityDefinitions_codec); size += security_.CalculateSize(_map_security_codec); if (_unknownFields != null) { size += _unknownFields.CalculateSize(); @@ -2556,7 +2612,6 @@ public void MergeFrom(ApiResource other) { if (other == null) { return; } - securityDefinitions_.Add(other.securityDefinitions_); security_.Add(other.security_); _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields); } @@ -2573,10 +2628,6 @@ public void MergeFrom(pb::CodedInputStream input) { _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input); break; case 10: { - securityDefinitions_.AddEntriesFrom(input, _map_securityDefinitions_codec); - break; - } - case 18: { security_.AddEntriesFrom(input, _map_security_codec); break; } @@ -2595,10 +2646,6 @@ public void MergeFrom(pb::CodedInputStream input) { _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, ref input); break; case 10: { - securityDefinitions_.AddEntriesFrom(ref input, _map_securityDefinitions_codec); - break; - } - case 18: { security_.AddEntriesFrom(ref input, _map_security_codec); break; } @@ -2621,7 +2668,7 @@ public sealed partial class ResourceDeclareResponse : pb::IMessage - #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE - , pb::IBufferMessage - #endif - { - private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new ApiResourceDetails()); - private pb::UnknownFieldSet _unknownFields; - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public static pb::MessageParser Parser { get { return _parser; } } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public static pbr::MessageDescriptor Descriptor { - get { return global::Nitric.Proto.Resource.v1.ResourceReflection.Descriptor.MessageTypes[13]; } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - pbr::MessageDescriptor pb::IMessage.Descriptor { - get { return Descriptor; } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public ApiResourceDetails() { - OnConstruction(); - } - - partial void OnConstruction(); - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public ApiResourceDetails(ApiResourceDetails other) : this() { - url_ = other.url_; - _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public ApiResourceDetails Clone() { - return new ApiResourceDetails(this); - } - - /// Field number for the "url" field. - public const int UrlFieldNumber = 1; - private string url_ = ""; - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public string Url { - get { return url_; } - set { - url_ = pb::ProtoPreconditions.CheckNotNull(value, "value"); - } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public override bool Equals(object other) { - return Equals(other as ApiResourceDetails); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public bool Equals(ApiResourceDetails other) { - if (ReferenceEquals(other, null)) { - return false; - } - if (ReferenceEquals(other, this)) { - return true; - } - if (Url != other.Url) return false; - return Equals(_unknownFields, other._unknownFields); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public override int GetHashCode() { - int hash = 1; - if (Url.Length != 0) hash ^= Url.GetHashCode(); - if (_unknownFields != null) { - hash ^= _unknownFields.GetHashCode(); - } - return hash; - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public override string ToString() { - return pb::JsonFormatter.ToDiagnosticString(this); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void WriteTo(pb::CodedOutputStream output) { - #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE - output.WriteRawMessage(this); - #else - if (Url.Length != 0) { - output.WriteRawTag(10); - output.WriteString(Url); - } - if (_unknownFields != null) { - _unknownFields.WriteTo(output); - } - #endif - } - - #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - void pb::IBufferMessage.InternalWriteTo(ref pb::WriteContext output) { - if (Url.Length != 0) { - output.WriteRawTag(10); - output.WriteString(Url); - } - if (_unknownFields != null) { - _unknownFields.WriteTo(ref output); - } - } - #endif - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public int CalculateSize() { - int size = 0; - if (Url.Length != 0) { - size += 1 + pb::CodedOutputStream.ComputeStringSize(Url); - } - if (_unknownFields != null) { - size += _unknownFields.CalculateSize(); - } - return size; - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void MergeFrom(ApiResourceDetails other) { - if (other == null) { - return; - } - if (other.Url.Length != 0) { - Url = other.Url; - } - _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void MergeFrom(pb::CodedInputStream input) { - #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE - input.ReadRawMessage(this); - #else - uint tag; - while ((tag = input.ReadTag()) != 0) { - switch(tag) { - default: - _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input); - break; - case 10: { - Url = input.ReadString(); - break; - } - } - } - #endif - } - - #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - void pb::IBufferMessage.InternalMergeFrom(ref pb::ParseContext input) { - uint tag; - while ((tag = input.ReadTag()) != 0) { - switch(tag) { - default: - _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, ref input); - break; - case 10: { - Url = input.ReadString(); - break; - } - } - } - } - #endif - - } - - public sealed partial class WebsocketResourceDetails : pb::IMessage - #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE - , pb::IBufferMessage - #endif - { - private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new WebsocketResourceDetails()); - private pb::UnknownFieldSet _unknownFields; - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public static pb::MessageParser Parser { get { return _parser; } } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public static pbr::MessageDescriptor Descriptor { - get { return global::Nitric.Proto.Resource.v1.ResourceReflection.Descriptor.MessageTypes[14]; } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - pbr::MessageDescriptor pb::IMessage.Descriptor { - get { return Descriptor; } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public WebsocketResourceDetails() { - OnConstruction(); - } - - partial void OnConstruction(); - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public WebsocketResourceDetails(WebsocketResourceDetails other) : this() { - url_ = other.url_; - _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public WebsocketResourceDetails Clone() { - return new WebsocketResourceDetails(this); - } - - /// Field number for the "url" field. - public const int UrlFieldNumber = 1; - private string url_ = ""; - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public string Url { - get { return url_; } - set { - url_ = pb::ProtoPreconditions.CheckNotNull(value, "value"); - } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public override bool Equals(object other) { - return Equals(other as WebsocketResourceDetails); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public bool Equals(WebsocketResourceDetails other) { - if (ReferenceEquals(other, null)) { - return false; - } - if (ReferenceEquals(other, this)) { - return true; - } - if (Url != other.Url) return false; - return Equals(_unknownFields, other._unknownFields); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public override int GetHashCode() { - int hash = 1; - if (Url.Length != 0) hash ^= Url.GetHashCode(); - if (_unknownFields != null) { - hash ^= _unknownFields.GetHashCode(); - } - return hash; - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public override string ToString() { - return pb::JsonFormatter.ToDiagnosticString(this); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void WriteTo(pb::CodedOutputStream output) { - #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE - output.WriteRawMessage(this); - #else - if (Url.Length != 0) { - output.WriteRawTag(10); - output.WriteString(Url); - } - if (_unknownFields != null) { - _unknownFields.WriteTo(output); - } - #endif - } - - #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - void pb::IBufferMessage.InternalWriteTo(ref pb::WriteContext output) { - if (Url.Length != 0) { - output.WriteRawTag(10); - output.WriteString(Url); - } - if (_unknownFields != null) { - _unknownFields.WriteTo(ref output); - } - } - #endif - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public int CalculateSize() { - int size = 0; - if (Url.Length != 0) { - size += 1 + pb::CodedOutputStream.ComputeStringSize(Url); - } - if (_unknownFields != null) { - size += _unknownFields.CalculateSize(); - } - return size; - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void MergeFrom(WebsocketResourceDetails other) { - if (other == null) { - return; - } - if (other.Url.Length != 0) { - Url = other.Url; - } - _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void MergeFrom(pb::CodedInputStream input) { - #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE - input.ReadRawMessage(this); - #else - uint tag; - while ((tag = input.ReadTag()) != 0) { - switch(tag) { - default: - _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input); - break; - case 10: { - Url = input.ReadString(); - break; - } - } - } - #endif - } - - #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - void pb::IBufferMessage.InternalMergeFrom(ref pb::ParseContext input) { - uint tag; - while ((tag = input.ReadTag()) != 0) { - switch(tag) { - default: - _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, ref input); - break; - case 10: { - Url = input.ReadString(); - break; - } - } - } - } - #endif - - } - - public sealed partial class ResourceDetailsRequest : pb::IMessage - #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE - , pb::IBufferMessage - #endif - { - private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new ResourceDetailsRequest()); - private pb::UnknownFieldSet _unknownFields; - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public static pb::MessageParser Parser { get { return _parser; } } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public static pbr::MessageDescriptor Descriptor { - get { return global::Nitric.Proto.Resource.v1.ResourceReflection.Descriptor.MessageTypes[15]; } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - pbr::MessageDescriptor pb::IMessage.Descriptor { - get { return Descriptor; } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public ResourceDetailsRequest() { - OnConstruction(); - } - - partial void OnConstruction(); - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public ResourceDetailsRequest(ResourceDetailsRequest other) : this() { - resource_ = other.resource_ != null ? other.resource_.Clone() : null; - _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public ResourceDetailsRequest Clone() { - return new ResourceDetailsRequest(this); - } - - /// Field number for the "resource" field. - public const int ResourceFieldNumber = 1; - private global::Nitric.Proto.Resource.v1.Resource resource_; - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public global::Nitric.Proto.Resource.v1.Resource Resource { - get { return resource_; } - set { - resource_ = value; - } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public override bool Equals(object other) { - return Equals(other as ResourceDetailsRequest); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public bool Equals(ResourceDetailsRequest other) { - if (ReferenceEquals(other, null)) { - return false; - } - if (ReferenceEquals(other, this)) { - return true; - } - if (!object.Equals(Resource, other.Resource)) return false; - return Equals(_unknownFields, other._unknownFields); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public override int GetHashCode() { - int hash = 1; - if (resource_ != null) hash ^= Resource.GetHashCode(); - if (_unknownFields != null) { - hash ^= _unknownFields.GetHashCode(); - } - return hash; - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public override string ToString() { - return pb::JsonFormatter.ToDiagnosticString(this); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void WriteTo(pb::CodedOutputStream output) { - #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE - output.WriteRawMessage(this); - #else - if (resource_ != null) { - output.WriteRawTag(10); - output.WriteMessage(Resource); - } - if (_unknownFields != null) { - _unknownFields.WriteTo(output); - } - #endif - } - - #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - void pb::IBufferMessage.InternalWriteTo(ref pb::WriteContext output) { - if (resource_ != null) { - output.WriteRawTag(10); - output.WriteMessage(Resource); - } - if (_unknownFields != null) { - _unknownFields.WriteTo(ref output); - } - } - #endif - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public int CalculateSize() { - int size = 0; - if (resource_ != null) { - size += 1 + pb::CodedOutputStream.ComputeMessageSize(Resource); - } - if (_unknownFields != null) { - size += _unknownFields.CalculateSize(); - } - return size; - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void MergeFrom(ResourceDetailsRequest other) { - if (other == null) { - return; - } - if (other.resource_ != null) { - if (resource_ == null) { - Resource = new global::Nitric.Proto.Resource.v1.Resource(); - } - Resource.MergeFrom(other.Resource); - } - _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void MergeFrom(pb::CodedInputStream input) { - #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE - input.ReadRawMessage(this); - #else - uint tag; - while ((tag = input.ReadTag()) != 0) { - switch(tag) { - default: - _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input); - break; - case 10: { - if (resource_ == null) { - Resource = new global::Nitric.Proto.Resource.v1.Resource(); - } - input.ReadMessage(Resource); - break; - } - } - } - #endif - } - - #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - void pb::IBufferMessage.InternalMergeFrom(ref pb::ParseContext input) { - uint tag; - while ((tag = input.ReadTag()) != 0) { - switch(tag) { - default: - _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, ref input); - break; - case 10: { - if (resource_ == null) { - Resource = new global::Nitric.Proto.Resource.v1.Resource(); - } - input.ReadMessage(Resource); - break; - } - } - } - } - #endif - - } - - public sealed partial class ResourceDetailsResponse : pb::IMessage - #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE - , pb::IBufferMessage - #endif - { - private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new ResourceDetailsResponse()); - private pb::UnknownFieldSet _unknownFields; - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public static pb::MessageParser Parser { get { return _parser; } } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public static pbr::MessageDescriptor Descriptor { - get { return global::Nitric.Proto.Resource.v1.ResourceReflection.Descriptor.MessageTypes[16]; } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - pbr::MessageDescriptor pb::IMessage.Descriptor { - get { return Descriptor; } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public ResourceDetailsResponse() { - OnConstruction(); - } - - partial void OnConstruction(); - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public ResourceDetailsResponse(ResourceDetailsResponse other) : this() { - id_ = other.id_; - provider_ = other.provider_; - service_ = other.service_; - switch (other.DetailsCase) { - case DetailsOneofCase.Api: - Api = other.Api.Clone(); - break; - case DetailsOneofCase.Websocket: - Websocket = other.Websocket.Clone(); - break; - } - - _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public ResourceDetailsResponse Clone() { - return new ResourceDetailsResponse(this); - } - - /// Field number for the "id" field. - public const int IdFieldNumber = 1; - private string id_ = ""; - /// - /// The identifier of the resource - /// - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public string Id { - get { return id_; } - set { - id_ = pb::ProtoPreconditions.CheckNotNull(value, "value"); - } - } - - /// Field number for the "provider" field. - public const int ProviderFieldNumber = 2; - private string provider_ = ""; - /// - /// The provider this resource is deployed with (e.g. aws) - /// - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public string Provider { - get { return provider_; } - set { - provider_ = pb::ProtoPreconditions.CheckNotNull(value, "value"); - } - } - - /// Field number for the "service" field. - public const int ServiceFieldNumber = 3; - private string service_ = ""; - /// - /// The service this resource is deployed on (e.g. ApiGateway) - /// - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public string Service { - get { return service_; } - set { - service_ = pb::ProtoPreconditions.CheckNotNull(value, "value"); - } - } - - /// Field number for the "api" field. - public const int ApiFieldNumber = 10; - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public global::Nitric.Proto.Resource.v1.ApiResourceDetails Api { - get { return detailsCase_ == DetailsOneofCase.Api ? (global::Nitric.Proto.Resource.v1.ApiResourceDetails) details_ : null; } - set { - details_ = value; - detailsCase_ = value == null ? DetailsOneofCase.None : DetailsOneofCase.Api; - } - } - - /// Field number for the "websocket" field. - public const int WebsocketFieldNumber = 11; - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public global::Nitric.Proto.Resource.v1.WebsocketResourceDetails Websocket { - get { return detailsCase_ == DetailsOneofCase.Websocket ? (global::Nitric.Proto.Resource.v1.WebsocketResourceDetails) details_ : null; } - set { - details_ = value; - detailsCase_ = value == null ? DetailsOneofCase.None : DetailsOneofCase.Websocket; - } - } - - private object details_; - /// Enum of possible cases for the "details" oneof. - public enum DetailsOneofCase { - None = 0, - Api = 10, - Websocket = 11, - } - private DetailsOneofCase detailsCase_ = DetailsOneofCase.None; - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public DetailsOneofCase DetailsCase { - get { return detailsCase_; } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void ClearDetails() { - detailsCase_ = DetailsOneofCase.None; - details_ = null; - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public override bool Equals(object other) { - return Equals(other as ResourceDetailsResponse); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public bool Equals(ResourceDetailsResponse other) { - if (ReferenceEquals(other, null)) { - return false; - } - if (ReferenceEquals(other, this)) { - return true; - } - if (Id != other.Id) return false; - if (Provider != other.Provider) return false; - if (Service != other.Service) return false; - if (!object.Equals(Api, other.Api)) return false; - if (!object.Equals(Websocket, other.Websocket)) return false; - if (DetailsCase != other.DetailsCase) return false; - return Equals(_unknownFields, other._unknownFields); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public override int GetHashCode() { - int hash = 1; - if (Id.Length != 0) hash ^= Id.GetHashCode(); - if (Provider.Length != 0) hash ^= Provider.GetHashCode(); - if (Service.Length != 0) hash ^= Service.GetHashCode(); - if (detailsCase_ == DetailsOneofCase.Api) hash ^= Api.GetHashCode(); - if (detailsCase_ == DetailsOneofCase.Websocket) hash ^= Websocket.GetHashCode(); - hash ^= (int) detailsCase_; - if (_unknownFields != null) { - hash ^= _unknownFields.GetHashCode(); - } - return hash; - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public override string ToString() { - return pb::JsonFormatter.ToDiagnosticString(this); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void WriteTo(pb::CodedOutputStream output) { - #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE - output.WriteRawMessage(this); - #else - if (Id.Length != 0) { - output.WriteRawTag(10); - output.WriteString(Id); - } - if (Provider.Length != 0) { - output.WriteRawTag(18); - output.WriteString(Provider); - } - if (Service.Length != 0) { - output.WriteRawTag(26); - output.WriteString(Service); - } - if (detailsCase_ == DetailsOneofCase.Api) { - output.WriteRawTag(82); - output.WriteMessage(Api); - } - if (detailsCase_ == DetailsOneofCase.Websocket) { - output.WriteRawTag(90); - output.WriteMessage(Websocket); - } - if (_unknownFields != null) { - _unknownFields.WriteTo(output); - } - #endif - } - - #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - void pb::IBufferMessage.InternalWriteTo(ref pb::WriteContext output) { - if (Id.Length != 0) { - output.WriteRawTag(10); - output.WriteString(Id); - } - if (Provider.Length != 0) { - output.WriteRawTag(18); - output.WriteString(Provider); - } - if (Service.Length != 0) { - output.WriteRawTag(26); - output.WriteString(Service); - } - if (detailsCase_ == DetailsOneofCase.Api) { - output.WriteRawTag(82); - output.WriteMessage(Api); - } - if (detailsCase_ == DetailsOneofCase.Websocket) { - output.WriteRawTag(90); - output.WriteMessage(Websocket); - } - if (_unknownFields != null) { - _unknownFields.WriteTo(ref output); - } - } - #endif - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public int CalculateSize() { - int size = 0; - if (Id.Length != 0) { - size += 1 + pb::CodedOutputStream.ComputeStringSize(Id); - } - if (Provider.Length != 0) { - size += 1 + pb::CodedOutputStream.ComputeStringSize(Provider); - } - if (Service.Length != 0) { - size += 1 + pb::CodedOutputStream.ComputeStringSize(Service); - } - if (detailsCase_ == DetailsOneofCase.Api) { - size += 1 + pb::CodedOutputStream.ComputeMessageSize(Api); - } - if (detailsCase_ == DetailsOneofCase.Websocket) { - size += 1 + pb::CodedOutputStream.ComputeMessageSize(Websocket); - } - if (_unknownFields != null) { - size += _unknownFields.CalculateSize(); - } - return size; - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void MergeFrom(ResourceDetailsResponse other) { - if (other == null) { - return; - } - if (other.Id.Length != 0) { - Id = other.Id; - } - if (other.Provider.Length != 0) { - Provider = other.Provider; - } - if (other.Service.Length != 0) { - Service = other.Service; - } - switch (other.DetailsCase) { - case DetailsOneofCase.Api: - if (Api == null) { - Api = new global::Nitric.Proto.Resource.v1.ApiResourceDetails(); - } - Api.MergeFrom(other.Api); - break; - case DetailsOneofCase.Websocket: - if (Websocket == null) { - Websocket = new global::Nitric.Proto.Resource.v1.WebsocketResourceDetails(); - } - Websocket.MergeFrom(other.Websocket); - break; - } - - _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void MergeFrom(pb::CodedInputStream input) { - #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE - input.ReadRawMessage(this); - #else - uint tag; - while ((tag = input.ReadTag()) != 0) { - switch(tag) { - default: - _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input); - break; - case 10: { - Id = input.ReadString(); - break; - } - case 18: { - Provider = input.ReadString(); - break; - } - case 26: { - Service = input.ReadString(); - break; - } - case 82: { - global::Nitric.Proto.Resource.v1.ApiResourceDetails subBuilder = new global::Nitric.Proto.Resource.v1.ApiResourceDetails(); - if (detailsCase_ == DetailsOneofCase.Api) { - subBuilder.MergeFrom(Api); - } - input.ReadMessage(subBuilder); - Api = subBuilder; - break; - } - case 90: { - global::Nitric.Proto.Resource.v1.WebsocketResourceDetails subBuilder = new global::Nitric.Proto.Resource.v1.WebsocketResourceDetails(); - if (detailsCase_ == DetailsOneofCase.Websocket) { - subBuilder.MergeFrom(Websocket); - } - input.ReadMessage(subBuilder); - Websocket = subBuilder; - break; - } - } - } - #endif - } - - #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - void pb::IBufferMessage.InternalMergeFrom(ref pb::ParseContext input) { - uint tag; - while ((tag = input.ReadTag()) != 0) { - switch(tag) { - default: - _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, ref input); - break; - case 10: { - Id = input.ReadString(); - break; - } - case 18: { - Provider = input.ReadString(); - break; - } - case 26: { - Service = input.ReadString(); - break; - } - case 82: { - global::Nitric.Proto.Resource.v1.ApiResourceDetails subBuilder = new global::Nitric.Proto.Resource.v1.ApiResourceDetails(); - if (detailsCase_ == DetailsOneofCase.Api) { - subBuilder.MergeFrom(Api); - } - input.ReadMessage(subBuilder); - Api = subBuilder; - break; - } - case 90: { - global::Nitric.Proto.Resource.v1.WebsocketResourceDetails subBuilder = new global::Nitric.Proto.Resource.v1.WebsocketResourceDetails(); - if (detailsCase_ == DetailsOneofCase.Websocket) { - subBuilder.MergeFrom(Websocket); - } - input.ReadMessage(subBuilder); - Websocket = subBuilder; - break; - } - } - } - } - #endif - - } - #endregion } diff --git a/src/Nitric.Sdk/Proto/nitric/proto/resources/v1/ResourcesGrpc.cs b/src/Nitric.Sdk/Proto/nitric/proto/resources/v1/ResourcesGrpc.cs new file mode 100644 index 0000000..c3abb6d --- /dev/null +++ b/src/Nitric.Sdk/Proto/nitric/proto/resources/v1/ResourcesGrpc.cs @@ -0,0 +1,185 @@ +// +// Generated by the protocol buffer compiler. DO NOT EDIT! +// source: nitric/proto/resources/v1/resources.proto +// +#pragma warning disable 0414, 1591 +#region Designer generated code + +using grpc = global::Grpc.Core; + +namespace Nitric.Proto.Resources.v1 { + /// + /// Nitric Resource Service + /// The service definition exists to allow a nitric application to declare peripheral dependencies + /// + public static partial class Resources + { + static readonly string __ServiceName = "nitric.proto.resources.v1.Resources"; + + static void __Helper_SerializeMessage(global::Google.Protobuf.IMessage message, grpc::SerializationContext context) + { + #if !GRPC_DISABLE_PROTOBUF_BUFFER_SERIALIZATION + if (message is global::Google.Protobuf.IBufferMessage) + { + context.SetPayloadLength(message.CalculateSize()); + global::Google.Protobuf.MessageExtensions.WriteTo(message, context.GetBufferWriter()); + context.Complete(); + return; + } + #endif + context.Complete(global::Google.Protobuf.MessageExtensions.ToByteArray(message)); + } + + static class __Helper_MessageCache + { + public static readonly bool IsBufferMessage = global::System.Reflection.IntrospectionExtensions.GetTypeInfo(typeof(global::Google.Protobuf.IBufferMessage)).IsAssignableFrom(typeof(T)); + } + + static T __Helper_DeserializeMessage(grpc::DeserializationContext context, global::Google.Protobuf.MessageParser parser) where T : global::Google.Protobuf.IMessage + { + #if !GRPC_DISABLE_PROTOBUF_BUFFER_SERIALIZATION + if (__Helper_MessageCache.IsBufferMessage) + { + return parser.ParseFrom(context.PayloadAsReadOnlySequence()); + } + #endif + return parser.ParseFrom(context.PayloadAsNewBuffer()); + } + + static readonly grpc::Marshaller __Marshaller_nitric_proto_resources_v1_ResourceDeclareRequest = grpc::Marshallers.Create(__Helper_SerializeMessage, context => __Helper_DeserializeMessage(context, global::Nitric.Proto.Resources.v1.ResourceDeclareRequest.Parser)); + static readonly grpc::Marshaller __Marshaller_nitric_proto_resources_v1_ResourceDeclareResponse = grpc::Marshallers.Create(__Helper_SerializeMessage, context => __Helper_DeserializeMessage(context, global::Nitric.Proto.Resources.v1.ResourceDeclareResponse.Parser)); + + static readonly grpc::Method __Method_Declare = new grpc::Method( + grpc::MethodType.Unary, + __ServiceName, + "Declare", + __Marshaller_nitric_proto_resources_v1_ResourceDeclareRequest, + __Marshaller_nitric_proto_resources_v1_ResourceDeclareResponse); + + /// Service descriptor + public static global::Google.Protobuf.Reflection.ServiceDescriptor Descriptor + { + get { return global::Nitric.Proto.Resources.v1.ResourcesReflection.Descriptor.Services[0]; } + } + + /// Base class for server-side implementations of Resources + [grpc::BindServiceMethod(typeof(Resources), "BindService")] + public abstract partial class ResourcesBase + { + /// + /// Declare a resource for the nitric application + /// At Deploy time this will create resources as part of the nitric stacks dependency graph + /// At runtime + /// + /// The request received from the client. + /// The context of the server-side call handler being invoked. + /// The response to send back to the client (wrapped by a task). + public virtual global::System.Threading.Tasks.Task Declare(global::Nitric.Proto.Resources.v1.ResourceDeclareRequest request, grpc::ServerCallContext context) + { + throw new grpc::RpcException(new grpc::Status(grpc::StatusCode.Unimplemented, "")); + } + + } + + /// Client for Resources + public partial class ResourcesClient : grpc::ClientBase + { + /// Creates a new client for Resources + /// The channel to use to make remote calls. + public ResourcesClient(grpc::ChannelBase channel) : base(channel) + { + } + /// Creates a new client for Resources that uses a custom CallInvoker. + /// The callInvoker to use to make remote calls. + public ResourcesClient(grpc::CallInvoker callInvoker) : base(callInvoker) + { + } + /// Protected parameterless constructor to allow creation of test doubles. + protected ResourcesClient() : base() + { + } + /// Protected constructor to allow creation of configured clients. + /// The client configuration. + protected ResourcesClient(ClientBaseConfiguration configuration) : base(configuration) + { + } + + /// + /// Declare a resource for the nitric application + /// At Deploy time this will create resources as part of the nitric stacks dependency graph + /// At runtime + /// + /// The request to send to the server. + /// The initial metadata to send with the call. This parameter is optional. + /// An optional deadline for the call. The call will be cancelled if deadline is hit. + /// An optional token for canceling the call. + /// The response received from the server. + public virtual global::Nitric.Proto.Resources.v1.ResourceDeclareResponse Declare(global::Nitric.Proto.Resources.v1.ResourceDeclareRequest request, grpc::Metadata headers = null, global::System.DateTime? deadline = null, global::System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken)) + { + return Declare(request, new grpc::CallOptions(headers, deadline, cancellationToken)); + } + /// + /// Declare a resource for the nitric application + /// At Deploy time this will create resources as part of the nitric stacks dependency graph + /// At runtime + /// + /// The request to send to the server. + /// The options for the call. + /// The response received from the server. + public virtual global::Nitric.Proto.Resources.v1.ResourceDeclareResponse Declare(global::Nitric.Proto.Resources.v1.ResourceDeclareRequest request, grpc::CallOptions options) + { + return CallInvoker.BlockingUnaryCall(__Method_Declare, null, options, request); + } + /// + /// Declare a resource for the nitric application + /// At Deploy time this will create resources as part of the nitric stacks dependency graph + /// At runtime + /// + /// The request to send to the server. + /// The initial metadata to send with the call. This parameter is optional. + /// An optional deadline for the call. The call will be cancelled if deadline is hit. + /// An optional token for canceling the call. + /// The call object. + public virtual grpc::AsyncUnaryCall DeclareAsync(global::Nitric.Proto.Resources.v1.ResourceDeclareRequest request, grpc::Metadata headers = null, global::System.DateTime? deadline = null, global::System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken)) + { + return DeclareAsync(request, new grpc::CallOptions(headers, deadline, cancellationToken)); + } + /// + /// Declare a resource for the nitric application + /// At Deploy time this will create resources as part of the nitric stacks dependency graph + /// At runtime + /// + /// The request to send to the server. + /// The options for the call. + /// The call object. + public virtual grpc::AsyncUnaryCall DeclareAsync(global::Nitric.Proto.Resources.v1.ResourceDeclareRequest request, grpc::CallOptions options) + { + return CallInvoker.AsyncUnaryCall(__Method_Declare, null, options, request); + } + /// Creates a new instance of client from given ClientBaseConfiguration. + protected override ResourcesClient NewInstance(ClientBaseConfiguration configuration) + { + return new ResourcesClient(configuration); + } + } + + /// Creates service definition that can be registered with a server + /// An object implementing the server-side handling logic. + public static grpc::ServerServiceDefinition BindService(ResourcesBase serviceImpl) + { + return grpc::ServerServiceDefinition.CreateBuilder() + .AddMethod(__Method_Declare, serviceImpl.Declare).Build(); + } + + /// Register service method with a service binder with or without implementation. Useful when customizing the service binding logic. + /// Note: this method is part of an experimental API that can change or be removed without any prior notice. + /// Service methods will be bound by calling AddMethod on this object. + /// An object implementing the server-side handling logic. + public static void BindService(grpc::ServiceBinderBase serviceBinder, ResourcesBase serviceImpl) + { + serviceBinder.AddMethod(__Method_Declare, serviceImpl == null ? null : new grpc::UnaryServerMethod(serviceImpl.Declare)); + } + + } +} +#endregion diff --git a/src/Nitric.Sdk/Proto/nitric/proto/schedules/v1/Schedules.cs b/src/Nitric.Sdk/Proto/nitric/proto/schedules/v1/Schedules.cs new file mode 100644 index 0000000..0f8ec57 --- /dev/null +++ b/src/Nitric.Sdk/Proto/nitric/proto/schedules/v1/Schedules.cs @@ -0,0 +1,1955 @@ +// +// Generated by the protocol buffer compiler. DO NOT EDIT! +// source: nitric/proto/schedules/v1/schedules.proto +// +#pragma warning disable 1591, 0612, 3021 +#region Designer generated code + +using pb = global::Google.Protobuf; +using pbc = global::Google.Protobuf.Collections; +using pbr = global::Google.Protobuf.Reflection; +using scg = global::System.Collections.Generic; +namespace Nitric.Proto.Schedules.v1 { + + /// Holder for reflection information generated from nitric/proto/schedules/v1/schedules.proto + public static partial class SchedulesReflection { + + #region Descriptor + /// File descriptor for nitric/proto/schedules/v1/schedules.proto + public static pbr::FileDescriptor Descriptor { + get { return descriptor; } + } + private static pbr::FileDescriptor descriptor; + + static SchedulesReflection() { + byte[] descriptorData = global::System.Convert.FromBase64String( + string.Concat( + "CiluaXRyaWMvcHJvdG8vc2NoZWR1bGVzL3YxL3NjaGVkdWxlcy5wcm90bxIZ", + "bml0cmljLnByb3RvLnNjaGVkdWxlcy52MSLAAQoNQ2xpZW50TWVzc2FnZRIK", + "CgJpZBgBIAEoCRJOChRyZWdpc3RyYXRpb25fcmVxdWVzdBgCIAEoCzIuLm5p", + "dHJpYy5wcm90by5zY2hlZHVsZXMudjEuUmVnaXN0cmF0aW9uUmVxdWVzdEgA", + "EkgKEWludGVydmFsX3Jlc3BvbnNlGAMgASgLMisubml0cmljLnByb3RvLnNj", + "aGVkdWxlcy52MS5JbnRlcnZhbFJlc3BvbnNlSABCCQoHY29udGVudCIoCg9J", + "bnRlcnZhbFJlcXVlc3QSFQoNc2NoZWR1bGVfbmFtZRgBIAEoCSIiCg9NZXNz", + "YWdlUmVzcG9uc2USDwoHc3VjY2VzcxgBIAEoCCLAAQoNU2VydmVyTWVzc2Fn", + "ZRIKCgJpZBgBIAEoCRJQChVyZWdpc3RyYXRpb25fcmVzcG9uc2UYAiABKAsy", + "Ly5uaXRyaWMucHJvdG8uc2NoZWR1bGVzLnYxLlJlZ2lzdHJhdGlvblJlc3Bv", + "bnNlSAASRgoQaW50ZXJ2YWxfcmVxdWVzdBgDIAEoCzIqLm5pdHJpYy5wcm90", + "by5zY2hlZHVsZXMudjEuSW50ZXJ2YWxSZXF1ZXN0SABCCQoHY29udGVudCKr", + "AQoTUmVnaXN0cmF0aW9uUmVxdWVzdBIVCg1zY2hlZHVsZV9uYW1lGAEgASgJ", + "EjkKBWV2ZXJ5GAogASgLMigubml0cmljLnByb3RvLnNjaGVkdWxlcy52MS5T", + "Y2hlZHVsZUV2ZXJ5SAASNwoEY3JvbhgLIAEoCzInLm5pdHJpYy5wcm90by5z", + "Y2hlZHVsZXMudjEuU2NoZWR1bGVDcm9uSABCCQoHY2FkZW5jZSIdCg1TY2hl", + "ZHVsZUV2ZXJ5EgwKBHJhdGUYASABKAkiIgoMU2NoZWR1bGVDcm9uEhIKCmV4", + "cHJlc3Npb24YASABKAkiFgoUUmVnaXN0cmF0aW9uUmVzcG9uc2UiEgoQSW50", + "ZXJ2YWxSZXNwb25zZTJvCglTY2hlZHVsZXMSYgoIU2NoZWR1bGUSKC5uaXRy", + "aWMucHJvdG8uc2NoZWR1bGVzLnYxLkNsaWVudE1lc3NhZ2UaKC5uaXRyaWMu", + "cHJvdG8uc2NoZWR1bGVzLnYxLlNlcnZlck1lc3NhZ2UoATABQrABChxpby5u", + "aXRyaWMucHJvdG8uc2NoZWR1bGVzLnYxQhBTY2hlZHVsZXNTZXJ2aWNlUAFa", + "RGdpdGh1Yi5jb20vbml0cmljdGVjaC9uaXRyaWMvY29yZS9wa2cvcHJvdG8v", + "c2NoZWR1bGVzL3YxO3NjaGVkdWxlc3BiqgIZTml0cmljLlByb3RvLlNjaGVk", + "dWxlcy52McoCGU5pdHJpY1xQcm90b1xTY2hlZHVsZXNcVjFiBnByb3RvMw==")); + descriptor = pbr::FileDescriptor.FromGeneratedCode(descriptorData, + new pbr::FileDescriptor[] { }, + new pbr::GeneratedClrTypeInfo(null, null, new pbr::GeneratedClrTypeInfo[] { + new pbr::GeneratedClrTypeInfo(typeof(global::Nitric.Proto.Schedules.v1.ClientMessage), global::Nitric.Proto.Schedules.v1.ClientMessage.Parser, new[]{ "Id", "RegistrationRequest", "IntervalResponse" }, new[]{ "Content" }, null, null, null), + new pbr::GeneratedClrTypeInfo(typeof(global::Nitric.Proto.Schedules.v1.IntervalRequest), global::Nitric.Proto.Schedules.v1.IntervalRequest.Parser, new[]{ "ScheduleName" }, null, null, null, null), + new pbr::GeneratedClrTypeInfo(typeof(global::Nitric.Proto.Schedules.v1.MessageResponse), global::Nitric.Proto.Schedules.v1.MessageResponse.Parser, new[]{ "Success" }, null, null, null, null), + new pbr::GeneratedClrTypeInfo(typeof(global::Nitric.Proto.Schedules.v1.ServerMessage), global::Nitric.Proto.Schedules.v1.ServerMessage.Parser, new[]{ "Id", "RegistrationResponse", "IntervalRequest" }, new[]{ "Content" }, null, null, null), + new pbr::GeneratedClrTypeInfo(typeof(global::Nitric.Proto.Schedules.v1.RegistrationRequest), global::Nitric.Proto.Schedules.v1.RegistrationRequest.Parser, new[]{ "ScheduleName", "Every", "Cron" }, new[]{ "Cadence" }, null, null, null), + new pbr::GeneratedClrTypeInfo(typeof(global::Nitric.Proto.Schedules.v1.ScheduleEvery), global::Nitric.Proto.Schedules.v1.ScheduleEvery.Parser, new[]{ "Rate" }, null, null, null, null), + new pbr::GeneratedClrTypeInfo(typeof(global::Nitric.Proto.Schedules.v1.ScheduleCron), global::Nitric.Proto.Schedules.v1.ScheduleCron.Parser, new[]{ "Expression" }, null, null, null, null), + new pbr::GeneratedClrTypeInfo(typeof(global::Nitric.Proto.Schedules.v1.RegistrationResponse), global::Nitric.Proto.Schedules.v1.RegistrationResponse.Parser, null, null, null, null, null), + new pbr::GeneratedClrTypeInfo(typeof(global::Nitric.Proto.Schedules.v1.IntervalResponse), global::Nitric.Proto.Schedules.v1.IntervalResponse.Parser, null, null, null, null, null) + })); + } + #endregion + + } + #region Messages + public sealed partial class ClientMessage : pb::IMessage + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + , pb::IBufferMessage + #endif + { + private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new ClientMessage()); + private pb::UnknownFieldSet _unknownFields; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public static pb::MessageParser Parser { get { return _parser; } } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public static pbr::MessageDescriptor Descriptor { + get { return global::Nitric.Proto.Schedules.v1.SchedulesReflection.Descriptor.MessageTypes[0]; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + pbr::MessageDescriptor pb::IMessage.Descriptor { + get { return Descriptor; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public ClientMessage() { + OnConstruction(); + } + + partial void OnConstruction(); + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public ClientMessage(ClientMessage other) : this() { + id_ = other.id_; + switch (other.ContentCase) { + case ContentOneofCase.RegistrationRequest: + RegistrationRequest = other.RegistrationRequest.Clone(); + break; + case ContentOneofCase.IntervalResponse: + IntervalResponse = other.IntervalResponse.Clone(); + break; + } + + _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public ClientMessage Clone() { + return new ClientMessage(this); + } + + /// Field number for the "id" field. + public const int IdFieldNumber = 1; + private string id_ = ""; + /// + /// globally unique ID of the request/response pair + /// + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public string Id { + get { return id_; } + set { + id_ = pb::ProtoPreconditions.CheckNotNull(value, "value"); + } + } + + /// Field number for the "registration_request" field. + public const int RegistrationRequestFieldNumber = 2; + /// + /// Register a subscription to a schedule + /// + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public global::Nitric.Proto.Schedules.v1.RegistrationRequest RegistrationRequest { + get { return contentCase_ == ContentOneofCase.RegistrationRequest ? (global::Nitric.Proto.Schedules.v1.RegistrationRequest) content_ : null; } + set { + content_ = value; + contentCase_ = value == null ? ContentOneofCase.None : ContentOneofCase.RegistrationRequest; + } + } + + /// Field number for the "interval_response" field. + public const int IntervalResponseFieldNumber = 3; + /// + /// Response to a schedule interval + /// + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public global::Nitric.Proto.Schedules.v1.IntervalResponse IntervalResponse { + get { return contentCase_ == ContentOneofCase.IntervalResponse ? (global::Nitric.Proto.Schedules.v1.IntervalResponse) content_ : null; } + set { + content_ = value; + contentCase_ = value == null ? ContentOneofCase.None : ContentOneofCase.IntervalResponse; + } + } + + private object content_; + /// Enum of possible cases for the "content" oneof. + public enum ContentOneofCase { + None = 0, + RegistrationRequest = 2, + IntervalResponse = 3, + } + private ContentOneofCase contentCase_ = ContentOneofCase.None; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public ContentOneofCase ContentCase { + get { return contentCase_; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public void ClearContent() { + contentCase_ = ContentOneofCase.None; + content_ = null; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public override bool Equals(object other) { + return Equals(other as ClientMessage); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public bool Equals(ClientMessage other) { + if (ReferenceEquals(other, null)) { + return false; + } + if (ReferenceEquals(other, this)) { + return true; + } + if (Id != other.Id) return false; + if (!object.Equals(RegistrationRequest, other.RegistrationRequest)) return false; + if (!object.Equals(IntervalResponse, other.IntervalResponse)) return false; + if (ContentCase != other.ContentCase) return false; + return Equals(_unknownFields, other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public override int GetHashCode() { + int hash = 1; + if (Id.Length != 0) hash ^= Id.GetHashCode(); + if (contentCase_ == ContentOneofCase.RegistrationRequest) hash ^= RegistrationRequest.GetHashCode(); + if (contentCase_ == ContentOneofCase.IntervalResponse) hash ^= IntervalResponse.GetHashCode(); + hash ^= (int) contentCase_; + if (_unknownFields != null) { + hash ^= _unknownFields.GetHashCode(); + } + return hash; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public override string ToString() { + return pb::JsonFormatter.ToDiagnosticString(this); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public void WriteTo(pb::CodedOutputStream output) { + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + output.WriteRawMessage(this); + #else + if (Id.Length != 0) { + output.WriteRawTag(10); + output.WriteString(Id); + } + if (contentCase_ == ContentOneofCase.RegistrationRequest) { + output.WriteRawTag(18); + output.WriteMessage(RegistrationRequest); + } + if (contentCase_ == ContentOneofCase.IntervalResponse) { + output.WriteRawTag(26); + output.WriteMessage(IntervalResponse); + } + if (_unknownFields != null) { + _unknownFields.WriteTo(output); + } + #endif + } + + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + void pb::IBufferMessage.InternalWriteTo(ref pb::WriteContext output) { + if (Id.Length != 0) { + output.WriteRawTag(10); + output.WriteString(Id); + } + if (contentCase_ == ContentOneofCase.RegistrationRequest) { + output.WriteRawTag(18); + output.WriteMessage(RegistrationRequest); + } + if (contentCase_ == ContentOneofCase.IntervalResponse) { + output.WriteRawTag(26); + output.WriteMessage(IntervalResponse); + } + if (_unknownFields != null) { + _unknownFields.WriteTo(ref output); + } + } + #endif + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public int CalculateSize() { + int size = 0; + if (Id.Length != 0) { + size += 1 + pb::CodedOutputStream.ComputeStringSize(Id); + } + if (contentCase_ == ContentOneofCase.RegistrationRequest) { + size += 1 + pb::CodedOutputStream.ComputeMessageSize(RegistrationRequest); + } + if (contentCase_ == ContentOneofCase.IntervalResponse) { + size += 1 + pb::CodedOutputStream.ComputeMessageSize(IntervalResponse); + } + if (_unknownFields != null) { + size += _unknownFields.CalculateSize(); + } + return size; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public void MergeFrom(ClientMessage other) { + if (other == null) { + return; + } + if (other.Id.Length != 0) { + Id = other.Id; + } + switch (other.ContentCase) { + case ContentOneofCase.RegistrationRequest: + if (RegistrationRequest == null) { + RegistrationRequest = new global::Nitric.Proto.Schedules.v1.RegistrationRequest(); + } + RegistrationRequest.MergeFrom(other.RegistrationRequest); + break; + case ContentOneofCase.IntervalResponse: + if (IntervalResponse == null) { + IntervalResponse = new global::Nitric.Proto.Schedules.v1.IntervalResponse(); + } + IntervalResponse.MergeFrom(other.IntervalResponse); + break; + } + + _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public void MergeFrom(pb::CodedInputStream input) { + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + input.ReadRawMessage(this); + #else + uint tag; + while ((tag = input.ReadTag()) != 0) { + switch(tag) { + default: + _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input); + break; + case 10: { + Id = input.ReadString(); + break; + } + case 18: { + global::Nitric.Proto.Schedules.v1.RegistrationRequest subBuilder = new global::Nitric.Proto.Schedules.v1.RegistrationRequest(); + if (contentCase_ == ContentOneofCase.RegistrationRequest) { + subBuilder.MergeFrom(RegistrationRequest); + } + input.ReadMessage(subBuilder); + RegistrationRequest = subBuilder; + break; + } + case 26: { + global::Nitric.Proto.Schedules.v1.IntervalResponse subBuilder = new global::Nitric.Proto.Schedules.v1.IntervalResponse(); + if (contentCase_ == ContentOneofCase.IntervalResponse) { + subBuilder.MergeFrom(IntervalResponse); + } + input.ReadMessage(subBuilder); + IntervalResponse = subBuilder; + break; + } + } + } + #endif + } + + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + void pb::IBufferMessage.InternalMergeFrom(ref pb::ParseContext input) { + uint tag; + while ((tag = input.ReadTag()) != 0) { + switch(tag) { + default: + _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, ref input); + break; + case 10: { + Id = input.ReadString(); + break; + } + case 18: { + global::Nitric.Proto.Schedules.v1.RegistrationRequest subBuilder = new global::Nitric.Proto.Schedules.v1.RegistrationRequest(); + if (contentCase_ == ContentOneofCase.RegistrationRequest) { + subBuilder.MergeFrom(RegistrationRequest); + } + input.ReadMessage(subBuilder); + RegistrationRequest = subBuilder; + break; + } + case 26: { + global::Nitric.Proto.Schedules.v1.IntervalResponse subBuilder = new global::Nitric.Proto.Schedules.v1.IntervalResponse(); + if (contentCase_ == ContentOneofCase.IntervalResponse) { + subBuilder.MergeFrom(IntervalResponse); + } + input.ReadMessage(subBuilder); + IntervalResponse = subBuilder; + break; + } + } + } + } + #endif + + } + + public sealed partial class IntervalRequest : pb::IMessage + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + , pb::IBufferMessage + #endif + { + private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new IntervalRequest()); + private pb::UnknownFieldSet _unknownFields; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public static pb::MessageParser Parser { get { return _parser; } } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public static pbr::MessageDescriptor Descriptor { + get { return global::Nitric.Proto.Schedules.v1.SchedulesReflection.Descriptor.MessageTypes[1]; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + pbr::MessageDescriptor pb::IMessage.Descriptor { + get { return Descriptor; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public IntervalRequest() { + OnConstruction(); + } + + partial void OnConstruction(); + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public IntervalRequest(IntervalRequest other) : this() { + scheduleName_ = other.scheduleName_; + _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public IntervalRequest Clone() { + return new IntervalRequest(this); + } + + /// Field number for the "schedule_name" field. + public const int ScheduleNameFieldNumber = 1; + private string scheduleName_ = ""; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public string ScheduleName { + get { return scheduleName_; } + set { + scheduleName_ = pb::ProtoPreconditions.CheckNotNull(value, "value"); + } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public override bool Equals(object other) { + return Equals(other as IntervalRequest); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public bool Equals(IntervalRequest other) { + if (ReferenceEquals(other, null)) { + return false; + } + if (ReferenceEquals(other, this)) { + return true; + } + if (ScheduleName != other.ScheduleName) return false; + return Equals(_unknownFields, other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public override int GetHashCode() { + int hash = 1; + if (ScheduleName.Length != 0) hash ^= ScheduleName.GetHashCode(); + if (_unknownFields != null) { + hash ^= _unknownFields.GetHashCode(); + } + return hash; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public override string ToString() { + return pb::JsonFormatter.ToDiagnosticString(this); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public void WriteTo(pb::CodedOutputStream output) { + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + output.WriteRawMessage(this); + #else + if (ScheduleName.Length != 0) { + output.WriteRawTag(10); + output.WriteString(ScheduleName); + } + if (_unknownFields != null) { + _unknownFields.WriteTo(output); + } + #endif + } + + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + void pb::IBufferMessage.InternalWriteTo(ref pb::WriteContext output) { + if (ScheduleName.Length != 0) { + output.WriteRawTag(10); + output.WriteString(ScheduleName); + } + if (_unknownFields != null) { + _unknownFields.WriteTo(ref output); + } + } + #endif + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public int CalculateSize() { + int size = 0; + if (ScheduleName.Length != 0) { + size += 1 + pb::CodedOutputStream.ComputeStringSize(ScheduleName); + } + if (_unknownFields != null) { + size += _unknownFields.CalculateSize(); + } + return size; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public void MergeFrom(IntervalRequest other) { + if (other == null) { + return; + } + if (other.ScheduleName.Length != 0) { + ScheduleName = other.ScheduleName; + } + _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public void MergeFrom(pb::CodedInputStream input) { + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + input.ReadRawMessage(this); + #else + uint tag; + while ((tag = input.ReadTag()) != 0) { + switch(tag) { + default: + _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input); + break; + case 10: { + ScheduleName = input.ReadString(); + break; + } + } + } + #endif + } + + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + void pb::IBufferMessage.InternalMergeFrom(ref pb::ParseContext input) { + uint tag; + while ((tag = input.ReadTag()) != 0) { + switch(tag) { + default: + _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, ref input); + break; + case 10: { + ScheduleName = input.ReadString(); + break; + } + } + } + } + #endif + + } + + public sealed partial class MessageResponse : pb::IMessage + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + , pb::IBufferMessage + #endif + { + private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new MessageResponse()); + private pb::UnknownFieldSet _unknownFields; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public static pb::MessageParser Parser { get { return _parser; } } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public static pbr::MessageDescriptor Descriptor { + get { return global::Nitric.Proto.Schedules.v1.SchedulesReflection.Descriptor.MessageTypes[2]; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + pbr::MessageDescriptor pb::IMessage.Descriptor { + get { return Descriptor; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public MessageResponse() { + OnConstruction(); + } + + partial void OnConstruction(); + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public MessageResponse(MessageResponse other) : this() { + success_ = other.success_; + _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public MessageResponse Clone() { + return new MessageResponse(this); + } + + /// Field number for the "success" field. + public const int SuccessFieldNumber = 1; + private bool success_; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public bool Success { + get { return success_; } + set { + success_ = value; + } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public override bool Equals(object other) { + return Equals(other as MessageResponse); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public bool Equals(MessageResponse other) { + if (ReferenceEquals(other, null)) { + return false; + } + if (ReferenceEquals(other, this)) { + return true; + } + if (Success != other.Success) return false; + return Equals(_unknownFields, other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public override int GetHashCode() { + int hash = 1; + if (Success != false) hash ^= Success.GetHashCode(); + if (_unknownFields != null) { + hash ^= _unknownFields.GetHashCode(); + } + return hash; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public override string ToString() { + return pb::JsonFormatter.ToDiagnosticString(this); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public void WriteTo(pb::CodedOutputStream output) { + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + output.WriteRawMessage(this); + #else + if (Success != false) { + output.WriteRawTag(8); + output.WriteBool(Success); + } + if (_unknownFields != null) { + _unknownFields.WriteTo(output); + } + #endif + } + + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + void pb::IBufferMessage.InternalWriteTo(ref pb::WriteContext output) { + if (Success != false) { + output.WriteRawTag(8); + output.WriteBool(Success); + } + if (_unknownFields != null) { + _unknownFields.WriteTo(ref output); + } + } + #endif + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public int CalculateSize() { + int size = 0; + if (Success != false) { + size += 1 + 1; + } + if (_unknownFields != null) { + size += _unknownFields.CalculateSize(); + } + return size; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public void MergeFrom(MessageResponse other) { + if (other == null) { + return; + } + if (other.Success != false) { + Success = other.Success; + } + _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public void MergeFrom(pb::CodedInputStream input) { + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + input.ReadRawMessage(this); + #else + uint tag; + while ((tag = input.ReadTag()) != 0) { + switch(tag) { + default: + _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input); + break; + case 8: { + Success = input.ReadBool(); + break; + } + } + } + #endif + } + + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + void pb::IBufferMessage.InternalMergeFrom(ref pb::ParseContext input) { + uint tag; + while ((tag = input.ReadTag()) != 0) { + switch(tag) { + default: + _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, ref input); + break; + case 8: { + Success = input.ReadBool(); + break; + } + } + } + } + #endif + + } + + public sealed partial class ServerMessage : pb::IMessage + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + , pb::IBufferMessage + #endif + { + private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new ServerMessage()); + private pb::UnknownFieldSet _unknownFields; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public static pb::MessageParser Parser { get { return _parser; } } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public static pbr::MessageDescriptor Descriptor { + get { return global::Nitric.Proto.Schedules.v1.SchedulesReflection.Descriptor.MessageTypes[3]; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + pbr::MessageDescriptor pb::IMessage.Descriptor { + get { return Descriptor; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public ServerMessage() { + OnConstruction(); + } + + partial void OnConstruction(); + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public ServerMessage(ServerMessage other) : this() { + id_ = other.id_; + switch (other.ContentCase) { + case ContentOneofCase.RegistrationResponse: + RegistrationResponse = other.RegistrationResponse.Clone(); + break; + case ContentOneofCase.IntervalRequest: + IntervalRequest = other.IntervalRequest.Clone(); + break; + } + + _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public ServerMessage Clone() { + return new ServerMessage(this); + } + + /// Field number for the "id" field. + public const int IdFieldNumber = 1; + private string id_ = ""; + /// + /// globally unique ID of the request/response pair + /// + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public string Id { + get { return id_; } + set { + id_ = pb::ProtoPreconditions.CheckNotNull(value, "value"); + } + } + + /// Field number for the "registration_response" field. + public const int RegistrationResponseFieldNumber = 2; + /// + /// Response to a schedule subscription request + /// + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public global::Nitric.Proto.Schedules.v1.RegistrationResponse RegistrationResponse { + get { return contentCase_ == ContentOneofCase.RegistrationResponse ? (global::Nitric.Proto.Schedules.v1.RegistrationResponse) content_ : null; } + set { + content_ = value; + contentCase_ = value == null ? ContentOneofCase.None : ContentOneofCase.RegistrationResponse; + } + } + + /// Field number for the "interval_request" field. + public const int IntervalRequestFieldNumber = 3; + /// + /// A schedule interval trigger request + /// + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public global::Nitric.Proto.Schedules.v1.IntervalRequest IntervalRequest { + get { return contentCase_ == ContentOneofCase.IntervalRequest ? (global::Nitric.Proto.Schedules.v1.IntervalRequest) content_ : null; } + set { + content_ = value; + contentCase_ = value == null ? ContentOneofCase.None : ContentOneofCase.IntervalRequest; + } + } + + private object content_; + /// Enum of possible cases for the "content" oneof. + public enum ContentOneofCase { + None = 0, + RegistrationResponse = 2, + IntervalRequest = 3, + } + private ContentOneofCase contentCase_ = ContentOneofCase.None; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public ContentOneofCase ContentCase { + get { return contentCase_; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public void ClearContent() { + contentCase_ = ContentOneofCase.None; + content_ = null; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public override bool Equals(object other) { + return Equals(other as ServerMessage); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public bool Equals(ServerMessage other) { + if (ReferenceEquals(other, null)) { + return false; + } + if (ReferenceEquals(other, this)) { + return true; + } + if (Id != other.Id) return false; + if (!object.Equals(RegistrationResponse, other.RegistrationResponse)) return false; + if (!object.Equals(IntervalRequest, other.IntervalRequest)) return false; + if (ContentCase != other.ContentCase) return false; + return Equals(_unknownFields, other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public override int GetHashCode() { + int hash = 1; + if (Id.Length != 0) hash ^= Id.GetHashCode(); + if (contentCase_ == ContentOneofCase.RegistrationResponse) hash ^= RegistrationResponse.GetHashCode(); + if (contentCase_ == ContentOneofCase.IntervalRequest) hash ^= IntervalRequest.GetHashCode(); + hash ^= (int) contentCase_; + if (_unknownFields != null) { + hash ^= _unknownFields.GetHashCode(); + } + return hash; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public override string ToString() { + return pb::JsonFormatter.ToDiagnosticString(this); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public void WriteTo(pb::CodedOutputStream output) { + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + output.WriteRawMessage(this); + #else + if (Id.Length != 0) { + output.WriteRawTag(10); + output.WriteString(Id); + } + if (contentCase_ == ContentOneofCase.RegistrationResponse) { + output.WriteRawTag(18); + output.WriteMessage(RegistrationResponse); + } + if (contentCase_ == ContentOneofCase.IntervalRequest) { + output.WriteRawTag(26); + output.WriteMessage(IntervalRequest); + } + if (_unknownFields != null) { + _unknownFields.WriteTo(output); + } + #endif + } + + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + void pb::IBufferMessage.InternalWriteTo(ref pb::WriteContext output) { + if (Id.Length != 0) { + output.WriteRawTag(10); + output.WriteString(Id); + } + if (contentCase_ == ContentOneofCase.RegistrationResponse) { + output.WriteRawTag(18); + output.WriteMessage(RegistrationResponse); + } + if (contentCase_ == ContentOneofCase.IntervalRequest) { + output.WriteRawTag(26); + output.WriteMessage(IntervalRequest); + } + if (_unknownFields != null) { + _unknownFields.WriteTo(ref output); + } + } + #endif + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public int CalculateSize() { + int size = 0; + if (Id.Length != 0) { + size += 1 + pb::CodedOutputStream.ComputeStringSize(Id); + } + if (contentCase_ == ContentOneofCase.RegistrationResponse) { + size += 1 + pb::CodedOutputStream.ComputeMessageSize(RegistrationResponse); + } + if (contentCase_ == ContentOneofCase.IntervalRequest) { + size += 1 + pb::CodedOutputStream.ComputeMessageSize(IntervalRequest); + } + if (_unknownFields != null) { + size += _unknownFields.CalculateSize(); + } + return size; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public void MergeFrom(ServerMessage other) { + if (other == null) { + return; + } + if (other.Id.Length != 0) { + Id = other.Id; + } + switch (other.ContentCase) { + case ContentOneofCase.RegistrationResponse: + if (RegistrationResponse == null) { + RegistrationResponse = new global::Nitric.Proto.Schedules.v1.RegistrationResponse(); + } + RegistrationResponse.MergeFrom(other.RegistrationResponse); + break; + case ContentOneofCase.IntervalRequest: + if (IntervalRequest == null) { + IntervalRequest = new global::Nitric.Proto.Schedules.v1.IntervalRequest(); + } + IntervalRequest.MergeFrom(other.IntervalRequest); + break; + } + + _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public void MergeFrom(pb::CodedInputStream input) { + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + input.ReadRawMessage(this); + #else + uint tag; + while ((tag = input.ReadTag()) != 0) { + switch(tag) { + default: + _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input); + break; + case 10: { + Id = input.ReadString(); + break; + } + case 18: { + global::Nitric.Proto.Schedules.v1.RegistrationResponse subBuilder = new global::Nitric.Proto.Schedules.v1.RegistrationResponse(); + if (contentCase_ == ContentOneofCase.RegistrationResponse) { + subBuilder.MergeFrom(RegistrationResponse); + } + input.ReadMessage(subBuilder); + RegistrationResponse = subBuilder; + break; + } + case 26: { + global::Nitric.Proto.Schedules.v1.IntervalRequest subBuilder = new global::Nitric.Proto.Schedules.v1.IntervalRequest(); + if (contentCase_ == ContentOneofCase.IntervalRequest) { + subBuilder.MergeFrom(IntervalRequest); + } + input.ReadMessage(subBuilder); + IntervalRequest = subBuilder; + break; + } + } + } + #endif + } + + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + void pb::IBufferMessage.InternalMergeFrom(ref pb::ParseContext input) { + uint tag; + while ((tag = input.ReadTag()) != 0) { + switch(tag) { + default: + _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, ref input); + break; + case 10: { + Id = input.ReadString(); + break; + } + case 18: { + global::Nitric.Proto.Schedules.v1.RegistrationResponse subBuilder = new global::Nitric.Proto.Schedules.v1.RegistrationResponse(); + if (contentCase_ == ContentOneofCase.RegistrationResponse) { + subBuilder.MergeFrom(RegistrationResponse); + } + input.ReadMessage(subBuilder); + RegistrationResponse = subBuilder; + break; + } + case 26: { + global::Nitric.Proto.Schedules.v1.IntervalRequest subBuilder = new global::Nitric.Proto.Schedules.v1.IntervalRequest(); + if (contentCase_ == ContentOneofCase.IntervalRequest) { + subBuilder.MergeFrom(IntervalRequest); + } + input.ReadMessage(subBuilder); + IntervalRequest = subBuilder; + break; + } + } + } + } + #endif + + } + + public sealed partial class RegistrationRequest : pb::IMessage + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + , pb::IBufferMessage + #endif + { + private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new RegistrationRequest()); + private pb::UnknownFieldSet _unknownFields; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public static pb::MessageParser Parser { get { return _parser; } } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public static pbr::MessageDescriptor Descriptor { + get { return global::Nitric.Proto.Schedules.v1.SchedulesReflection.Descriptor.MessageTypes[4]; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + pbr::MessageDescriptor pb::IMessage.Descriptor { + get { return Descriptor; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public RegistrationRequest() { + OnConstruction(); + } + + partial void OnConstruction(); + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public RegistrationRequest(RegistrationRequest other) : this() { + scheduleName_ = other.scheduleName_; + switch (other.CadenceCase) { + case CadenceOneofCase.Every: + Every = other.Every.Clone(); + break; + case CadenceOneofCase.Cron: + Cron = other.Cron.Clone(); + break; + } + + _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public RegistrationRequest Clone() { + return new RegistrationRequest(this); + } + + /// Field number for the "schedule_name" field. + public const int ScheduleNameFieldNumber = 1; + private string scheduleName_ = ""; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public string ScheduleName { + get { return scheduleName_; } + set { + scheduleName_ = pb::ProtoPreconditions.CheckNotNull(value, "value"); + } + } + + /// Field number for the "every" field. + public const int EveryFieldNumber = 10; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public global::Nitric.Proto.Schedules.v1.ScheduleEvery Every { + get { return cadenceCase_ == CadenceOneofCase.Every ? (global::Nitric.Proto.Schedules.v1.ScheduleEvery) cadence_ : null; } + set { + cadence_ = value; + cadenceCase_ = value == null ? CadenceOneofCase.None : CadenceOneofCase.Every; + } + } + + /// Field number for the "cron" field. + public const int CronFieldNumber = 11; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public global::Nitric.Proto.Schedules.v1.ScheduleCron Cron { + get { return cadenceCase_ == CadenceOneofCase.Cron ? (global::Nitric.Proto.Schedules.v1.ScheduleCron) cadence_ : null; } + set { + cadence_ = value; + cadenceCase_ = value == null ? CadenceOneofCase.None : CadenceOneofCase.Cron; + } + } + + private object cadence_; + /// Enum of possible cases for the "cadence" oneof. + public enum CadenceOneofCase { + None = 0, + Every = 10, + Cron = 11, + } + private CadenceOneofCase cadenceCase_ = CadenceOneofCase.None; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public CadenceOneofCase CadenceCase { + get { return cadenceCase_; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public void ClearCadence() { + cadenceCase_ = CadenceOneofCase.None; + cadence_ = null; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public override bool Equals(object other) { + return Equals(other as RegistrationRequest); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public bool Equals(RegistrationRequest other) { + if (ReferenceEquals(other, null)) { + return false; + } + if (ReferenceEquals(other, this)) { + return true; + } + if (ScheduleName != other.ScheduleName) return false; + if (!object.Equals(Every, other.Every)) return false; + if (!object.Equals(Cron, other.Cron)) return false; + if (CadenceCase != other.CadenceCase) return false; + return Equals(_unknownFields, other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public override int GetHashCode() { + int hash = 1; + if (ScheduleName.Length != 0) hash ^= ScheduleName.GetHashCode(); + if (cadenceCase_ == CadenceOneofCase.Every) hash ^= Every.GetHashCode(); + if (cadenceCase_ == CadenceOneofCase.Cron) hash ^= Cron.GetHashCode(); + hash ^= (int) cadenceCase_; + if (_unknownFields != null) { + hash ^= _unknownFields.GetHashCode(); + } + return hash; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public override string ToString() { + return pb::JsonFormatter.ToDiagnosticString(this); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public void WriteTo(pb::CodedOutputStream output) { + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + output.WriteRawMessage(this); + #else + if (ScheduleName.Length != 0) { + output.WriteRawTag(10); + output.WriteString(ScheduleName); + } + if (cadenceCase_ == CadenceOneofCase.Every) { + output.WriteRawTag(82); + output.WriteMessage(Every); + } + if (cadenceCase_ == CadenceOneofCase.Cron) { + output.WriteRawTag(90); + output.WriteMessage(Cron); + } + if (_unknownFields != null) { + _unknownFields.WriteTo(output); + } + #endif + } + + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + void pb::IBufferMessage.InternalWriteTo(ref pb::WriteContext output) { + if (ScheduleName.Length != 0) { + output.WriteRawTag(10); + output.WriteString(ScheduleName); + } + if (cadenceCase_ == CadenceOneofCase.Every) { + output.WriteRawTag(82); + output.WriteMessage(Every); + } + if (cadenceCase_ == CadenceOneofCase.Cron) { + output.WriteRawTag(90); + output.WriteMessage(Cron); + } + if (_unknownFields != null) { + _unknownFields.WriteTo(ref output); + } + } + #endif + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public int CalculateSize() { + int size = 0; + if (ScheduleName.Length != 0) { + size += 1 + pb::CodedOutputStream.ComputeStringSize(ScheduleName); + } + if (cadenceCase_ == CadenceOneofCase.Every) { + size += 1 + pb::CodedOutputStream.ComputeMessageSize(Every); + } + if (cadenceCase_ == CadenceOneofCase.Cron) { + size += 1 + pb::CodedOutputStream.ComputeMessageSize(Cron); + } + if (_unknownFields != null) { + size += _unknownFields.CalculateSize(); + } + return size; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public void MergeFrom(RegistrationRequest other) { + if (other == null) { + return; + } + if (other.ScheduleName.Length != 0) { + ScheduleName = other.ScheduleName; + } + switch (other.CadenceCase) { + case CadenceOneofCase.Every: + if (Every == null) { + Every = new global::Nitric.Proto.Schedules.v1.ScheduleEvery(); + } + Every.MergeFrom(other.Every); + break; + case CadenceOneofCase.Cron: + if (Cron == null) { + Cron = new global::Nitric.Proto.Schedules.v1.ScheduleCron(); + } + Cron.MergeFrom(other.Cron); + break; + } + + _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public void MergeFrom(pb::CodedInputStream input) { + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + input.ReadRawMessage(this); + #else + uint tag; + while ((tag = input.ReadTag()) != 0) { + switch(tag) { + default: + _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input); + break; + case 10: { + ScheduleName = input.ReadString(); + break; + } + case 82: { + global::Nitric.Proto.Schedules.v1.ScheduleEvery subBuilder = new global::Nitric.Proto.Schedules.v1.ScheduleEvery(); + if (cadenceCase_ == CadenceOneofCase.Every) { + subBuilder.MergeFrom(Every); + } + input.ReadMessage(subBuilder); + Every = subBuilder; + break; + } + case 90: { + global::Nitric.Proto.Schedules.v1.ScheduleCron subBuilder = new global::Nitric.Proto.Schedules.v1.ScheduleCron(); + if (cadenceCase_ == CadenceOneofCase.Cron) { + subBuilder.MergeFrom(Cron); + } + input.ReadMessage(subBuilder); + Cron = subBuilder; + break; + } + } + } + #endif + } + + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + void pb::IBufferMessage.InternalMergeFrom(ref pb::ParseContext input) { + uint tag; + while ((tag = input.ReadTag()) != 0) { + switch(tag) { + default: + _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, ref input); + break; + case 10: { + ScheduleName = input.ReadString(); + break; + } + case 82: { + global::Nitric.Proto.Schedules.v1.ScheduleEvery subBuilder = new global::Nitric.Proto.Schedules.v1.ScheduleEvery(); + if (cadenceCase_ == CadenceOneofCase.Every) { + subBuilder.MergeFrom(Every); + } + input.ReadMessage(subBuilder); + Every = subBuilder; + break; + } + case 90: { + global::Nitric.Proto.Schedules.v1.ScheduleCron subBuilder = new global::Nitric.Proto.Schedules.v1.ScheduleCron(); + if (cadenceCase_ == CadenceOneofCase.Cron) { + subBuilder.MergeFrom(Cron); + } + input.ReadMessage(subBuilder); + Cron = subBuilder; + break; + } + } + } + } + #endif + + } + + public sealed partial class ScheduleEvery : pb::IMessage + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + , pb::IBufferMessage + #endif + { + private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new ScheduleEvery()); + private pb::UnknownFieldSet _unknownFields; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public static pb::MessageParser Parser { get { return _parser; } } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public static pbr::MessageDescriptor Descriptor { + get { return global::Nitric.Proto.Schedules.v1.SchedulesReflection.Descriptor.MessageTypes[5]; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + pbr::MessageDescriptor pb::IMessage.Descriptor { + get { return Descriptor; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public ScheduleEvery() { + OnConstruction(); + } + + partial void OnConstruction(); + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public ScheduleEvery(ScheduleEvery other) : this() { + rate_ = other.rate_; + _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public ScheduleEvery Clone() { + return new ScheduleEvery(this); + } + + /// Field number for the "rate" field. + public const int RateFieldNumber = 1; + private string rate_ = ""; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public string Rate { + get { return rate_; } + set { + rate_ = pb::ProtoPreconditions.CheckNotNull(value, "value"); + } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public override bool Equals(object other) { + return Equals(other as ScheduleEvery); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public bool Equals(ScheduleEvery other) { + if (ReferenceEquals(other, null)) { + return false; + } + if (ReferenceEquals(other, this)) { + return true; + } + if (Rate != other.Rate) return false; + return Equals(_unknownFields, other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public override int GetHashCode() { + int hash = 1; + if (Rate.Length != 0) hash ^= Rate.GetHashCode(); + if (_unknownFields != null) { + hash ^= _unknownFields.GetHashCode(); + } + return hash; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public override string ToString() { + return pb::JsonFormatter.ToDiagnosticString(this); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public void WriteTo(pb::CodedOutputStream output) { + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + output.WriteRawMessage(this); + #else + if (Rate.Length != 0) { + output.WriteRawTag(10); + output.WriteString(Rate); + } + if (_unknownFields != null) { + _unknownFields.WriteTo(output); + } + #endif + } + + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + void pb::IBufferMessage.InternalWriteTo(ref pb::WriteContext output) { + if (Rate.Length != 0) { + output.WriteRawTag(10); + output.WriteString(Rate); + } + if (_unknownFields != null) { + _unknownFields.WriteTo(ref output); + } + } + #endif + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public int CalculateSize() { + int size = 0; + if (Rate.Length != 0) { + size += 1 + pb::CodedOutputStream.ComputeStringSize(Rate); + } + if (_unknownFields != null) { + size += _unknownFields.CalculateSize(); + } + return size; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public void MergeFrom(ScheduleEvery other) { + if (other == null) { + return; + } + if (other.Rate.Length != 0) { + Rate = other.Rate; + } + _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public void MergeFrom(pb::CodedInputStream input) { + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + input.ReadRawMessage(this); + #else + uint tag; + while ((tag = input.ReadTag()) != 0) { + switch(tag) { + default: + _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input); + break; + case 10: { + Rate = input.ReadString(); + break; + } + } + } + #endif + } + + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + void pb::IBufferMessage.InternalMergeFrom(ref pb::ParseContext input) { + uint tag; + while ((tag = input.ReadTag()) != 0) { + switch(tag) { + default: + _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, ref input); + break; + case 10: { + Rate = input.ReadString(); + break; + } + } + } + } + #endif + + } + + public sealed partial class ScheduleCron : pb::IMessage + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + , pb::IBufferMessage + #endif + { + private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new ScheduleCron()); + private pb::UnknownFieldSet _unknownFields; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public static pb::MessageParser Parser { get { return _parser; } } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public static pbr::MessageDescriptor Descriptor { + get { return global::Nitric.Proto.Schedules.v1.SchedulesReflection.Descriptor.MessageTypes[6]; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + pbr::MessageDescriptor pb::IMessage.Descriptor { + get { return Descriptor; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public ScheduleCron() { + OnConstruction(); + } + + partial void OnConstruction(); + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public ScheduleCron(ScheduleCron other) : this() { + expression_ = other.expression_; + _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public ScheduleCron Clone() { + return new ScheduleCron(this); + } + + /// Field number for the "expression" field. + public const int ExpressionFieldNumber = 1; + private string expression_ = ""; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public string Expression { + get { return expression_; } + set { + expression_ = pb::ProtoPreconditions.CheckNotNull(value, "value"); + } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public override bool Equals(object other) { + return Equals(other as ScheduleCron); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public bool Equals(ScheduleCron other) { + if (ReferenceEquals(other, null)) { + return false; + } + if (ReferenceEquals(other, this)) { + return true; + } + if (Expression != other.Expression) return false; + return Equals(_unknownFields, other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public override int GetHashCode() { + int hash = 1; + if (Expression.Length != 0) hash ^= Expression.GetHashCode(); + if (_unknownFields != null) { + hash ^= _unknownFields.GetHashCode(); + } + return hash; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public override string ToString() { + return pb::JsonFormatter.ToDiagnosticString(this); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public void WriteTo(pb::CodedOutputStream output) { + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + output.WriteRawMessage(this); + #else + if (Expression.Length != 0) { + output.WriteRawTag(10); + output.WriteString(Expression); + } + if (_unknownFields != null) { + _unknownFields.WriteTo(output); + } + #endif + } + + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + void pb::IBufferMessage.InternalWriteTo(ref pb::WriteContext output) { + if (Expression.Length != 0) { + output.WriteRawTag(10); + output.WriteString(Expression); + } + if (_unknownFields != null) { + _unknownFields.WriteTo(ref output); + } + } + #endif + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public int CalculateSize() { + int size = 0; + if (Expression.Length != 0) { + size += 1 + pb::CodedOutputStream.ComputeStringSize(Expression); + } + if (_unknownFields != null) { + size += _unknownFields.CalculateSize(); + } + return size; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public void MergeFrom(ScheduleCron other) { + if (other == null) { + return; + } + if (other.Expression.Length != 0) { + Expression = other.Expression; + } + _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public void MergeFrom(pb::CodedInputStream input) { + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + input.ReadRawMessage(this); + #else + uint tag; + while ((tag = input.ReadTag()) != 0) { + switch(tag) { + default: + _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input); + break; + case 10: { + Expression = input.ReadString(); + break; + } + } + } + #endif + } + + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + void pb::IBufferMessage.InternalMergeFrom(ref pb::ParseContext input) { + uint tag; + while ((tag = input.ReadTag()) != 0) { + switch(tag) { + default: + _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, ref input); + break; + case 10: { + Expression = input.ReadString(); + break; + } + } + } + } + #endif + + } + + public sealed partial class RegistrationResponse : pb::IMessage + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + , pb::IBufferMessage + #endif + { + private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new RegistrationResponse()); + private pb::UnknownFieldSet _unknownFields; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public static pb::MessageParser Parser { get { return _parser; } } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public static pbr::MessageDescriptor Descriptor { + get { return global::Nitric.Proto.Schedules.v1.SchedulesReflection.Descriptor.MessageTypes[7]; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + pbr::MessageDescriptor pb::IMessage.Descriptor { + get { return Descriptor; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public RegistrationResponse() { + OnConstruction(); + } + + partial void OnConstruction(); + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public RegistrationResponse(RegistrationResponse other) : this() { + _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public RegistrationResponse Clone() { + return new RegistrationResponse(this); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public override bool Equals(object other) { + return Equals(other as RegistrationResponse); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public bool Equals(RegistrationResponse other) { + if (ReferenceEquals(other, null)) { + return false; + } + if (ReferenceEquals(other, this)) { + return true; + } + return Equals(_unknownFields, other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public override int GetHashCode() { + int hash = 1; + if (_unknownFields != null) { + hash ^= _unknownFields.GetHashCode(); + } + return hash; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public override string ToString() { + return pb::JsonFormatter.ToDiagnosticString(this); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public void WriteTo(pb::CodedOutputStream output) { + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + output.WriteRawMessage(this); + #else + if (_unknownFields != null) { + _unknownFields.WriteTo(output); + } + #endif + } + + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + void pb::IBufferMessage.InternalWriteTo(ref pb::WriteContext output) { + if (_unknownFields != null) { + _unknownFields.WriteTo(ref output); + } + } + #endif + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public int CalculateSize() { + int size = 0; + if (_unknownFields != null) { + size += _unknownFields.CalculateSize(); + } + return size; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public void MergeFrom(RegistrationResponse other) { + if (other == null) { + return; + } + _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public void MergeFrom(pb::CodedInputStream input) { + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + input.ReadRawMessage(this); + #else + uint tag; + while ((tag = input.ReadTag()) != 0) { + switch(tag) { + default: + _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input); + break; + } + } + #endif + } + + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + void pb::IBufferMessage.InternalMergeFrom(ref pb::ParseContext input) { + uint tag; + while ((tag = input.ReadTag()) != 0) { + switch(tag) { + default: + _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, ref input); + break; + } + } + } + #endif + + } + + public sealed partial class IntervalResponse : pb::IMessage + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + , pb::IBufferMessage + #endif + { + private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new IntervalResponse()); + private pb::UnknownFieldSet _unknownFields; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public static pb::MessageParser Parser { get { return _parser; } } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public static pbr::MessageDescriptor Descriptor { + get { return global::Nitric.Proto.Schedules.v1.SchedulesReflection.Descriptor.MessageTypes[8]; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + pbr::MessageDescriptor pb::IMessage.Descriptor { + get { return Descriptor; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public IntervalResponse() { + OnConstruction(); + } + + partial void OnConstruction(); + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public IntervalResponse(IntervalResponse other) : this() { + _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public IntervalResponse Clone() { + return new IntervalResponse(this); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public override bool Equals(object other) { + return Equals(other as IntervalResponse); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public bool Equals(IntervalResponse other) { + if (ReferenceEquals(other, null)) { + return false; + } + if (ReferenceEquals(other, this)) { + return true; + } + return Equals(_unknownFields, other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public override int GetHashCode() { + int hash = 1; + if (_unknownFields != null) { + hash ^= _unknownFields.GetHashCode(); + } + return hash; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public override string ToString() { + return pb::JsonFormatter.ToDiagnosticString(this); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public void WriteTo(pb::CodedOutputStream output) { + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + output.WriteRawMessage(this); + #else + if (_unknownFields != null) { + _unknownFields.WriteTo(output); + } + #endif + } + + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + void pb::IBufferMessage.InternalWriteTo(ref pb::WriteContext output) { + if (_unknownFields != null) { + _unknownFields.WriteTo(ref output); + } + } + #endif + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public int CalculateSize() { + int size = 0; + if (_unknownFields != null) { + size += _unknownFields.CalculateSize(); + } + return size; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public void MergeFrom(IntervalResponse other) { + if (other == null) { + return; + } + _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public void MergeFrom(pb::CodedInputStream input) { + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + input.ReadRawMessage(this); + #else + uint tag; + while ((tag = input.ReadTag()) != 0) { + switch(tag) { + default: + _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input); + break; + } + } + #endif + } + + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + void pb::IBufferMessage.InternalMergeFrom(ref pb::ParseContext input) { + uint tag; + while ((tag = input.ReadTag()) != 0) { + switch(tag) { + default: + _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, ref input); + break; + } + } + } + #endif + + } + + #endregion + +} + +#endregion Designer generated code diff --git a/src/Nitric.Sdk/Proto/nitric/proto/schedules/v1/SchedulesGrpc.cs b/src/Nitric.Sdk/Proto/nitric/proto/schedules/v1/SchedulesGrpc.cs new file mode 100644 index 0000000..bd38bf2 --- /dev/null +++ b/src/Nitric.Sdk/Proto/nitric/proto/schedules/v1/SchedulesGrpc.cs @@ -0,0 +1,132 @@ +// +// Generated by the protocol buffer compiler. DO NOT EDIT! +// source: nitric/proto/schedules/v1/schedules.proto +// +#pragma warning disable 0414, 1591 +#region Designer generated code + +using grpc = global::Grpc.Core; + +namespace Nitric.Proto.Schedules.v1 { + /// + /// Service for publishing asynchronous messages + /// + public static partial class Schedules + { + static readonly string __ServiceName = "nitric.proto.schedules.v1.Schedules"; + + static void __Helper_SerializeMessage(global::Google.Protobuf.IMessage message, grpc::SerializationContext context) + { + #if !GRPC_DISABLE_PROTOBUF_BUFFER_SERIALIZATION + if (message is global::Google.Protobuf.IBufferMessage) + { + context.SetPayloadLength(message.CalculateSize()); + global::Google.Protobuf.MessageExtensions.WriteTo(message, context.GetBufferWriter()); + context.Complete(); + return; + } + #endif + context.Complete(global::Google.Protobuf.MessageExtensions.ToByteArray(message)); + } + + static class __Helper_MessageCache + { + public static readonly bool IsBufferMessage = global::System.Reflection.IntrospectionExtensions.GetTypeInfo(typeof(global::Google.Protobuf.IBufferMessage)).IsAssignableFrom(typeof(T)); + } + + static T __Helper_DeserializeMessage(grpc::DeserializationContext context, global::Google.Protobuf.MessageParser parser) where T : global::Google.Protobuf.IMessage + { + #if !GRPC_DISABLE_PROTOBUF_BUFFER_SERIALIZATION + if (__Helper_MessageCache.IsBufferMessage) + { + return parser.ParseFrom(context.PayloadAsReadOnlySequence()); + } + #endif + return parser.ParseFrom(context.PayloadAsNewBuffer()); + } + + static readonly grpc::Marshaller __Marshaller_nitric_proto_schedules_v1_ClientMessage = grpc::Marshallers.Create(__Helper_SerializeMessage, context => __Helper_DeserializeMessage(context, global::Nitric.Proto.Schedules.v1.ClientMessage.Parser)); + static readonly grpc::Marshaller __Marshaller_nitric_proto_schedules_v1_ServerMessage = grpc::Marshallers.Create(__Helper_SerializeMessage, context => __Helper_DeserializeMessage(context, global::Nitric.Proto.Schedules.v1.ServerMessage.Parser)); + + static readonly grpc::Method __Method_Schedule = new grpc::Method( + grpc::MethodType.DuplexStreaming, + __ServiceName, + "Schedule", + __Marshaller_nitric_proto_schedules_v1_ClientMessage, + __Marshaller_nitric_proto_schedules_v1_ServerMessage); + + /// Service descriptor + public static global::Google.Protobuf.Reflection.ServiceDescriptor Descriptor + { + get { return global::Nitric.Proto.Schedules.v1.SchedulesReflection.Descriptor.Services[0]; } + } + + /// Base class for server-side implementations of Schedules + [grpc::BindServiceMethod(typeof(Schedules), "BindService")] + public abstract partial class SchedulesBase + { + public virtual global::System.Threading.Tasks.Task Schedule(grpc::IAsyncStreamReader requestStream, grpc::IServerStreamWriter responseStream, grpc::ServerCallContext context) + { + throw new grpc::RpcException(new grpc::Status(grpc::StatusCode.Unimplemented, "")); + } + + } + + /// Client for Schedules + public partial class SchedulesClient : grpc::ClientBase + { + /// Creates a new client for Schedules + /// The channel to use to make remote calls. + public SchedulesClient(grpc::ChannelBase channel) : base(channel) + { + } + /// Creates a new client for Schedules that uses a custom CallInvoker. + /// The callInvoker to use to make remote calls. + public SchedulesClient(grpc::CallInvoker callInvoker) : base(callInvoker) + { + } + /// Protected parameterless constructor to allow creation of test doubles. + protected SchedulesClient() : base() + { + } + /// Protected constructor to allow creation of configured clients. + /// The client configuration. + protected SchedulesClient(ClientBaseConfiguration configuration) : base(configuration) + { + } + + public virtual grpc::AsyncDuplexStreamingCall Schedule(grpc::Metadata headers = null, global::System.DateTime? deadline = null, global::System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken)) + { + return Schedule(new grpc::CallOptions(headers, deadline, cancellationToken)); + } + public virtual grpc::AsyncDuplexStreamingCall Schedule(grpc::CallOptions options) + { + return CallInvoker.AsyncDuplexStreamingCall(__Method_Schedule, null, options); + } + /// Creates a new instance of client from given ClientBaseConfiguration. + protected override SchedulesClient NewInstance(ClientBaseConfiguration configuration) + { + return new SchedulesClient(configuration); + } + } + + /// Creates service definition that can be registered with a server + /// An object implementing the server-side handling logic. + public static grpc::ServerServiceDefinition BindService(SchedulesBase serviceImpl) + { + return grpc::ServerServiceDefinition.CreateBuilder() + .AddMethod(__Method_Schedule, serviceImpl.Schedule).Build(); + } + + /// Register service method with a service binder with or without implementation. Useful when customizing the service binding logic. + /// Note: this method is part of an experimental API that can change or be removed without any prior notice. + /// Service methods will be bound by calling AddMethod on this object. + /// An object implementing the server-side handling logic. + public static void BindService(grpc::ServiceBinderBase serviceBinder, SchedulesBase serviceImpl) + { + serviceBinder.AddMethod(__Method_Schedule, serviceImpl == null ? null : new grpc::DuplexStreamingServerMethod(serviceImpl.Schedule)); + } + + } +} +#endregion diff --git a/src/Nitric.Sdk/Proto/proto/secret/v1/Secret.cs b/src/Nitric.Sdk/Proto/nitric/proto/secrets/v1/Secrets.cs similarity index 88% rename from src/Nitric.Sdk/Proto/proto/secret/v1/Secret.cs rename to src/Nitric.Sdk/Proto/nitric/proto/secrets/v1/Secrets.cs index 4f3368d..ca76a39 100644 --- a/src/Nitric.Sdk/Proto/proto/secret/v1/Secret.cs +++ b/src/Nitric.Sdk/Proto/nitric/proto/secrets/v1/Secrets.cs @@ -1,6 +1,6 @@ // // Generated by the protocol buffer compiler. DO NOT EDIT! -// source: proto/secret/v1/secret.proto +// source: nitric/proto/secrets/v1/secrets.proto // #pragma warning disable 1591, 0612, 3021 #region Designer generated code @@ -9,51 +9,51 @@ using pbc = global::Google.Protobuf.Collections; using pbr = global::Google.Protobuf.Reflection; using scg = global::System.Collections.Generic; -namespace Nitric.Proto.Secret.v1 { +namespace Nitric.Proto.Secrets.v1 { - /// Holder for reflection information generated from proto/secret/v1/secret.proto - public static partial class SecretReflection { + /// Holder for reflection information generated from nitric/proto/secrets/v1/secrets.proto + public static partial class SecretsReflection { #region Descriptor - /// File descriptor for proto/secret/v1/secret.proto + /// File descriptor for nitric/proto/secrets/v1/secrets.proto public static pbr::FileDescriptor Descriptor { get { return descriptor; } } private static pbr::FileDescriptor descriptor; - static SecretReflection() { + static SecretsReflection() { byte[] descriptorData = global::System.Convert.FromBase64String( string.Concat( - "Chxwcm90by9zZWNyZXQvdjEvc2VjcmV0LnByb3RvEhBuaXRyaWMuc2VjcmV0", - "LnYxGhd2YWxpZGF0ZS92YWxpZGF0ZS5wcm90byJVChBTZWNyZXRQdXRSZXF1", - "ZXN0EjIKBnNlY3JldBgBIAEoCzIYLm5pdHJpYy5zZWNyZXQudjEuU2VjcmV0", - "Qgj6QgWKAQIQARINCgV2YWx1ZRgCIAEoDCJMChFTZWNyZXRQdXRSZXNwb25z", - "ZRI3Cg5zZWNyZXRfdmVyc2lvbhgBIAEoCzIfLm5pdHJpYy5zZWNyZXQudjEu", - "U2VjcmV0VmVyc2lvbiJYChNTZWNyZXRBY2Nlc3NSZXF1ZXN0EkEKDnNlY3Jl", - "dF92ZXJzaW9uGAEgASgLMh8ubml0cmljLnNlY3JldC52MS5TZWNyZXRWZXJz", - "aW9uQgj6QgWKAQIQASJzChRTZWNyZXRBY2Nlc3NSZXNwb25zZRJBCg5zZWNy", - "ZXRfdmVyc2lvbhgBIAEoCzIfLm5pdHJpYy5zZWNyZXQudjEuU2VjcmV0VmVy", - "c2lvbkII+kIFigECEAESGAoFdmFsdWUYAiABKAxCCfpCBnoEGMC7ASIWCgZT", - "ZWNyZXQSDAoEbmFtZRgBIAEoCSJdCg1TZWNyZXRWZXJzaW9uEjIKBnNlY3Jl", - "dBgBIAEoCzIYLm5pdHJpYy5zZWNyZXQudjEuU2VjcmV0Qgj6QgWKAQIQARIY", - "Cgd2ZXJzaW9uGAIgASgJQgf6QgRyAhABMrgBCg1TZWNyZXRTZXJ2aWNlEk4K", - "A1B1dBIiLm5pdHJpYy5zZWNyZXQudjEuU2VjcmV0UHV0UmVxdWVzdBojLm5p", - "dHJpYy5zZWNyZXQudjEuU2VjcmV0UHV0UmVzcG9uc2USVwoGQWNjZXNzEiUu", - "bml0cmljLnNlY3JldC52MS5TZWNyZXRBY2Nlc3NSZXF1ZXN0GiYubml0cmlj", - "LnNlY3JldC52MS5TZWNyZXRBY2Nlc3NSZXNwb25zZUKNAQoZaW8ubml0cmlj", - "LnByb3RvLnNlY3JldC52MUIHU2VjcmV0c1ABWjNnaXRodWIuY29tL25pdHJp", - "Y3RlY2gvbml0cmljL2NvcmUvcGtnL2FwaS9uaXRyaWMvdjGqAhZOaXRyaWMu", - "UHJvdG8uU2VjcmV0LnYxygIWTml0cmljXFByb3RvXFNlY3JldFxWMWIGcHJv", - "dG8z")); + "CiVuaXRyaWMvcHJvdG8vc2VjcmV0cy92MS9zZWNyZXRzLnByb3RvEhduaXRy", + "aWMucHJvdG8uc2VjcmV0cy52MSJSChBTZWNyZXRQdXRSZXF1ZXN0Ei8KBnNl", + "Y3JldBgBIAEoCzIfLm5pdHJpYy5wcm90by5zZWNyZXRzLnYxLlNlY3JldBIN", + "CgV2YWx1ZRgCIAEoDCJTChFTZWNyZXRQdXRSZXNwb25zZRI+Cg5zZWNyZXRf", + "dmVyc2lvbhgBIAEoCzImLm5pdHJpYy5wcm90by5zZWNyZXRzLnYxLlNlY3Jl", + "dFZlcnNpb24iVQoTU2VjcmV0QWNjZXNzUmVxdWVzdBI+Cg5zZWNyZXRfdmVy", + "c2lvbhgBIAEoCzImLm5pdHJpYy5wcm90by5zZWNyZXRzLnYxLlNlY3JldFZl", + "cnNpb24iZQoUU2VjcmV0QWNjZXNzUmVzcG9uc2USPgoOc2VjcmV0X3ZlcnNp", + "b24YASABKAsyJi5uaXRyaWMucHJvdG8uc2VjcmV0cy52MS5TZWNyZXRWZXJz", + "aW9uEg0KBXZhbHVlGAIgASgMIhYKBlNlY3JldBIMCgRuYW1lGAEgASgJIlEK", + "DVNlY3JldFZlcnNpb24SLwoGc2VjcmV0GAEgASgLMh8ubml0cmljLnByb3Rv", + "LnNlY3JldHMudjEuU2VjcmV0Eg8KB3ZlcnNpb24YAiABKAky1AEKDVNlY3Jl", + "dE1hbmFnZXISXAoDUHV0Eikubml0cmljLnByb3RvLnNlY3JldHMudjEuU2Vj", + "cmV0UHV0UmVxdWVzdBoqLm5pdHJpYy5wcm90by5zZWNyZXRzLnYxLlNlY3Jl", + "dFB1dFJlc3BvbnNlEmUKBkFjY2VzcxIsLm5pdHJpYy5wcm90by5zZWNyZXRz", + "LnYxLlNlY3JldEFjY2Vzc1JlcXVlc3QaLS5uaXRyaWMucHJvdG8uc2VjcmV0", + "cy52MS5TZWNyZXRBY2Nlc3NSZXNwb25zZUKkAQoaaW8ubml0cmljLnByb3Rv", + "LnNlY3JldHMudjFCDlNlY3JldHNTZXJ2aWNlUAFaQGdpdGh1Yi5jb20vbml0", + "cmljdGVjaC9uaXRyaWMvY29yZS9wa2cvcHJvdG8vc2VjcmV0cy92MTtzZWNy", + "ZXRzcGKqAhdOaXRyaWMuUHJvdG8uU2VjcmV0cy52McoCF05pdHJpY1xQcm90", + "b1xTZWNyZXRzXFYxYgZwcm90bzM=")); descriptor = pbr::FileDescriptor.FromGeneratedCode(descriptorData, - new pbr::FileDescriptor[] { global::Validate.ValidateReflection.Descriptor, }, + new pbr::FileDescriptor[] { }, new pbr::GeneratedClrTypeInfo(null, null, new pbr::GeneratedClrTypeInfo[] { - new pbr::GeneratedClrTypeInfo(typeof(global::Nitric.Proto.Secret.v1.SecretPutRequest), global::Nitric.Proto.Secret.v1.SecretPutRequest.Parser, new[]{ "Secret", "Value" }, null, null, null, null), - new pbr::GeneratedClrTypeInfo(typeof(global::Nitric.Proto.Secret.v1.SecretPutResponse), global::Nitric.Proto.Secret.v1.SecretPutResponse.Parser, new[]{ "SecretVersion" }, null, null, null, null), - new pbr::GeneratedClrTypeInfo(typeof(global::Nitric.Proto.Secret.v1.SecretAccessRequest), global::Nitric.Proto.Secret.v1.SecretAccessRequest.Parser, new[]{ "SecretVersion" }, null, null, null, null), - new pbr::GeneratedClrTypeInfo(typeof(global::Nitric.Proto.Secret.v1.SecretAccessResponse), global::Nitric.Proto.Secret.v1.SecretAccessResponse.Parser, new[]{ "SecretVersion", "Value" }, null, null, null, null), - new pbr::GeneratedClrTypeInfo(typeof(global::Nitric.Proto.Secret.v1.Secret), global::Nitric.Proto.Secret.v1.Secret.Parser, new[]{ "Name" }, null, null, null, null), - new pbr::GeneratedClrTypeInfo(typeof(global::Nitric.Proto.Secret.v1.SecretVersion), global::Nitric.Proto.Secret.v1.SecretVersion.Parser, new[]{ "Secret", "Version" }, null, null, null, null) + new pbr::GeneratedClrTypeInfo(typeof(global::Nitric.Proto.Secrets.v1.SecretPutRequest), global::Nitric.Proto.Secrets.v1.SecretPutRequest.Parser, new[]{ "Secret", "Value" }, null, null, null, null), + new pbr::GeneratedClrTypeInfo(typeof(global::Nitric.Proto.Secrets.v1.SecretPutResponse), global::Nitric.Proto.Secrets.v1.SecretPutResponse.Parser, new[]{ "SecretVersion" }, null, null, null, null), + new pbr::GeneratedClrTypeInfo(typeof(global::Nitric.Proto.Secrets.v1.SecretAccessRequest), global::Nitric.Proto.Secrets.v1.SecretAccessRequest.Parser, new[]{ "SecretVersion" }, null, null, null, null), + new pbr::GeneratedClrTypeInfo(typeof(global::Nitric.Proto.Secrets.v1.SecretAccessResponse), global::Nitric.Proto.Secrets.v1.SecretAccessResponse.Parser, new[]{ "SecretVersion", "Value" }, null, null, null, null), + new pbr::GeneratedClrTypeInfo(typeof(global::Nitric.Proto.Secrets.v1.Secret), global::Nitric.Proto.Secrets.v1.Secret.Parser, new[]{ "Name" }, null, null, null, null), + new pbr::GeneratedClrTypeInfo(typeof(global::Nitric.Proto.Secrets.v1.SecretVersion), global::Nitric.Proto.Secrets.v1.SecretVersion.Parser, new[]{ "Secret", "Version" }, null, null, null, null) })); } #endregion @@ -75,7 +75,7 @@ public sealed partial class SecretPutRequest : pb::IMessage [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public static pbr::MessageDescriptor Descriptor { - get { return global::Nitric.Proto.Secret.v1.SecretReflection.Descriptor.MessageTypes[0]; } + get { return global::Nitric.Proto.Secrets.v1.SecretsReflection.Descriptor.MessageTypes[0]; } } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] @@ -104,12 +104,12 @@ public SecretPutRequest Clone() { /// Field number for the "secret" field. public const int SecretFieldNumber = 1; - private global::Nitric.Proto.Secret.v1.Secret secret_; + private global::Nitric.Proto.Secrets.v1.Secret secret_; /// /// The Secret to put to the Secret store /// [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public global::Nitric.Proto.Secret.v1.Secret Secret { + public global::Nitric.Proto.Secrets.v1.Secret Secret { get { return secret_; } set { secret_ = value; @@ -222,7 +222,7 @@ public void MergeFrom(SecretPutRequest other) { } if (other.secret_ != null) { if (secret_ == null) { - Secret = new global::Nitric.Proto.Secret.v1.Secret(); + Secret = new global::Nitric.Proto.Secrets.v1.Secret(); } Secret.MergeFrom(other.Secret); } @@ -245,7 +245,7 @@ public void MergeFrom(pb::CodedInputStream input) { break; case 10: { if (secret_ == null) { - Secret = new global::Nitric.Proto.Secret.v1.Secret(); + Secret = new global::Nitric.Proto.Secrets.v1.Secret(); } input.ReadMessage(Secret); break; @@ -270,7 +270,7 @@ public void MergeFrom(pb::CodedInputStream input) { break; case 10: { if (secret_ == null) { - Secret = new global::Nitric.Proto.Secret.v1.Secret(); + Secret = new global::Nitric.Proto.Secrets.v1.Secret(); } input.ReadMessage(Secret); break; @@ -301,7 +301,7 @@ public sealed partial class SecretPutResponse : pb::IMessage [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public static pbr::MessageDescriptor Descriptor { - get { return global::Nitric.Proto.Secret.v1.SecretReflection.Descriptor.MessageTypes[1]; } + get { return global::Nitric.Proto.Secrets.v1.SecretsReflection.Descriptor.MessageTypes[1]; } } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] @@ -329,12 +329,12 @@ public SecretPutResponse Clone() { /// Field number for the "secret_version" field. public const int SecretVersionFieldNumber = 1; - private global::Nitric.Proto.Secret.v1.SecretVersion secretVersion_; + private global::Nitric.Proto.Secrets.v1.SecretVersion secretVersion_; /// /// The id of the secret /// [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public global::Nitric.Proto.Secret.v1.SecretVersion SecretVersion { + public global::Nitric.Proto.Secrets.v1.SecretVersion SecretVersion { get { return secretVersion_; } set { secretVersion_ = value; @@ -420,7 +420,7 @@ public void MergeFrom(SecretPutResponse other) { } if (other.secretVersion_ != null) { if (secretVersion_ == null) { - SecretVersion = new global::Nitric.Proto.Secret.v1.SecretVersion(); + SecretVersion = new global::Nitric.Proto.Secrets.v1.SecretVersion(); } SecretVersion.MergeFrom(other.SecretVersion); } @@ -440,7 +440,7 @@ public void MergeFrom(pb::CodedInputStream input) { break; case 10: { if (secretVersion_ == null) { - SecretVersion = new global::Nitric.Proto.Secret.v1.SecretVersion(); + SecretVersion = new global::Nitric.Proto.Secrets.v1.SecretVersion(); } input.ReadMessage(SecretVersion); break; @@ -461,7 +461,7 @@ public void MergeFrom(pb::CodedInputStream input) { break; case 10: { if (secretVersion_ == null) { - SecretVersion = new global::Nitric.Proto.Secret.v1.SecretVersion(); + SecretVersion = new global::Nitric.Proto.Secrets.v1.SecretVersion(); } input.ReadMessage(SecretVersion); break; @@ -488,7 +488,7 @@ public sealed partial class SecretAccessRequest : pb::IMessageField number for the "secret_version" field. public const int SecretVersionFieldNumber = 1; - private global::Nitric.Proto.Secret.v1.SecretVersion secretVersion_; + private global::Nitric.Proto.Secrets.v1.SecretVersion secretVersion_; /// /// The id of the secret /// [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public global::Nitric.Proto.Secret.v1.SecretVersion SecretVersion { + public global::Nitric.Proto.Secrets.v1.SecretVersion SecretVersion { get { return secretVersion_; } set { secretVersion_ = value; @@ -607,7 +607,7 @@ public void MergeFrom(SecretAccessRequest other) { } if (other.secretVersion_ != null) { if (secretVersion_ == null) { - SecretVersion = new global::Nitric.Proto.Secret.v1.SecretVersion(); + SecretVersion = new global::Nitric.Proto.Secrets.v1.SecretVersion(); } SecretVersion.MergeFrom(other.SecretVersion); } @@ -627,7 +627,7 @@ public void MergeFrom(pb::CodedInputStream input) { break; case 10: { if (secretVersion_ == null) { - SecretVersion = new global::Nitric.Proto.Secret.v1.SecretVersion(); + SecretVersion = new global::Nitric.Proto.Secrets.v1.SecretVersion(); } input.ReadMessage(SecretVersion); break; @@ -648,7 +648,7 @@ public void MergeFrom(pb::CodedInputStream input) { break; case 10: { if (secretVersion_ == null) { - SecretVersion = new global::Nitric.Proto.Secret.v1.SecretVersion(); + SecretVersion = new global::Nitric.Proto.Secrets.v1.SecretVersion(); } input.ReadMessage(SecretVersion); break; @@ -675,7 +675,7 @@ public sealed partial class SecretAccessResponse : pb::IMessageField number for the "secret_version" field. public const int SecretVersionFieldNumber = 1; - private global::Nitric.Proto.Secret.v1.SecretVersion secretVersion_; + private global::Nitric.Proto.Secrets.v1.SecretVersion secretVersion_; /// /// The version of the secret that was requested /// [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public global::Nitric.Proto.Secret.v1.SecretVersion SecretVersion { + public global::Nitric.Proto.Secrets.v1.SecretVersion SecretVersion { get { return secretVersion_; } set { secretVersion_ = value; @@ -822,7 +822,7 @@ public void MergeFrom(SecretAccessResponse other) { } if (other.secretVersion_ != null) { if (secretVersion_ == null) { - SecretVersion = new global::Nitric.Proto.Secret.v1.SecretVersion(); + SecretVersion = new global::Nitric.Proto.Secrets.v1.SecretVersion(); } SecretVersion.MergeFrom(other.SecretVersion); } @@ -845,7 +845,7 @@ public void MergeFrom(pb::CodedInputStream input) { break; case 10: { if (secretVersion_ == null) { - SecretVersion = new global::Nitric.Proto.Secret.v1.SecretVersion(); + SecretVersion = new global::Nitric.Proto.Secrets.v1.SecretVersion(); } input.ReadMessage(SecretVersion); break; @@ -870,7 +870,7 @@ public void MergeFrom(pb::CodedInputStream input) { break; case 10: { if (secretVersion_ == null) { - SecretVersion = new global::Nitric.Proto.Secret.v1.SecretVersion(); + SecretVersion = new global::Nitric.Proto.Secrets.v1.SecretVersion(); } input.ReadMessage(SecretVersion); break; @@ -901,7 +901,7 @@ public sealed partial class Secret : pb::IMessage [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public static pbr::MessageDescriptor Descriptor { - get { return global::Nitric.Proto.Secret.v1.SecretReflection.Descriptor.MessageTypes[4]; } + get { return global::Nitric.Proto.Secrets.v1.SecretsReflection.Descriptor.MessageTypes[4]; } } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] @@ -1079,7 +1079,7 @@ public sealed partial class SecretVersion : pb::IMessage [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public static pbr::MessageDescriptor Descriptor { - get { return global::Nitric.Proto.Secret.v1.SecretReflection.Descriptor.MessageTypes[5]; } + get { return global::Nitric.Proto.Secrets.v1.SecretsReflection.Descriptor.MessageTypes[5]; } } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] @@ -1108,12 +1108,12 @@ public SecretVersion Clone() { /// Field number for the "secret" field. public const int SecretFieldNumber = 1; - private global::Nitric.Proto.Secret.v1.Secret secret_; + private global::Nitric.Proto.Secrets.v1.Secret secret_; /// /// Reference to the secret container /// [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public global::Nitric.Proto.Secret.v1.Secret Secret { + public global::Nitric.Proto.Secrets.v1.Secret Secret { get { return secret_; } set { secret_ = value; @@ -1226,7 +1226,7 @@ public void MergeFrom(SecretVersion other) { } if (other.secret_ != null) { if (secret_ == null) { - Secret = new global::Nitric.Proto.Secret.v1.Secret(); + Secret = new global::Nitric.Proto.Secrets.v1.Secret(); } Secret.MergeFrom(other.Secret); } @@ -1249,7 +1249,7 @@ public void MergeFrom(pb::CodedInputStream input) { break; case 10: { if (secret_ == null) { - Secret = new global::Nitric.Proto.Secret.v1.Secret(); + Secret = new global::Nitric.Proto.Secrets.v1.Secret(); } input.ReadMessage(Secret); break; @@ -1274,7 +1274,7 @@ public void MergeFrom(pb::CodedInputStream input) { break; case 10: { if (secret_ == null) { - Secret = new global::Nitric.Proto.Secret.v1.Secret(); + Secret = new global::Nitric.Proto.Secrets.v1.Secret(); } input.ReadMessage(Secret); break; diff --git a/src/Nitric.Sdk/Proto/proto/secret/v1/SecretGrpc.cs b/src/Nitric.Sdk/Proto/nitric/proto/secrets/v1/SecretsGrpc.cs similarity index 65% rename from src/Nitric.Sdk/Proto/proto/secret/v1/SecretGrpc.cs rename to src/Nitric.Sdk/Proto/nitric/proto/secrets/v1/SecretsGrpc.cs index 210e5d7..8be1987 100644 --- a/src/Nitric.Sdk/Proto/proto/secret/v1/SecretGrpc.cs +++ b/src/Nitric.Sdk/Proto/nitric/proto/secrets/v1/SecretsGrpc.cs @@ -1,19 +1,16 @@ // // Generated by the protocol buffer compiler. DO NOT EDIT! -// source: proto/secret/v1/secret.proto +// source: nitric/proto/secrets/v1/secrets.proto // #pragma warning disable 0414, 1591 #region Designer generated code using grpc = global::Grpc.Core; -namespace Nitric.Proto.Secret.v1 { - /// - /// The Nitric Secret Service contract - /// - public static partial class SecretService +namespace Nitric.Proto.Secrets.v1 { + public static partial class SecretManager { - static readonly string __ServiceName = "nitric.secret.v1.SecretService"; + static readonly string __ServiceName = "nitric.proto.secrets.v1.SecretManager"; static void __Helper_SerializeMessage(global::Google.Protobuf.IMessage message, grpc::SerializationContext context) { @@ -45,34 +42,34 @@ static T __Helper_DeserializeMessage(grpc::DeserializationContext context, gl return parser.ParseFrom(context.PayloadAsNewBuffer()); } - static readonly grpc::Marshaller __Marshaller_nitric_secret_v1_SecretPutRequest = grpc::Marshallers.Create(__Helper_SerializeMessage, context => __Helper_DeserializeMessage(context, global::Nitric.Proto.Secret.v1.SecretPutRequest.Parser)); - static readonly grpc::Marshaller __Marshaller_nitric_secret_v1_SecretPutResponse = grpc::Marshallers.Create(__Helper_SerializeMessage, context => __Helper_DeserializeMessage(context, global::Nitric.Proto.Secret.v1.SecretPutResponse.Parser)); - static readonly grpc::Marshaller __Marshaller_nitric_secret_v1_SecretAccessRequest = grpc::Marshallers.Create(__Helper_SerializeMessage, context => __Helper_DeserializeMessage(context, global::Nitric.Proto.Secret.v1.SecretAccessRequest.Parser)); - static readonly grpc::Marshaller __Marshaller_nitric_secret_v1_SecretAccessResponse = grpc::Marshallers.Create(__Helper_SerializeMessage, context => __Helper_DeserializeMessage(context, global::Nitric.Proto.Secret.v1.SecretAccessResponse.Parser)); + static readonly grpc::Marshaller __Marshaller_nitric_proto_secrets_v1_SecretPutRequest = grpc::Marshallers.Create(__Helper_SerializeMessage, context => __Helper_DeserializeMessage(context, global::Nitric.Proto.Secrets.v1.SecretPutRequest.Parser)); + static readonly grpc::Marshaller __Marshaller_nitric_proto_secrets_v1_SecretPutResponse = grpc::Marshallers.Create(__Helper_SerializeMessage, context => __Helper_DeserializeMessage(context, global::Nitric.Proto.Secrets.v1.SecretPutResponse.Parser)); + static readonly grpc::Marshaller __Marshaller_nitric_proto_secrets_v1_SecretAccessRequest = grpc::Marshallers.Create(__Helper_SerializeMessage, context => __Helper_DeserializeMessage(context, global::Nitric.Proto.Secrets.v1.SecretAccessRequest.Parser)); + static readonly grpc::Marshaller __Marshaller_nitric_proto_secrets_v1_SecretAccessResponse = grpc::Marshallers.Create(__Helper_SerializeMessage, context => __Helper_DeserializeMessage(context, global::Nitric.Proto.Secrets.v1.SecretAccessResponse.Parser)); - static readonly grpc::Method __Method_Put = new grpc::Method( + static readonly grpc::Method __Method_Put = new grpc::Method( grpc::MethodType.Unary, __ServiceName, "Put", - __Marshaller_nitric_secret_v1_SecretPutRequest, - __Marshaller_nitric_secret_v1_SecretPutResponse); + __Marshaller_nitric_proto_secrets_v1_SecretPutRequest, + __Marshaller_nitric_proto_secrets_v1_SecretPutResponse); - static readonly grpc::Method __Method_Access = new grpc::Method( + static readonly grpc::Method __Method_Access = new grpc::Method( grpc::MethodType.Unary, __ServiceName, "Access", - __Marshaller_nitric_secret_v1_SecretAccessRequest, - __Marshaller_nitric_secret_v1_SecretAccessResponse); + __Marshaller_nitric_proto_secrets_v1_SecretAccessRequest, + __Marshaller_nitric_proto_secrets_v1_SecretAccessResponse); /// Service descriptor public static global::Google.Protobuf.Reflection.ServiceDescriptor Descriptor { - get { return global::Nitric.Proto.Secret.v1.SecretReflection.Descriptor.Services[0]; } + get { return global::Nitric.Proto.Secrets.v1.SecretsReflection.Descriptor.Services[0]; } } - /// Base class for server-side implementations of SecretService - [grpc::BindServiceMethod(typeof(SecretService), "BindService")] - public abstract partial class SecretServiceBase + /// Base class for server-side implementations of SecretManager + [grpc::BindServiceMethod(typeof(SecretManager), "BindService")] + public abstract partial class SecretManagerBase { /// /// Updates a secret, creating a new one if it doesn't already exist @@ -80,7 +77,7 @@ public abstract partial class SecretServiceBase /// The request received from the client. /// The context of the server-side call handler being invoked. /// The response to send back to the client (wrapped by a task). - public virtual global::System.Threading.Tasks.Task Put(global::Nitric.Proto.Secret.v1.SecretPutRequest request, grpc::ServerCallContext context) + public virtual global::System.Threading.Tasks.Task Put(global::Nitric.Proto.Secrets.v1.SecretPutRequest request, grpc::ServerCallContext context) { throw new grpc::RpcException(new grpc::Status(grpc::StatusCode.Unimplemented, "")); } @@ -91,33 +88,33 @@ public abstract partial class SecretServiceBase /// The request received from the client. /// The context of the server-side call handler being invoked. /// The response to send back to the client (wrapped by a task). - public virtual global::System.Threading.Tasks.Task Access(global::Nitric.Proto.Secret.v1.SecretAccessRequest request, grpc::ServerCallContext context) + public virtual global::System.Threading.Tasks.Task Access(global::Nitric.Proto.Secrets.v1.SecretAccessRequest request, grpc::ServerCallContext context) { throw new grpc::RpcException(new grpc::Status(grpc::StatusCode.Unimplemented, "")); } } - /// Client for SecretService - public partial class SecretServiceClient : grpc::ClientBase + /// Client for SecretManager + public partial class SecretManagerClient : grpc::ClientBase { - /// Creates a new client for SecretService + /// Creates a new client for SecretManager /// The channel to use to make remote calls. - public SecretServiceClient(grpc::ChannelBase channel) : base(channel) + public SecretManagerClient(grpc::ChannelBase channel) : base(channel) { } - /// Creates a new client for SecretService that uses a custom CallInvoker. + /// Creates a new client for SecretManager that uses a custom CallInvoker. /// The callInvoker to use to make remote calls. - public SecretServiceClient(grpc::CallInvoker callInvoker) : base(callInvoker) + public SecretManagerClient(grpc::CallInvoker callInvoker) : base(callInvoker) { } /// Protected parameterless constructor to allow creation of test doubles. - protected SecretServiceClient() : base() + protected SecretManagerClient() : base() { } /// Protected constructor to allow creation of configured clients. /// The client configuration. - protected SecretServiceClient(ClientBaseConfiguration configuration) : base(configuration) + protected SecretManagerClient(ClientBaseConfiguration configuration) : base(configuration) { } @@ -129,7 +126,7 @@ protected SecretServiceClient(ClientBaseConfiguration configuration) : base(conf /// An optional deadline for the call. The call will be cancelled if deadline is hit. /// An optional token for canceling the call. /// The response received from the server. - public virtual global::Nitric.Proto.Secret.v1.SecretPutResponse Put(global::Nitric.Proto.Secret.v1.SecretPutRequest request, grpc::Metadata headers = null, global::System.DateTime? deadline = null, global::System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken)) + public virtual global::Nitric.Proto.Secrets.v1.SecretPutResponse Put(global::Nitric.Proto.Secrets.v1.SecretPutRequest request, grpc::Metadata headers = null, global::System.DateTime? deadline = null, global::System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken)) { return Put(request, new grpc::CallOptions(headers, deadline, cancellationToken)); } @@ -139,7 +136,7 @@ protected SecretServiceClient(ClientBaseConfiguration configuration) : base(conf /// The request to send to the server. /// The options for the call. /// The response received from the server. - public virtual global::Nitric.Proto.Secret.v1.SecretPutResponse Put(global::Nitric.Proto.Secret.v1.SecretPutRequest request, grpc::CallOptions options) + public virtual global::Nitric.Proto.Secrets.v1.SecretPutResponse Put(global::Nitric.Proto.Secrets.v1.SecretPutRequest request, grpc::CallOptions options) { return CallInvoker.BlockingUnaryCall(__Method_Put, null, options, request); } @@ -151,7 +148,7 @@ protected SecretServiceClient(ClientBaseConfiguration configuration) : base(conf /// An optional deadline for the call. The call will be cancelled if deadline is hit. /// An optional token for canceling the call. /// The call object. - public virtual grpc::AsyncUnaryCall PutAsync(global::Nitric.Proto.Secret.v1.SecretPutRequest request, grpc::Metadata headers = null, global::System.DateTime? deadline = null, global::System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken)) + public virtual grpc::AsyncUnaryCall PutAsync(global::Nitric.Proto.Secrets.v1.SecretPutRequest request, grpc::Metadata headers = null, global::System.DateTime? deadline = null, global::System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken)) { return PutAsync(request, new grpc::CallOptions(headers, deadline, cancellationToken)); } @@ -161,7 +158,7 @@ protected SecretServiceClient(ClientBaseConfiguration configuration) : base(conf /// The request to send to the server. /// The options for the call. /// The call object. - public virtual grpc::AsyncUnaryCall PutAsync(global::Nitric.Proto.Secret.v1.SecretPutRequest request, grpc::CallOptions options) + public virtual grpc::AsyncUnaryCall PutAsync(global::Nitric.Proto.Secrets.v1.SecretPutRequest request, grpc::CallOptions options) { return CallInvoker.AsyncUnaryCall(__Method_Put, null, options, request); } @@ -173,7 +170,7 @@ protected SecretServiceClient(ClientBaseConfiguration configuration) : base(conf /// An optional deadline for the call. The call will be cancelled if deadline is hit. /// An optional token for canceling the call. /// The response received from the server. - public virtual global::Nitric.Proto.Secret.v1.SecretAccessResponse Access(global::Nitric.Proto.Secret.v1.SecretAccessRequest request, grpc::Metadata headers = null, global::System.DateTime? deadline = null, global::System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken)) + public virtual global::Nitric.Proto.Secrets.v1.SecretAccessResponse Access(global::Nitric.Proto.Secrets.v1.SecretAccessRequest request, grpc::Metadata headers = null, global::System.DateTime? deadline = null, global::System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken)) { return Access(request, new grpc::CallOptions(headers, deadline, cancellationToken)); } @@ -183,7 +180,7 @@ protected SecretServiceClient(ClientBaseConfiguration configuration) : base(conf /// The request to send to the server. /// The options for the call. /// The response received from the server. - public virtual global::Nitric.Proto.Secret.v1.SecretAccessResponse Access(global::Nitric.Proto.Secret.v1.SecretAccessRequest request, grpc::CallOptions options) + public virtual global::Nitric.Proto.Secrets.v1.SecretAccessResponse Access(global::Nitric.Proto.Secrets.v1.SecretAccessRequest request, grpc::CallOptions options) { return CallInvoker.BlockingUnaryCall(__Method_Access, null, options, request); } @@ -195,7 +192,7 @@ protected SecretServiceClient(ClientBaseConfiguration configuration) : base(conf /// An optional deadline for the call. The call will be cancelled if deadline is hit. /// An optional token for canceling the call. /// The call object. - public virtual grpc::AsyncUnaryCall AccessAsync(global::Nitric.Proto.Secret.v1.SecretAccessRequest request, grpc::Metadata headers = null, global::System.DateTime? deadline = null, global::System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken)) + public virtual grpc::AsyncUnaryCall AccessAsync(global::Nitric.Proto.Secrets.v1.SecretAccessRequest request, grpc::Metadata headers = null, global::System.DateTime? deadline = null, global::System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken)) { return AccessAsync(request, new grpc::CallOptions(headers, deadline, cancellationToken)); } @@ -205,20 +202,20 @@ protected SecretServiceClient(ClientBaseConfiguration configuration) : base(conf /// The request to send to the server. /// The options for the call. /// The call object. - public virtual grpc::AsyncUnaryCall AccessAsync(global::Nitric.Proto.Secret.v1.SecretAccessRequest request, grpc::CallOptions options) + public virtual grpc::AsyncUnaryCall AccessAsync(global::Nitric.Proto.Secrets.v1.SecretAccessRequest request, grpc::CallOptions options) { return CallInvoker.AsyncUnaryCall(__Method_Access, null, options, request); } /// Creates a new instance of client from given ClientBaseConfiguration. - protected override SecretServiceClient NewInstance(ClientBaseConfiguration configuration) + protected override SecretManagerClient NewInstance(ClientBaseConfiguration configuration) { - return new SecretServiceClient(configuration); + return new SecretManagerClient(configuration); } } /// Creates service definition that can be registered with a server /// An object implementing the server-side handling logic. - public static grpc::ServerServiceDefinition BindService(SecretServiceBase serviceImpl) + public static grpc::ServerServiceDefinition BindService(SecretManagerBase serviceImpl) { return grpc::ServerServiceDefinition.CreateBuilder() .AddMethod(__Method_Put, serviceImpl.Put) @@ -229,10 +226,10 @@ protected override SecretServiceClient NewInstance(ClientBaseConfiguration confi /// Note: this method is part of an experimental API that can change or be removed without any prior notice. /// Service methods will be bound by calling AddMethod on this object. /// An object implementing the server-side handling logic. - public static void BindService(grpc::ServiceBinderBase serviceBinder, SecretServiceBase serviceImpl) + public static void BindService(grpc::ServiceBinderBase serviceBinder, SecretManagerBase serviceImpl) { - serviceBinder.AddMethod(__Method_Put, serviceImpl == null ? null : new grpc::UnaryServerMethod(serviceImpl.Put)); - serviceBinder.AddMethod(__Method_Access, serviceImpl == null ? null : new grpc::UnaryServerMethod(serviceImpl.Access)); + serviceBinder.AddMethod(__Method_Put, serviceImpl == null ? null : new grpc::UnaryServerMethod(serviceImpl.Put)); + serviceBinder.AddMethod(__Method_Access, serviceImpl == null ? null : new grpc::UnaryServerMethod(serviceImpl.Access)); } } diff --git a/src/Nitric.Sdk/Proto/nitric/proto/storage/v1/Storage.cs b/src/Nitric.Sdk/Proto/nitric/proto/storage/v1/Storage.cs new file mode 100644 index 0000000..0df1285 --- /dev/null +++ b/src/Nitric.Sdk/Proto/nitric/proto/storage/v1/Storage.cs @@ -0,0 +1,4379 @@ +// +// Generated by the protocol buffer compiler. DO NOT EDIT! +// source: nitric/proto/storage/v1/storage.proto +// +#pragma warning disable 1591, 0612, 3021 +#region Designer generated code + +using pb = global::Google.Protobuf; +using pbc = global::Google.Protobuf.Collections; +using pbr = global::Google.Protobuf.Reflection; +using scg = global::System.Collections.Generic; +namespace Nitric.Proto.Storage.v1 { + + /// Holder for reflection information generated from nitric/proto/storage/v1/storage.proto + public static partial class StorageReflection { + + #region Descriptor + /// File descriptor for nitric/proto/storage/v1/storage.proto + public static pbr::FileDescriptor Descriptor { + get { return descriptor; } + } + private static pbr::FileDescriptor descriptor; + + static StorageReflection() { + byte[] descriptorData = global::System.Convert.FromBase64String( + string.Concat( + "CiVuaXRyaWMvcHJvdG8vc3RvcmFnZS92MS9zdG9yYWdlLnByb3RvEhduaXRy", + "aWMucHJvdG8uc3RvcmFnZS52MRoeZ29vZ2xlL3Byb3RvYnVmL2R1cmF0aW9u", + "LnByb3RvIr8BCg1DbGllbnRNZXNzYWdlEgoKAmlkGAEgASgJEkwKFHJlZ2lz", + "dHJhdGlvbl9yZXF1ZXN0GAIgASgLMiwubml0cmljLnByb3RvLnN0b3JhZ2Uu", + "djEuUmVnaXN0cmF0aW9uUmVxdWVzdEgAEkkKE2Jsb2JfZXZlbnRfcmVzcG9u", + "c2UYAyABKAsyKi5uaXRyaWMucHJvdG8uc3RvcmFnZS52MS5CbG9iRXZlbnRS", + "ZXNwb25zZUgAQgkKB2NvbnRlbnQivwEKDVNlcnZlck1lc3NhZ2USCgoCaWQY", + "ASABKAkSTgoVcmVnaXN0cmF0aW9uX3Jlc3BvbnNlGAIgASgLMi0ubml0cmlj", + "LnByb3RvLnN0b3JhZ2UudjEuUmVnaXN0cmF0aW9uUmVzcG9uc2VIABJHChJi", + "bG9iX2V2ZW50X3JlcXVlc3QYAyABKAsyKS5uaXRyaWMucHJvdG8uc3RvcmFn", + "ZS52MS5CbG9iRXZlbnRSZXF1ZXN0SABCCQoHY29udGVudCJqChBCbG9iRXZl", + "bnRSZXF1ZXN0EhMKC2J1Y2tldF9uYW1lGAEgASgJEjgKCmJsb2JfZXZlbnQY", + "CiABKAsyIi5uaXRyaWMucHJvdG8uc3RvcmFnZS52MS5CbG9iRXZlbnRIAEIH", + "CgVldmVudCJOCglCbG9iRXZlbnQSCwoDa2V5GAEgASgJEjQKBHR5cGUYAiAB", + "KA4yJi5uaXRyaWMucHJvdG8uc3RvcmFnZS52MS5CbG9iRXZlbnRUeXBlIiQK", + "EUJsb2JFdmVudFJlc3BvbnNlEg8KB3N1Y2Nlc3MYASABKAgihgEKE1JlZ2lz", + "dHJhdGlvblJlcXVlc3QSEwoLYnVja2V0X25hbWUYASABKAkSPwoPYmxvYl9l", + "dmVudF90eXBlGAIgASgOMiYubml0cmljLnByb3RvLnN0b3JhZ2UudjEuQmxv", + "YkV2ZW50VHlwZRIZChFrZXlfcHJlZml4X2ZpbHRlchgDIAEoCSIiChRSZWdp", + "c3RyYXRpb25SZXNwb25zZRIKCgJpZBgBIAEoCSJFChNTdG9yYWdlV3JpdGVS", + "ZXF1ZXN0EhMKC2J1Y2tldF9uYW1lGAEgASgJEgsKA2tleRgCIAEoCRIMCgRi", + "b2R5GAMgASgMIhYKFFN0b3JhZ2VXcml0ZVJlc3BvbnNlIjYKElN0b3JhZ2VS", + "ZWFkUmVxdWVzdBITCgtidWNrZXRfbmFtZRgBIAEoCRILCgNrZXkYAiABKAki", + "IwoTU3RvcmFnZVJlYWRSZXNwb25zZRIMCgRib2R5GAEgASgMIjgKFFN0b3Jh", + "Z2VEZWxldGVSZXF1ZXN0EhMKC2J1Y2tldF9uYW1lGAEgASgJEgsKA2tleRgC", + "IAEoCSIXChVTdG9yYWdlRGVsZXRlUmVzcG9uc2Ui2QEKGFN0b3JhZ2VQcmVT", + "aWduVXJsUmVxdWVzdBITCgtidWNrZXRfbmFtZRgBIAEoCRILCgNrZXkYAiAB", + "KAkSTgoJb3BlcmF0aW9uGAMgASgOMjsubml0cmljLnByb3RvLnN0b3JhZ2Uu", + "djEuU3RvcmFnZVByZVNpZ25VcmxSZXF1ZXN0Lk9wZXJhdGlvbhIpCgZleHBp", + "cnkYBCABKAsyGS5nb29nbGUucHJvdG9idWYuRHVyYXRpb24iIAoJT3BlcmF0", + "aW9uEggKBFJFQUQQABIJCgVXUklURRABIigKGVN0b3JhZ2VQcmVTaWduVXJs", + "UmVzcG9uc2USCwoDdXJsGAEgASgJIj4KF1N0b3JhZ2VMaXN0QmxvYnNSZXF1", + "ZXN0EhMKC2J1Y2tldF9uYW1lGAEgASgJEg4KBnByZWZpeBgCIAEoCSITCgRC", + "bG9iEgsKA2tleRgBIAEoCSJIChhTdG9yYWdlTGlzdEJsb2JzUmVzcG9uc2US", + "LAoFYmxvYnMYASADKAsyHS5uaXRyaWMucHJvdG8uc3RvcmFnZS52MS5CbG9i", + "IjgKFFN0b3JhZ2VFeGlzdHNSZXF1ZXN0EhMKC2J1Y2tldF9uYW1lGAEgASgJ", + "EgsKA2tleRgCIAEoCSInChVTdG9yYWdlRXhpc3RzUmVzcG9uc2USDgoGZXhp", + "c3RzGAEgASgIKikKDUJsb2JFdmVudFR5cGUSCwoHQ3JlYXRlZBAAEgsKB0Rl", + "bGV0ZWQQATKLBQoHU3RvcmFnZRJhCgRSZWFkEisubml0cmljLnByb3RvLnN0", + "b3JhZ2UudjEuU3RvcmFnZVJlYWRSZXF1ZXN0Giwubml0cmljLnByb3RvLnN0", + "b3JhZ2UudjEuU3RvcmFnZVJlYWRSZXNwb25zZRJkCgVXcml0ZRIsLm5pdHJp", + "Yy5wcm90by5zdG9yYWdlLnYxLlN0b3JhZ2VXcml0ZVJlcXVlc3QaLS5uaXRy", + "aWMucHJvdG8uc3RvcmFnZS52MS5TdG9yYWdlV3JpdGVSZXNwb25zZRJnCgZE", + "ZWxldGUSLS5uaXRyaWMucHJvdG8uc3RvcmFnZS52MS5TdG9yYWdlRGVsZXRl", + "UmVxdWVzdBouLm5pdHJpYy5wcm90by5zdG9yYWdlLnYxLlN0b3JhZ2VEZWxl", + "dGVSZXNwb25zZRJzCgpQcmVTaWduVXJsEjEubml0cmljLnByb3RvLnN0b3Jh", + "Z2UudjEuU3RvcmFnZVByZVNpZ25VcmxSZXF1ZXN0GjIubml0cmljLnByb3Rv", + "LnN0b3JhZ2UudjEuU3RvcmFnZVByZVNpZ25VcmxSZXNwb25zZRJwCglMaXN0", + "QmxvYnMSMC5uaXRyaWMucHJvdG8uc3RvcmFnZS52MS5TdG9yYWdlTGlzdEJs", + "b2JzUmVxdWVzdBoxLm5pdHJpYy5wcm90by5zdG9yYWdlLnYxLlN0b3JhZ2VM", + "aXN0QmxvYnNSZXNwb25zZRJnCgZFeGlzdHMSLS5uaXRyaWMucHJvdG8uc3Rv", + "cmFnZS52MS5TdG9yYWdlRXhpc3RzUmVxdWVzdBouLm5pdHJpYy5wcm90by5z", + "dG9yYWdlLnYxLlN0b3JhZ2VFeGlzdHNSZXNwb25zZTJvCg9TdG9yYWdlTGlz", + "dGVuZXISXAoGTGlzdGVuEiYubml0cmljLnByb3RvLnN0b3JhZ2UudjEuQ2xp", + "ZW50TWVzc2FnZRomLm5pdHJpYy5wcm90by5zdG9yYWdlLnYxLlNlcnZlck1l", + "c3NhZ2UoATABQqQBChppby5uaXRyaWMucHJvdG8uc3RvcmFnZS52MUIOU3Rv", + "cmFnZVNlcnZpY2VQAVpAZ2l0aHViLmNvbS9uaXRyaWN0ZWNoL25pdHJpYy9j", + "b3JlL3BrZy9wcm90by9zdG9yYWdlL3YxO3N0b3JhZ2VwYqoCF05pdHJpYy5Q", + "cm90by5TdG9yYWdlLnYxygIXTml0cmljXFByb3RvXFN0b3JhZ2VcVjFiBnBy", + "b3RvMw==")); + descriptor = pbr::FileDescriptor.FromGeneratedCode(descriptorData, + new pbr::FileDescriptor[] { global::Google.Protobuf.WellKnownTypes.DurationReflection.Descriptor, }, + new pbr::GeneratedClrTypeInfo(new[] {typeof(global::Nitric.Proto.Storage.v1.BlobEventType), }, null, new pbr::GeneratedClrTypeInfo[] { + new pbr::GeneratedClrTypeInfo(typeof(global::Nitric.Proto.Storage.v1.ClientMessage), global::Nitric.Proto.Storage.v1.ClientMessage.Parser, new[]{ "Id", "RegistrationRequest", "BlobEventResponse" }, new[]{ "Content" }, null, null, null), + new pbr::GeneratedClrTypeInfo(typeof(global::Nitric.Proto.Storage.v1.ServerMessage), global::Nitric.Proto.Storage.v1.ServerMessage.Parser, new[]{ "Id", "RegistrationResponse", "BlobEventRequest" }, new[]{ "Content" }, null, null, null), + new pbr::GeneratedClrTypeInfo(typeof(global::Nitric.Proto.Storage.v1.BlobEventRequest), global::Nitric.Proto.Storage.v1.BlobEventRequest.Parser, new[]{ "BucketName", "BlobEvent" }, new[]{ "Event" }, null, null, null), + new pbr::GeneratedClrTypeInfo(typeof(global::Nitric.Proto.Storage.v1.BlobEvent), global::Nitric.Proto.Storage.v1.BlobEvent.Parser, new[]{ "Key", "Type" }, null, null, null, null), + new pbr::GeneratedClrTypeInfo(typeof(global::Nitric.Proto.Storage.v1.BlobEventResponse), global::Nitric.Proto.Storage.v1.BlobEventResponse.Parser, new[]{ "Success" }, null, null, null, null), + new pbr::GeneratedClrTypeInfo(typeof(global::Nitric.Proto.Storage.v1.RegistrationRequest), global::Nitric.Proto.Storage.v1.RegistrationRequest.Parser, new[]{ "BucketName", "BlobEventType", "KeyPrefixFilter" }, null, null, null, null), + new pbr::GeneratedClrTypeInfo(typeof(global::Nitric.Proto.Storage.v1.RegistrationResponse), global::Nitric.Proto.Storage.v1.RegistrationResponse.Parser, new[]{ "Id" }, null, null, null, null), + new pbr::GeneratedClrTypeInfo(typeof(global::Nitric.Proto.Storage.v1.StorageWriteRequest), global::Nitric.Proto.Storage.v1.StorageWriteRequest.Parser, new[]{ "BucketName", "Key", "Body" }, null, null, null, null), + new pbr::GeneratedClrTypeInfo(typeof(global::Nitric.Proto.Storage.v1.StorageWriteResponse), global::Nitric.Proto.Storage.v1.StorageWriteResponse.Parser, null, null, null, null, null), + new pbr::GeneratedClrTypeInfo(typeof(global::Nitric.Proto.Storage.v1.StorageReadRequest), global::Nitric.Proto.Storage.v1.StorageReadRequest.Parser, new[]{ "BucketName", "Key" }, null, null, null, null), + new pbr::GeneratedClrTypeInfo(typeof(global::Nitric.Proto.Storage.v1.StorageReadResponse), global::Nitric.Proto.Storage.v1.StorageReadResponse.Parser, new[]{ "Body" }, null, null, null, null), + new pbr::GeneratedClrTypeInfo(typeof(global::Nitric.Proto.Storage.v1.StorageDeleteRequest), global::Nitric.Proto.Storage.v1.StorageDeleteRequest.Parser, new[]{ "BucketName", "Key" }, null, null, null, null), + new pbr::GeneratedClrTypeInfo(typeof(global::Nitric.Proto.Storage.v1.StorageDeleteResponse), global::Nitric.Proto.Storage.v1.StorageDeleteResponse.Parser, null, null, null, null, null), + new pbr::GeneratedClrTypeInfo(typeof(global::Nitric.Proto.Storage.v1.StoragePreSignUrlRequest), global::Nitric.Proto.Storage.v1.StoragePreSignUrlRequest.Parser, new[]{ "BucketName", "Key", "Operation", "Expiry" }, null, new[]{ typeof(global::Nitric.Proto.Storage.v1.StoragePreSignUrlRequest.Types.Operation) }, null, null), + new pbr::GeneratedClrTypeInfo(typeof(global::Nitric.Proto.Storage.v1.StoragePreSignUrlResponse), global::Nitric.Proto.Storage.v1.StoragePreSignUrlResponse.Parser, new[]{ "Url" }, null, null, null, null), + new pbr::GeneratedClrTypeInfo(typeof(global::Nitric.Proto.Storage.v1.StorageListBlobsRequest), global::Nitric.Proto.Storage.v1.StorageListBlobsRequest.Parser, new[]{ "BucketName", "Prefix" }, null, null, null, null), + new pbr::GeneratedClrTypeInfo(typeof(global::Nitric.Proto.Storage.v1.Blob), global::Nitric.Proto.Storage.v1.Blob.Parser, new[]{ "Key" }, null, null, null, null), + new pbr::GeneratedClrTypeInfo(typeof(global::Nitric.Proto.Storage.v1.StorageListBlobsResponse), global::Nitric.Proto.Storage.v1.StorageListBlobsResponse.Parser, new[]{ "Blobs" }, null, null, null, null), + new pbr::GeneratedClrTypeInfo(typeof(global::Nitric.Proto.Storage.v1.StorageExistsRequest), global::Nitric.Proto.Storage.v1.StorageExistsRequest.Parser, new[]{ "BucketName", "Key" }, null, null, null, null), + new pbr::GeneratedClrTypeInfo(typeof(global::Nitric.Proto.Storage.v1.StorageExistsResponse), global::Nitric.Proto.Storage.v1.StorageExistsResponse.Parser, new[]{ "Exists" }, null, null, null, null) + })); + } + #endregion + + } + #region Enums + public enum BlobEventType { + [pbr::OriginalName("Created")] Created = 0, + [pbr::OriginalName("Deleted")] Deleted = 1, + } + + #endregion + + #region Messages + public sealed partial class ClientMessage : pb::IMessage + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + , pb::IBufferMessage + #endif + { + private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new ClientMessage()); + private pb::UnknownFieldSet _unknownFields; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public static pb::MessageParser Parser { get { return _parser; } } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public static pbr::MessageDescriptor Descriptor { + get { return global::Nitric.Proto.Storage.v1.StorageReflection.Descriptor.MessageTypes[0]; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + pbr::MessageDescriptor pb::IMessage.Descriptor { + get { return Descriptor; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public ClientMessage() { + OnConstruction(); + } + + partial void OnConstruction(); + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public ClientMessage(ClientMessage other) : this() { + id_ = other.id_; + switch (other.ContentCase) { + case ContentOneofCase.RegistrationRequest: + RegistrationRequest = other.RegistrationRequest.Clone(); + break; + case ContentOneofCase.BlobEventResponse: + BlobEventResponse = other.BlobEventResponse.Clone(); + break; + } + + _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public ClientMessage Clone() { + return new ClientMessage(this); + } + + /// Field number for the "id" field. + public const int IdFieldNumber = 1; + private string id_ = ""; + /// + /// globally unique ID of the request/response pair + /// + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public string Id { + get { return id_; } + set { + id_ = pb::ProtoPreconditions.CheckNotNull(value, "value"); + } + } + + /// Field number for the "registration_request" field. + public const int RegistrationRequestFieldNumber = 2; + /// + /// Watch for changes on a bucket + /// + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public global::Nitric.Proto.Storage.v1.RegistrationRequest RegistrationRequest { + get { return contentCase_ == ContentOneofCase.RegistrationRequest ? (global::Nitric.Proto.Storage.v1.RegistrationRequest) content_ : null; } + set { + content_ = value; + contentCase_ = value == null ? ContentOneofCase.None : ContentOneofCase.RegistrationRequest; + } + } + + /// Field number for the "blob_event_response" field. + public const int BlobEventResponseFieldNumber = 3; + /// + /// Stop watching for changes on a bucket + /// + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public global::Nitric.Proto.Storage.v1.BlobEventResponse BlobEventResponse { + get { return contentCase_ == ContentOneofCase.BlobEventResponse ? (global::Nitric.Proto.Storage.v1.BlobEventResponse) content_ : null; } + set { + content_ = value; + contentCase_ = value == null ? ContentOneofCase.None : ContentOneofCase.BlobEventResponse; + } + } + + private object content_; + /// Enum of possible cases for the "content" oneof. + public enum ContentOneofCase { + None = 0, + RegistrationRequest = 2, + BlobEventResponse = 3, + } + private ContentOneofCase contentCase_ = ContentOneofCase.None; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public ContentOneofCase ContentCase { + get { return contentCase_; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public void ClearContent() { + contentCase_ = ContentOneofCase.None; + content_ = null; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public override bool Equals(object other) { + return Equals(other as ClientMessage); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public bool Equals(ClientMessage other) { + if (ReferenceEquals(other, null)) { + return false; + } + if (ReferenceEquals(other, this)) { + return true; + } + if (Id != other.Id) return false; + if (!object.Equals(RegistrationRequest, other.RegistrationRequest)) return false; + if (!object.Equals(BlobEventResponse, other.BlobEventResponse)) return false; + if (ContentCase != other.ContentCase) return false; + return Equals(_unknownFields, other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public override int GetHashCode() { + int hash = 1; + if (Id.Length != 0) hash ^= Id.GetHashCode(); + if (contentCase_ == ContentOneofCase.RegistrationRequest) hash ^= RegistrationRequest.GetHashCode(); + if (contentCase_ == ContentOneofCase.BlobEventResponse) hash ^= BlobEventResponse.GetHashCode(); + hash ^= (int) contentCase_; + if (_unknownFields != null) { + hash ^= _unknownFields.GetHashCode(); + } + return hash; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public override string ToString() { + return pb::JsonFormatter.ToDiagnosticString(this); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public void WriteTo(pb::CodedOutputStream output) { + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + output.WriteRawMessage(this); + #else + if (Id.Length != 0) { + output.WriteRawTag(10); + output.WriteString(Id); + } + if (contentCase_ == ContentOneofCase.RegistrationRequest) { + output.WriteRawTag(18); + output.WriteMessage(RegistrationRequest); + } + if (contentCase_ == ContentOneofCase.BlobEventResponse) { + output.WriteRawTag(26); + output.WriteMessage(BlobEventResponse); + } + if (_unknownFields != null) { + _unknownFields.WriteTo(output); + } + #endif + } + + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + void pb::IBufferMessage.InternalWriteTo(ref pb::WriteContext output) { + if (Id.Length != 0) { + output.WriteRawTag(10); + output.WriteString(Id); + } + if (contentCase_ == ContentOneofCase.RegistrationRequest) { + output.WriteRawTag(18); + output.WriteMessage(RegistrationRequest); + } + if (contentCase_ == ContentOneofCase.BlobEventResponse) { + output.WriteRawTag(26); + output.WriteMessage(BlobEventResponse); + } + if (_unknownFields != null) { + _unknownFields.WriteTo(ref output); + } + } + #endif + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public int CalculateSize() { + int size = 0; + if (Id.Length != 0) { + size += 1 + pb::CodedOutputStream.ComputeStringSize(Id); + } + if (contentCase_ == ContentOneofCase.RegistrationRequest) { + size += 1 + pb::CodedOutputStream.ComputeMessageSize(RegistrationRequest); + } + if (contentCase_ == ContentOneofCase.BlobEventResponse) { + size += 1 + pb::CodedOutputStream.ComputeMessageSize(BlobEventResponse); + } + if (_unknownFields != null) { + size += _unknownFields.CalculateSize(); + } + return size; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public void MergeFrom(ClientMessage other) { + if (other == null) { + return; + } + if (other.Id.Length != 0) { + Id = other.Id; + } + switch (other.ContentCase) { + case ContentOneofCase.RegistrationRequest: + if (RegistrationRequest == null) { + RegistrationRequest = new global::Nitric.Proto.Storage.v1.RegistrationRequest(); + } + RegistrationRequest.MergeFrom(other.RegistrationRequest); + break; + case ContentOneofCase.BlobEventResponse: + if (BlobEventResponse == null) { + BlobEventResponse = new global::Nitric.Proto.Storage.v1.BlobEventResponse(); + } + BlobEventResponse.MergeFrom(other.BlobEventResponse); + break; + } + + _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public void MergeFrom(pb::CodedInputStream input) { + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + input.ReadRawMessage(this); + #else + uint tag; + while ((tag = input.ReadTag()) != 0) { + switch(tag) { + default: + _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input); + break; + case 10: { + Id = input.ReadString(); + break; + } + case 18: { + global::Nitric.Proto.Storage.v1.RegistrationRequest subBuilder = new global::Nitric.Proto.Storage.v1.RegistrationRequest(); + if (contentCase_ == ContentOneofCase.RegistrationRequest) { + subBuilder.MergeFrom(RegistrationRequest); + } + input.ReadMessage(subBuilder); + RegistrationRequest = subBuilder; + break; + } + case 26: { + global::Nitric.Proto.Storage.v1.BlobEventResponse subBuilder = new global::Nitric.Proto.Storage.v1.BlobEventResponse(); + if (contentCase_ == ContentOneofCase.BlobEventResponse) { + subBuilder.MergeFrom(BlobEventResponse); + } + input.ReadMessage(subBuilder); + BlobEventResponse = subBuilder; + break; + } + } + } + #endif + } + + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + void pb::IBufferMessage.InternalMergeFrom(ref pb::ParseContext input) { + uint tag; + while ((tag = input.ReadTag()) != 0) { + switch(tag) { + default: + _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, ref input); + break; + case 10: { + Id = input.ReadString(); + break; + } + case 18: { + global::Nitric.Proto.Storage.v1.RegistrationRequest subBuilder = new global::Nitric.Proto.Storage.v1.RegistrationRequest(); + if (contentCase_ == ContentOneofCase.RegistrationRequest) { + subBuilder.MergeFrom(RegistrationRequest); + } + input.ReadMessage(subBuilder); + RegistrationRequest = subBuilder; + break; + } + case 26: { + global::Nitric.Proto.Storage.v1.BlobEventResponse subBuilder = new global::Nitric.Proto.Storage.v1.BlobEventResponse(); + if (contentCase_ == ContentOneofCase.BlobEventResponse) { + subBuilder.MergeFrom(BlobEventResponse); + } + input.ReadMessage(subBuilder); + BlobEventResponse = subBuilder; + break; + } + } + } + } + #endif + + } + + public sealed partial class ServerMessage : pb::IMessage + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + , pb::IBufferMessage + #endif + { + private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new ServerMessage()); + private pb::UnknownFieldSet _unknownFields; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public static pb::MessageParser Parser { get { return _parser; } } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public static pbr::MessageDescriptor Descriptor { + get { return global::Nitric.Proto.Storage.v1.StorageReflection.Descriptor.MessageTypes[1]; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + pbr::MessageDescriptor pb::IMessage.Descriptor { + get { return Descriptor; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public ServerMessage() { + OnConstruction(); + } + + partial void OnConstruction(); + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public ServerMessage(ServerMessage other) : this() { + id_ = other.id_; + switch (other.ContentCase) { + case ContentOneofCase.RegistrationResponse: + RegistrationResponse = other.RegistrationResponse.Clone(); + break; + case ContentOneofCase.BlobEventRequest: + BlobEventRequest = other.BlobEventRequest.Clone(); + break; + } + + _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public ServerMessage Clone() { + return new ServerMessage(this); + } + + /// Field number for the "id" field. + public const int IdFieldNumber = 1; + private string id_ = ""; + /// + /// globally unique ID of the request/response pair + /// + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public string Id { + get { return id_; } + set { + id_ = pb::ProtoPreconditions.CheckNotNull(value, "value"); + } + } + + /// Field number for the "registration_response" field. + public const int RegistrationResponseFieldNumber = 2; + /// + /// Watch for changes on a bucket + /// + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public global::Nitric.Proto.Storage.v1.RegistrationResponse RegistrationResponse { + get { return contentCase_ == ContentOneofCase.RegistrationResponse ? (global::Nitric.Proto.Storage.v1.RegistrationResponse) content_ : null; } + set { + content_ = value; + contentCase_ = value == null ? ContentOneofCase.None : ContentOneofCase.RegistrationResponse; + } + } + + /// Field number for the "blob_event_request" field. + public const int BlobEventRequestFieldNumber = 3; + /// + /// Stop watching for changes on a bucket + /// + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public global::Nitric.Proto.Storage.v1.BlobEventRequest BlobEventRequest { + get { return contentCase_ == ContentOneofCase.BlobEventRequest ? (global::Nitric.Proto.Storage.v1.BlobEventRequest) content_ : null; } + set { + content_ = value; + contentCase_ = value == null ? ContentOneofCase.None : ContentOneofCase.BlobEventRequest; + } + } + + private object content_; + /// Enum of possible cases for the "content" oneof. + public enum ContentOneofCase { + None = 0, + RegistrationResponse = 2, + BlobEventRequest = 3, + } + private ContentOneofCase contentCase_ = ContentOneofCase.None; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public ContentOneofCase ContentCase { + get { return contentCase_; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public void ClearContent() { + contentCase_ = ContentOneofCase.None; + content_ = null; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public override bool Equals(object other) { + return Equals(other as ServerMessage); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public bool Equals(ServerMessage other) { + if (ReferenceEquals(other, null)) { + return false; + } + if (ReferenceEquals(other, this)) { + return true; + } + if (Id != other.Id) return false; + if (!object.Equals(RegistrationResponse, other.RegistrationResponse)) return false; + if (!object.Equals(BlobEventRequest, other.BlobEventRequest)) return false; + if (ContentCase != other.ContentCase) return false; + return Equals(_unknownFields, other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public override int GetHashCode() { + int hash = 1; + if (Id.Length != 0) hash ^= Id.GetHashCode(); + if (contentCase_ == ContentOneofCase.RegistrationResponse) hash ^= RegistrationResponse.GetHashCode(); + if (contentCase_ == ContentOneofCase.BlobEventRequest) hash ^= BlobEventRequest.GetHashCode(); + hash ^= (int) contentCase_; + if (_unknownFields != null) { + hash ^= _unknownFields.GetHashCode(); + } + return hash; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public override string ToString() { + return pb::JsonFormatter.ToDiagnosticString(this); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public void WriteTo(pb::CodedOutputStream output) { + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + output.WriteRawMessage(this); + #else + if (Id.Length != 0) { + output.WriteRawTag(10); + output.WriteString(Id); + } + if (contentCase_ == ContentOneofCase.RegistrationResponse) { + output.WriteRawTag(18); + output.WriteMessage(RegistrationResponse); + } + if (contentCase_ == ContentOneofCase.BlobEventRequest) { + output.WriteRawTag(26); + output.WriteMessage(BlobEventRequest); + } + if (_unknownFields != null) { + _unknownFields.WriteTo(output); + } + #endif + } + + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + void pb::IBufferMessage.InternalWriteTo(ref pb::WriteContext output) { + if (Id.Length != 0) { + output.WriteRawTag(10); + output.WriteString(Id); + } + if (contentCase_ == ContentOneofCase.RegistrationResponse) { + output.WriteRawTag(18); + output.WriteMessage(RegistrationResponse); + } + if (contentCase_ == ContentOneofCase.BlobEventRequest) { + output.WriteRawTag(26); + output.WriteMessage(BlobEventRequest); + } + if (_unknownFields != null) { + _unknownFields.WriteTo(ref output); + } + } + #endif + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public int CalculateSize() { + int size = 0; + if (Id.Length != 0) { + size += 1 + pb::CodedOutputStream.ComputeStringSize(Id); + } + if (contentCase_ == ContentOneofCase.RegistrationResponse) { + size += 1 + pb::CodedOutputStream.ComputeMessageSize(RegistrationResponse); + } + if (contentCase_ == ContentOneofCase.BlobEventRequest) { + size += 1 + pb::CodedOutputStream.ComputeMessageSize(BlobEventRequest); + } + if (_unknownFields != null) { + size += _unknownFields.CalculateSize(); + } + return size; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public void MergeFrom(ServerMessage other) { + if (other == null) { + return; + } + if (other.Id.Length != 0) { + Id = other.Id; + } + switch (other.ContentCase) { + case ContentOneofCase.RegistrationResponse: + if (RegistrationResponse == null) { + RegistrationResponse = new global::Nitric.Proto.Storage.v1.RegistrationResponse(); + } + RegistrationResponse.MergeFrom(other.RegistrationResponse); + break; + case ContentOneofCase.BlobEventRequest: + if (BlobEventRequest == null) { + BlobEventRequest = new global::Nitric.Proto.Storage.v1.BlobEventRequest(); + } + BlobEventRequest.MergeFrom(other.BlobEventRequest); + break; + } + + _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public void MergeFrom(pb::CodedInputStream input) { + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + input.ReadRawMessage(this); + #else + uint tag; + while ((tag = input.ReadTag()) != 0) { + switch(tag) { + default: + _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input); + break; + case 10: { + Id = input.ReadString(); + break; + } + case 18: { + global::Nitric.Proto.Storage.v1.RegistrationResponse subBuilder = new global::Nitric.Proto.Storage.v1.RegistrationResponse(); + if (contentCase_ == ContentOneofCase.RegistrationResponse) { + subBuilder.MergeFrom(RegistrationResponse); + } + input.ReadMessage(subBuilder); + RegistrationResponse = subBuilder; + break; + } + case 26: { + global::Nitric.Proto.Storage.v1.BlobEventRequest subBuilder = new global::Nitric.Proto.Storage.v1.BlobEventRequest(); + if (contentCase_ == ContentOneofCase.BlobEventRequest) { + subBuilder.MergeFrom(BlobEventRequest); + } + input.ReadMessage(subBuilder); + BlobEventRequest = subBuilder; + break; + } + } + } + #endif + } + + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + void pb::IBufferMessage.InternalMergeFrom(ref pb::ParseContext input) { + uint tag; + while ((tag = input.ReadTag()) != 0) { + switch(tag) { + default: + _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, ref input); + break; + case 10: { + Id = input.ReadString(); + break; + } + case 18: { + global::Nitric.Proto.Storage.v1.RegistrationResponse subBuilder = new global::Nitric.Proto.Storage.v1.RegistrationResponse(); + if (contentCase_ == ContentOneofCase.RegistrationResponse) { + subBuilder.MergeFrom(RegistrationResponse); + } + input.ReadMessage(subBuilder); + RegistrationResponse = subBuilder; + break; + } + case 26: { + global::Nitric.Proto.Storage.v1.BlobEventRequest subBuilder = new global::Nitric.Proto.Storage.v1.BlobEventRequest(); + if (contentCase_ == ContentOneofCase.BlobEventRequest) { + subBuilder.MergeFrom(BlobEventRequest); + } + input.ReadMessage(subBuilder); + BlobEventRequest = subBuilder; + break; + } + } + } + } + #endif + + } + + public sealed partial class BlobEventRequest : pb::IMessage + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + , pb::IBufferMessage + #endif + { + private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new BlobEventRequest()); + private pb::UnknownFieldSet _unknownFields; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public static pb::MessageParser Parser { get { return _parser; } } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public static pbr::MessageDescriptor Descriptor { + get { return global::Nitric.Proto.Storage.v1.StorageReflection.Descriptor.MessageTypes[2]; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + pbr::MessageDescriptor pb::IMessage.Descriptor { + get { return Descriptor; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public BlobEventRequest() { + OnConstruction(); + } + + partial void OnConstruction(); + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public BlobEventRequest(BlobEventRequest other) : this() { + bucketName_ = other.bucketName_; + switch (other.EventCase) { + case EventOneofCase.BlobEvent: + BlobEvent = other.BlobEvent.Clone(); + break; + } + + _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public BlobEventRequest Clone() { + return new BlobEventRequest(this); + } + + /// Field number for the "bucket_name" field. + public const int BucketNameFieldNumber = 1; + private string bucketName_ = ""; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public string BucketName { + get { return bucketName_; } + set { + bucketName_ = pb::ProtoPreconditions.CheckNotNull(value, "value"); + } + } + + /// Field number for the "blob_event" field. + public const int BlobEventFieldNumber = 10; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public global::Nitric.Proto.Storage.v1.BlobEvent BlobEvent { + get { return eventCase_ == EventOneofCase.BlobEvent ? (global::Nitric.Proto.Storage.v1.BlobEvent) event_ : null; } + set { + event_ = value; + eventCase_ = value == null ? EventOneofCase.None : EventOneofCase.BlobEvent; + } + } + + private object event_; + /// Enum of possible cases for the "event" oneof. + public enum EventOneofCase { + None = 0, + BlobEvent = 10, + } + private EventOneofCase eventCase_ = EventOneofCase.None; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public EventOneofCase EventCase { + get { return eventCase_; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public void ClearEvent() { + eventCase_ = EventOneofCase.None; + event_ = null; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public override bool Equals(object other) { + return Equals(other as BlobEventRequest); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public bool Equals(BlobEventRequest other) { + if (ReferenceEquals(other, null)) { + return false; + } + if (ReferenceEquals(other, this)) { + return true; + } + if (BucketName != other.BucketName) return false; + if (!object.Equals(BlobEvent, other.BlobEvent)) return false; + if (EventCase != other.EventCase) return false; + return Equals(_unknownFields, other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public override int GetHashCode() { + int hash = 1; + if (BucketName.Length != 0) hash ^= BucketName.GetHashCode(); + if (eventCase_ == EventOneofCase.BlobEvent) hash ^= BlobEvent.GetHashCode(); + hash ^= (int) eventCase_; + if (_unknownFields != null) { + hash ^= _unknownFields.GetHashCode(); + } + return hash; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public override string ToString() { + return pb::JsonFormatter.ToDiagnosticString(this); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public void WriteTo(pb::CodedOutputStream output) { + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + output.WriteRawMessage(this); + #else + if (BucketName.Length != 0) { + output.WriteRawTag(10); + output.WriteString(BucketName); + } + if (eventCase_ == EventOneofCase.BlobEvent) { + output.WriteRawTag(82); + output.WriteMessage(BlobEvent); + } + if (_unknownFields != null) { + _unknownFields.WriteTo(output); + } + #endif + } + + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + void pb::IBufferMessage.InternalWriteTo(ref pb::WriteContext output) { + if (BucketName.Length != 0) { + output.WriteRawTag(10); + output.WriteString(BucketName); + } + if (eventCase_ == EventOneofCase.BlobEvent) { + output.WriteRawTag(82); + output.WriteMessage(BlobEvent); + } + if (_unknownFields != null) { + _unknownFields.WriteTo(ref output); + } + } + #endif + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public int CalculateSize() { + int size = 0; + if (BucketName.Length != 0) { + size += 1 + pb::CodedOutputStream.ComputeStringSize(BucketName); + } + if (eventCase_ == EventOneofCase.BlobEvent) { + size += 1 + pb::CodedOutputStream.ComputeMessageSize(BlobEvent); + } + if (_unknownFields != null) { + size += _unknownFields.CalculateSize(); + } + return size; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public void MergeFrom(BlobEventRequest other) { + if (other == null) { + return; + } + if (other.BucketName.Length != 0) { + BucketName = other.BucketName; + } + switch (other.EventCase) { + case EventOneofCase.BlobEvent: + if (BlobEvent == null) { + BlobEvent = new global::Nitric.Proto.Storage.v1.BlobEvent(); + } + BlobEvent.MergeFrom(other.BlobEvent); + break; + } + + _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public void MergeFrom(pb::CodedInputStream input) { + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + input.ReadRawMessage(this); + #else + uint tag; + while ((tag = input.ReadTag()) != 0) { + switch(tag) { + default: + _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input); + break; + case 10: { + BucketName = input.ReadString(); + break; + } + case 82: { + global::Nitric.Proto.Storage.v1.BlobEvent subBuilder = new global::Nitric.Proto.Storage.v1.BlobEvent(); + if (eventCase_ == EventOneofCase.BlobEvent) { + subBuilder.MergeFrom(BlobEvent); + } + input.ReadMessage(subBuilder); + BlobEvent = subBuilder; + break; + } + } + } + #endif + } + + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + void pb::IBufferMessage.InternalMergeFrom(ref pb::ParseContext input) { + uint tag; + while ((tag = input.ReadTag()) != 0) { + switch(tag) { + default: + _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, ref input); + break; + case 10: { + BucketName = input.ReadString(); + break; + } + case 82: { + global::Nitric.Proto.Storage.v1.BlobEvent subBuilder = new global::Nitric.Proto.Storage.v1.BlobEvent(); + if (eventCase_ == EventOneofCase.BlobEvent) { + subBuilder.MergeFrom(BlobEvent); + } + input.ReadMessage(subBuilder); + BlobEvent = subBuilder; + break; + } + } + } + } + #endif + + } + + public sealed partial class BlobEvent : pb::IMessage + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + , pb::IBufferMessage + #endif + { + private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new BlobEvent()); + private pb::UnknownFieldSet _unknownFields; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public static pb::MessageParser Parser { get { return _parser; } } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public static pbr::MessageDescriptor Descriptor { + get { return global::Nitric.Proto.Storage.v1.StorageReflection.Descriptor.MessageTypes[3]; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + pbr::MessageDescriptor pb::IMessage.Descriptor { + get { return Descriptor; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public BlobEvent() { + OnConstruction(); + } + + partial void OnConstruction(); + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public BlobEvent(BlobEvent other) : this() { + key_ = other.key_; + type_ = other.type_; + _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public BlobEvent Clone() { + return new BlobEvent(this); + } + + /// Field number for the "key" field. + public const int KeyFieldNumber = 1; + private string key_ = ""; + /// + /// The key of the blob the event is for + /// + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public string Key { + get { return key_; } + set { + key_ = pb::ProtoPreconditions.CheckNotNull(value, "value"); + } + } + + /// Field number for the "type" field. + public const int TypeFieldNumber = 2; + private global::Nitric.Proto.Storage.v1.BlobEventType type_ = global::Nitric.Proto.Storage.v1.BlobEventType.Created; + /// + /// The type of event that occurred + /// + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public global::Nitric.Proto.Storage.v1.BlobEventType Type { + get { return type_; } + set { + type_ = value; + } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public override bool Equals(object other) { + return Equals(other as BlobEvent); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public bool Equals(BlobEvent other) { + if (ReferenceEquals(other, null)) { + return false; + } + if (ReferenceEquals(other, this)) { + return true; + } + if (Key != other.Key) return false; + if (Type != other.Type) return false; + return Equals(_unknownFields, other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public override int GetHashCode() { + int hash = 1; + if (Key.Length != 0) hash ^= Key.GetHashCode(); + if (Type != global::Nitric.Proto.Storage.v1.BlobEventType.Created) hash ^= Type.GetHashCode(); + if (_unknownFields != null) { + hash ^= _unknownFields.GetHashCode(); + } + return hash; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public override string ToString() { + return pb::JsonFormatter.ToDiagnosticString(this); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public void WriteTo(pb::CodedOutputStream output) { + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + output.WriteRawMessage(this); + #else + if (Key.Length != 0) { + output.WriteRawTag(10); + output.WriteString(Key); + } + if (Type != global::Nitric.Proto.Storage.v1.BlobEventType.Created) { + output.WriteRawTag(16); + output.WriteEnum((int) Type); + } + if (_unknownFields != null) { + _unknownFields.WriteTo(output); + } + #endif + } + + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + void pb::IBufferMessage.InternalWriteTo(ref pb::WriteContext output) { + if (Key.Length != 0) { + output.WriteRawTag(10); + output.WriteString(Key); + } + if (Type != global::Nitric.Proto.Storage.v1.BlobEventType.Created) { + output.WriteRawTag(16); + output.WriteEnum((int) Type); + } + if (_unknownFields != null) { + _unknownFields.WriteTo(ref output); + } + } + #endif + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public int CalculateSize() { + int size = 0; + if (Key.Length != 0) { + size += 1 + pb::CodedOutputStream.ComputeStringSize(Key); + } + if (Type != global::Nitric.Proto.Storage.v1.BlobEventType.Created) { + size += 1 + pb::CodedOutputStream.ComputeEnumSize((int) Type); + } + if (_unknownFields != null) { + size += _unknownFields.CalculateSize(); + } + return size; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public void MergeFrom(BlobEvent other) { + if (other == null) { + return; + } + if (other.Key.Length != 0) { + Key = other.Key; + } + if (other.Type != global::Nitric.Proto.Storage.v1.BlobEventType.Created) { + Type = other.Type; + } + _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public void MergeFrom(pb::CodedInputStream input) { + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + input.ReadRawMessage(this); + #else + uint tag; + while ((tag = input.ReadTag()) != 0) { + switch(tag) { + default: + _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input); + break; + case 10: { + Key = input.ReadString(); + break; + } + case 16: { + Type = (global::Nitric.Proto.Storage.v1.BlobEventType) input.ReadEnum(); + break; + } + } + } + #endif + } + + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + void pb::IBufferMessage.InternalMergeFrom(ref pb::ParseContext input) { + uint tag; + while ((tag = input.ReadTag()) != 0) { + switch(tag) { + default: + _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, ref input); + break; + case 10: { + Key = input.ReadString(); + break; + } + case 16: { + Type = (global::Nitric.Proto.Storage.v1.BlobEventType) input.ReadEnum(); + break; + } + } + } + } + #endif + + } + + public sealed partial class BlobEventResponse : pb::IMessage + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + , pb::IBufferMessage + #endif + { + private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new BlobEventResponse()); + private pb::UnknownFieldSet _unknownFields; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public static pb::MessageParser Parser { get { return _parser; } } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public static pbr::MessageDescriptor Descriptor { + get { return global::Nitric.Proto.Storage.v1.StorageReflection.Descriptor.MessageTypes[4]; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + pbr::MessageDescriptor pb::IMessage.Descriptor { + get { return Descriptor; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public BlobEventResponse() { + OnConstruction(); + } + + partial void OnConstruction(); + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public BlobEventResponse(BlobEventResponse other) : this() { + success_ = other.success_; + _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public BlobEventResponse Clone() { + return new BlobEventResponse(this); + } + + /// Field number for the "success" field. + public const int SuccessFieldNumber = 1; + private bool success_; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public bool Success { + get { return success_; } + set { + success_ = value; + } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public override bool Equals(object other) { + return Equals(other as BlobEventResponse); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public bool Equals(BlobEventResponse other) { + if (ReferenceEquals(other, null)) { + return false; + } + if (ReferenceEquals(other, this)) { + return true; + } + if (Success != other.Success) return false; + return Equals(_unknownFields, other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public override int GetHashCode() { + int hash = 1; + if (Success != false) hash ^= Success.GetHashCode(); + if (_unknownFields != null) { + hash ^= _unknownFields.GetHashCode(); + } + return hash; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public override string ToString() { + return pb::JsonFormatter.ToDiagnosticString(this); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public void WriteTo(pb::CodedOutputStream output) { + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + output.WriteRawMessage(this); + #else + if (Success != false) { + output.WriteRawTag(8); + output.WriteBool(Success); + } + if (_unknownFields != null) { + _unknownFields.WriteTo(output); + } + #endif + } + + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + void pb::IBufferMessage.InternalWriteTo(ref pb::WriteContext output) { + if (Success != false) { + output.WriteRawTag(8); + output.WriteBool(Success); + } + if (_unknownFields != null) { + _unknownFields.WriteTo(ref output); + } + } + #endif + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public int CalculateSize() { + int size = 0; + if (Success != false) { + size += 1 + 1; + } + if (_unknownFields != null) { + size += _unknownFields.CalculateSize(); + } + return size; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public void MergeFrom(BlobEventResponse other) { + if (other == null) { + return; + } + if (other.Success != false) { + Success = other.Success; + } + _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public void MergeFrom(pb::CodedInputStream input) { + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + input.ReadRawMessage(this); + #else + uint tag; + while ((tag = input.ReadTag()) != 0) { + switch(tag) { + default: + _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input); + break; + case 8: { + Success = input.ReadBool(); + break; + } + } + } + #endif + } + + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + void pb::IBufferMessage.InternalMergeFrom(ref pb::ParseContext input) { + uint tag; + while ((tag = input.ReadTag()) != 0) { + switch(tag) { + default: + _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, ref input); + break; + case 8: { + Success = input.ReadBool(); + break; + } + } + } + } + #endif + + } + + public sealed partial class RegistrationRequest : pb::IMessage + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + , pb::IBufferMessage + #endif + { + private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new RegistrationRequest()); + private pb::UnknownFieldSet _unknownFields; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public static pb::MessageParser Parser { get { return _parser; } } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public static pbr::MessageDescriptor Descriptor { + get { return global::Nitric.Proto.Storage.v1.StorageReflection.Descriptor.MessageTypes[5]; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + pbr::MessageDescriptor pb::IMessage.Descriptor { + get { return Descriptor; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public RegistrationRequest() { + OnConstruction(); + } + + partial void OnConstruction(); + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public RegistrationRequest(RegistrationRequest other) : this() { + bucketName_ = other.bucketName_; + blobEventType_ = other.blobEventType_; + keyPrefixFilter_ = other.keyPrefixFilter_; + _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public RegistrationRequest Clone() { + return new RegistrationRequest(this); + } + + /// Field number for the "bucket_name" field. + public const int BucketNameFieldNumber = 1; + private string bucketName_ = ""; + /// + /// Name of the bucket to watch + /// + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public string BucketName { + get { return bucketName_; } + set { + bucketName_ = pb::ProtoPreconditions.CheckNotNull(value, "value"); + } + } + + /// Field number for the "blob_event_type" field. + public const int BlobEventTypeFieldNumber = 2; + private global::Nitric.Proto.Storage.v1.BlobEventType blobEventType_ = global::Nitric.Proto.Storage.v1.BlobEventType.Created; + /// + /// Event type to listen for + /// + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public global::Nitric.Proto.Storage.v1.BlobEventType BlobEventType { + get { return blobEventType_; } + set { + blobEventType_ = value; + } + } + + /// Field number for the "key_prefix_filter" field. + public const int KeyPrefixFilterFieldNumber = 3; + private string keyPrefixFilter_ = ""; + /// + /// A blob key prefix to filter events by + /// + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public string KeyPrefixFilter { + get { return keyPrefixFilter_; } + set { + keyPrefixFilter_ = pb::ProtoPreconditions.CheckNotNull(value, "value"); + } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public override bool Equals(object other) { + return Equals(other as RegistrationRequest); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public bool Equals(RegistrationRequest other) { + if (ReferenceEquals(other, null)) { + return false; + } + if (ReferenceEquals(other, this)) { + return true; + } + if (BucketName != other.BucketName) return false; + if (BlobEventType != other.BlobEventType) return false; + if (KeyPrefixFilter != other.KeyPrefixFilter) return false; + return Equals(_unknownFields, other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public override int GetHashCode() { + int hash = 1; + if (BucketName.Length != 0) hash ^= BucketName.GetHashCode(); + if (BlobEventType != global::Nitric.Proto.Storage.v1.BlobEventType.Created) hash ^= BlobEventType.GetHashCode(); + if (KeyPrefixFilter.Length != 0) hash ^= KeyPrefixFilter.GetHashCode(); + if (_unknownFields != null) { + hash ^= _unknownFields.GetHashCode(); + } + return hash; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public override string ToString() { + return pb::JsonFormatter.ToDiagnosticString(this); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public void WriteTo(pb::CodedOutputStream output) { + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + output.WriteRawMessage(this); + #else + if (BucketName.Length != 0) { + output.WriteRawTag(10); + output.WriteString(BucketName); + } + if (BlobEventType != global::Nitric.Proto.Storage.v1.BlobEventType.Created) { + output.WriteRawTag(16); + output.WriteEnum((int) BlobEventType); + } + if (KeyPrefixFilter.Length != 0) { + output.WriteRawTag(26); + output.WriteString(KeyPrefixFilter); + } + if (_unknownFields != null) { + _unknownFields.WriteTo(output); + } + #endif + } + + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + void pb::IBufferMessage.InternalWriteTo(ref pb::WriteContext output) { + if (BucketName.Length != 0) { + output.WriteRawTag(10); + output.WriteString(BucketName); + } + if (BlobEventType != global::Nitric.Proto.Storage.v1.BlobEventType.Created) { + output.WriteRawTag(16); + output.WriteEnum((int) BlobEventType); + } + if (KeyPrefixFilter.Length != 0) { + output.WriteRawTag(26); + output.WriteString(KeyPrefixFilter); + } + if (_unknownFields != null) { + _unknownFields.WriteTo(ref output); + } + } + #endif + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public int CalculateSize() { + int size = 0; + if (BucketName.Length != 0) { + size += 1 + pb::CodedOutputStream.ComputeStringSize(BucketName); + } + if (BlobEventType != global::Nitric.Proto.Storage.v1.BlobEventType.Created) { + size += 1 + pb::CodedOutputStream.ComputeEnumSize((int) BlobEventType); + } + if (KeyPrefixFilter.Length != 0) { + size += 1 + pb::CodedOutputStream.ComputeStringSize(KeyPrefixFilter); + } + if (_unknownFields != null) { + size += _unknownFields.CalculateSize(); + } + return size; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public void MergeFrom(RegistrationRequest other) { + if (other == null) { + return; + } + if (other.BucketName.Length != 0) { + BucketName = other.BucketName; + } + if (other.BlobEventType != global::Nitric.Proto.Storage.v1.BlobEventType.Created) { + BlobEventType = other.BlobEventType; + } + if (other.KeyPrefixFilter.Length != 0) { + KeyPrefixFilter = other.KeyPrefixFilter; + } + _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public void MergeFrom(pb::CodedInputStream input) { + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + input.ReadRawMessage(this); + #else + uint tag; + while ((tag = input.ReadTag()) != 0) { + switch(tag) { + default: + _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input); + break; + case 10: { + BucketName = input.ReadString(); + break; + } + case 16: { + BlobEventType = (global::Nitric.Proto.Storage.v1.BlobEventType) input.ReadEnum(); + break; + } + case 26: { + KeyPrefixFilter = input.ReadString(); + break; + } + } + } + #endif + } + + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + void pb::IBufferMessage.InternalMergeFrom(ref pb::ParseContext input) { + uint tag; + while ((tag = input.ReadTag()) != 0) { + switch(tag) { + default: + _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, ref input); + break; + case 10: { + BucketName = input.ReadString(); + break; + } + case 16: { + BlobEventType = (global::Nitric.Proto.Storage.v1.BlobEventType) input.ReadEnum(); + break; + } + case 26: { + KeyPrefixFilter = input.ReadString(); + break; + } + } + } + } + #endif + + } + + public sealed partial class RegistrationResponse : pb::IMessage + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + , pb::IBufferMessage + #endif + { + private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new RegistrationResponse()); + private pb::UnknownFieldSet _unknownFields; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public static pb::MessageParser Parser { get { return _parser; } } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public static pbr::MessageDescriptor Descriptor { + get { return global::Nitric.Proto.Storage.v1.StorageReflection.Descriptor.MessageTypes[6]; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + pbr::MessageDescriptor pb::IMessage.Descriptor { + get { return Descriptor; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public RegistrationResponse() { + OnConstruction(); + } + + partial void OnConstruction(); + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public RegistrationResponse(RegistrationResponse other) : this() { + id_ = other.id_; + _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public RegistrationResponse Clone() { + return new RegistrationResponse(this); + } + + /// Field number for the "id" field. + public const int IdFieldNumber = 1; + private string id_ = ""; + /// + /// The ID of the registration + /// + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public string Id { + get { return id_; } + set { + id_ = pb::ProtoPreconditions.CheckNotNull(value, "value"); + } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public override bool Equals(object other) { + return Equals(other as RegistrationResponse); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public bool Equals(RegistrationResponse other) { + if (ReferenceEquals(other, null)) { + return false; + } + if (ReferenceEquals(other, this)) { + return true; + } + if (Id != other.Id) return false; + return Equals(_unknownFields, other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public override int GetHashCode() { + int hash = 1; + if (Id.Length != 0) hash ^= Id.GetHashCode(); + if (_unknownFields != null) { + hash ^= _unknownFields.GetHashCode(); + } + return hash; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public override string ToString() { + return pb::JsonFormatter.ToDiagnosticString(this); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public void WriteTo(pb::CodedOutputStream output) { + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + output.WriteRawMessage(this); + #else + if (Id.Length != 0) { + output.WriteRawTag(10); + output.WriteString(Id); + } + if (_unknownFields != null) { + _unknownFields.WriteTo(output); + } + #endif + } + + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + void pb::IBufferMessage.InternalWriteTo(ref pb::WriteContext output) { + if (Id.Length != 0) { + output.WriteRawTag(10); + output.WriteString(Id); + } + if (_unknownFields != null) { + _unknownFields.WriteTo(ref output); + } + } + #endif + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public int CalculateSize() { + int size = 0; + if (Id.Length != 0) { + size += 1 + pb::CodedOutputStream.ComputeStringSize(Id); + } + if (_unknownFields != null) { + size += _unknownFields.CalculateSize(); + } + return size; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public void MergeFrom(RegistrationResponse other) { + if (other == null) { + return; + } + if (other.Id.Length != 0) { + Id = other.Id; + } + _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public void MergeFrom(pb::CodedInputStream input) { + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + input.ReadRawMessage(this); + #else + uint tag; + while ((tag = input.ReadTag()) != 0) { + switch(tag) { + default: + _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input); + break; + case 10: { + Id = input.ReadString(); + break; + } + } + } + #endif + } + + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + void pb::IBufferMessage.InternalMergeFrom(ref pb::ParseContext input) { + uint tag; + while ((tag = input.ReadTag()) != 0) { + switch(tag) { + default: + _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, ref input); + break; + case 10: { + Id = input.ReadString(); + break; + } + } + } + } + #endif + + } + + /// + /// Request to put (create/update) a storage item + /// + public sealed partial class StorageWriteRequest : pb::IMessage + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + , pb::IBufferMessage + #endif + { + private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new StorageWriteRequest()); + private pb::UnknownFieldSet _unknownFields; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public static pb::MessageParser Parser { get { return _parser; } } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public static pbr::MessageDescriptor Descriptor { + get { return global::Nitric.Proto.Storage.v1.StorageReflection.Descriptor.MessageTypes[7]; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + pbr::MessageDescriptor pb::IMessage.Descriptor { + get { return Descriptor; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public StorageWriteRequest() { + OnConstruction(); + } + + partial void OnConstruction(); + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public StorageWriteRequest(StorageWriteRequest other) : this() { + bucketName_ = other.bucketName_; + key_ = other.key_; + body_ = other.body_; + _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public StorageWriteRequest Clone() { + return new StorageWriteRequest(this); + } + + /// Field number for the "bucket_name" field. + public const int BucketNameFieldNumber = 1; + private string bucketName_ = ""; + /// + /// Nitric name of the bucket to store in + /// this will be automatically resolved to the provider specific bucket identifier. + /// + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public string BucketName { + get { return bucketName_; } + set { + bucketName_ = pb::ProtoPreconditions.CheckNotNull(value, "value"); + } + } + + /// Field number for the "key" field. + public const int KeyFieldNumber = 2; + private string key_ = ""; + /// + /// Key to store the item under + /// + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public string Key { + get { return key_; } + set { + key_ = pb::ProtoPreconditions.CheckNotNull(value, "value"); + } + } + + /// Field number for the "body" field. + public const int BodyFieldNumber = 3; + private pb::ByteString body_ = pb::ByteString.Empty; + /// + /// bytes array to store + /// + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public pb::ByteString Body { + get { return body_; } + set { + body_ = pb::ProtoPreconditions.CheckNotNull(value, "value"); + } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public override bool Equals(object other) { + return Equals(other as StorageWriteRequest); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public bool Equals(StorageWriteRequest other) { + if (ReferenceEquals(other, null)) { + return false; + } + if (ReferenceEquals(other, this)) { + return true; + } + if (BucketName != other.BucketName) return false; + if (Key != other.Key) return false; + if (Body != other.Body) return false; + return Equals(_unknownFields, other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public override int GetHashCode() { + int hash = 1; + if (BucketName.Length != 0) hash ^= BucketName.GetHashCode(); + if (Key.Length != 0) hash ^= Key.GetHashCode(); + if (Body.Length != 0) hash ^= Body.GetHashCode(); + if (_unknownFields != null) { + hash ^= _unknownFields.GetHashCode(); + } + return hash; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public override string ToString() { + return pb::JsonFormatter.ToDiagnosticString(this); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public void WriteTo(pb::CodedOutputStream output) { + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + output.WriteRawMessage(this); + #else + if (BucketName.Length != 0) { + output.WriteRawTag(10); + output.WriteString(BucketName); + } + if (Key.Length != 0) { + output.WriteRawTag(18); + output.WriteString(Key); + } + if (Body.Length != 0) { + output.WriteRawTag(26); + output.WriteBytes(Body); + } + if (_unknownFields != null) { + _unknownFields.WriteTo(output); + } + #endif + } + + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + void pb::IBufferMessage.InternalWriteTo(ref pb::WriteContext output) { + if (BucketName.Length != 0) { + output.WriteRawTag(10); + output.WriteString(BucketName); + } + if (Key.Length != 0) { + output.WriteRawTag(18); + output.WriteString(Key); + } + if (Body.Length != 0) { + output.WriteRawTag(26); + output.WriteBytes(Body); + } + if (_unknownFields != null) { + _unknownFields.WriteTo(ref output); + } + } + #endif + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public int CalculateSize() { + int size = 0; + if (BucketName.Length != 0) { + size += 1 + pb::CodedOutputStream.ComputeStringSize(BucketName); + } + if (Key.Length != 0) { + size += 1 + pb::CodedOutputStream.ComputeStringSize(Key); + } + if (Body.Length != 0) { + size += 1 + pb::CodedOutputStream.ComputeBytesSize(Body); + } + if (_unknownFields != null) { + size += _unknownFields.CalculateSize(); + } + return size; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public void MergeFrom(StorageWriteRequest other) { + if (other == null) { + return; + } + if (other.BucketName.Length != 0) { + BucketName = other.BucketName; + } + if (other.Key.Length != 0) { + Key = other.Key; + } + if (other.Body.Length != 0) { + Body = other.Body; + } + _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public void MergeFrom(pb::CodedInputStream input) { + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + input.ReadRawMessage(this); + #else + uint tag; + while ((tag = input.ReadTag()) != 0) { + switch(tag) { + default: + _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input); + break; + case 10: { + BucketName = input.ReadString(); + break; + } + case 18: { + Key = input.ReadString(); + break; + } + case 26: { + Body = input.ReadBytes(); + break; + } + } + } + #endif + } + + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + void pb::IBufferMessage.InternalMergeFrom(ref pb::ParseContext input) { + uint tag; + while ((tag = input.ReadTag()) != 0) { + switch(tag) { + default: + _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, ref input); + break; + case 10: { + BucketName = input.ReadString(); + break; + } + case 18: { + Key = input.ReadString(); + break; + } + case 26: { + Body = input.ReadBytes(); + break; + } + } + } + } + #endif + + } + + /// + /// Result of putting a storage item + /// + public sealed partial class StorageWriteResponse : pb::IMessage + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + , pb::IBufferMessage + #endif + { + private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new StorageWriteResponse()); + private pb::UnknownFieldSet _unknownFields; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public static pb::MessageParser Parser { get { return _parser; } } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public static pbr::MessageDescriptor Descriptor { + get { return global::Nitric.Proto.Storage.v1.StorageReflection.Descriptor.MessageTypes[8]; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + pbr::MessageDescriptor pb::IMessage.Descriptor { + get { return Descriptor; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public StorageWriteResponse() { + OnConstruction(); + } + + partial void OnConstruction(); + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public StorageWriteResponse(StorageWriteResponse other) : this() { + _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public StorageWriteResponse Clone() { + return new StorageWriteResponse(this); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public override bool Equals(object other) { + return Equals(other as StorageWriteResponse); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public bool Equals(StorageWriteResponse other) { + if (ReferenceEquals(other, null)) { + return false; + } + if (ReferenceEquals(other, this)) { + return true; + } + return Equals(_unknownFields, other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public override int GetHashCode() { + int hash = 1; + if (_unknownFields != null) { + hash ^= _unknownFields.GetHashCode(); + } + return hash; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public override string ToString() { + return pb::JsonFormatter.ToDiagnosticString(this); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public void WriteTo(pb::CodedOutputStream output) { + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + output.WriteRawMessage(this); + #else + if (_unknownFields != null) { + _unknownFields.WriteTo(output); + } + #endif + } + + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + void pb::IBufferMessage.InternalWriteTo(ref pb::WriteContext output) { + if (_unknownFields != null) { + _unknownFields.WriteTo(ref output); + } + } + #endif + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public int CalculateSize() { + int size = 0; + if (_unknownFields != null) { + size += _unknownFields.CalculateSize(); + } + return size; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public void MergeFrom(StorageWriteResponse other) { + if (other == null) { + return; + } + _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public void MergeFrom(pb::CodedInputStream input) { + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + input.ReadRawMessage(this); + #else + uint tag; + while ((tag = input.ReadTag()) != 0) { + switch(tag) { + default: + _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input); + break; + } + } + #endif + } + + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + void pb::IBufferMessage.InternalMergeFrom(ref pb::ParseContext input) { + uint tag; + while ((tag = input.ReadTag()) != 0) { + switch(tag) { + default: + _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, ref input); + break; + } + } + } + #endif + + } + + /// + /// Request to retrieve a storage item + /// + public sealed partial class StorageReadRequest : pb::IMessage + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + , pb::IBufferMessage + #endif + { + private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new StorageReadRequest()); + private pb::UnknownFieldSet _unknownFields; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public static pb::MessageParser Parser { get { return _parser; } } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public static pbr::MessageDescriptor Descriptor { + get { return global::Nitric.Proto.Storage.v1.StorageReflection.Descriptor.MessageTypes[9]; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + pbr::MessageDescriptor pb::IMessage.Descriptor { + get { return Descriptor; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public StorageReadRequest() { + OnConstruction(); + } + + partial void OnConstruction(); + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public StorageReadRequest(StorageReadRequest other) : this() { + bucketName_ = other.bucketName_; + key_ = other.key_; + _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public StorageReadRequest Clone() { + return new StorageReadRequest(this); + } + + /// Field number for the "bucket_name" field. + public const int BucketNameFieldNumber = 1; + private string bucketName_ = ""; + /// + /// Nitric name of the bucket to retrieve from + /// this will be automatically resolved to the provider specific bucket identifier. + /// + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public string BucketName { + get { return bucketName_; } + set { + bucketName_ = pb::ProtoPreconditions.CheckNotNull(value, "value"); + } + } + + /// Field number for the "key" field. + public const int KeyFieldNumber = 2; + private string key_ = ""; + /// + /// Key of item to retrieve + /// + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public string Key { + get { return key_; } + set { + key_ = pb::ProtoPreconditions.CheckNotNull(value, "value"); + } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public override bool Equals(object other) { + return Equals(other as StorageReadRequest); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public bool Equals(StorageReadRequest other) { + if (ReferenceEquals(other, null)) { + return false; + } + if (ReferenceEquals(other, this)) { + return true; + } + if (BucketName != other.BucketName) return false; + if (Key != other.Key) return false; + return Equals(_unknownFields, other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public override int GetHashCode() { + int hash = 1; + if (BucketName.Length != 0) hash ^= BucketName.GetHashCode(); + if (Key.Length != 0) hash ^= Key.GetHashCode(); + if (_unknownFields != null) { + hash ^= _unknownFields.GetHashCode(); + } + return hash; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public override string ToString() { + return pb::JsonFormatter.ToDiagnosticString(this); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public void WriteTo(pb::CodedOutputStream output) { + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + output.WriteRawMessage(this); + #else + if (BucketName.Length != 0) { + output.WriteRawTag(10); + output.WriteString(BucketName); + } + if (Key.Length != 0) { + output.WriteRawTag(18); + output.WriteString(Key); + } + if (_unknownFields != null) { + _unknownFields.WriteTo(output); + } + #endif + } + + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + void pb::IBufferMessage.InternalWriteTo(ref pb::WriteContext output) { + if (BucketName.Length != 0) { + output.WriteRawTag(10); + output.WriteString(BucketName); + } + if (Key.Length != 0) { + output.WriteRawTag(18); + output.WriteString(Key); + } + if (_unknownFields != null) { + _unknownFields.WriteTo(ref output); + } + } + #endif + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public int CalculateSize() { + int size = 0; + if (BucketName.Length != 0) { + size += 1 + pb::CodedOutputStream.ComputeStringSize(BucketName); + } + if (Key.Length != 0) { + size += 1 + pb::CodedOutputStream.ComputeStringSize(Key); + } + if (_unknownFields != null) { + size += _unknownFields.CalculateSize(); + } + return size; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public void MergeFrom(StorageReadRequest other) { + if (other == null) { + return; + } + if (other.BucketName.Length != 0) { + BucketName = other.BucketName; + } + if (other.Key.Length != 0) { + Key = other.Key; + } + _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public void MergeFrom(pb::CodedInputStream input) { + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + input.ReadRawMessage(this); + #else + uint tag; + while ((tag = input.ReadTag()) != 0) { + switch(tag) { + default: + _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input); + break; + case 10: { + BucketName = input.ReadString(); + break; + } + case 18: { + Key = input.ReadString(); + break; + } + } + } + #endif + } + + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + void pb::IBufferMessage.InternalMergeFrom(ref pb::ParseContext input) { + uint tag; + while ((tag = input.ReadTag()) != 0) { + switch(tag) { + default: + _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, ref input); + break; + case 10: { + BucketName = input.ReadString(); + break; + } + case 18: { + Key = input.ReadString(); + break; + } + } + } + } + #endif + + } + + /// + /// Returned storage item + /// + public sealed partial class StorageReadResponse : pb::IMessage + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + , pb::IBufferMessage + #endif + { + private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new StorageReadResponse()); + private pb::UnknownFieldSet _unknownFields; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public static pb::MessageParser Parser { get { return _parser; } } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public static pbr::MessageDescriptor Descriptor { + get { return global::Nitric.Proto.Storage.v1.StorageReflection.Descriptor.MessageTypes[10]; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + pbr::MessageDescriptor pb::IMessage.Descriptor { + get { return Descriptor; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public StorageReadResponse() { + OnConstruction(); + } + + partial void OnConstruction(); + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public StorageReadResponse(StorageReadResponse other) : this() { + body_ = other.body_; + _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public StorageReadResponse Clone() { + return new StorageReadResponse(this); + } + + /// Field number for the "body" field. + public const int BodyFieldNumber = 1; + private pb::ByteString body_ = pb::ByteString.Empty; + /// + /// The body bytes of the retrieved storage item + /// + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public pb::ByteString Body { + get { return body_; } + set { + body_ = pb::ProtoPreconditions.CheckNotNull(value, "value"); + } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public override bool Equals(object other) { + return Equals(other as StorageReadResponse); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public bool Equals(StorageReadResponse other) { + if (ReferenceEquals(other, null)) { + return false; + } + if (ReferenceEquals(other, this)) { + return true; + } + if (Body != other.Body) return false; + return Equals(_unknownFields, other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public override int GetHashCode() { + int hash = 1; + if (Body.Length != 0) hash ^= Body.GetHashCode(); + if (_unknownFields != null) { + hash ^= _unknownFields.GetHashCode(); + } + return hash; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public override string ToString() { + return pb::JsonFormatter.ToDiagnosticString(this); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public void WriteTo(pb::CodedOutputStream output) { + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + output.WriteRawMessage(this); + #else + if (Body.Length != 0) { + output.WriteRawTag(10); + output.WriteBytes(Body); + } + if (_unknownFields != null) { + _unknownFields.WriteTo(output); + } + #endif + } + + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + void pb::IBufferMessage.InternalWriteTo(ref pb::WriteContext output) { + if (Body.Length != 0) { + output.WriteRawTag(10); + output.WriteBytes(Body); + } + if (_unknownFields != null) { + _unknownFields.WriteTo(ref output); + } + } + #endif + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public int CalculateSize() { + int size = 0; + if (Body.Length != 0) { + size += 1 + pb::CodedOutputStream.ComputeBytesSize(Body); + } + if (_unknownFields != null) { + size += _unknownFields.CalculateSize(); + } + return size; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public void MergeFrom(StorageReadResponse other) { + if (other == null) { + return; + } + if (other.Body.Length != 0) { + Body = other.Body; + } + _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public void MergeFrom(pb::CodedInputStream input) { + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + input.ReadRawMessage(this); + #else + uint tag; + while ((tag = input.ReadTag()) != 0) { + switch(tag) { + default: + _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input); + break; + case 10: { + Body = input.ReadBytes(); + break; + } + } + } + #endif + } + + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + void pb::IBufferMessage.InternalMergeFrom(ref pb::ParseContext input) { + uint tag; + while ((tag = input.ReadTag()) != 0) { + switch(tag) { + default: + _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, ref input); + break; + case 10: { + Body = input.ReadBytes(); + break; + } + } + } + } + #endif + + } + + /// + /// Request to delete a storage item + /// + public sealed partial class StorageDeleteRequest : pb::IMessage + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + , pb::IBufferMessage + #endif + { + private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new StorageDeleteRequest()); + private pb::UnknownFieldSet _unknownFields; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public static pb::MessageParser Parser { get { return _parser; } } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public static pbr::MessageDescriptor Descriptor { + get { return global::Nitric.Proto.Storage.v1.StorageReflection.Descriptor.MessageTypes[11]; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + pbr::MessageDescriptor pb::IMessage.Descriptor { + get { return Descriptor; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public StorageDeleteRequest() { + OnConstruction(); + } + + partial void OnConstruction(); + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public StorageDeleteRequest(StorageDeleteRequest other) : this() { + bucketName_ = other.bucketName_; + key_ = other.key_; + _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public StorageDeleteRequest Clone() { + return new StorageDeleteRequest(this); + } + + /// Field number for the "bucket_name" field. + public const int BucketNameFieldNumber = 1; + private string bucketName_ = ""; + /// + /// Name of the bucket to delete from + /// + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public string BucketName { + get { return bucketName_; } + set { + bucketName_ = pb::ProtoPreconditions.CheckNotNull(value, "value"); + } + } + + /// Field number for the "key" field. + public const int KeyFieldNumber = 2; + private string key_ = ""; + /// + /// Key of item to delete + /// + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public string Key { + get { return key_; } + set { + key_ = pb::ProtoPreconditions.CheckNotNull(value, "value"); + } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public override bool Equals(object other) { + return Equals(other as StorageDeleteRequest); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public bool Equals(StorageDeleteRequest other) { + if (ReferenceEquals(other, null)) { + return false; + } + if (ReferenceEquals(other, this)) { + return true; + } + if (BucketName != other.BucketName) return false; + if (Key != other.Key) return false; + return Equals(_unknownFields, other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public override int GetHashCode() { + int hash = 1; + if (BucketName.Length != 0) hash ^= BucketName.GetHashCode(); + if (Key.Length != 0) hash ^= Key.GetHashCode(); + if (_unknownFields != null) { + hash ^= _unknownFields.GetHashCode(); + } + return hash; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public override string ToString() { + return pb::JsonFormatter.ToDiagnosticString(this); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public void WriteTo(pb::CodedOutputStream output) { + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + output.WriteRawMessage(this); + #else + if (BucketName.Length != 0) { + output.WriteRawTag(10); + output.WriteString(BucketName); + } + if (Key.Length != 0) { + output.WriteRawTag(18); + output.WriteString(Key); + } + if (_unknownFields != null) { + _unknownFields.WriteTo(output); + } + #endif + } + + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + void pb::IBufferMessage.InternalWriteTo(ref pb::WriteContext output) { + if (BucketName.Length != 0) { + output.WriteRawTag(10); + output.WriteString(BucketName); + } + if (Key.Length != 0) { + output.WriteRawTag(18); + output.WriteString(Key); + } + if (_unknownFields != null) { + _unknownFields.WriteTo(ref output); + } + } + #endif + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public int CalculateSize() { + int size = 0; + if (BucketName.Length != 0) { + size += 1 + pb::CodedOutputStream.ComputeStringSize(BucketName); + } + if (Key.Length != 0) { + size += 1 + pb::CodedOutputStream.ComputeStringSize(Key); + } + if (_unknownFields != null) { + size += _unknownFields.CalculateSize(); + } + return size; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public void MergeFrom(StorageDeleteRequest other) { + if (other == null) { + return; + } + if (other.BucketName.Length != 0) { + BucketName = other.BucketName; + } + if (other.Key.Length != 0) { + Key = other.Key; + } + _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public void MergeFrom(pb::CodedInputStream input) { + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + input.ReadRawMessage(this); + #else + uint tag; + while ((tag = input.ReadTag()) != 0) { + switch(tag) { + default: + _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input); + break; + case 10: { + BucketName = input.ReadString(); + break; + } + case 18: { + Key = input.ReadString(); + break; + } + } + } + #endif + } + + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + void pb::IBufferMessage.InternalMergeFrom(ref pb::ParseContext input) { + uint tag; + while ((tag = input.ReadTag()) != 0) { + switch(tag) { + default: + _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, ref input); + break; + case 10: { + BucketName = input.ReadString(); + break; + } + case 18: { + Key = input.ReadString(); + break; + } + } + } + } + #endif + + } + + /// + /// Result of deleting a storage item + /// + public sealed partial class StorageDeleteResponse : pb::IMessage + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + , pb::IBufferMessage + #endif + { + private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new StorageDeleteResponse()); + private pb::UnknownFieldSet _unknownFields; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public static pb::MessageParser Parser { get { return _parser; } } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public static pbr::MessageDescriptor Descriptor { + get { return global::Nitric.Proto.Storage.v1.StorageReflection.Descriptor.MessageTypes[12]; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + pbr::MessageDescriptor pb::IMessage.Descriptor { + get { return Descriptor; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public StorageDeleteResponse() { + OnConstruction(); + } + + partial void OnConstruction(); + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public StorageDeleteResponse(StorageDeleteResponse other) : this() { + _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public StorageDeleteResponse Clone() { + return new StorageDeleteResponse(this); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public override bool Equals(object other) { + return Equals(other as StorageDeleteResponse); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public bool Equals(StorageDeleteResponse other) { + if (ReferenceEquals(other, null)) { + return false; + } + if (ReferenceEquals(other, this)) { + return true; + } + return Equals(_unknownFields, other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public override int GetHashCode() { + int hash = 1; + if (_unknownFields != null) { + hash ^= _unknownFields.GetHashCode(); + } + return hash; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public override string ToString() { + return pb::JsonFormatter.ToDiagnosticString(this); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public void WriteTo(pb::CodedOutputStream output) { + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + output.WriteRawMessage(this); + #else + if (_unknownFields != null) { + _unknownFields.WriteTo(output); + } + #endif + } + + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + void pb::IBufferMessage.InternalWriteTo(ref pb::WriteContext output) { + if (_unknownFields != null) { + _unknownFields.WriteTo(ref output); + } + } + #endif + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public int CalculateSize() { + int size = 0; + if (_unknownFields != null) { + size += _unknownFields.CalculateSize(); + } + return size; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public void MergeFrom(StorageDeleteResponse other) { + if (other == null) { + return; + } + _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public void MergeFrom(pb::CodedInputStream input) { + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + input.ReadRawMessage(this); + #else + uint tag; + while ((tag = input.ReadTag()) != 0) { + switch(tag) { + default: + _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input); + break; + } + } + #endif + } + + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + void pb::IBufferMessage.InternalMergeFrom(ref pb::ParseContext input) { + uint tag; + while ((tag = input.ReadTag()) != 0) { + switch(tag) { + default: + _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, ref input); + break; + } + } + } + #endif + + } + + /// + /// Request to generate a pre-signed URL for a blob to perform a specific operation, such as read or write. + /// + public sealed partial class StoragePreSignUrlRequest : pb::IMessage + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + , pb::IBufferMessage + #endif + { + private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new StoragePreSignUrlRequest()); + private pb::UnknownFieldSet _unknownFields; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public static pb::MessageParser Parser { get { return _parser; } } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public static pbr::MessageDescriptor Descriptor { + get { return global::Nitric.Proto.Storage.v1.StorageReflection.Descriptor.MessageTypes[13]; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + pbr::MessageDescriptor pb::IMessage.Descriptor { + get { return Descriptor; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public StoragePreSignUrlRequest() { + OnConstruction(); + } + + partial void OnConstruction(); + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public StoragePreSignUrlRequest(StoragePreSignUrlRequest other) : this() { + bucketName_ = other.bucketName_; + key_ = other.key_; + operation_ = other.operation_; + expiry_ = other.expiry_ != null ? other.expiry_.Clone() : null; + _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public StoragePreSignUrlRequest Clone() { + return new StoragePreSignUrlRequest(this); + } + + /// Field number for the "bucket_name" field. + public const int BucketNameFieldNumber = 1; + private string bucketName_ = ""; + /// + /// Nitric name of the bucket to retrieve from + /// this will be automatically resolved to the provider specific bucket identifier. + /// + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public string BucketName { + get { return bucketName_; } + set { + bucketName_ = pb::ProtoPreconditions.CheckNotNull(value, "value"); + } + } + + /// Field number for the "key" field. + public const int KeyFieldNumber = 2; + private string key_ = ""; + /// + /// Key of item to generate the signed URL for. + /// The URL and the token it contains will only be valid for operations on this resource specifically. + /// + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public string Key { + get { return key_; } + set { + key_ = pb::ProtoPreconditions.CheckNotNull(value, "value"); + } + } + + /// Field number for the "operation" field. + public const int OperationFieldNumber = 3; + private global::Nitric.Proto.Storage.v1.StoragePreSignUrlRequest.Types.Operation operation_ = global::Nitric.Proto.Storage.v1.StoragePreSignUrlRequest.Types.Operation.Read; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public global::Nitric.Proto.Storage.v1.StoragePreSignUrlRequest.Types.Operation Operation { + get { return operation_; } + set { + operation_ = value; + } + } + + /// Field number for the "expiry" field. + public const int ExpiryFieldNumber = 4; + private global::Google.Protobuf.WellKnownTypes.Duration expiry_; + /// + /// Expiry defined as as protobuf duration + /// + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public global::Google.Protobuf.WellKnownTypes.Duration Expiry { + get { return expiry_; } + set { + expiry_ = value; + } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public override bool Equals(object other) { + return Equals(other as StoragePreSignUrlRequest); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public bool Equals(StoragePreSignUrlRequest other) { + if (ReferenceEquals(other, null)) { + return false; + } + if (ReferenceEquals(other, this)) { + return true; + } + if (BucketName != other.BucketName) return false; + if (Key != other.Key) return false; + if (Operation != other.Operation) return false; + if (!object.Equals(Expiry, other.Expiry)) return false; + return Equals(_unknownFields, other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public override int GetHashCode() { + int hash = 1; + if (BucketName.Length != 0) hash ^= BucketName.GetHashCode(); + if (Key.Length != 0) hash ^= Key.GetHashCode(); + if (Operation != global::Nitric.Proto.Storage.v1.StoragePreSignUrlRequest.Types.Operation.Read) hash ^= Operation.GetHashCode(); + if (expiry_ != null) hash ^= Expiry.GetHashCode(); + if (_unknownFields != null) { + hash ^= _unknownFields.GetHashCode(); + } + return hash; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public override string ToString() { + return pb::JsonFormatter.ToDiagnosticString(this); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public void WriteTo(pb::CodedOutputStream output) { + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + output.WriteRawMessage(this); + #else + if (BucketName.Length != 0) { + output.WriteRawTag(10); + output.WriteString(BucketName); + } + if (Key.Length != 0) { + output.WriteRawTag(18); + output.WriteString(Key); + } + if (Operation != global::Nitric.Proto.Storage.v1.StoragePreSignUrlRequest.Types.Operation.Read) { + output.WriteRawTag(24); + output.WriteEnum((int) Operation); + } + if (expiry_ != null) { + output.WriteRawTag(34); + output.WriteMessage(Expiry); + } + if (_unknownFields != null) { + _unknownFields.WriteTo(output); + } + #endif + } + + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + void pb::IBufferMessage.InternalWriteTo(ref pb::WriteContext output) { + if (BucketName.Length != 0) { + output.WriteRawTag(10); + output.WriteString(BucketName); + } + if (Key.Length != 0) { + output.WriteRawTag(18); + output.WriteString(Key); + } + if (Operation != global::Nitric.Proto.Storage.v1.StoragePreSignUrlRequest.Types.Operation.Read) { + output.WriteRawTag(24); + output.WriteEnum((int) Operation); + } + if (expiry_ != null) { + output.WriteRawTag(34); + output.WriteMessage(Expiry); + } + if (_unknownFields != null) { + _unknownFields.WriteTo(ref output); + } + } + #endif + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public int CalculateSize() { + int size = 0; + if (BucketName.Length != 0) { + size += 1 + pb::CodedOutputStream.ComputeStringSize(BucketName); + } + if (Key.Length != 0) { + size += 1 + pb::CodedOutputStream.ComputeStringSize(Key); + } + if (Operation != global::Nitric.Proto.Storage.v1.StoragePreSignUrlRequest.Types.Operation.Read) { + size += 1 + pb::CodedOutputStream.ComputeEnumSize((int) Operation); + } + if (expiry_ != null) { + size += 1 + pb::CodedOutputStream.ComputeMessageSize(Expiry); + } + if (_unknownFields != null) { + size += _unknownFields.CalculateSize(); + } + return size; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public void MergeFrom(StoragePreSignUrlRequest other) { + if (other == null) { + return; + } + if (other.BucketName.Length != 0) { + BucketName = other.BucketName; + } + if (other.Key.Length != 0) { + Key = other.Key; + } + if (other.Operation != global::Nitric.Proto.Storage.v1.StoragePreSignUrlRequest.Types.Operation.Read) { + Operation = other.Operation; + } + if (other.expiry_ != null) { + if (expiry_ == null) { + Expiry = new global::Google.Protobuf.WellKnownTypes.Duration(); + } + Expiry.MergeFrom(other.Expiry); + } + _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public void MergeFrom(pb::CodedInputStream input) { + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + input.ReadRawMessage(this); + #else + uint tag; + while ((tag = input.ReadTag()) != 0) { + switch(tag) { + default: + _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input); + break; + case 10: { + BucketName = input.ReadString(); + break; + } + case 18: { + Key = input.ReadString(); + break; + } + case 24: { + Operation = (global::Nitric.Proto.Storage.v1.StoragePreSignUrlRequest.Types.Operation) input.ReadEnum(); + break; + } + case 34: { + if (expiry_ == null) { + Expiry = new global::Google.Protobuf.WellKnownTypes.Duration(); + } + input.ReadMessage(Expiry); + break; + } + } + } + #endif + } + + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + void pb::IBufferMessage.InternalMergeFrom(ref pb::ParseContext input) { + uint tag; + while ((tag = input.ReadTag()) != 0) { + switch(tag) { + default: + _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, ref input); + break; + case 10: { + BucketName = input.ReadString(); + break; + } + case 18: { + Key = input.ReadString(); + break; + } + case 24: { + Operation = (global::Nitric.Proto.Storage.v1.StoragePreSignUrlRequest.Types.Operation) input.ReadEnum(); + break; + } + case 34: { + if (expiry_ == null) { + Expiry = new global::Google.Protobuf.WellKnownTypes.Duration(); + } + input.ReadMessage(Expiry); + break; + } + } + } + } + #endif + + #region Nested types + /// Container for nested types declared in the StoragePreSignUrlRequest message type. + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public static partial class Types { + /// + /// Operation + /// + public enum Operation { + [pbr::OriginalName("READ")] Read = 0, + [pbr::OriginalName("WRITE")] Write = 1, + } + + } + #endregion + + } + + public sealed partial class StoragePreSignUrlResponse : pb::IMessage + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + , pb::IBufferMessage + #endif + { + private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new StoragePreSignUrlResponse()); + private pb::UnknownFieldSet _unknownFields; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public static pb::MessageParser Parser { get { return _parser; } } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public static pbr::MessageDescriptor Descriptor { + get { return global::Nitric.Proto.Storage.v1.StorageReflection.Descriptor.MessageTypes[14]; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + pbr::MessageDescriptor pb::IMessage.Descriptor { + get { return Descriptor; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public StoragePreSignUrlResponse() { + OnConstruction(); + } + + partial void OnConstruction(); + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public StoragePreSignUrlResponse(StoragePreSignUrlResponse other) : this() { + url_ = other.url_; + _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public StoragePreSignUrlResponse Clone() { + return new StoragePreSignUrlResponse(this); + } + + /// Field number for the "url" field. + public const int UrlFieldNumber = 1; + private string url_ = ""; + /// + /// The pre-signed url, restricted to the operation, resource and expiry time specified in the request. + /// + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public string Url { + get { return url_; } + set { + url_ = pb::ProtoPreconditions.CheckNotNull(value, "value"); + } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public override bool Equals(object other) { + return Equals(other as StoragePreSignUrlResponse); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public bool Equals(StoragePreSignUrlResponse other) { + if (ReferenceEquals(other, null)) { + return false; + } + if (ReferenceEquals(other, this)) { + return true; + } + if (Url != other.Url) return false; + return Equals(_unknownFields, other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public override int GetHashCode() { + int hash = 1; + if (Url.Length != 0) hash ^= Url.GetHashCode(); + if (_unknownFields != null) { + hash ^= _unknownFields.GetHashCode(); + } + return hash; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public override string ToString() { + return pb::JsonFormatter.ToDiagnosticString(this); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public void WriteTo(pb::CodedOutputStream output) { + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + output.WriteRawMessage(this); + #else + if (Url.Length != 0) { + output.WriteRawTag(10); + output.WriteString(Url); + } + if (_unknownFields != null) { + _unknownFields.WriteTo(output); + } + #endif + } + + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + void pb::IBufferMessage.InternalWriteTo(ref pb::WriteContext output) { + if (Url.Length != 0) { + output.WriteRawTag(10); + output.WriteString(Url); + } + if (_unknownFields != null) { + _unknownFields.WriteTo(ref output); + } + } + #endif + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public int CalculateSize() { + int size = 0; + if (Url.Length != 0) { + size += 1 + pb::CodedOutputStream.ComputeStringSize(Url); + } + if (_unknownFields != null) { + size += _unknownFields.CalculateSize(); + } + return size; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public void MergeFrom(StoragePreSignUrlResponse other) { + if (other == null) { + return; + } + if (other.Url.Length != 0) { + Url = other.Url; + } + _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public void MergeFrom(pb::CodedInputStream input) { + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + input.ReadRawMessage(this); + #else + uint tag; + while ((tag = input.ReadTag()) != 0) { + switch(tag) { + default: + _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input); + break; + case 10: { + Url = input.ReadString(); + break; + } + } + } + #endif + } + + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + void pb::IBufferMessage.InternalMergeFrom(ref pb::ParseContext input) { + uint tag; + while ((tag = input.ReadTag()) != 0) { + switch(tag) { + default: + _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, ref input); + break; + case 10: { + Url = input.ReadString(); + break; + } + } + } + } + #endif + + } + + public sealed partial class StorageListBlobsRequest : pb::IMessage + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + , pb::IBufferMessage + #endif + { + private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new StorageListBlobsRequest()); + private pb::UnknownFieldSet _unknownFields; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public static pb::MessageParser Parser { get { return _parser; } } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public static pbr::MessageDescriptor Descriptor { + get { return global::Nitric.Proto.Storage.v1.StorageReflection.Descriptor.MessageTypes[15]; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + pbr::MessageDescriptor pb::IMessage.Descriptor { + get { return Descriptor; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public StorageListBlobsRequest() { + OnConstruction(); + } + + partial void OnConstruction(); + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public StorageListBlobsRequest(StorageListBlobsRequest other) : this() { + bucketName_ = other.bucketName_; + prefix_ = other.prefix_; + _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public StorageListBlobsRequest Clone() { + return new StorageListBlobsRequest(this); + } + + /// Field number for the "bucket_name" field. + public const int BucketNameFieldNumber = 1; + private string bucketName_ = ""; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public string BucketName { + get { return bucketName_; } + set { + bucketName_ = pb::ProtoPreconditions.CheckNotNull(value, "value"); + } + } + + /// Field number for the "prefix" field. + public const int PrefixFieldNumber = 2; + private string prefix_ = ""; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public string Prefix { + get { return prefix_; } + set { + prefix_ = pb::ProtoPreconditions.CheckNotNull(value, "value"); + } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public override bool Equals(object other) { + return Equals(other as StorageListBlobsRequest); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public bool Equals(StorageListBlobsRequest other) { + if (ReferenceEquals(other, null)) { + return false; + } + if (ReferenceEquals(other, this)) { + return true; + } + if (BucketName != other.BucketName) return false; + if (Prefix != other.Prefix) return false; + return Equals(_unknownFields, other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public override int GetHashCode() { + int hash = 1; + if (BucketName.Length != 0) hash ^= BucketName.GetHashCode(); + if (Prefix.Length != 0) hash ^= Prefix.GetHashCode(); + if (_unknownFields != null) { + hash ^= _unknownFields.GetHashCode(); + } + return hash; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public override string ToString() { + return pb::JsonFormatter.ToDiagnosticString(this); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public void WriteTo(pb::CodedOutputStream output) { + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + output.WriteRawMessage(this); + #else + if (BucketName.Length != 0) { + output.WriteRawTag(10); + output.WriteString(BucketName); + } + if (Prefix.Length != 0) { + output.WriteRawTag(18); + output.WriteString(Prefix); + } + if (_unknownFields != null) { + _unknownFields.WriteTo(output); + } + #endif + } + + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + void pb::IBufferMessage.InternalWriteTo(ref pb::WriteContext output) { + if (BucketName.Length != 0) { + output.WriteRawTag(10); + output.WriteString(BucketName); + } + if (Prefix.Length != 0) { + output.WriteRawTag(18); + output.WriteString(Prefix); + } + if (_unknownFields != null) { + _unknownFields.WriteTo(ref output); + } + } + #endif + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public int CalculateSize() { + int size = 0; + if (BucketName.Length != 0) { + size += 1 + pb::CodedOutputStream.ComputeStringSize(BucketName); + } + if (Prefix.Length != 0) { + size += 1 + pb::CodedOutputStream.ComputeStringSize(Prefix); + } + if (_unknownFields != null) { + size += _unknownFields.CalculateSize(); + } + return size; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public void MergeFrom(StorageListBlobsRequest other) { + if (other == null) { + return; + } + if (other.BucketName.Length != 0) { + BucketName = other.BucketName; + } + if (other.Prefix.Length != 0) { + Prefix = other.Prefix; + } + _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public void MergeFrom(pb::CodedInputStream input) { + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + input.ReadRawMessage(this); + #else + uint tag; + while ((tag = input.ReadTag()) != 0) { + switch(tag) { + default: + _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input); + break; + case 10: { + BucketName = input.ReadString(); + break; + } + case 18: { + Prefix = input.ReadString(); + break; + } + } + } + #endif + } + + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + void pb::IBufferMessage.InternalMergeFrom(ref pb::ParseContext input) { + uint tag; + while ((tag = input.ReadTag()) != 0) { + switch(tag) { + default: + _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, ref input); + break; + case 10: { + BucketName = input.ReadString(); + break; + } + case 18: { + Prefix = input.ReadString(); + break; + } + } + } + } + #endif + + } + + public sealed partial class Blob : pb::IMessage + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + , pb::IBufferMessage + #endif + { + private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new Blob()); + private pb::UnknownFieldSet _unknownFields; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public static pb::MessageParser Parser { get { return _parser; } } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public static pbr::MessageDescriptor Descriptor { + get { return global::Nitric.Proto.Storage.v1.StorageReflection.Descriptor.MessageTypes[16]; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + pbr::MessageDescriptor pb::IMessage.Descriptor { + get { return Descriptor; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public Blob() { + OnConstruction(); + } + + partial void OnConstruction(); + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public Blob(Blob other) : this() { + key_ = other.key_; + _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public Blob Clone() { + return new Blob(this); + } + + /// Field number for the "key" field. + public const int KeyFieldNumber = 1; + private string key_ = ""; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public string Key { + get { return key_; } + set { + key_ = pb::ProtoPreconditions.CheckNotNull(value, "value"); + } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public override bool Equals(object other) { + return Equals(other as Blob); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public bool Equals(Blob other) { + if (ReferenceEquals(other, null)) { + return false; + } + if (ReferenceEquals(other, this)) { + return true; + } + if (Key != other.Key) return false; + return Equals(_unknownFields, other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public override int GetHashCode() { + int hash = 1; + if (Key.Length != 0) hash ^= Key.GetHashCode(); + if (_unknownFields != null) { + hash ^= _unknownFields.GetHashCode(); + } + return hash; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public override string ToString() { + return pb::JsonFormatter.ToDiagnosticString(this); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public void WriteTo(pb::CodedOutputStream output) { + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + output.WriteRawMessage(this); + #else + if (Key.Length != 0) { + output.WriteRawTag(10); + output.WriteString(Key); + } + if (_unknownFields != null) { + _unknownFields.WriteTo(output); + } + #endif + } + + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + void pb::IBufferMessage.InternalWriteTo(ref pb::WriteContext output) { + if (Key.Length != 0) { + output.WriteRawTag(10); + output.WriteString(Key); + } + if (_unknownFields != null) { + _unknownFields.WriteTo(ref output); + } + } + #endif + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public int CalculateSize() { + int size = 0; + if (Key.Length != 0) { + size += 1 + pb::CodedOutputStream.ComputeStringSize(Key); + } + if (_unknownFields != null) { + size += _unknownFields.CalculateSize(); + } + return size; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public void MergeFrom(Blob other) { + if (other == null) { + return; + } + if (other.Key.Length != 0) { + Key = other.Key; + } + _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public void MergeFrom(pb::CodedInputStream input) { + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + input.ReadRawMessage(this); + #else + uint tag; + while ((tag = input.ReadTag()) != 0) { + switch(tag) { + default: + _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input); + break; + case 10: { + Key = input.ReadString(); + break; + } + } + } + #endif + } + + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + void pb::IBufferMessage.InternalMergeFrom(ref pb::ParseContext input) { + uint tag; + while ((tag = input.ReadTag()) != 0) { + switch(tag) { + default: + _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, ref input); + break; + case 10: { + Key = input.ReadString(); + break; + } + } + } + } + #endif + + } + + public sealed partial class StorageListBlobsResponse : pb::IMessage + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + , pb::IBufferMessage + #endif + { + private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new StorageListBlobsResponse()); + private pb::UnknownFieldSet _unknownFields; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public static pb::MessageParser Parser { get { return _parser; } } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public static pbr::MessageDescriptor Descriptor { + get { return global::Nitric.Proto.Storage.v1.StorageReflection.Descriptor.MessageTypes[17]; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + pbr::MessageDescriptor pb::IMessage.Descriptor { + get { return Descriptor; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public StorageListBlobsResponse() { + OnConstruction(); + } + + partial void OnConstruction(); + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public StorageListBlobsResponse(StorageListBlobsResponse other) : this() { + blobs_ = other.blobs_.Clone(); + _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public StorageListBlobsResponse Clone() { + return new StorageListBlobsResponse(this); + } + + /// Field number for the "blobs" field. + public const int BlobsFieldNumber = 1; + private static readonly pb::FieldCodec _repeated_blobs_codec + = pb::FieldCodec.ForMessage(10, global::Nitric.Proto.Storage.v1.Blob.Parser); + private readonly pbc::RepeatedField blobs_ = new pbc::RepeatedField(); + /// + /// keys of the blobs in the bucket + /// + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public pbc::RepeatedField Blobs { + get { return blobs_; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public override bool Equals(object other) { + return Equals(other as StorageListBlobsResponse); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public bool Equals(StorageListBlobsResponse other) { + if (ReferenceEquals(other, null)) { + return false; + } + if (ReferenceEquals(other, this)) { + return true; + } + if(!blobs_.Equals(other.blobs_)) return false; + return Equals(_unknownFields, other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public override int GetHashCode() { + int hash = 1; + hash ^= blobs_.GetHashCode(); + if (_unknownFields != null) { + hash ^= _unknownFields.GetHashCode(); + } + return hash; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public override string ToString() { + return pb::JsonFormatter.ToDiagnosticString(this); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public void WriteTo(pb::CodedOutputStream output) { + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + output.WriteRawMessage(this); + #else + blobs_.WriteTo(output, _repeated_blobs_codec); + if (_unknownFields != null) { + _unknownFields.WriteTo(output); + } + #endif + } + + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + void pb::IBufferMessage.InternalWriteTo(ref pb::WriteContext output) { + blobs_.WriteTo(ref output, _repeated_blobs_codec); + if (_unknownFields != null) { + _unknownFields.WriteTo(ref output); + } + } + #endif + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public int CalculateSize() { + int size = 0; + size += blobs_.CalculateSize(_repeated_blobs_codec); + if (_unknownFields != null) { + size += _unknownFields.CalculateSize(); + } + return size; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public void MergeFrom(StorageListBlobsResponse other) { + if (other == null) { + return; + } + blobs_.Add(other.blobs_); + _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public void MergeFrom(pb::CodedInputStream input) { + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + input.ReadRawMessage(this); + #else + uint tag; + while ((tag = input.ReadTag()) != 0) { + switch(tag) { + default: + _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input); + break; + case 10: { + blobs_.AddEntriesFrom(input, _repeated_blobs_codec); + break; + } + } + } + #endif + } + + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + void pb::IBufferMessage.InternalMergeFrom(ref pb::ParseContext input) { + uint tag; + while ((tag = input.ReadTag()) != 0) { + switch(tag) { + default: + _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, ref input); + break; + case 10: { + blobs_.AddEntriesFrom(ref input, _repeated_blobs_codec); + break; + } + } + } + } + #endif + + } + + public sealed partial class StorageExistsRequest : pb::IMessage + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + , pb::IBufferMessage + #endif + { + private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new StorageExistsRequest()); + private pb::UnknownFieldSet _unknownFields; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public static pb::MessageParser Parser { get { return _parser; } } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public static pbr::MessageDescriptor Descriptor { + get { return global::Nitric.Proto.Storage.v1.StorageReflection.Descriptor.MessageTypes[18]; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + pbr::MessageDescriptor pb::IMessage.Descriptor { + get { return Descriptor; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public StorageExistsRequest() { + OnConstruction(); + } + + partial void OnConstruction(); + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public StorageExistsRequest(StorageExistsRequest other) : this() { + bucketName_ = other.bucketName_; + key_ = other.key_; + _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public StorageExistsRequest Clone() { + return new StorageExistsRequest(this); + } + + /// Field number for the "bucket_name" field. + public const int BucketNameFieldNumber = 1; + private string bucketName_ = ""; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public string BucketName { + get { return bucketName_; } + set { + bucketName_ = pb::ProtoPreconditions.CheckNotNull(value, "value"); + } + } + + /// Field number for the "key" field. + public const int KeyFieldNumber = 2; + private string key_ = ""; + /// + /// Key of item to retrieve + /// + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public string Key { + get { return key_; } + set { + key_ = pb::ProtoPreconditions.CheckNotNull(value, "value"); + } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public override bool Equals(object other) { + return Equals(other as StorageExistsRequest); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public bool Equals(StorageExistsRequest other) { + if (ReferenceEquals(other, null)) { + return false; + } + if (ReferenceEquals(other, this)) { + return true; + } + if (BucketName != other.BucketName) return false; + if (Key != other.Key) return false; + return Equals(_unknownFields, other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public override int GetHashCode() { + int hash = 1; + if (BucketName.Length != 0) hash ^= BucketName.GetHashCode(); + if (Key.Length != 0) hash ^= Key.GetHashCode(); + if (_unknownFields != null) { + hash ^= _unknownFields.GetHashCode(); + } + return hash; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public override string ToString() { + return pb::JsonFormatter.ToDiagnosticString(this); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public void WriteTo(pb::CodedOutputStream output) { + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + output.WriteRawMessage(this); + #else + if (BucketName.Length != 0) { + output.WriteRawTag(10); + output.WriteString(BucketName); + } + if (Key.Length != 0) { + output.WriteRawTag(18); + output.WriteString(Key); + } + if (_unknownFields != null) { + _unknownFields.WriteTo(output); + } + #endif + } + + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + void pb::IBufferMessage.InternalWriteTo(ref pb::WriteContext output) { + if (BucketName.Length != 0) { + output.WriteRawTag(10); + output.WriteString(BucketName); + } + if (Key.Length != 0) { + output.WriteRawTag(18); + output.WriteString(Key); + } + if (_unknownFields != null) { + _unknownFields.WriteTo(ref output); + } + } + #endif + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public int CalculateSize() { + int size = 0; + if (BucketName.Length != 0) { + size += 1 + pb::CodedOutputStream.ComputeStringSize(BucketName); + } + if (Key.Length != 0) { + size += 1 + pb::CodedOutputStream.ComputeStringSize(Key); + } + if (_unknownFields != null) { + size += _unknownFields.CalculateSize(); + } + return size; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public void MergeFrom(StorageExistsRequest other) { + if (other == null) { + return; + } + if (other.BucketName.Length != 0) { + BucketName = other.BucketName; + } + if (other.Key.Length != 0) { + Key = other.Key; + } + _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public void MergeFrom(pb::CodedInputStream input) { + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + input.ReadRawMessage(this); + #else + uint tag; + while ((tag = input.ReadTag()) != 0) { + switch(tag) { + default: + _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input); + break; + case 10: { + BucketName = input.ReadString(); + break; + } + case 18: { + Key = input.ReadString(); + break; + } + } + } + #endif + } + + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + void pb::IBufferMessage.InternalMergeFrom(ref pb::ParseContext input) { + uint tag; + while ((tag = input.ReadTag()) != 0) { + switch(tag) { + default: + _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, ref input); + break; + case 10: { + BucketName = input.ReadString(); + break; + } + case 18: { + Key = input.ReadString(); + break; + } + } + } + } + #endif + + } + + public sealed partial class StorageExistsResponse : pb::IMessage + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + , pb::IBufferMessage + #endif + { + private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new StorageExistsResponse()); + private pb::UnknownFieldSet _unknownFields; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public static pb::MessageParser Parser { get { return _parser; } } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public static pbr::MessageDescriptor Descriptor { + get { return global::Nitric.Proto.Storage.v1.StorageReflection.Descriptor.MessageTypes[19]; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + pbr::MessageDescriptor pb::IMessage.Descriptor { + get { return Descriptor; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public StorageExistsResponse() { + OnConstruction(); + } + + partial void OnConstruction(); + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public StorageExistsResponse(StorageExistsResponse other) : this() { + exists_ = other.exists_; + _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public StorageExistsResponse Clone() { + return new StorageExistsResponse(this); + } + + /// Field number for the "exists" field. + public const int ExistsFieldNumber = 1; + private bool exists_; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public bool Exists { + get { return exists_; } + set { + exists_ = value; + } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public override bool Equals(object other) { + return Equals(other as StorageExistsResponse); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public bool Equals(StorageExistsResponse other) { + if (ReferenceEquals(other, null)) { + return false; + } + if (ReferenceEquals(other, this)) { + return true; + } + if (Exists != other.Exists) return false; + return Equals(_unknownFields, other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public override int GetHashCode() { + int hash = 1; + if (Exists != false) hash ^= Exists.GetHashCode(); + if (_unknownFields != null) { + hash ^= _unknownFields.GetHashCode(); + } + return hash; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public override string ToString() { + return pb::JsonFormatter.ToDiagnosticString(this); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public void WriteTo(pb::CodedOutputStream output) { + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + output.WriteRawMessage(this); + #else + if (Exists != false) { + output.WriteRawTag(8); + output.WriteBool(Exists); + } + if (_unknownFields != null) { + _unknownFields.WriteTo(output); + } + #endif + } + + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + void pb::IBufferMessage.InternalWriteTo(ref pb::WriteContext output) { + if (Exists != false) { + output.WriteRawTag(8); + output.WriteBool(Exists); + } + if (_unknownFields != null) { + _unknownFields.WriteTo(ref output); + } + } + #endif + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public int CalculateSize() { + int size = 0; + if (Exists != false) { + size += 1 + 1; + } + if (_unknownFields != null) { + size += _unknownFields.CalculateSize(); + } + return size; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public void MergeFrom(StorageExistsResponse other) { + if (other == null) { + return; + } + if (other.Exists != false) { + Exists = other.Exists; + } + _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public void MergeFrom(pb::CodedInputStream input) { + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + input.ReadRawMessage(this); + #else + uint tag; + while ((tag = input.ReadTag()) != 0) { + switch(tag) { + default: + _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input); + break; + case 8: { + Exists = input.ReadBool(); + break; + } + } + } + #endif + } + + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + void pb::IBufferMessage.InternalMergeFrom(ref pb::ParseContext input) { + uint tag; + while ((tag = input.ReadTag()) != 0) { + switch(tag) { + default: + _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, ref input); + break; + case 8: { + Exists = input.ReadBool(); + break; + } + } + } + } + #endif + + } + + #endregion + +} + +#endregion Designer generated code diff --git a/src/Nitric.Sdk/Proto/proto/storage/v1/StorageGrpc.cs b/src/Nitric.Sdk/Proto/nitric/proto/storage/v1/StorageGrpc.cs similarity index 67% rename from src/Nitric.Sdk/Proto/proto/storage/v1/StorageGrpc.cs rename to src/Nitric.Sdk/Proto/nitric/proto/storage/v1/StorageGrpc.cs index 9ea1423..e29700f 100644 --- a/src/Nitric.Sdk/Proto/proto/storage/v1/StorageGrpc.cs +++ b/src/Nitric.Sdk/Proto/nitric/proto/storage/v1/StorageGrpc.cs @@ -1,6 +1,6 @@ // // Generated by the protocol buffer compiler. DO NOT EDIT! -// source: proto/storage/v1/storage.proto +// source: nitric/proto/storage/v1/storage.proto // #pragma warning disable 0414, 1591 #region Designer generated code @@ -9,11 +9,11 @@ namespace Nitric.Proto.Storage.v1 { /// - /// Services for storage and retrieval of files in the form of byte arrays, such as text and binary files. + /// Services for storage and retrieval of blobs in the form of byte arrays, such as text and binary blobs. /// - public static partial class StorageService + public static partial class Storage { - static readonly string __ServiceName = "nitric.storage.v1.StorageService"; + static readonly string __ServiceName = "nitric.proto.storage.v1.Storage"; static void __Helper_SerializeMessage(global::Google.Protobuf.IMessage message, grpc::SerializationContext context) { @@ -45,60 +45,60 @@ static T __Helper_DeserializeMessage(grpc::DeserializationContext context, gl return parser.ParseFrom(context.PayloadAsNewBuffer()); } - static readonly grpc::Marshaller __Marshaller_nitric_storage_v1_StorageReadRequest = grpc::Marshallers.Create(__Helper_SerializeMessage, context => __Helper_DeserializeMessage(context, global::Nitric.Proto.Storage.v1.StorageReadRequest.Parser)); - static readonly grpc::Marshaller __Marshaller_nitric_storage_v1_StorageReadResponse = grpc::Marshallers.Create(__Helper_SerializeMessage, context => __Helper_DeserializeMessage(context, global::Nitric.Proto.Storage.v1.StorageReadResponse.Parser)); - static readonly grpc::Marshaller __Marshaller_nitric_storage_v1_StorageWriteRequest = grpc::Marshallers.Create(__Helper_SerializeMessage, context => __Helper_DeserializeMessage(context, global::Nitric.Proto.Storage.v1.StorageWriteRequest.Parser)); - static readonly grpc::Marshaller __Marshaller_nitric_storage_v1_StorageWriteResponse = grpc::Marshallers.Create(__Helper_SerializeMessage, context => __Helper_DeserializeMessage(context, global::Nitric.Proto.Storage.v1.StorageWriteResponse.Parser)); - static readonly grpc::Marshaller __Marshaller_nitric_storage_v1_StorageDeleteRequest = grpc::Marshallers.Create(__Helper_SerializeMessage, context => __Helper_DeserializeMessage(context, global::Nitric.Proto.Storage.v1.StorageDeleteRequest.Parser)); - static readonly grpc::Marshaller __Marshaller_nitric_storage_v1_StorageDeleteResponse = grpc::Marshallers.Create(__Helper_SerializeMessage, context => __Helper_DeserializeMessage(context, global::Nitric.Proto.Storage.v1.StorageDeleteResponse.Parser)); - static readonly grpc::Marshaller __Marshaller_nitric_storage_v1_StoragePreSignUrlRequest = grpc::Marshallers.Create(__Helper_SerializeMessage, context => __Helper_DeserializeMessage(context, global::Nitric.Proto.Storage.v1.StoragePreSignUrlRequest.Parser)); - static readonly grpc::Marshaller __Marshaller_nitric_storage_v1_StoragePreSignUrlResponse = grpc::Marshallers.Create(__Helper_SerializeMessage, context => __Helper_DeserializeMessage(context, global::Nitric.Proto.Storage.v1.StoragePreSignUrlResponse.Parser)); - static readonly grpc::Marshaller __Marshaller_nitric_storage_v1_StorageListFilesRequest = grpc::Marshallers.Create(__Helper_SerializeMessage, context => __Helper_DeserializeMessage(context, global::Nitric.Proto.Storage.v1.StorageListFilesRequest.Parser)); - static readonly grpc::Marshaller __Marshaller_nitric_storage_v1_StorageListFilesResponse = grpc::Marshallers.Create(__Helper_SerializeMessage, context => __Helper_DeserializeMessage(context, global::Nitric.Proto.Storage.v1.StorageListFilesResponse.Parser)); - static readonly grpc::Marshaller __Marshaller_nitric_storage_v1_StorageExistsRequest = grpc::Marshallers.Create(__Helper_SerializeMessage, context => __Helper_DeserializeMessage(context, global::Nitric.Proto.Storage.v1.StorageExistsRequest.Parser)); - static readonly grpc::Marshaller __Marshaller_nitric_storage_v1_StorageExistsResponse = grpc::Marshallers.Create(__Helper_SerializeMessage, context => __Helper_DeserializeMessage(context, global::Nitric.Proto.Storage.v1.StorageExistsResponse.Parser)); + static readonly grpc::Marshaller __Marshaller_nitric_proto_storage_v1_StorageReadRequest = grpc::Marshallers.Create(__Helper_SerializeMessage, context => __Helper_DeserializeMessage(context, global::Nitric.Proto.Storage.v1.StorageReadRequest.Parser)); + static readonly grpc::Marshaller __Marshaller_nitric_proto_storage_v1_StorageReadResponse = grpc::Marshallers.Create(__Helper_SerializeMessage, context => __Helper_DeserializeMessage(context, global::Nitric.Proto.Storage.v1.StorageReadResponse.Parser)); + static readonly grpc::Marshaller __Marshaller_nitric_proto_storage_v1_StorageWriteRequest = grpc::Marshallers.Create(__Helper_SerializeMessage, context => __Helper_DeserializeMessage(context, global::Nitric.Proto.Storage.v1.StorageWriteRequest.Parser)); + static readonly grpc::Marshaller __Marshaller_nitric_proto_storage_v1_StorageWriteResponse = grpc::Marshallers.Create(__Helper_SerializeMessage, context => __Helper_DeserializeMessage(context, global::Nitric.Proto.Storage.v1.StorageWriteResponse.Parser)); + static readonly grpc::Marshaller __Marshaller_nitric_proto_storage_v1_StorageDeleteRequest = grpc::Marshallers.Create(__Helper_SerializeMessage, context => __Helper_DeserializeMessage(context, global::Nitric.Proto.Storage.v1.StorageDeleteRequest.Parser)); + static readonly grpc::Marshaller __Marshaller_nitric_proto_storage_v1_StorageDeleteResponse = grpc::Marshallers.Create(__Helper_SerializeMessage, context => __Helper_DeserializeMessage(context, global::Nitric.Proto.Storage.v1.StorageDeleteResponse.Parser)); + static readonly grpc::Marshaller __Marshaller_nitric_proto_storage_v1_StoragePreSignUrlRequest = grpc::Marshallers.Create(__Helper_SerializeMessage, context => __Helper_DeserializeMessage(context, global::Nitric.Proto.Storage.v1.StoragePreSignUrlRequest.Parser)); + static readonly grpc::Marshaller __Marshaller_nitric_proto_storage_v1_StoragePreSignUrlResponse = grpc::Marshallers.Create(__Helper_SerializeMessage, context => __Helper_DeserializeMessage(context, global::Nitric.Proto.Storage.v1.StoragePreSignUrlResponse.Parser)); + static readonly grpc::Marshaller __Marshaller_nitric_proto_storage_v1_StorageListBlobsRequest = grpc::Marshallers.Create(__Helper_SerializeMessage, context => __Helper_DeserializeMessage(context, global::Nitric.Proto.Storage.v1.StorageListBlobsRequest.Parser)); + static readonly grpc::Marshaller __Marshaller_nitric_proto_storage_v1_StorageListBlobsResponse = grpc::Marshallers.Create(__Helper_SerializeMessage, context => __Helper_DeserializeMessage(context, global::Nitric.Proto.Storage.v1.StorageListBlobsResponse.Parser)); + static readonly grpc::Marshaller __Marshaller_nitric_proto_storage_v1_StorageExistsRequest = grpc::Marshallers.Create(__Helper_SerializeMessage, context => __Helper_DeserializeMessage(context, global::Nitric.Proto.Storage.v1.StorageExistsRequest.Parser)); + static readonly grpc::Marshaller __Marshaller_nitric_proto_storage_v1_StorageExistsResponse = grpc::Marshallers.Create(__Helper_SerializeMessage, context => __Helper_DeserializeMessage(context, global::Nitric.Proto.Storage.v1.StorageExistsResponse.Parser)); static readonly grpc::Method __Method_Read = new grpc::Method( grpc::MethodType.Unary, __ServiceName, "Read", - __Marshaller_nitric_storage_v1_StorageReadRequest, - __Marshaller_nitric_storage_v1_StorageReadResponse); + __Marshaller_nitric_proto_storage_v1_StorageReadRequest, + __Marshaller_nitric_proto_storage_v1_StorageReadResponse); static readonly grpc::Method __Method_Write = new grpc::Method( grpc::MethodType.Unary, __ServiceName, "Write", - __Marshaller_nitric_storage_v1_StorageWriteRequest, - __Marshaller_nitric_storage_v1_StorageWriteResponse); + __Marshaller_nitric_proto_storage_v1_StorageWriteRequest, + __Marshaller_nitric_proto_storage_v1_StorageWriteResponse); static readonly grpc::Method __Method_Delete = new grpc::Method( grpc::MethodType.Unary, __ServiceName, "Delete", - __Marshaller_nitric_storage_v1_StorageDeleteRequest, - __Marshaller_nitric_storage_v1_StorageDeleteResponse); + __Marshaller_nitric_proto_storage_v1_StorageDeleteRequest, + __Marshaller_nitric_proto_storage_v1_StorageDeleteResponse); static readonly grpc::Method __Method_PreSignUrl = new grpc::Method( grpc::MethodType.Unary, __ServiceName, "PreSignUrl", - __Marshaller_nitric_storage_v1_StoragePreSignUrlRequest, - __Marshaller_nitric_storage_v1_StoragePreSignUrlResponse); + __Marshaller_nitric_proto_storage_v1_StoragePreSignUrlRequest, + __Marshaller_nitric_proto_storage_v1_StoragePreSignUrlResponse); - static readonly grpc::Method __Method_ListFiles = new grpc::Method( + static readonly grpc::Method __Method_ListBlobs = new grpc::Method( grpc::MethodType.Unary, __ServiceName, - "ListFiles", - __Marshaller_nitric_storage_v1_StorageListFilesRequest, - __Marshaller_nitric_storage_v1_StorageListFilesResponse); + "ListBlobs", + __Marshaller_nitric_proto_storage_v1_StorageListBlobsRequest, + __Marshaller_nitric_proto_storage_v1_StorageListBlobsResponse); static readonly grpc::Method __Method_Exists = new grpc::Method( grpc::MethodType.Unary, __ServiceName, "Exists", - __Marshaller_nitric_storage_v1_StorageExistsRequest, - __Marshaller_nitric_storage_v1_StorageExistsResponse); + __Marshaller_nitric_proto_storage_v1_StorageExistsRequest, + __Marshaller_nitric_proto_storage_v1_StorageExistsResponse); /// Service descriptor public static global::Google.Protobuf.Reflection.ServiceDescriptor Descriptor @@ -106,9 +106,9 @@ static T __Helper_DeserializeMessage(grpc::DeserializationContext context, gl get { return global::Nitric.Proto.Storage.v1.StorageReflection.Descriptor.Services[0]; } } - /// Base class for server-side implementations of StorageService - [grpc::BindServiceMethod(typeof(StorageService), "BindService")] - public abstract partial class StorageServiceBase + /// Base class for server-side implementations of Storage + [grpc::BindServiceMethod(typeof(Storage), "BindService")] + public abstract partial class StorageBase { /// /// Retrieve an item from a bucket @@ -155,12 +155,12 @@ public abstract partial class StorageServiceBase } /// - /// List files currently in the bucket + /// List blobs currently in the bucket /// /// The request received from the client. /// The context of the server-side call handler being invoked. /// The response to send back to the client (wrapped by a task). - public virtual global::System.Threading.Tasks.Task ListFiles(global::Nitric.Proto.Storage.v1.StorageListFilesRequest request, grpc::ServerCallContext context) + public virtual global::System.Threading.Tasks.Task ListBlobs(global::Nitric.Proto.Storage.v1.StorageListBlobsRequest request, grpc::ServerCallContext context) { throw new grpc::RpcException(new grpc::Status(grpc::StatusCode.Unimplemented, "")); } @@ -178,26 +178,26 @@ public abstract partial class StorageServiceBase } - /// Client for StorageService - public partial class StorageServiceClient : grpc::ClientBase + /// Client for Storage + public partial class StorageClient : grpc::ClientBase { - /// Creates a new client for StorageService + /// Creates a new client for Storage /// The channel to use to make remote calls. - public StorageServiceClient(grpc::ChannelBase channel) : base(channel) + public StorageClient(grpc::ChannelBase channel) : base(channel) { } - /// Creates a new client for StorageService that uses a custom CallInvoker. + /// Creates a new client for Storage that uses a custom CallInvoker. /// The callInvoker to use to make remote calls. - public StorageServiceClient(grpc::CallInvoker callInvoker) : base(callInvoker) + public StorageClient(grpc::CallInvoker callInvoker) : base(callInvoker) { } /// Protected parameterless constructor to allow creation of test doubles. - protected StorageServiceClient() : base() + protected StorageClient() : base() { } /// Protected constructor to allow creation of configured clients. /// The client configuration. - protected StorageServiceClient(ClientBaseConfiguration configuration) : base(configuration) + protected StorageClient(ClientBaseConfiguration configuration) : base(configuration) { } @@ -378,48 +378,48 @@ protected StorageServiceClient(ClientBaseConfiguration configuration) : base(con return CallInvoker.AsyncUnaryCall(__Method_PreSignUrl, null, options, request); } /// - /// List files currently in the bucket + /// List blobs currently in the bucket /// /// The request to send to the server. /// The initial metadata to send with the call. This parameter is optional. /// An optional deadline for the call. The call will be cancelled if deadline is hit. /// An optional token for canceling the call. /// The response received from the server. - public virtual global::Nitric.Proto.Storage.v1.StorageListFilesResponse ListFiles(global::Nitric.Proto.Storage.v1.StorageListFilesRequest request, grpc::Metadata headers = null, global::System.DateTime? deadline = null, global::System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken)) + public virtual global::Nitric.Proto.Storage.v1.StorageListBlobsResponse ListBlobs(global::Nitric.Proto.Storage.v1.StorageListBlobsRequest request, grpc::Metadata headers = null, global::System.DateTime? deadline = null, global::System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken)) { - return ListFiles(request, new grpc::CallOptions(headers, deadline, cancellationToken)); + return ListBlobs(request, new grpc::CallOptions(headers, deadline, cancellationToken)); } /// - /// List files currently in the bucket + /// List blobs currently in the bucket /// /// The request to send to the server. /// The options for the call. /// The response received from the server. - public virtual global::Nitric.Proto.Storage.v1.StorageListFilesResponse ListFiles(global::Nitric.Proto.Storage.v1.StorageListFilesRequest request, grpc::CallOptions options) + public virtual global::Nitric.Proto.Storage.v1.StorageListBlobsResponse ListBlobs(global::Nitric.Proto.Storage.v1.StorageListBlobsRequest request, grpc::CallOptions options) { - return CallInvoker.BlockingUnaryCall(__Method_ListFiles, null, options, request); + return CallInvoker.BlockingUnaryCall(__Method_ListBlobs, null, options, request); } /// - /// List files currently in the bucket + /// List blobs currently in the bucket /// /// The request to send to the server. /// The initial metadata to send with the call. This parameter is optional. /// An optional deadline for the call. The call will be cancelled if deadline is hit. /// An optional token for canceling the call. /// The call object. - public virtual grpc::AsyncUnaryCall ListFilesAsync(global::Nitric.Proto.Storage.v1.StorageListFilesRequest request, grpc::Metadata headers = null, global::System.DateTime? deadline = null, global::System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken)) + public virtual grpc::AsyncUnaryCall ListBlobsAsync(global::Nitric.Proto.Storage.v1.StorageListBlobsRequest request, grpc::Metadata headers = null, global::System.DateTime? deadline = null, global::System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken)) { - return ListFilesAsync(request, new grpc::CallOptions(headers, deadline, cancellationToken)); + return ListBlobsAsync(request, new grpc::CallOptions(headers, deadline, cancellationToken)); } /// - /// List files currently in the bucket + /// List blobs currently in the bucket /// /// The request to send to the server. /// The options for the call. /// The call object. - public virtual grpc::AsyncUnaryCall ListFilesAsync(global::Nitric.Proto.Storage.v1.StorageListFilesRequest request, grpc::CallOptions options) + public virtual grpc::AsyncUnaryCall ListBlobsAsync(global::Nitric.Proto.Storage.v1.StorageListBlobsRequest request, grpc::CallOptions options) { - return CallInvoker.AsyncUnaryCall(__Method_ListFiles, null, options, request); + return CallInvoker.AsyncUnaryCall(__Method_ListBlobs, null, options, request); } /// /// Determine is an object exists in a bucket @@ -466,22 +466,22 @@ protected StorageServiceClient(ClientBaseConfiguration configuration) : base(con return CallInvoker.AsyncUnaryCall(__Method_Exists, null, options, request); } /// Creates a new instance of client from given ClientBaseConfiguration. - protected override StorageServiceClient NewInstance(ClientBaseConfiguration configuration) + protected override StorageClient NewInstance(ClientBaseConfiguration configuration) { - return new StorageServiceClient(configuration); + return new StorageClient(configuration); } } /// Creates service definition that can be registered with a server /// An object implementing the server-side handling logic. - public static grpc::ServerServiceDefinition BindService(StorageServiceBase serviceImpl) + public static grpc::ServerServiceDefinition BindService(StorageBase serviceImpl) { return grpc::ServerServiceDefinition.CreateBuilder() .AddMethod(__Method_Read, serviceImpl.Read) .AddMethod(__Method_Write, serviceImpl.Write) .AddMethod(__Method_Delete, serviceImpl.Delete) .AddMethod(__Method_PreSignUrl, serviceImpl.PreSignUrl) - .AddMethod(__Method_ListFiles, serviceImpl.ListFiles) + .AddMethod(__Method_ListBlobs, serviceImpl.ListBlobs) .AddMethod(__Method_Exists, serviceImpl.Exists).Build(); } @@ -489,16 +489,152 @@ protected override StorageServiceClient NewInstance(ClientBaseConfiguration conf /// Note: this method is part of an experimental API that can change or be removed without any prior notice. /// Service methods will be bound by calling AddMethod on this object. /// An object implementing the server-side handling logic. - public static void BindService(grpc::ServiceBinderBase serviceBinder, StorageServiceBase serviceImpl) + public static void BindService(grpc::ServiceBinderBase serviceBinder, StorageBase serviceImpl) { serviceBinder.AddMethod(__Method_Read, serviceImpl == null ? null : new grpc::UnaryServerMethod(serviceImpl.Read)); serviceBinder.AddMethod(__Method_Write, serviceImpl == null ? null : new grpc::UnaryServerMethod(serviceImpl.Write)); serviceBinder.AddMethod(__Method_Delete, serviceImpl == null ? null : new grpc::UnaryServerMethod(serviceImpl.Delete)); serviceBinder.AddMethod(__Method_PreSignUrl, serviceImpl == null ? null : new grpc::UnaryServerMethod(serviceImpl.PreSignUrl)); - serviceBinder.AddMethod(__Method_ListFiles, serviceImpl == null ? null : new grpc::UnaryServerMethod(serviceImpl.ListFiles)); + serviceBinder.AddMethod(__Method_ListBlobs, serviceImpl == null ? null : new grpc::UnaryServerMethod(serviceImpl.ListBlobs)); serviceBinder.AddMethod(__Method_Exists, serviceImpl == null ? null : new grpc::UnaryServerMethod(serviceImpl.Exists)); } } + public static partial class StorageListener + { + static readonly string __ServiceName = "nitric.proto.storage.v1.StorageListener"; + + static void __Helper_SerializeMessage(global::Google.Protobuf.IMessage message, grpc::SerializationContext context) + { + #if !GRPC_DISABLE_PROTOBUF_BUFFER_SERIALIZATION + if (message is global::Google.Protobuf.IBufferMessage) + { + context.SetPayloadLength(message.CalculateSize()); + global::Google.Protobuf.MessageExtensions.WriteTo(message, context.GetBufferWriter()); + context.Complete(); + return; + } + #endif + context.Complete(global::Google.Protobuf.MessageExtensions.ToByteArray(message)); + } + + static class __Helper_MessageCache + { + public static readonly bool IsBufferMessage = global::System.Reflection.IntrospectionExtensions.GetTypeInfo(typeof(global::Google.Protobuf.IBufferMessage)).IsAssignableFrom(typeof(T)); + } + + static T __Helper_DeserializeMessage(grpc::DeserializationContext context, global::Google.Protobuf.MessageParser parser) where T : global::Google.Protobuf.IMessage + { + #if !GRPC_DISABLE_PROTOBUF_BUFFER_SERIALIZATION + if (__Helper_MessageCache.IsBufferMessage) + { + return parser.ParseFrom(context.PayloadAsReadOnlySequence()); + } + #endif + return parser.ParseFrom(context.PayloadAsNewBuffer()); + } + + static readonly grpc::Marshaller __Marshaller_nitric_proto_storage_v1_ClientMessage = grpc::Marshallers.Create(__Helper_SerializeMessage, context => __Helper_DeserializeMessage(context, global::Nitric.Proto.Storage.v1.ClientMessage.Parser)); + static readonly grpc::Marshaller __Marshaller_nitric_proto_storage_v1_ServerMessage = grpc::Marshallers.Create(__Helper_SerializeMessage, context => __Helper_DeserializeMessage(context, global::Nitric.Proto.Storage.v1.ServerMessage.Parser)); + + static readonly grpc::Method __Method_Listen = new grpc::Method( + grpc::MethodType.DuplexStreaming, + __ServiceName, + "Listen", + __Marshaller_nitric_proto_storage_v1_ClientMessage, + __Marshaller_nitric_proto_storage_v1_ServerMessage); + + /// Service descriptor + public static global::Google.Protobuf.Reflection.ServiceDescriptor Descriptor + { + get { return global::Nitric.Proto.Storage.v1.StorageReflection.Descriptor.Services[1]; } + } + + /// Base class for server-side implementations of StorageListener + [grpc::BindServiceMethod(typeof(StorageListener), "BindService")] + public abstract partial class StorageListenerBase + { + /// + /// Listen for changes on a bucket + /// + /// Used for reading requests from the client. + /// Used for sending responses back to the client. + /// The context of the server-side call handler being invoked. + /// A task indicating completion of the handler. + public virtual global::System.Threading.Tasks.Task Listen(grpc::IAsyncStreamReader requestStream, grpc::IServerStreamWriter responseStream, grpc::ServerCallContext context) + { + throw new grpc::RpcException(new grpc::Status(grpc::StatusCode.Unimplemented, "")); + } + + } + + /// Client for StorageListener + public partial class StorageListenerClient : grpc::ClientBase + { + /// Creates a new client for StorageListener + /// The channel to use to make remote calls. + public StorageListenerClient(grpc::ChannelBase channel) : base(channel) + { + } + /// Creates a new client for StorageListener that uses a custom CallInvoker. + /// The callInvoker to use to make remote calls. + public StorageListenerClient(grpc::CallInvoker callInvoker) : base(callInvoker) + { + } + /// Protected parameterless constructor to allow creation of test doubles. + protected StorageListenerClient() : base() + { + } + /// Protected constructor to allow creation of configured clients. + /// The client configuration. + protected StorageListenerClient(ClientBaseConfiguration configuration) : base(configuration) + { + } + + /// + /// Listen for changes on a bucket + /// + /// The initial metadata to send with the call. This parameter is optional. + /// An optional deadline for the call. The call will be cancelled if deadline is hit. + /// An optional token for canceling the call. + /// The call object. + public virtual grpc::AsyncDuplexStreamingCall Listen(grpc::Metadata headers = null, global::System.DateTime? deadline = null, global::System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken)) + { + return Listen(new grpc::CallOptions(headers, deadline, cancellationToken)); + } + /// + /// Listen for changes on a bucket + /// + /// The options for the call. + /// The call object. + public virtual grpc::AsyncDuplexStreamingCall Listen(grpc::CallOptions options) + { + return CallInvoker.AsyncDuplexStreamingCall(__Method_Listen, null, options); + } + /// Creates a new instance of client from given ClientBaseConfiguration. + protected override StorageListenerClient NewInstance(ClientBaseConfiguration configuration) + { + return new StorageListenerClient(configuration); + } + } + + /// Creates service definition that can be registered with a server + /// An object implementing the server-side handling logic. + public static grpc::ServerServiceDefinition BindService(StorageListenerBase serviceImpl) + { + return grpc::ServerServiceDefinition.CreateBuilder() + .AddMethod(__Method_Listen, serviceImpl.Listen).Build(); + } + + /// Register service method with a service binder with or without implementation. Useful when customizing the service binding logic. + /// Note: this method is part of an experimental API that can change or be removed without any prior notice. + /// Service methods will be bound by calling AddMethod on this object. + /// An object implementing the server-side handling logic. + public static void BindService(grpc::ServiceBinderBase serviceBinder, StorageListenerBase serviceImpl) + { + serviceBinder.AddMethod(__Method_Listen, serviceImpl == null ? null : new grpc::DuplexStreamingServerMethod(serviceImpl.Listen)); + } + + } } #endregion diff --git a/src/Nitric.Sdk/Proto/nitric/proto/topics/v1/Topics.cs b/src/Nitric.Sdk/Proto/nitric/proto/topics/v1/Topics.cs new file mode 100644 index 0000000..b822422 --- /dev/null +++ b/src/Nitric.Sdk/Proto/nitric/proto/topics/v1/Topics.cs @@ -0,0 +1,2025 @@ +// +// Generated by the protocol buffer compiler. DO NOT EDIT! +// source: nitric/proto/topics/v1/topics.proto +// +#pragma warning disable 1591, 0612, 3021 +#region Designer generated code + +using pb = global::Google.Protobuf; +using pbc = global::Google.Protobuf.Collections; +using pbr = global::Google.Protobuf.Reflection; +using scg = global::System.Collections.Generic; +namespace Nitric.Proto.Topics.v1 { + + /// Holder for reflection information generated from nitric/proto/topics/v1/topics.proto + public static partial class TopicsReflection { + + #region Descriptor + /// File descriptor for nitric/proto/topics/v1/topics.proto + public static pbr::FileDescriptor Descriptor { + get { return descriptor; } + } + private static pbr::FileDescriptor descriptor; + + static TopicsReflection() { + byte[] descriptorData = global::System.Convert.FromBase64String( + string.Concat( + "CiNuaXRyaWMvcHJvdG8vdG9waWNzL3YxL3RvcGljcy5wcm90bxIWbml0cmlj", + "LnByb3RvLnRvcGljcy52MRocZ29vZ2xlL3Byb3RvYnVmL3N0cnVjdC5wcm90", + "bxoeZ29vZ2xlL3Byb3RvYnVmL2R1cmF0aW9uLnByb3RvIrgBCg1DbGllbnRN", + "ZXNzYWdlEgoKAmlkGAEgASgJEksKFHJlZ2lzdHJhdGlvbl9yZXF1ZXN0GAIg", + "ASgLMisubml0cmljLnByb3RvLnRvcGljcy52MS5SZWdpc3RyYXRpb25SZXF1", + "ZXN0SAASQwoQbWVzc2FnZV9yZXNwb25zZRgDIAEoCzInLm5pdHJpYy5wcm90", + "by50b3BpY3MudjEuTWVzc2FnZVJlc3BvbnNlSABCCQoHY29udGVudCJWCg5N", + "ZXNzYWdlUmVxdWVzdBISCgp0b3BpY19uYW1lGAEgASgJEjAKB21lc3NhZ2UY", + "AiABKAsyHy5uaXRyaWMucHJvdG8udG9waWNzLnYxLk1lc3NhZ2UiIgoPTWVz", + "c2FnZVJlc3BvbnNlEg8KB3N1Y2Nlc3MYASABKAgiuAEKDVNlcnZlck1lc3Nh", + "Z2USCgoCaWQYASABKAkSTQoVcmVnaXN0cmF0aW9uX3Jlc3BvbnNlGAIgASgL", + "Miwubml0cmljLnByb3RvLnRvcGljcy52MS5SZWdpc3RyYXRpb25SZXNwb25z", + "ZUgAEkEKD21lc3NhZ2VfcmVxdWVzdBgDIAEoCzImLm5pdHJpYy5wcm90by50", + "b3BpY3MudjEuTWVzc2FnZVJlcXVlc3RIAEIJCgdjb250ZW50IikKE1JlZ2lz", + "dHJhdGlvblJlcXVlc3QSEgoKdG9waWNfbmFtZRgBIAEoCSIWChRSZWdpc3Ry", + "YXRpb25SZXNwb25zZSJHCgdNZXNzYWdlEjEKDnN0cnVjdF9wYXlsb2FkGAEg", + "ASgLMhcuZ29vZ2xlLnByb3RvYnVmLlN0cnVjdEgAQgkKB2NvbnRlbnQihQEK", + "E1RvcGljUHVibGlzaFJlcXVlc3QSEgoKdG9waWNfbmFtZRgBIAEoCRIwCgdt", + "ZXNzYWdlGAIgASgLMh8ubml0cmljLnByb3RvLnRvcGljcy52MS5NZXNzYWdl", + "EigKBWRlbGF5GAMgASgLMhkuZ29vZ2xlLnByb3RvYnVmLkR1cmF0aW9uIhYK", + "FFRvcGljUHVibGlzaFJlc3BvbnNlMm4KBlRvcGljcxJkCgdQdWJsaXNoEisu", + "bml0cmljLnByb3RvLnRvcGljcy52MS5Ub3BpY1B1Ymxpc2hSZXF1ZXN0Giwu", + "bml0cmljLnByb3RvLnRvcGljcy52MS5Ub3BpY1B1Ymxpc2hSZXNwb25zZTJr", + "CgpTdWJzY3JpYmVyEl0KCVN1YnNjcmliZRIlLm5pdHJpYy5wcm90by50b3Bp", + "Y3MudjEuQ2xpZW50TWVzc2FnZRolLm5pdHJpYy5wcm90by50b3BpY3MudjEu", + "U2VydmVyTWVzc2FnZSgBMAFCngEKGWlvLm5pdHJpYy5wcm90by50b3BpY3Mu", + "djFCDVRvcGljc1NlcnZpY2VQAVo+Z2l0aHViLmNvbS9uaXRyaWN0ZWNoL25p", + "dHJpYy9jb3JlL3BrZy9wcm90by90b3BpY3MvdjE7dG9waWNzcGKqAhZOaXRy", + "aWMuUHJvdG8uVG9waWNzLnYxygIWTml0cmljXFByb3RvXFRvcGljc1xWMWIG", + "cHJvdG8z")); + descriptor = pbr::FileDescriptor.FromGeneratedCode(descriptorData, + new pbr::FileDescriptor[] { global::Google.Protobuf.WellKnownTypes.StructReflection.Descriptor, global::Google.Protobuf.WellKnownTypes.DurationReflection.Descriptor, }, + new pbr::GeneratedClrTypeInfo(null, null, new pbr::GeneratedClrTypeInfo[] { + new pbr::GeneratedClrTypeInfo(typeof(global::Nitric.Proto.Topics.v1.ClientMessage), global::Nitric.Proto.Topics.v1.ClientMessage.Parser, new[]{ "Id", "RegistrationRequest", "MessageResponse" }, new[]{ "Content" }, null, null, null), + new pbr::GeneratedClrTypeInfo(typeof(global::Nitric.Proto.Topics.v1.MessageRequest), global::Nitric.Proto.Topics.v1.MessageRequest.Parser, new[]{ "TopicName", "Message" }, null, null, null, null), + new pbr::GeneratedClrTypeInfo(typeof(global::Nitric.Proto.Topics.v1.MessageResponse), global::Nitric.Proto.Topics.v1.MessageResponse.Parser, new[]{ "Success" }, null, null, null, null), + new pbr::GeneratedClrTypeInfo(typeof(global::Nitric.Proto.Topics.v1.ServerMessage), global::Nitric.Proto.Topics.v1.ServerMessage.Parser, new[]{ "Id", "RegistrationResponse", "MessageRequest" }, new[]{ "Content" }, null, null, null), + new pbr::GeneratedClrTypeInfo(typeof(global::Nitric.Proto.Topics.v1.RegistrationRequest), global::Nitric.Proto.Topics.v1.RegistrationRequest.Parser, new[]{ "TopicName" }, null, null, null, null), + new pbr::GeneratedClrTypeInfo(typeof(global::Nitric.Proto.Topics.v1.RegistrationResponse), global::Nitric.Proto.Topics.v1.RegistrationResponse.Parser, null, null, null, null, null), + new pbr::GeneratedClrTypeInfo(typeof(global::Nitric.Proto.Topics.v1.Message), global::Nitric.Proto.Topics.v1.Message.Parser, new[]{ "StructPayload" }, new[]{ "Content" }, null, null, null), + new pbr::GeneratedClrTypeInfo(typeof(global::Nitric.Proto.Topics.v1.TopicPublishRequest), global::Nitric.Proto.Topics.v1.TopicPublishRequest.Parser, new[]{ "TopicName", "Message", "Delay" }, null, null, null, null), + new pbr::GeneratedClrTypeInfo(typeof(global::Nitric.Proto.Topics.v1.TopicPublishResponse), global::Nitric.Proto.Topics.v1.TopicPublishResponse.Parser, null, null, null, null, null) + })); + } + #endregion + + } + #region Messages + public sealed partial class ClientMessage : pb::IMessage + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + , pb::IBufferMessage + #endif + { + private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new ClientMessage()); + private pb::UnknownFieldSet _unknownFields; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public static pb::MessageParser Parser { get { return _parser; } } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public static pbr::MessageDescriptor Descriptor { + get { return global::Nitric.Proto.Topics.v1.TopicsReflection.Descriptor.MessageTypes[0]; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + pbr::MessageDescriptor pb::IMessage.Descriptor { + get { return Descriptor; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public ClientMessage() { + OnConstruction(); + } + + partial void OnConstruction(); + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public ClientMessage(ClientMessage other) : this() { + id_ = other.id_; + switch (other.ContentCase) { + case ContentOneofCase.RegistrationRequest: + RegistrationRequest = other.RegistrationRequest.Clone(); + break; + case ContentOneofCase.MessageResponse: + MessageResponse = other.MessageResponse.Clone(); + break; + } + + _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public ClientMessage Clone() { + return new ClientMessage(this); + } + + /// Field number for the "id" field. + public const int IdFieldNumber = 1; + private string id_ = ""; + /// + /// globally unique ID of the request/response pair + /// + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public string Id { + get { return id_; } + set { + id_ = pb::ProtoPreconditions.CheckNotNull(value, "value"); + } + } + + /// Field number for the "registration_request" field. + public const int RegistrationRequestFieldNumber = 2; + /// + /// Register a subscription to a topic + /// + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public global::Nitric.Proto.Topics.v1.RegistrationRequest RegistrationRequest { + get { return contentCase_ == ContentOneofCase.RegistrationRequest ? (global::Nitric.Proto.Topics.v1.RegistrationRequest) content_ : null; } + set { + content_ = value; + contentCase_ = value == null ? ContentOneofCase.None : ContentOneofCase.RegistrationRequest; + } + } + + /// Field number for the "message_response" field. + public const int MessageResponseFieldNumber = 3; + /// + /// Handle a message received from a topic + /// + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public global::Nitric.Proto.Topics.v1.MessageResponse MessageResponse { + get { return contentCase_ == ContentOneofCase.MessageResponse ? (global::Nitric.Proto.Topics.v1.MessageResponse) content_ : null; } + set { + content_ = value; + contentCase_ = value == null ? ContentOneofCase.None : ContentOneofCase.MessageResponse; + } + } + + private object content_; + /// Enum of possible cases for the "content" oneof. + public enum ContentOneofCase { + None = 0, + RegistrationRequest = 2, + MessageResponse = 3, + } + private ContentOneofCase contentCase_ = ContentOneofCase.None; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public ContentOneofCase ContentCase { + get { return contentCase_; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public void ClearContent() { + contentCase_ = ContentOneofCase.None; + content_ = null; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public override bool Equals(object other) { + return Equals(other as ClientMessage); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public bool Equals(ClientMessage other) { + if (ReferenceEquals(other, null)) { + return false; + } + if (ReferenceEquals(other, this)) { + return true; + } + if (Id != other.Id) return false; + if (!object.Equals(RegistrationRequest, other.RegistrationRequest)) return false; + if (!object.Equals(MessageResponse, other.MessageResponse)) return false; + if (ContentCase != other.ContentCase) return false; + return Equals(_unknownFields, other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public override int GetHashCode() { + int hash = 1; + if (Id.Length != 0) hash ^= Id.GetHashCode(); + if (contentCase_ == ContentOneofCase.RegistrationRequest) hash ^= RegistrationRequest.GetHashCode(); + if (contentCase_ == ContentOneofCase.MessageResponse) hash ^= MessageResponse.GetHashCode(); + hash ^= (int) contentCase_; + if (_unknownFields != null) { + hash ^= _unknownFields.GetHashCode(); + } + return hash; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public override string ToString() { + return pb::JsonFormatter.ToDiagnosticString(this); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public void WriteTo(pb::CodedOutputStream output) { + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + output.WriteRawMessage(this); + #else + if (Id.Length != 0) { + output.WriteRawTag(10); + output.WriteString(Id); + } + if (contentCase_ == ContentOneofCase.RegistrationRequest) { + output.WriteRawTag(18); + output.WriteMessage(RegistrationRequest); + } + if (contentCase_ == ContentOneofCase.MessageResponse) { + output.WriteRawTag(26); + output.WriteMessage(MessageResponse); + } + if (_unknownFields != null) { + _unknownFields.WriteTo(output); + } + #endif + } + + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + void pb::IBufferMessage.InternalWriteTo(ref pb::WriteContext output) { + if (Id.Length != 0) { + output.WriteRawTag(10); + output.WriteString(Id); + } + if (contentCase_ == ContentOneofCase.RegistrationRequest) { + output.WriteRawTag(18); + output.WriteMessage(RegistrationRequest); + } + if (contentCase_ == ContentOneofCase.MessageResponse) { + output.WriteRawTag(26); + output.WriteMessage(MessageResponse); + } + if (_unknownFields != null) { + _unknownFields.WriteTo(ref output); + } + } + #endif + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public int CalculateSize() { + int size = 0; + if (Id.Length != 0) { + size += 1 + pb::CodedOutputStream.ComputeStringSize(Id); + } + if (contentCase_ == ContentOneofCase.RegistrationRequest) { + size += 1 + pb::CodedOutputStream.ComputeMessageSize(RegistrationRequest); + } + if (contentCase_ == ContentOneofCase.MessageResponse) { + size += 1 + pb::CodedOutputStream.ComputeMessageSize(MessageResponse); + } + if (_unknownFields != null) { + size += _unknownFields.CalculateSize(); + } + return size; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public void MergeFrom(ClientMessage other) { + if (other == null) { + return; + } + if (other.Id.Length != 0) { + Id = other.Id; + } + switch (other.ContentCase) { + case ContentOneofCase.RegistrationRequest: + if (RegistrationRequest == null) { + RegistrationRequest = new global::Nitric.Proto.Topics.v1.RegistrationRequest(); + } + RegistrationRequest.MergeFrom(other.RegistrationRequest); + break; + case ContentOneofCase.MessageResponse: + if (MessageResponse == null) { + MessageResponse = new global::Nitric.Proto.Topics.v1.MessageResponse(); + } + MessageResponse.MergeFrom(other.MessageResponse); + break; + } + + _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public void MergeFrom(pb::CodedInputStream input) { + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + input.ReadRawMessage(this); + #else + uint tag; + while ((tag = input.ReadTag()) != 0) { + switch(tag) { + default: + _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input); + break; + case 10: { + Id = input.ReadString(); + break; + } + case 18: { + global::Nitric.Proto.Topics.v1.RegistrationRequest subBuilder = new global::Nitric.Proto.Topics.v1.RegistrationRequest(); + if (contentCase_ == ContentOneofCase.RegistrationRequest) { + subBuilder.MergeFrom(RegistrationRequest); + } + input.ReadMessage(subBuilder); + RegistrationRequest = subBuilder; + break; + } + case 26: { + global::Nitric.Proto.Topics.v1.MessageResponse subBuilder = new global::Nitric.Proto.Topics.v1.MessageResponse(); + if (contentCase_ == ContentOneofCase.MessageResponse) { + subBuilder.MergeFrom(MessageResponse); + } + input.ReadMessage(subBuilder); + MessageResponse = subBuilder; + break; + } + } + } + #endif + } + + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + void pb::IBufferMessage.InternalMergeFrom(ref pb::ParseContext input) { + uint tag; + while ((tag = input.ReadTag()) != 0) { + switch(tag) { + default: + _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, ref input); + break; + case 10: { + Id = input.ReadString(); + break; + } + case 18: { + global::Nitric.Proto.Topics.v1.RegistrationRequest subBuilder = new global::Nitric.Proto.Topics.v1.RegistrationRequest(); + if (contentCase_ == ContentOneofCase.RegistrationRequest) { + subBuilder.MergeFrom(RegistrationRequest); + } + input.ReadMessage(subBuilder); + RegistrationRequest = subBuilder; + break; + } + case 26: { + global::Nitric.Proto.Topics.v1.MessageResponse subBuilder = new global::Nitric.Proto.Topics.v1.MessageResponse(); + if (contentCase_ == ContentOneofCase.MessageResponse) { + subBuilder.MergeFrom(MessageResponse); + } + input.ReadMessage(subBuilder); + MessageResponse = subBuilder; + break; + } + } + } + } + #endif + + } + + public sealed partial class MessageRequest : pb::IMessage + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + , pb::IBufferMessage + #endif + { + private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new MessageRequest()); + private pb::UnknownFieldSet _unknownFields; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public static pb::MessageParser Parser { get { return _parser; } } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public static pbr::MessageDescriptor Descriptor { + get { return global::Nitric.Proto.Topics.v1.TopicsReflection.Descriptor.MessageTypes[1]; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + pbr::MessageDescriptor pb::IMessage.Descriptor { + get { return Descriptor; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public MessageRequest() { + OnConstruction(); + } + + partial void OnConstruction(); + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public MessageRequest(MessageRequest other) : this() { + topicName_ = other.topicName_; + message_ = other.message_ != null ? other.message_.Clone() : null; + _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public MessageRequest Clone() { + return new MessageRequest(this); + } + + /// Field number for the "topic_name" field. + public const int TopicNameFieldNumber = 1; + private string topicName_ = ""; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public string TopicName { + get { return topicName_; } + set { + topicName_ = pb::ProtoPreconditions.CheckNotNull(value, "value"); + } + } + + /// Field number for the "message" field. + public const int MessageFieldNumber = 2; + private global::Nitric.Proto.Topics.v1.Message message_; + /// + /// Message Type + /// + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public global::Nitric.Proto.Topics.v1.Message Message { + get { return message_; } + set { + message_ = value; + } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public override bool Equals(object other) { + return Equals(other as MessageRequest); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public bool Equals(MessageRequest other) { + if (ReferenceEquals(other, null)) { + return false; + } + if (ReferenceEquals(other, this)) { + return true; + } + if (TopicName != other.TopicName) return false; + if (!object.Equals(Message, other.Message)) return false; + return Equals(_unknownFields, other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public override int GetHashCode() { + int hash = 1; + if (TopicName.Length != 0) hash ^= TopicName.GetHashCode(); + if (message_ != null) hash ^= Message.GetHashCode(); + if (_unknownFields != null) { + hash ^= _unknownFields.GetHashCode(); + } + return hash; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public override string ToString() { + return pb::JsonFormatter.ToDiagnosticString(this); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public void WriteTo(pb::CodedOutputStream output) { + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + output.WriteRawMessage(this); + #else + if (TopicName.Length != 0) { + output.WriteRawTag(10); + output.WriteString(TopicName); + } + if (message_ != null) { + output.WriteRawTag(18); + output.WriteMessage(Message); + } + if (_unknownFields != null) { + _unknownFields.WriteTo(output); + } + #endif + } + + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + void pb::IBufferMessage.InternalWriteTo(ref pb::WriteContext output) { + if (TopicName.Length != 0) { + output.WriteRawTag(10); + output.WriteString(TopicName); + } + if (message_ != null) { + output.WriteRawTag(18); + output.WriteMessage(Message); + } + if (_unknownFields != null) { + _unknownFields.WriteTo(ref output); + } + } + #endif + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public int CalculateSize() { + int size = 0; + if (TopicName.Length != 0) { + size += 1 + pb::CodedOutputStream.ComputeStringSize(TopicName); + } + if (message_ != null) { + size += 1 + pb::CodedOutputStream.ComputeMessageSize(Message); + } + if (_unknownFields != null) { + size += _unknownFields.CalculateSize(); + } + return size; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public void MergeFrom(MessageRequest other) { + if (other == null) { + return; + } + if (other.TopicName.Length != 0) { + TopicName = other.TopicName; + } + if (other.message_ != null) { + if (message_ == null) { + Message = new global::Nitric.Proto.Topics.v1.Message(); + } + Message.MergeFrom(other.Message); + } + _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public void MergeFrom(pb::CodedInputStream input) { + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + input.ReadRawMessage(this); + #else + uint tag; + while ((tag = input.ReadTag()) != 0) { + switch(tag) { + default: + _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input); + break; + case 10: { + TopicName = input.ReadString(); + break; + } + case 18: { + if (message_ == null) { + Message = new global::Nitric.Proto.Topics.v1.Message(); + } + input.ReadMessage(Message); + break; + } + } + } + #endif + } + + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + void pb::IBufferMessage.InternalMergeFrom(ref pb::ParseContext input) { + uint tag; + while ((tag = input.ReadTag()) != 0) { + switch(tag) { + default: + _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, ref input); + break; + case 10: { + TopicName = input.ReadString(); + break; + } + case 18: { + if (message_ == null) { + Message = new global::Nitric.Proto.Topics.v1.Message(); + } + input.ReadMessage(Message); + break; + } + } + } + } + #endif + + } + + public sealed partial class MessageResponse : pb::IMessage + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + , pb::IBufferMessage + #endif + { + private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new MessageResponse()); + private pb::UnknownFieldSet _unknownFields; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public static pb::MessageParser Parser { get { return _parser; } } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public static pbr::MessageDescriptor Descriptor { + get { return global::Nitric.Proto.Topics.v1.TopicsReflection.Descriptor.MessageTypes[2]; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + pbr::MessageDescriptor pb::IMessage.Descriptor { + get { return Descriptor; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public MessageResponse() { + OnConstruction(); + } + + partial void OnConstruction(); + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public MessageResponse(MessageResponse other) : this() { + success_ = other.success_; + _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public MessageResponse Clone() { + return new MessageResponse(this); + } + + /// Field number for the "success" field. + public const int SuccessFieldNumber = 1; + private bool success_; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public bool Success { + get { return success_; } + set { + success_ = value; + } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public override bool Equals(object other) { + return Equals(other as MessageResponse); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public bool Equals(MessageResponse other) { + if (ReferenceEquals(other, null)) { + return false; + } + if (ReferenceEquals(other, this)) { + return true; + } + if (Success != other.Success) return false; + return Equals(_unknownFields, other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public override int GetHashCode() { + int hash = 1; + if (Success != false) hash ^= Success.GetHashCode(); + if (_unknownFields != null) { + hash ^= _unknownFields.GetHashCode(); + } + return hash; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public override string ToString() { + return pb::JsonFormatter.ToDiagnosticString(this); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public void WriteTo(pb::CodedOutputStream output) { + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + output.WriteRawMessage(this); + #else + if (Success != false) { + output.WriteRawTag(8); + output.WriteBool(Success); + } + if (_unknownFields != null) { + _unknownFields.WriteTo(output); + } + #endif + } + + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + void pb::IBufferMessage.InternalWriteTo(ref pb::WriteContext output) { + if (Success != false) { + output.WriteRawTag(8); + output.WriteBool(Success); + } + if (_unknownFields != null) { + _unknownFields.WriteTo(ref output); + } + } + #endif + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public int CalculateSize() { + int size = 0; + if (Success != false) { + size += 1 + 1; + } + if (_unknownFields != null) { + size += _unknownFields.CalculateSize(); + } + return size; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public void MergeFrom(MessageResponse other) { + if (other == null) { + return; + } + if (other.Success != false) { + Success = other.Success; + } + _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public void MergeFrom(pb::CodedInputStream input) { + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + input.ReadRawMessage(this); + #else + uint tag; + while ((tag = input.ReadTag()) != 0) { + switch(tag) { + default: + _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input); + break; + case 8: { + Success = input.ReadBool(); + break; + } + } + } + #endif + } + + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + void pb::IBufferMessage.InternalMergeFrom(ref pb::ParseContext input) { + uint tag; + while ((tag = input.ReadTag()) != 0) { + switch(tag) { + default: + _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, ref input); + break; + case 8: { + Success = input.ReadBool(); + break; + } + } + } + } + #endif + + } + + public sealed partial class ServerMessage : pb::IMessage + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + , pb::IBufferMessage + #endif + { + private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new ServerMessage()); + private pb::UnknownFieldSet _unknownFields; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public static pb::MessageParser Parser { get { return _parser; } } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public static pbr::MessageDescriptor Descriptor { + get { return global::Nitric.Proto.Topics.v1.TopicsReflection.Descriptor.MessageTypes[3]; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + pbr::MessageDescriptor pb::IMessage.Descriptor { + get { return Descriptor; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public ServerMessage() { + OnConstruction(); + } + + partial void OnConstruction(); + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public ServerMessage(ServerMessage other) : this() { + id_ = other.id_; + switch (other.ContentCase) { + case ContentOneofCase.RegistrationResponse: + RegistrationResponse = other.RegistrationResponse.Clone(); + break; + case ContentOneofCase.MessageRequest: + MessageRequest = other.MessageRequest.Clone(); + break; + } + + _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public ServerMessage Clone() { + return new ServerMessage(this); + } + + /// Field number for the "id" field. + public const int IdFieldNumber = 1; + private string id_ = ""; + /// + /// globally unique ID of the request/response pair + /// + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public string Id { + get { return id_; } + set { + id_ = pb::ProtoPreconditions.CheckNotNull(value, "value"); + } + } + + /// Field number for the "registration_response" field. + public const int RegistrationResponseFieldNumber = 2; + /// + /// Response to a topic subscription request + /// + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public global::Nitric.Proto.Topics.v1.RegistrationResponse RegistrationResponse { + get { return contentCase_ == ContentOneofCase.RegistrationResponse ? (global::Nitric.Proto.Topics.v1.RegistrationResponse) content_ : null; } + set { + content_ = value; + contentCase_ = value == null ? ContentOneofCase.None : ContentOneofCase.RegistrationResponse; + } + } + + /// Field number for the "message_request" field. + public const int MessageRequestFieldNumber = 3; + /// + /// Response to a topic message request + /// + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public global::Nitric.Proto.Topics.v1.MessageRequest MessageRequest { + get { return contentCase_ == ContentOneofCase.MessageRequest ? (global::Nitric.Proto.Topics.v1.MessageRequest) content_ : null; } + set { + content_ = value; + contentCase_ = value == null ? ContentOneofCase.None : ContentOneofCase.MessageRequest; + } + } + + private object content_; + /// Enum of possible cases for the "content" oneof. + public enum ContentOneofCase { + None = 0, + RegistrationResponse = 2, + MessageRequest = 3, + } + private ContentOneofCase contentCase_ = ContentOneofCase.None; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public ContentOneofCase ContentCase { + get { return contentCase_; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public void ClearContent() { + contentCase_ = ContentOneofCase.None; + content_ = null; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public override bool Equals(object other) { + return Equals(other as ServerMessage); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public bool Equals(ServerMessage other) { + if (ReferenceEquals(other, null)) { + return false; + } + if (ReferenceEquals(other, this)) { + return true; + } + if (Id != other.Id) return false; + if (!object.Equals(RegistrationResponse, other.RegistrationResponse)) return false; + if (!object.Equals(MessageRequest, other.MessageRequest)) return false; + if (ContentCase != other.ContentCase) return false; + return Equals(_unknownFields, other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public override int GetHashCode() { + int hash = 1; + if (Id.Length != 0) hash ^= Id.GetHashCode(); + if (contentCase_ == ContentOneofCase.RegistrationResponse) hash ^= RegistrationResponse.GetHashCode(); + if (contentCase_ == ContentOneofCase.MessageRequest) hash ^= MessageRequest.GetHashCode(); + hash ^= (int) contentCase_; + if (_unknownFields != null) { + hash ^= _unknownFields.GetHashCode(); + } + return hash; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public override string ToString() { + return pb::JsonFormatter.ToDiagnosticString(this); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public void WriteTo(pb::CodedOutputStream output) { + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + output.WriteRawMessage(this); + #else + if (Id.Length != 0) { + output.WriteRawTag(10); + output.WriteString(Id); + } + if (contentCase_ == ContentOneofCase.RegistrationResponse) { + output.WriteRawTag(18); + output.WriteMessage(RegistrationResponse); + } + if (contentCase_ == ContentOneofCase.MessageRequest) { + output.WriteRawTag(26); + output.WriteMessage(MessageRequest); + } + if (_unknownFields != null) { + _unknownFields.WriteTo(output); + } + #endif + } + + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + void pb::IBufferMessage.InternalWriteTo(ref pb::WriteContext output) { + if (Id.Length != 0) { + output.WriteRawTag(10); + output.WriteString(Id); + } + if (contentCase_ == ContentOneofCase.RegistrationResponse) { + output.WriteRawTag(18); + output.WriteMessage(RegistrationResponse); + } + if (contentCase_ == ContentOneofCase.MessageRequest) { + output.WriteRawTag(26); + output.WriteMessage(MessageRequest); + } + if (_unknownFields != null) { + _unknownFields.WriteTo(ref output); + } + } + #endif + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public int CalculateSize() { + int size = 0; + if (Id.Length != 0) { + size += 1 + pb::CodedOutputStream.ComputeStringSize(Id); + } + if (contentCase_ == ContentOneofCase.RegistrationResponse) { + size += 1 + pb::CodedOutputStream.ComputeMessageSize(RegistrationResponse); + } + if (contentCase_ == ContentOneofCase.MessageRequest) { + size += 1 + pb::CodedOutputStream.ComputeMessageSize(MessageRequest); + } + if (_unknownFields != null) { + size += _unknownFields.CalculateSize(); + } + return size; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public void MergeFrom(ServerMessage other) { + if (other == null) { + return; + } + if (other.Id.Length != 0) { + Id = other.Id; + } + switch (other.ContentCase) { + case ContentOneofCase.RegistrationResponse: + if (RegistrationResponse == null) { + RegistrationResponse = new global::Nitric.Proto.Topics.v1.RegistrationResponse(); + } + RegistrationResponse.MergeFrom(other.RegistrationResponse); + break; + case ContentOneofCase.MessageRequest: + if (MessageRequest == null) { + MessageRequest = new global::Nitric.Proto.Topics.v1.MessageRequest(); + } + MessageRequest.MergeFrom(other.MessageRequest); + break; + } + + _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public void MergeFrom(pb::CodedInputStream input) { + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + input.ReadRawMessage(this); + #else + uint tag; + while ((tag = input.ReadTag()) != 0) { + switch(tag) { + default: + _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input); + break; + case 10: { + Id = input.ReadString(); + break; + } + case 18: { + global::Nitric.Proto.Topics.v1.RegistrationResponse subBuilder = new global::Nitric.Proto.Topics.v1.RegistrationResponse(); + if (contentCase_ == ContentOneofCase.RegistrationResponse) { + subBuilder.MergeFrom(RegistrationResponse); + } + input.ReadMessage(subBuilder); + RegistrationResponse = subBuilder; + break; + } + case 26: { + global::Nitric.Proto.Topics.v1.MessageRequest subBuilder = new global::Nitric.Proto.Topics.v1.MessageRequest(); + if (contentCase_ == ContentOneofCase.MessageRequest) { + subBuilder.MergeFrom(MessageRequest); + } + input.ReadMessage(subBuilder); + MessageRequest = subBuilder; + break; + } + } + } + #endif + } + + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + void pb::IBufferMessage.InternalMergeFrom(ref pb::ParseContext input) { + uint tag; + while ((tag = input.ReadTag()) != 0) { + switch(tag) { + default: + _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, ref input); + break; + case 10: { + Id = input.ReadString(); + break; + } + case 18: { + global::Nitric.Proto.Topics.v1.RegistrationResponse subBuilder = new global::Nitric.Proto.Topics.v1.RegistrationResponse(); + if (contentCase_ == ContentOneofCase.RegistrationResponse) { + subBuilder.MergeFrom(RegistrationResponse); + } + input.ReadMessage(subBuilder); + RegistrationResponse = subBuilder; + break; + } + case 26: { + global::Nitric.Proto.Topics.v1.MessageRequest subBuilder = new global::Nitric.Proto.Topics.v1.MessageRequest(); + if (contentCase_ == ContentOneofCase.MessageRequest) { + subBuilder.MergeFrom(MessageRequest); + } + input.ReadMessage(subBuilder); + MessageRequest = subBuilder; + break; + } + } + } + } + #endif + + } + + public sealed partial class RegistrationRequest : pb::IMessage + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + , pb::IBufferMessage + #endif + { + private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new RegistrationRequest()); + private pb::UnknownFieldSet _unknownFields; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public static pb::MessageParser Parser { get { return _parser; } } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public static pbr::MessageDescriptor Descriptor { + get { return global::Nitric.Proto.Topics.v1.TopicsReflection.Descriptor.MessageTypes[4]; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + pbr::MessageDescriptor pb::IMessage.Descriptor { + get { return Descriptor; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public RegistrationRequest() { + OnConstruction(); + } + + partial void OnConstruction(); + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public RegistrationRequest(RegistrationRequest other) : this() { + topicName_ = other.topicName_; + _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public RegistrationRequest Clone() { + return new RegistrationRequest(this); + } + + /// Field number for the "topic_name" field. + public const int TopicNameFieldNumber = 1; + private string topicName_ = ""; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public string TopicName { + get { return topicName_; } + set { + topicName_ = pb::ProtoPreconditions.CheckNotNull(value, "value"); + } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public override bool Equals(object other) { + return Equals(other as RegistrationRequest); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public bool Equals(RegistrationRequest other) { + if (ReferenceEquals(other, null)) { + return false; + } + if (ReferenceEquals(other, this)) { + return true; + } + if (TopicName != other.TopicName) return false; + return Equals(_unknownFields, other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public override int GetHashCode() { + int hash = 1; + if (TopicName.Length != 0) hash ^= TopicName.GetHashCode(); + if (_unknownFields != null) { + hash ^= _unknownFields.GetHashCode(); + } + return hash; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public override string ToString() { + return pb::JsonFormatter.ToDiagnosticString(this); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public void WriteTo(pb::CodedOutputStream output) { + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + output.WriteRawMessage(this); + #else + if (TopicName.Length != 0) { + output.WriteRawTag(10); + output.WriteString(TopicName); + } + if (_unknownFields != null) { + _unknownFields.WriteTo(output); + } + #endif + } + + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + void pb::IBufferMessage.InternalWriteTo(ref pb::WriteContext output) { + if (TopicName.Length != 0) { + output.WriteRawTag(10); + output.WriteString(TopicName); + } + if (_unknownFields != null) { + _unknownFields.WriteTo(ref output); + } + } + #endif + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public int CalculateSize() { + int size = 0; + if (TopicName.Length != 0) { + size += 1 + pb::CodedOutputStream.ComputeStringSize(TopicName); + } + if (_unknownFields != null) { + size += _unknownFields.CalculateSize(); + } + return size; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public void MergeFrom(RegistrationRequest other) { + if (other == null) { + return; + } + if (other.TopicName.Length != 0) { + TopicName = other.TopicName; + } + _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public void MergeFrom(pb::CodedInputStream input) { + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + input.ReadRawMessage(this); + #else + uint tag; + while ((tag = input.ReadTag()) != 0) { + switch(tag) { + default: + _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input); + break; + case 10: { + TopicName = input.ReadString(); + break; + } + } + } + #endif + } + + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + void pb::IBufferMessage.InternalMergeFrom(ref pb::ParseContext input) { + uint tag; + while ((tag = input.ReadTag()) != 0) { + switch(tag) { + default: + _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, ref input); + break; + case 10: { + TopicName = input.ReadString(); + break; + } + } + } + } + #endif + + } + + public sealed partial class RegistrationResponse : pb::IMessage + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + , pb::IBufferMessage + #endif + { + private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new RegistrationResponse()); + private pb::UnknownFieldSet _unknownFields; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public static pb::MessageParser Parser { get { return _parser; } } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public static pbr::MessageDescriptor Descriptor { + get { return global::Nitric.Proto.Topics.v1.TopicsReflection.Descriptor.MessageTypes[5]; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + pbr::MessageDescriptor pb::IMessage.Descriptor { + get { return Descriptor; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public RegistrationResponse() { + OnConstruction(); + } + + partial void OnConstruction(); + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public RegistrationResponse(RegistrationResponse other) : this() { + _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public RegistrationResponse Clone() { + return new RegistrationResponse(this); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public override bool Equals(object other) { + return Equals(other as RegistrationResponse); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public bool Equals(RegistrationResponse other) { + if (ReferenceEquals(other, null)) { + return false; + } + if (ReferenceEquals(other, this)) { + return true; + } + return Equals(_unknownFields, other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public override int GetHashCode() { + int hash = 1; + if (_unknownFields != null) { + hash ^= _unknownFields.GetHashCode(); + } + return hash; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public override string ToString() { + return pb::JsonFormatter.ToDiagnosticString(this); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public void WriteTo(pb::CodedOutputStream output) { + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + output.WriteRawMessage(this); + #else + if (_unknownFields != null) { + _unknownFields.WriteTo(output); + } + #endif + } + + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + void pb::IBufferMessage.InternalWriteTo(ref pb::WriteContext output) { + if (_unknownFields != null) { + _unknownFields.WriteTo(ref output); + } + } + #endif + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public int CalculateSize() { + int size = 0; + if (_unknownFields != null) { + size += _unknownFields.CalculateSize(); + } + return size; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public void MergeFrom(RegistrationResponse other) { + if (other == null) { + return; + } + _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public void MergeFrom(pb::CodedInputStream input) { + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + input.ReadRawMessage(this); + #else + uint tag; + while ((tag = input.ReadTag()) != 0) { + switch(tag) { + default: + _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input); + break; + } + } + #endif + } + + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + void pb::IBufferMessage.InternalMergeFrom(ref pb::ParseContext input) { + uint tag; + while ((tag = input.ReadTag()) != 0) { + switch(tag) { + default: + _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, ref input); + break; + } + } + } + #endif + + } + + public sealed partial class Message : pb::IMessage + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + , pb::IBufferMessage + #endif + { + private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new Message()); + private pb::UnknownFieldSet _unknownFields; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public static pb::MessageParser Parser { get { return _parser; } } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public static pbr::MessageDescriptor Descriptor { + get { return global::Nitric.Proto.Topics.v1.TopicsReflection.Descriptor.MessageTypes[6]; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + pbr::MessageDescriptor pb::IMessage.Descriptor { + get { return Descriptor; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public Message() { + OnConstruction(); + } + + partial void OnConstruction(); + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public Message(Message other) : this() { + switch (other.ContentCase) { + case ContentOneofCase.StructPayload: + StructPayload = other.StructPayload.Clone(); + break; + } + + _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public Message Clone() { + return new Message(this); + } + + /// Field number for the "struct_payload" field. + public const int StructPayloadFieldNumber = 1; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public global::Google.Protobuf.WellKnownTypes.Struct StructPayload { + get { return contentCase_ == ContentOneofCase.StructPayload ? (global::Google.Protobuf.WellKnownTypes.Struct) content_ : null; } + set { + content_ = value; + contentCase_ = value == null ? ContentOneofCase.None : ContentOneofCase.StructPayload; + } + } + + private object content_; + /// Enum of possible cases for the "content" oneof. + public enum ContentOneofCase { + None = 0, + StructPayload = 1, + } + private ContentOneofCase contentCase_ = ContentOneofCase.None; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public ContentOneofCase ContentCase { + get { return contentCase_; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public void ClearContent() { + contentCase_ = ContentOneofCase.None; + content_ = null; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public override bool Equals(object other) { + return Equals(other as Message); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public bool Equals(Message other) { + if (ReferenceEquals(other, null)) { + return false; + } + if (ReferenceEquals(other, this)) { + return true; + } + if (!object.Equals(StructPayload, other.StructPayload)) return false; + if (ContentCase != other.ContentCase) return false; + return Equals(_unknownFields, other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public override int GetHashCode() { + int hash = 1; + if (contentCase_ == ContentOneofCase.StructPayload) hash ^= StructPayload.GetHashCode(); + hash ^= (int) contentCase_; + if (_unknownFields != null) { + hash ^= _unknownFields.GetHashCode(); + } + return hash; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public override string ToString() { + return pb::JsonFormatter.ToDiagnosticString(this); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public void WriteTo(pb::CodedOutputStream output) { + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + output.WriteRawMessage(this); + #else + if (contentCase_ == ContentOneofCase.StructPayload) { + output.WriteRawTag(10); + output.WriteMessage(StructPayload); + } + if (_unknownFields != null) { + _unknownFields.WriteTo(output); + } + #endif + } + + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + void pb::IBufferMessage.InternalWriteTo(ref pb::WriteContext output) { + if (contentCase_ == ContentOneofCase.StructPayload) { + output.WriteRawTag(10); + output.WriteMessage(StructPayload); + } + if (_unknownFields != null) { + _unknownFields.WriteTo(ref output); + } + } + #endif + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public int CalculateSize() { + int size = 0; + if (contentCase_ == ContentOneofCase.StructPayload) { + size += 1 + pb::CodedOutputStream.ComputeMessageSize(StructPayload); + } + if (_unknownFields != null) { + size += _unknownFields.CalculateSize(); + } + return size; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public void MergeFrom(Message other) { + if (other == null) { + return; + } + switch (other.ContentCase) { + case ContentOneofCase.StructPayload: + if (StructPayload == null) { + StructPayload = new global::Google.Protobuf.WellKnownTypes.Struct(); + } + StructPayload.MergeFrom(other.StructPayload); + break; + } + + _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public void MergeFrom(pb::CodedInputStream input) { + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + input.ReadRawMessage(this); + #else + uint tag; + while ((tag = input.ReadTag()) != 0) { + switch(tag) { + default: + _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input); + break; + case 10: { + global::Google.Protobuf.WellKnownTypes.Struct subBuilder = new global::Google.Protobuf.WellKnownTypes.Struct(); + if (contentCase_ == ContentOneofCase.StructPayload) { + subBuilder.MergeFrom(StructPayload); + } + input.ReadMessage(subBuilder); + StructPayload = subBuilder; + break; + } + } + } + #endif + } + + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + void pb::IBufferMessage.InternalMergeFrom(ref pb::ParseContext input) { + uint tag; + while ((tag = input.ReadTag()) != 0) { + switch(tag) { + default: + _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, ref input); + break; + case 10: { + global::Google.Protobuf.WellKnownTypes.Struct subBuilder = new global::Google.Protobuf.WellKnownTypes.Struct(); + if (contentCase_ == ContentOneofCase.StructPayload) { + subBuilder.MergeFrom(StructPayload); + } + input.ReadMessage(subBuilder); + StructPayload = subBuilder; + break; + } + } + } + } + #endif + + } + + /// + /// Request to publish a message to a topic + /// + public sealed partial class TopicPublishRequest : pb::IMessage + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + , pb::IBufferMessage + #endif + { + private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new TopicPublishRequest()); + private pb::UnknownFieldSet _unknownFields; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public static pb::MessageParser Parser { get { return _parser; } } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public static pbr::MessageDescriptor Descriptor { + get { return global::Nitric.Proto.Topics.v1.TopicsReflection.Descriptor.MessageTypes[7]; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + pbr::MessageDescriptor pb::IMessage.Descriptor { + get { return Descriptor; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public TopicPublishRequest() { + OnConstruction(); + } + + partial void OnConstruction(); + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public TopicPublishRequest(TopicPublishRequest other) : this() { + topicName_ = other.topicName_; + message_ = other.message_ != null ? other.message_.Clone() : null; + delay_ = other.delay_ != null ? other.delay_.Clone() : null; + _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public TopicPublishRequest Clone() { + return new TopicPublishRequest(this); + } + + /// Field number for the "topic_name" field. + public const int TopicNameFieldNumber = 1; + private string topicName_ = ""; + /// + /// The name of the topic to publish the topic to + /// + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public string TopicName { + get { return topicName_; } + set { + topicName_ = pb::ProtoPreconditions.CheckNotNull(value, "value"); + } + } + + /// Field number for the "message" field. + public const int MessageFieldNumber = 2; + private global::Nitric.Proto.Topics.v1.Message message_; + /// + /// The message to be published + /// + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public global::Nitric.Proto.Topics.v1.Message Message { + get { return message_; } + set { + message_ = value; + } + } + + /// Field number for the "delay" field. + public const int DelayFieldNumber = 3; + private global::Google.Protobuf.WellKnownTypes.Duration delay_; + /// + /// An optional delay specified in seconds (minimum 10 seconds) + /// + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public global::Google.Protobuf.WellKnownTypes.Duration Delay { + get { return delay_; } + set { + delay_ = value; + } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public override bool Equals(object other) { + return Equals(other as TopicPublishRequest); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public bool Equals(TopicPublishRequest other) { + if (ReferenceEquals(other, null)) { + return false; + } + if (ReferenceEquals(other, this)) { + return true; + } + if (TopicName != other.TopicName) return false; + if (!object.Equals(Message, other.Message)) return false; + if (!object.Equals(Delay, other.Delay)) return false; + return Equals(_unknownFields, other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public override int GetHashCode() { + int hash = 1; + if (TopicName.Length != 0) hash ^= TopicName.GetHashCode(); + if (message_ != null) hash ^= Message.GetHashCode(); + if (delay_ != null) hash ^= Delay.GetHashCode(); + if (_unknownFields != null) { + hash ^= _unknownFields.GetHashCode(); + } + return hash; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public override string ToString() { + return pb::JsonFormatter.ToDiagnosticString(this); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public void WriteTo(pb::CodedOutputStream output) { + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + output.WriteRawMessage(this); + #else + if (TopicName.Length != 0) { + output.WriteRawTag(10); + output.WriteString(TopicName); + } + if (message_ != null) { + output.WriteRawTag(18); + output.WriteMessage(Message); + } + if (delay_ != null) { + output.WriteRawTag(26); + output.WriteMessage(Delay); + } + if (_unknownFields != null) { + _unknownFields.WriteTo(output); + } + #endif + } + + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + void pb::IBufferMessage.InternalWriteTo(ref pb::WriteContext output) { + if (TopicName.Length != 0) { + output.WriteRawTag(10); + output.WriteString(TopicName); + } + if (message_ != null) { + output.WriteRawTag(18); + output.WriteMessage(Message); + } + if (delay_ != null) { + output.WriteRawTag(26); + output.WriteMessage(Delay); + } + if (_unknownFields != null) { + _unknownFields.WriteTo(ref output); + } + } + #endif + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public int CalculateSize() { + int size = 0; + if (TopicName.Length != 0) { + size += 1 + pb::CodedOutputStream.ComputeStringSize(TopicName); + } + if (message_ != null) { + size += 1 + pb::CodedOutputStream.ComputeMessageSize(Message); + } + if (delay_ != null) { + size += 1 + pb::CodedOutputStream.ComputeMessageSize(Delay); + } + if (_unknownFields != null) { + size += _unknownFields.CalculateSize(); + } + return size; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public void MergeFrom(TopicPublishRequest other) { + if (other == null) { + return; + } + if (other.TopicName.Length != 0) { + TopicName = other.TopicName; + } + if (other.message_ != null) { + if (message_ == null) { + Message = new global::Nitric.Proto.Topics.v1.Message(); + } + Message.MergeFrom(other.Message); + } + if (other.delay_ != null) { + if (delay_ == null) { + Delay = new global::Google.Protobuf.WellKnownTypes.Duration(); + } + Delay.MergeFrom(other.Delay); + } + _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public void MergeFrom(pb::CodedInputStream input) { + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + input.ReadRawMessage(this); + #else + uint tag; + while ((tag = input.ReadTag()) != 0) { + switch(tag) { + default: + _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input); + break; + case 10: { + TopicName = input.ReadString(); + break; + } + case 18: { + if (message_ == null) { + Message = new global::Nitric.Proto.Topics.v1.Message(); + } + input.ReadMessage(Message); + break; + } + case 26: { + if (delay_ == null) { + Delay = new global::Google.Protobuf.WellKnownTypes.Duration(); + } + input.ReadMessage(Delay); + break; + } + } + } + #endif + } + + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + void pb::IBufferMessage.InternalMergeFrom(ref pb::ParseContext input) { + uint tag; + while ((tag = input.ReadTag()) != 0) { + switch(tag) { + default: + _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, ref input); + break; + case 10: { + TopicName = input.ReadString(); + break; + } + case 18: { + if (message_ == null) { + Message = new global::Nitric.Proto.Topics.v1.Message(); + } + input.ReadMessage(Message); + break; + } + case 26: { + if (delay_ == null) { + Delay = new global::Google.Protobuf.WellKnownTypes.Duration(); + } + input.ReadMessage(Delay); + break; + } + } + } + } + #endif + + } + + /// + /// Result of publishing an topic + /// + public sealed partial class TopicPublishResponse : pb::IMessage + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + , pb::IBufferMessage + #endif + { + private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new TopicPublishResponse()); + private pb::UnknownFieldSet _unknownFields; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public static pb::MessageParser Parser { get { return _parser; } } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public static pbr::MessageDescriptor Descriptor { + get { return global::Nitric.Proto.Topics.v1.TopicsReflection.Descriptor.MessageTypes[8]; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + pbr::MessageDescriptor pb::IMessage.Descriptor { + get { return Descriptor; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public TopicPublishResponse() { + OnConstruction(); + } + + partial void OnConstruction(); + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public TopicPublishResponse(TopicPublishResponse other) : this() { + _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public TopicPublishResponse Clone() { + return new TopicPublishResponse(this); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public override bool Equals(object other) { + return Equals(other as TopicPublishResponse); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public bool Equals(TopicPublishResponse other) { + if (ReferenceEquals(other, null)) { + return false; + } + if (ReferenceEquals(other, this)) { + return true; + } + return Equals(_unknownFields, other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public override int GetHashCode() { + int hash = 1; + if (_unknownFields != null) { + hash ^= _unknownFields.GetHashCode(); + } + return hash; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public override string ToString() { + return pb::JsonFormatter.ToDiagnosticString(this); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public void WriteTo(pb::CodedOutputStream output) { + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + output.WriteRawMessage(this); + #else + if (_unknownFields != null) { + _unknownFields.WriteTo(output); + } + #endif + } + + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + void pb::IBufferMessage.InternalWriteTo(ref pb::WriteContext output) { + if (_unknownFields != null) { + _unknownFields.WriteTo(ref output); + } + } + #endif + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public int CalculateSize() { + int size = 0; + if (_unknownFields != null) { + size += _unknownFields.CalculateSize(); + } + return size; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public void MergeFrom(TopicPublishResponse other) { + if (other == null) { + return; + } + _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public void MergeFrom(pb::CodedInputStream input) { + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + input.ReadRawMessage(this); + #else + uint tag; + while ((tag = input.ReadTag()) != 0) { + switch(tag) { + default: + _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input); + break; + } + } + #endif + } + + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + void pb::IBufferMessage.InternalMergeFrom(ref pb::ParseContext input) { + uint tag; + while ((tag = input.ReadTag()) != 0) { + switch(tag) { + default: + _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, ref input); + break; + } + } + } + #endif + + } + + #endregion + +} + +#endregion Designer generated code diff --git a/src/Nitric.Sdk/Proto/proto/event/v1/EventGrpc.cs b/src/Nitric.Sdk/Proto/nitric/proto/topics/v1/TopicsGrpc.cs similarity index 50% rename from src/Nitric.Sdk/Proto/proto/event/v1/EventGrpc.cs rename to src/Nitric.Sdk/Proto/nitric/proto/topics/v1/TopicsGrpc.cs index 6a71037..5ef7756 100644 --- a/src/Nitric.Sdk/Proto/proto/event/v1/EventGrpc.cs +++ b/src/Nitric.Sdk/Proto/nitric/proto/topics/v1/TopicsGrpc.cs @@ -1,19 +1,19 @@ // // Generated by the protocol buffer compiler. DO NOT EDIT! -// source: proto/event/v1/event.proto +// source: nitric/proto/topics/v1/topics.proto // #pragma warning disable 0414, 1591 #region Designer generated code using grpc = global::Grpc.Core; -namespace Nitric.Proto.Event.v1 { +namespace Nitric.Proto.Topics.v1 { /// - /// Service for publishing asynchronous event + /// Service for publishing asynchronous messages /// - public static partial class EventService + public static partial class Topics { - static readonly string __ServiceName = "nitric.event.v1.EventService"; + static readonly string __ServiceName = "nitric.proto.topics.v1.Topics"; static void __Helper_SerializeMessage(global::Google.Protobuf.IMessage message, grpc::SerializationContext context) { @@ -45,116 +45,116 @@ static T __Helper_DeserializeMessage(grpc::DeserializationContext context, gl return parser.ParseFrom(context.PayloadAsNewBuffer()); } - static readonly grpc::Marshaller __Marshaller_nitric_event_v1_EventPublishRequest = grpc::Marshallers.Create(__Helper_SerializeMessage, context => __Helper_DeserializeMessage(context, global::Nitric.Proto.Event.v1.EventPublishRequest.Parser)); - static readonly grpc::Marshaller __Marshaller_nitric_event_v1_EventPublishResponse = grpc::Marshallers.Create(__Helper_SerializeMessage, context => __Helper_DeserializeMessage(context, global::Nitric.Proto.Event.v1.EventPublishResponse.Parser)); + static readonly grpc::Marshaller __Marshaller_nitric_proto_topics_v1_TopicPublishRequest = grpc::Marshallers.Create(__Helper_SerializeMessage, context => __Helper_DeserializeMessage(context, global::Nitric.Proto.Topics.v1.TopicPublishRequest.Parser)); + static readonly grpc::Marshaller __Marshaller_nitric_proto_topics_v1_TopicPublishResponse = grpc::Marshallers.Create(__Helper_SerializeMessage, context => __Helper_DeserializeMessage(context, global::Nitric.Proto.Topics.v1.TopicPublishResponse.Parser)); - static readonly grpc::Method __Method_Publish = new grpc::Method( + static readonly grpc::Method __Method_Publish = new grpc::Method( grpc::MethodType.Unary, __ServiceName, "Publish", - __Marshaller_nitric_event_v1_EventPublishRequest, - __Marshaller_nitric_event_v1_EventPublishResponse); + __Marshaller_nitric_proto_topics_v1_TopicPublishRequest, + __Marshaller_nitric_proto_topics_v1_TopicPublishResponse); /// Service descriptor public static global::Google.Protobuf.Reflection.ServiceDescriptor Descriptor { - get { return global::Nitric.Proto.Event.v1.EventReflection.Descriptor.Services[0]; } + get { return global::Nitric.Proto.Topics.v1.TopicsReflection.Descriptor.Services[0]; } } - /// Base class for server-side implementations of EventService - [grpc::BindServiceMethod(typeof(EventService), "BindService")] - public abstract partial class EventServiceBase + /// Base class for server-side implementations of Topics + [grpc::BindServiceMethod(typeof(Topics), "BindService")] + public abstract partial class TopicsBase { /// - /// Publishes an message to a given topic + /// Publishes a message to a given topic /// /// The request received from the client. /// The context of the server-side call handler being invoked. /// The response to send back to the client (wrapped by a task). - public virtual global::System.Threading.Tasks.Task Publish(global::Nitric.Proto.Event.v1.EventPublishRequest request, grpc::ServerCallContext context) + public virtual global::System.Threading.Tasks.Task Publish(global::Nitric.Proto.Topics.v1.TopicPublishRequest request, grpc::ServerCallContext context) { throw new grpc::RpcException(new grpc::Status(grpc::StatusCode.Unimplemented, "")); } } - /// Client for EventService - public partial class EventServiceClient : grpc::ClientBase + /// Client for Topics + public partial class TopicsClient : grpc::ClientBase { - /// Creates a new client for EventService + /// Creates a new client for Topics /// The channel to use to make remote calls. - public EventServiceClient(grpc::ChannelBase channel) : base(channel) + public TopicsClient(grpc::ChannelBase channel) : base(channel) { } - /// Creates a new client for EventService that uses a custom CallInvoker. + /// Creates a new client for Topics that uses a custom CallInvoker. /// The callInvoker to use to make remote calls. - public EventServiceClient(grpc::CallInvoker callInvoker) : base(callInvoker) + public TopicsClient(grpc::CallInvoker callInvoker) : base(callInvoker) { } /// Protected parameterless constructor to allow creation of test doubles. - protected EventServiceClient() : base() + protected TopicsClient() : base() { } /// Protected constructor to allow creation of configured clients. /// The client configuration. - protected EventServiceClient(ClientBaseConfiguration configuration) : base(configuration) + protected TopicsClient(ClientBaseConfiguration configuration) : base(configuration) { } /// - /// Publishes an message to a given topic + /// Publishes a message to a given topic /// /// The request to send to the server. /// The initial metadata to send with the call. This parameter is optional. /// An optional deadline for the call. The call will be cancelled if deadline is hit. /// An optional token for canceling the call. /// The response received from the server. - public virtual global::Nitric.Proto.Event.v1.EventPublishResponse Publish(global::Nitric.Proto.Event.v1.EventPublishRequest request, grpc::Metadata headers = null, global::System.DateTime? deadline = null, global::System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken)) + public virtual global::Nitric.Proto.Topics.v1.TopicPublishResponse Publish(global::Nitric.Proto.Topics.v1.TopicPublishRequest request, grpc::Metadata headers = null, global::System.DateTime? deadline = null, global::System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken)) { return Publish(request, new grpc::CallOptions(headers, deadline, cancellationToken)); } /// - /// Publishes an message to a given topic + /// Publishes a message to a given topic /// /// The request to send to the server. /// The options for the call. /// The response received from the server. - public virtual global::Nitric.Proto.Event.v1.EventPublishResponse Publish(global::Nitric.Proto.Event.v1.EventPublishRequest request, grpc::CallOptions options) + public virtual global::Nitric.Proto.Topics.v1.TopicPublishResponse Publish(global::Nitric.Proto.Topics.v1.TopicPublishRequest request, grpc::CallOptions options) { return CallInvoker.BlockingUnaryCall(__Method_Publish, null, options, request); } /// - /// Publishes an message to a given topic + /// Publishes a message to a given topic /// /// The request to send to the server. /// The initial metadata to send with the call. This parameter is optional. /// An optional deadline for the call. The call will be cancelled if deadline is hit. /// An optional token for canceling the call. /// The call object. - public virtual grpc::AsyncUnaryCall PublishAsync(global::Nitric.Proto.Event.v1.EventPublishRequest request, grpc::Metadata headers = null, global::System.DateTime? deadline = null, global::System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken)) + public virtual grpc::AsyncUnaryCall PublishAsync(global::Nitric.Proto.Topics.v1.TopicPublishRequest request, grpc::Metadata headers = null, global::System.DateTime? deadline = null, global::System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken)) { return PublishAsync(request, new grpc::CallOptions(headers, deadline, cancellationToken)); } /// - /// Publishes an message to a given topic + /// Publishes a message to a given topic /// /// The request to send to the server. /// The options for the call. /// The call object. - public virtual grpc::AsyncUnaryCall PublishAsync(global::Nitric.Proto.Event.v1.EventPublishRequest request, grpc::CallOptions options) + public virtual grpc::AsyncUnaryCall PublishAsync(global::Nitric.Proto.Topics.v1.TopicPublishRequest request, grpc::CallOptions options) { return CallInvoker.AsyncUnaryCall(__Method_Publish, null, options, request); } /// Creates a new instance of client from given ClientBaseConfiguration. - protected override EventServiceClient NewInstance(ClientBaseConfiguration configuration) + protected override TopicsClient NewInstance(ClientBaseConfiguration configuration) { - return new EventServiceClient(configuration); + return new TopicsClient(configuration); } } /// Creates service definition that can be registered with a server /// An object implementing the server-side handling logic. - public static grpc::ServerServiceDefinition BindService(EventServiceBase serviceImpl) + public static grpc::ServerServiceDefinition BindService(TopicsBase serviceImpl) { return grpc::ServerServiceDefinition.CreateBuilder() .AddMethod(__Method_Publish, serviceImpl.Publish).Build(); @@ -164,18 +164,18 @@ protected override EventServiceClient NewInstance(ClientBaseConfiguration config /// Note: this method is part of an experimental API that can change or be removed without any prior notice. /// Service methods will be bound by calling AddMethod on this object. /// An object implementing the server-side handling logic. - public static void BindService(grpc::ServiceBinderBase serviceBinder, EventServiceBase serviceImpl) + public static void BindService(grpc::ServiceBinderBase serviceBinder, TopicsBase serviceImpl) { - serviceBinder.AddMethod(__Method_Publish, serviceImpl == null ? null : new grpc::UnaryServerMethod(serviceImpl.Publish)); + serviceBinder.AddMethod(__Method_Publish, serviceImpl == null ? null : new grpc::UnaryServerMethod(serviceImpl.Publish)); } } /// - /// Service for management of event topics + /// Service for subscribing to asynchronous messages /// - public static partial class TopicService + public static partial class Subscriber { - static readonly string __ServiceName = "nitric.event.v1.TopicService"; + static readonly string __ServiceName = "nitric.proto.topics.v1.Subscriber"; static void __Helper_SerializeMessage(global::Google.Protobuf.IMessage message, grpc::SerializationContext context) { @@ -207,128 +207,105 @@ static T __Helper_DeserializeMessage(grpc::DeserializationContext context, gl return parser.ParseFrom(context.PayloadAsNewBuffer()); } - static readonly grpc::Marshaller __Marshaller_nitric_event_v1_TopicListRequest = grpc::Marshallers.Create(__Helper_SerializeMessage, context => __Helper_DeserializeMessage(context, global::Nitric.Proto.Event.v1.TopicListRequest.Parser)); - static readonly grpc::Marshaller __Marshaller_nitric_event_v1_TopicListResponse = grpc::Marshallers.Create(__Helper_SerializeMessage, context => __Helper_DeserializeMessage(context, global::Nitric.Proto.Event.v1.TopicListResponse.Parser)); + static readonly grpc::Marshaller __Marshaller_nitric_proto_topics_v1_ClientMessage = grpc::Marshallers.Create(__Helper_SerializeMessage, context => __Helper_DeserializeMessage(context, global::Nitric.Proto.Topics.v1.ClientMessage.Parser)); + static readonly grpc::Marshaller __Marshaller_nitric_proto_topics_v1_ServerMessage = grpc::Marshallers.Create(__Helper_SerializeMessage, context => __Helper_DeserializeMessage(context, global::Nitric.Proto.Topics.v1.ServerMessage.Parser)); - static readonly grpc::Method __Method_List = new grpc::Method( - grpc::MethodType.Unary, + static readonly grpc::Method __Method_Subscribe = new grpc::Method( + grpc::MethodType.DuplexStreaming, __ServiceName, - "List", - __Marshaller_nitric_event_v1_TopicListRequest, - __Marshaller_nitric_event_v1_TopicListResponse); + "Subscribe", + __Marshaller_nitric_proto_topics_v1_ClientMessage, + __Marshaller_nitric_proto_topics_v1_ServerMessage); /// Service descriptor public static global::Google.Protobuf.Reflection.ServiceDescriptor Descriptor { - get { return global::Nitric.Proto.Event.v1.EventReflection.Descriptor.Services[1]; } + get { return global::Nitric.Proto.Topics.v1.TopicsReflection.Descriptor.Services[1]; } } - /// Base class for server-side implementations of TopicService - [grpc::BindServiceMethod(typeof(TopicService), "BindService")] - public abstract partial class TopicServiceBase + /// Base class for server-side implementations of Subscriber + [grpc::BindServiceMethod(typeof(Subscriber), "BindService")] + public abstract partial class SubscriberBase { /// - /// Return a list of existing topics in the provider environment + /// Subscribe to a topic and handle incoming messages /// - /// The request received from the client. + /// Used for reading requests from the client. + /// Used for sending responses back to the client. /// The context of the server-side call handler being invoked. - /// The response to send back to the client (wrapped by a task). - public virtual global::System.Threading.Tasks.Task List(global::Nitric.Proto.Event.v1.TopicListRequest request, grpc::ServerCallContext context) + /// A task indicating completion of the handler. + public virtual global::System.Threading.Tasks.Task Subscribe(grpc::IAsyncStreamReader requestStream, grpc::IServerStreamWriter responseStream, grpc::ServerCallContext context) { throw new grpc::RpcException(new grpc::Status(grpc::StatusCode.Unimplemented, "")); } } - /// Client for TopicService - public partial class TopicServiceClient : grpc::ClientBase + /// Client for Subscriber + public partial class SubscriberClient : grpc::ClientBase { - /// Creates a new client for TopicService + /// Creates a new client for Subscriber /// The channel to use to make remote calls. - public TopicServiceClient(grpc::ChannelBase channel) : base(channel) + public SubscriberClient(grpc::ChannelBase channel) : base(channel) { } - /// Creates a new client for TopicService that uses a custom CallInvoker. + /// Creates a new client for Subscriber that uses a custom CallInvoker. /// The callInvoker to use to make remote calls. - public TopicServiceClient(grpc::CallInvoker callInvoker) : base(callInvoker) + public SubscriberClient(grpc::CallInvoker callInvoker) : base(callInvoker) { } /// Protected parameterless constructor to allow creation of test doubles. - protected TopicServiceClient() : base() + protected SubscriberClient() : base() { } /// Protected constructor to allow creation of configured clients. /// The client configuration. - protected TopicServiceClient(ClientBaseConfiguration configuration) : base(configuration) + protected SubscriberClient(ClientBaseConfiguration configuration) : base(configuration) { } /// - /// Return a list of existing topics in the provider environment + /// Subscribe to a topic and handle incoming messages /// - /// The request to send to the server. - /// The initial metadata to send with the call. This parameter is optional. - /// An optional deadline for the call. The call will be cancelled if deadline is hit. - /// An optional token for canceling the call. - /// The response received from the server. - public virtual global::Nitric.Proto.Event.v1.TopicListResponse List(global::Nitric.Proto.Event.v1.TopicListRequest request, grpc::Metadata headers = null, global::System.DateTime? deadline = null, global::System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken)) - { - return List(request, new grpc::CallOptions(headers, deadline, cancellationToken)); - } - /// - /// Return a list of existing topics in the provider environment - /// - /// The request to send to the server. - /// The options for the call. - /// The response received from the server. - public virtual global::Nitric.Proto.Event.v1.TopicListResponse List(global::Nitric.Proto.Event.v1.TopicListRequest request, grpc::CallOptions options) - { - return CallInvoker.BlockingUnaryCall(__Method_List, null, options, request); - } - /// - /// Return a list of existing topics in the provider environment - /// - /// The request to send to the server. /// The initial metadata to send with the call. This parameter is optional. /// An optional deadline for the call. The call will be cancelled if deadline is hit. /// An optional token for canceling the call. /// The call object. - public virtual grpc::AsyncUnaryCall ListAsync(global::Nitric.Proto.Event.v1.TopicListRequest request, grpc::Metadata headers = null, global::System.DateTime? deadline = null, global::System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken)) + public virtual grpc::AsyncDuplexStreamingCall Subscribe(grpc::Metadata headers = null, global::System.DateTime? deadline = null, global::System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken)) { - return ListAsync(request, new grpc::CallOptions(headers, deadline, cancellationToken)); + return Subscribe(new grpc::CallOptions(headers, deadline, cancellationToken)); } /// - /// Return a list of existing topics in the provider environment + /// Subscribe to a topic and handle incoming messages /// - /// The request to send to the server. /// The options for the call. /// The call object. - public virtual grpc::AsyncUnaryCall ListAsync(global::Nitric.Proto.Event.v1.TopicListRequest request, grpc::CallOptions options) + public virtual grpc::AsyncDuplexStreamingCall Subscribe(grpc::CallOptions options) { - return CallInvoker.AsyncUnaryCall(__Method_List, null, options, request); + return CallInvoker.AsyncDuplexStreamingCall(__Method_Subscribe, null, options); } /// Creates a new instance of client from given ClientBaseConfiguration. - protected override TopicServiceClient NewInstance(ClientBaseConfiguration configuration) + protected override SubscriberClient NewInstance(ClientBaseConfiguration configuration) { - return new TopicServiceClient(configuration); + return new SubscriberClient(configuration); } } /// Creates service definition that can be registered with a server /// An object implementing the server-side handling logic. - public static grpc::ServerServiceDefinition BindService(TopicServiceBase serviceImpl) + public static grpc::ServerServiceDefinition BindService(SubscriberBase serviceImpl) { return grpc::ServerServiceDefinition.CreateBuilder() - .AddMethod(__Method_List, serviceImpl.List).Build(); + .AddMethod(__Method_Subscribe, serviceImpl.Subscribe).Build(); } /// Register service method with a service binder with or without implementation. Useful when customizing the service binding logic. /// Note: this method is part of an experimental API that can change or be removed without any prior notice. /// Service methods will be bound by calling AddMethod on this object. /// An object implementing the server-side handling logic. - public static void BindService(grpc::ServiceBinderBase serviceBinder, TopicServiceBase serviceImpl) + public static void BindService(grpc::ServiceBinderBase serviceBinder, SubscriberBase serviceImpl) { - serviceBinder.AddMethod(__Method_List, serviceImpl == null ? null : new grpc::UnaryServerMethod(serviceImpl.List)); + serviceBinder.AddMethod(__Method_Subscribe, serviceImpl == null ? null : new grpc::DuplexStreamingServerMethod(serviceImpl.Subscribe)); } } diff --git a/src/Nitric.Sdk/Proto/proto/document/v1/Document.cs b/src/Nitric.Sdk/Proto/nitric/proto/websockets/v1/Websockets.cs similarity index 50% rename from src/Nitric.Sdk/Proto/proto/document/v1/Document.cs rename to src/Nitric.Sdk/Proto/nitric/proto/websockets/v1/Websockets.cs index a8798c7..dd87b75 100644 --- a/src/Nitric.Sdk/Proto/proto/document/v1/Document.cs +++ b/src/Nitric.Sdk/Proto/nitric/proto/websockets/v1/Websockets.cs @@ -1,6 +1,6 @@ // // Generated by the protocol buffer compiler. DO NOT EDIT! -// source: proto/document/v1/document.proto +// source: nitric/proto/websockets/v1/websockets.proto // #pragma warning disable 1591, 0612, 3021 #region Designer generated code @@ -9,116 +9,133 @@ using pbc = global::Google.Protobuf.Collections; using pbr = global::Google.Protobuf.Reflection; using scg = global::System.Collections.Generic; -namespace Nitric.Proto.Document.v1 { +namespace Nitric.Proto.Websockets.v1 { - /// Holder for reflection information generated from proto/document/v1/document.proto - public static partial class DocumentReflection { + /// Holder for reflection information generated from nitric/proto/websockets/v1/websockets.proto + public static partial class WebsocketsReflection { #region Descriptor - /// File descriptor for proto/document/v1/document.proto + /// File descriptor for nitric/proto/websockets/v1/websockets.proto public static pbr::FileDescriptor Descriptor { get { return descriptor; } } private static pbr::FileDescriptor descriptor; - static DocumentReflection() { + static WebsocketsReflection() { byte[] descriptorData = global::System.Convert.FromBase64String( string.Concat( - "CiBwcm90by9kb2N1bWVudC92MS9kb2N1bWVudC5wcm90bxISbml0cmljLmRv", - "Y3VtZW50LnYxGhxnb29nbGUvcHJvdG9idWYvc3RydWN0LnByb3RvGhd2YWxp", - "ZGF0ZS92YWxpZGF0ZS5wcm90byJDCgpDb2xsZWN0aW9uEgwKBG5hbWUYASAB", - "KAkSJwoGcGFyZW50GAIgASgLMhcubml0cmljLmRvY3VtZW50LnYxLktleSJb", - "CgNLZXkSPAoKY29sbGVjdGlvbhgBIAEoCzIeLm5pdHJpYy5kb2N1bWVudC52", - "MS5Db2xsZWN0aW9uQgj6QgWKAQIQARIWCgJpZBgCIAEoCUIK+kIHcgUgASiA", - "AiJuCghEb2N1bWVudBIyCgdjb250ZW50GAEgASgLMhcuZ29vZ2xlLnByb3Rv", - "YnVmLlN0cnVjdEII+kIFigECEAESLgoDa2V5GAIgASgLMhcubml0cmljLmRv", - "Y3VtZW50LnYxLktleUII+kIFigECEAEidAoPRXhwcmVzc2lvblZhbHVlEhMK", - "CWludF92YWx1ZRgBIAEoA0gAEhYKDGRvdWJsZV92YWx1ZRgCIAEoAUgAEhYK", - "DHN0cmluZ192YWx1ZRgDIAEoCUgAEhQKCmJvb2xfdmFsdWUYBCABKAhIAEIG", - "CgRraW5kIpIBCgpFeHByZXNzaW9uEg8KB29wZXJhbmQYASABKAkSNQoIb3Bl", - "cmF0b3IYAiABKAlCI/pCIHIeUgI9PVIBPFICPD1SAT5SAj49UgpzdGFydHNX", - "aXRoEjwKBXZhbHVlGAMgASgLMiMubml0cmljLmRvY3VtZW50LnYxLkV4cHJl", - "c3Npb25WYWx1ZUII+kIFigECEAEiRAoSRG9jdW1lbnRHZXRSZXF1ZXN0Ei4K", - "A2tleRgBIAEoCzIXLm5pdHJpYy5kb2N1bWVudC52MS5LZXlCCPpCBYoBAhAB", - "IkUKE0RvY3VtZW50R2V0UmVzcG9uc2USLgoIZG9jdW1lbnQYASABKAsyHC5u", - "aXRyaWMuZG9jdW1lbnQudjEuRG9jdW1lbnQieAoSRG9jdW1lbnRTZXRSZXF1", - "ZXN0Ei4KA2tleRgBIAEoCzIXLm5pdHJpYy5kb2N1bWVudC52MS5LZXlCCPpC", - "BYoBAhABEjIKB2NvbnRlbnQYAyABKAsyFy5nb29nbGUucHJvdG9idWYuU3Ry", - "dWN0Qgj6QgWKAQIQASIVChNEb2N1bWVudFNldFJlc3BvbnNlIkcKFURvY3Vt", - "ZW50RGVsZXRlUmVxdWVzdBIuCgNrZXkYASABKAsyFy5uaXRyaWMuZG9jdW1l", - "bnQudjEuS2V5Qgj6QgWKAQIQASIYChZEb2N1bWVudERlbGV0ZVJlc3BvbnNl", - "Ip0CChREb2N1bWVudFF1ZXJ5UmVxdWVzdBI8Cgpjb2xsZWN0aW9uGAEgASgL", - "Mh4ubml0cmljLmRvY3VtZW50LnYxLkNvbGxlY3Rpb25CCPpCBYoBAhABEjMK", - "C2V4cHJlc3Npb25zGAMgAygLMh4ubml0cmljLmRvY3VtZW50LnYxLkV4cHJl", - "c3Npb24SDQoFbGltaXQYBCABKAUSTwoMcGFnaW5nX3Rva2VuGAUgAygLMjku", - "bml0cmljLmRvY3VtZW50LnYxLkRvY3VtZW50UXVlcnlSZXF1ZXN0LlBhZ2lu", - "Z1Rva2VuRW50cnkaMgoQUGFnaW5nVG9rZW5FbnRyeRILCgNrZXkYASABKAkS", - "DQoFdmFsdWUYAiABKAk6AjgBIs4BChVEb2N1bWVudFF1ZXJ5UmVzcG9uc2US", - "LwoJZG9jdW1lbnRzGAEgAygLMhwubml0cmljLmRvY3VtZW50LnYxLkRvY3Vt", - "ZW50ElAKDHBhZ2luZ190b2tlbhgCIAMoCzI6Lm5pdHJpYy5kb2N1bWVudC52", - "MS5Eb2N1bWVudFF1ZXJ5UmVzcG9uc2UuUGFnaW5nVG9rZW5FbnRyeRoyChBQ", - "YWdpbmdUb2tlbkVudHJ5EgsKA2tleRgBIAEoCRINCgV2YWx1ZRgCIAEoCToC", - "OAEingEKGkRvY3VtZW50UXVlcnlTdHJlYW1SZXF1ZXN0EjwKCmNvbGxlY3Rp", - "b24YASABKAsyHi5uaXRyaWMuZG9jdW1lbnQudjEuQ29sbGVjdGlvbkII+kIF", - "igECEAESMwoLZXhwcmVzc2lvbnMYAyADKAsyHi5uaXRyaWMuZG9jdW1lbnQu", - "djEuRXhwcmVzc2lvbhINCgVsaW1pdBgEIAEoBSJNChtEb2N1bWVudFF1ZXJ5", - "U3RyZWFtUmVzcG9uc2USLgoIZG9jdW1lbnQYASABKAsyHC5uaXRyaWMuZG9j", - "dW1lbnQudjEuRG9jdW1lbnQy8gMKD0RvY3VtZW50U2VydmljZRJWCgNHZXQS", - "Ji5uaXRyaWMuZG9jdW1lbnQudjEuRG9jdW1lbnRHZXRSZXF1ZXN0Gicubml0", - "cmljLmRvY3VtZW50LnYxLkRvY3VtZW50R2V0UmVzcG9uc2USVgoDU2V0EiYu", - "bml0cmljLmRvY3VtZW50LnYxLkRvY3VtZW50U2V0UmVxdWVzdBonLm5pdHJp", - "Yy5kb2N1bWVudC52MS5Eb2N1bWVudFNldFJlc3BvbnNlEl8KBkRlbGV0ZRIp", - "Lm5pdHJpYy5kb2N1bWVudC52MS5Eb2N1bWVudERlbGV0ZVJlcXVlc3QaKi5u", - "aXRyaWMuZG9jdW1lbnQudjEuRG9jdW1lbnREZWxldGVSZXNwb25zZRJcCgVR", - "dWVyeRIoLm5pdHJpYy5kb2N1bWVudC52MS5Eb2N1bWVudFF1ZXJ5UmVxdWVz", - "dBopLm5pdHJpYy5kb2N1bWVudC52MS5Eb2N1bWVudFF1ZXJ5UmVzcG9uc2US", - "cAoLUXVlcnlTdHJlYW0SLi5uaXRyaWMuZG9jdW1lbnQudjEuRG9jdW1lbnRR", - "dWVyeVN0cmVhbVJlcXVlc3QaLy5uaXRyaWMuZG9jdW1lbnQudjEuRG9jdW1l", - "bnRRdWVyeVN0cmVhbVJlc3BvbnNlMAFClQEKG2lvLm5pdHJpYy5wcm90by5k", - "b2N1bWVudC52MUIJRG9jdW1lbnRzUAFaM2dpdGh1Yi5jb20vbml0cmljdGVj", - "aC9uaXRyaWMvY29yZS9wa2cvYXBpL25pdHJpYy92MaoCGE5pdHJpYy5Qcm90", - "by5Eb2N1bWVudC52McoCGE5pdHJpY1xQcm90b1xEb2N1bWVudFxWMWIGcHJv", - "dG8z")); + "CituaXRyaWMvcHJvdG8vd2Vic29ja2V0cy92MS93ZWJzb2NrZXRzLnByb3Rv", + "EhpuaXRyaWMucHJvdG8ud2Vic29ja2V0cy52MSIuChdXZWJzb2NrZXREZXRh", + "aWxzUmVxdWVzdBITCgtzb2NrZXRfbmFtZRgBIAEoCSInChhXZWJzb2NrZXRE", + "ZXRhaWxzUmVzcG9uc2USCwoDdXJsGAEgASgJIlAKFFdlYnNvY2tldFNlbmRS", + "ZXF1ZXN0EhMKC3NvY2tldF9uYW1lGAEgASgJEhUKDWNvbm5lY3Rpb25faWQY", + "AiABKAkSDAoEZGF0YRgDIAEoDCIXChVXZWJzb2NrZXRTZW5kUmVzcG9uc2Ui", + "QwoVV2Vic29ja2V0Q2xvc2VSZXF1ZXN0EhMKC3NvY2tldF9uYW1lGAEgASgJ", + "EhUKDWNvbm5lY3Rpb25faWQYAiABKAkiGAoWV2Vic29ja2V0Q2xvc2VSZXNw", + "b25zZSLPAQoNQ2xpZW50TWVzc2FnZRIKCgJpZBgBIAEoCRJPChRyZWdpc3Ry", + "YXRpb25fcmVxdWVzdBgCIAEoCzIvLm5pdHJpYy5wcm90by53ZWJzb2NrZXRz", + "LnYxLlJlZ2lzdHJhdGlvblJlcXVlc3RIABJWChh3ZWJzb2NrZXRfZXZlbnRf", + "cmVzcG9uc2UYAyABKAsyMi5uaXRyaWMucHJvdG8ud2Vic29ja2V0cy52MS5X", + "ZWJzb2NrZXRFdmVudFJlc3BvbnNlSABCCQoHY29udGVudCIWChRSZWdpc3Ry", + "YXRpb25SZXNwb25zZSJuChNSZWdpc3RyYXRpb25SZXF1ZXN0EhMKC3NvY2tl", + "dF9uYW1lGAEgASgJEkIKCmV2ZW50X3R5cGUYAiABKA4yLi5uaXRyaWMucHJv", + "dG8ud2Vic29ja2V0cy52MS5XZWJzb2NrZXRFdmVudFR5cGUiuQIKFVdlYnNv", + "Y2tldEV2ZW50UmVxdWVzdBITCgtzb2NrZXRfbmFtZRgBIAEoCRIUCgxjb25u", + "ZWN0aW9uSWQYAiABKAkSSgoKY29ubmVjdGlvbhgKIAEoCzI0Lm5pdHJpYy5w", + "cm90by53ZWJzb2NrZXRzLnYxLldlYnNvY2tldENvbm5lY3Rpb25FdmVudEgA", + "ElAKDWRpc2Nvbm5lY3Rpb24YCyABKAsyNy5uaXRyaWMucHJvdG8ud2Vic29j", + "a2V0cy52MS5XZWJzb2NrZXREaXNjb25uZWN0aW9uRXZlbnRIABJECgdtZXNz", + "YWdlGAwgASgLMjEubml0cmljLnByb3RvLndlYnNvY2tldHMudjEuV2Vic29j", + "a2V0TWVzc2FnZUV2ZW50SABCEQoPd2Vic29ja2V0X2V2ZW50IhsKClF1ZXJ5", + "VmFsdWUSDQoFdmFsdWUYASADKAkizwEKDVNlcnZlck1lc3NhZ2USCgoCaWQY", + "ASABKAkSUQoVcmVnaXN0cmF0aW9uX3Jlc3BvbnNlGAIgASgLMjAubml0cmlj", + "LnByb3RvLndlYnNvY2tldHMudjEuUmVnaXN0cmF0aW9uUmVzcG9uc2VIABJU", + "Chd3ZWJzb2NrZXRfZXZlbnRfcmVxdWVzdBgDIAEoCzIxLm5pdHJpYy5wcm90", + "by53ZWJzb2NrZXRzLnYxLldlYnNvY2tldEV2ZW50UmVxdWVzdEgAQgkKB2Nv", + "bnRlbnQihgEKFldlYnNvY2tldEV2ZW50UmVzcG9uc2USVgoTY29ubmVjdGlv", + "bl9yZXNwb25zZRgKIAEoCzI3Lm5pdHJpYy5wcm90by53ZWJzb2NrZXRzLnYx", + "LldlYnNvY2tldENvbm5lY3Rpb25SZXNwb25zZUgAQhQKEndlYnNvY2tldF9y", + "ZXNwb25zZSLTAQoYV2Vic29ja2V0Q29ubmVjdGlvbkV2ZW50ElsKDHF1ZXJ5", + "X3BhcmFtcxgBIAMoCzJFLm5pdHJpYy5wcm90by53ZWJzb2NrZXRzLnYxLldl", + "YnNvY2tldENvbm5lY3Rpb25FdmVudC5RdWVyeVBhcmFtc0VudHJ5GloKEFF1", + "ZXJ5UGFyYW1zRW50cnkSCwoDa2V5GAEgASgJEjUKBXZhbHVlGAIgASgLMiYu", + "bml0cmljLnByb3RvLndlYnNvY2tldHMudjEuUXVlcnlWYWx1ZToCOAEiLQob", + "V2Vic29ja2V0Q29ubmVjdGlvblJlc3BvbnNlEg4KBnJlamVjdBgBIAEoCCId", + "ChtXZWJzb2NrZXREaXNjb25uZWN0aW9uRXZlbnQiJQoVV2Vic29ja2V0TWVz", + "c2FnZUV2ZW50EgwKBGJvZHkYASABKAwqPgoSV2Vic29ja2V0RXZlbnRUeXBl", + "EgsKB0Nvbm5lY3QQABIOCgpEaXNjb25uZWN0EAESCwoHTWVzc2FnZRACMt4C", + "CglXZWJzb2NrZXQSawoEU2VuZBIwLm5pdHJpYy5wcm90by53ZWJzb2NrZXRz", + "LnYxLldlYnNvY2tldFNlbmRSZXF1ZXN0GjEubml0cmljLnByb3RvLndlYnNv", + "Y2tldHMudjEuV2Vic29ja2V0U2VuZFJlc3BvbnNlEm4KBUNsb3NlEjEubml0", + "cmljLnByb3RvLndlYnNvY2tldHMudjEuV2Vic29ja2V0Q2xvc2VSZXF1ZXN0", + "GjIubml0cmljLnByb3RvLndlYnNvY2tldHMudjEuV2Vic29ja2V0Q2xvc2VS", + "ZXNwb25zZRJ0CgdEZXRhaWxzEjMubml0cmljLnByb3RvLndlYnNvY2tldHMu", + "djEuV2Vic29ja2V0RGV0YWlsc1JlcXVlc3QaNC5uaXRyaWMucHJvdG8ud2Vi", + "c29ja2V0cy52MS5XZWJzb2NrZXREZXRhaWxzUmVzcG9uc2UyfAoQV2Vic29j", + "a2V0SGFuZGxlchJoCgxIYW5kbGVFdmVudHMSKS5uaXRyaWMucHJvdG8ud2Vi", + "c29ja2V0cy52MS5DbGllbnRNZXNzYWdlGikubml0cmljLnByb3RvLndlYnNv", + "Y2tldHMudjEuU2VydmVyTWVzc2FnZSgBMAFCtgEKHWlvLm5pdHJpYy5wcm90", + "by53ZWJzb2NrZXRzLnYxQhFXZWJzb2NrZXRzU2VydmljZVABWkZnaXRodWIu", + "Y29tL25pdHJpY3RlY2gvbml0cmljL2NvcmUvcGtnL3Byb3RvL3dlYnNvY2tl", + "dHMvdjE7d2Vic29ja2V0c3BiqgIaTml0cmljLlByb3RvLldlYnNvY2tldHMu", + "djHKAhpOaXRyaWNcUHJvdG9cV2Vic29ja2V0c1xWMWIGcHJvdG8z")); descriptor = pbr::FileDescriptor.FromGeneratedCode(descriptorData, - new pbr::FileDescriptor[] { global::Google.Protobuf.WellKnownTypes.StructReflection.Descriptor, global::Validate.ValidateReflection.Descriptor, }, - new pbr::GeneratedClrTypeInfo(null, null, new pbr::GeneratedClrTypeInfo[] { - new pbr::GeneratedClrTypeInfo(typeof(global::Nitric.Proto.Document.v1.Collection), global::Nitric.Proto.Document.v1.Collection.Parser, new[]{ "Name", "Parent" }, null, null, null, null), - new pbr::GeneratedClrTypeInfo(typeof(global::Nitric.Proto.Document.v1.Key), global::Nitric.Proto.Document.v1.Key.Parser, new[]{ "Collection", "Id" }, null, null, null, null), - new pbr::GeneratedClrTypeInfo(typeof(global::Nitric.Proto.Document.v1.Document), global::Nitric.Proto.Document.v1.Document.Parser, new[]{ "Content", "Key" }, null, null, null, null), - new pbr::GeneratedClrTypeInfo(typeof(global::Nitric.Proto.Document.v1.ExpressionValue), global::Nitric.Proto.Document.v1.ExpressionValue.Parser, new[]{ "IntValue", "DoubleValue", "StringValue", "BoolValue" }, new[]{ "Kind" }, null, null, null), - new pbr::GeneratedClrTypeInfo(typeof(global::Nitric.Proto.Document.v1.Expression), global::Nitric.Proto.Document.v1.Expression.Parser, new[]{ "Operand", "Operator", "Value" }, null, null, null, null), - new pbr::GeneratedClrTypeInfo(typeof(global::Nitric.Proto.Document.v1.DocumentGetRequest), global::Nitric.Proto.Document.v1.DocumentGetRequest.Parser, new[]{ "Key" }, null, null, null, null), - new pbr::GeneratedClrTypeInfo(typeof(global::Nitric.Proto.Document.v1.DocumentGetResponse), global::Nitric.Proto.Document.v1.DocumentGetResponse.Parser, new[]{ "Document" }, null, null, null, null), - new pbr::GeneratedClrTypeInfo(typeof(global::Nitric.Proto.Document.v1.DocumentSetRequest), global::Nitric.Proto.Document.v1.DocumentSetRequest.Parser, new[]{ "Key", "Content" }, null, null, null, null), - new pbr::GeneratedClrTypeInfo(typeof(global::Nitric.Proto.Document.v1.DocumentSetResponse), global::Nitric.Proto.Document.v1.DocumentSetResponse.Parser, null, null, null, null, null), - new pbr::GeneratedClrTypeInfo(typeof(global::Nitric.Proto.Document.v1.DocumentDeleteRequest), global::Nitric.Proto.Document.v1.DocumentDeleteRequest.Parser, new[]{ "Key" }, null, null, null, null), - new pbr::GeneratedClrTypeInfo(typeof(global::Nitric.Proto.Document.v1.DocumentDeleteResponse), global::Nitric.Proto.Document.v1.DocumentDeleteResponse.Parser, null, null, null, null, null), - new pbr::GeneratedClrTypeInfo(typeof(global::Nitric.Proto.Document.v1.DocumentQueryRequest), global::Nitric.Proto.Document.v1.DocumentQueryRequest.Parser, new[]{ "Collection", "Expressions", "Limit", "PagingToken" }, null, null, null, new pbr::GeneratedClrTypeInfo[] { null, }), - new pbr::GeneratedClrTypeInfo(typeof(global::Nitric.Proto.Document.v1.DocumentQueryResponse), global::Nitric.Proto.Document.v1.DocumentQueryResponse.Parser, new[]{ "Documents", "PagingToken" }, null, null, null, new pbr::GeneratedClrTypeInfo[] { null, }), - new pbr::GeneratedClrTypeInfo(typeof(global::Nitric.Proto.Document.v1.DocumentQueryStreamRequest), global::Nitric.Proto.Document.v1.DocumentQueryStreamRequest.Parser, new[]{ "Collection", "Expressions", "Limit" }, null, null, null, null), - new pbr::GeneratedClrTypeInfo(typeof(global::Nitric.Proto.Document.v1.DocumentQueryStreamResponse), global::Nitric.Proto.Document.v1.DocumentQueryStreamResponse.Parser, new[]{ "Document" }, null, null, null, null) + new pbr::FileDescriptor[] { }, + new pbr::GeneratedClrTypeInfo(new[] {typeof(global::Nitric.Proto.Websockets.v1.WebsocketEventType), }, null, new pbr::GeneratedClrTypeInfo[] { + new pbr::GeneratedClrTypeInfo(typeof(global::Nitric.Proto.Websockets.v1.WebsocketDetailsRequest), global::Nitric.Proto.Websockets.v1.WebsocketDetailsRequest.Parser, new[]{ "SocketName" }, null, null, null, null), + new pbr::GeneratedClrTypeInfo(typeof(global::Nitric.Proto.Websockets.v1.WebsocketDetailsResponse), global::Nitric.Proto.Websockets.v1.WebsocketDetailsResponse.Parser, new[]{ "Url" }, null, null, null, null), + new pbr::GeneratedClrTypeInfo(typeof(global::Nitric.Proto.Websockets.v1.WebsocketSendRequest), global::Nitric.Proto.Websockets.v1.WebsocketSendRequest.Parser, new[]{ "SocketName", "ConnectionId", "Data" }, null, null, null, null), + new pbr::GeneratedClrTypeInfo(typeof(global::Nitric.Proto.Websockets.v1.WebsocketSendResponse), global::Nitric.Proto.Websockets.v1.WebsocketSendResponse.Parser, null, null, null, null, null), + new pbr::GeneratedClrTypeInfo(typeof(global::Nitric.Proto.Websockets.v1.WebsocketCloseRequest), global::Nitric.Proto.Websockets.v1.WebsocketCloseRequest.Parser, new[]{ "SocketName", "ConnectionId" }, null, null, null, null), + new pbr::GeneratedClrTypeInfo(typeof(global::Nitric.Proto.Websockets.v1.WebsocketCloseResponse), global::Nitric.Proto.Websockets.v1.WebsocketCloseResponse.Parser, null, null, null, null, null), + new pbr::GeneratedClrTypeInfo(typeof(global::Nitric.Proto.Websockets.v1.ClientMessage), global::Nitric.Proto.Websockets.v1.ClientMessage.Parser, new[]{ "Id", "RegistrationRequest", "WebsocketEventResponse" }, new[]{ "Content" }, null, null, null), + new pbr::GeneratedClrTypeInfo(typeof(global::Nitric.Proto.Websockets.v1.RegistrationResponse), global::Nitric.Proto.Websockets.v1.RegistrationResponse.Parser, null, null, null, null, null), + new pbr::GeneratedClrTypeInfo(typeof(global::Nitric.Proto.Websockets.v1.RegistrationRequest), global::Nitric.Proto.Websockets.v1.RegistrationRequest.Parser, new[]{ "SocketName", "EventType" }, null, null, null, null), + new pbr::GeneratedClrTypeInfo(typeof(global::Nitric.Proto.Websockets.v1.WebsocketEventRequest), global::Nitric.Proto.Websockets.v1.WebsocketEventRequest.Parser, new[]{ "SocketName", "ConnectionId", "Connection", "Disconnection", "Message" }, new[]{ "WebsocketEvent" }, null, null, null), + new pbr::GeneratedClrTypeInfo(typeof(global::Nitric.Proto.Websockets.v1.QueryValue), global::Nitric.Proto.Websockets.v1.QueryValue.Parser, new[]{ "Value" }, null, null, null, null), + new pbr::GeneratedClrTypeInfo(typeof(global::Nitric.Proto.Websockets.v1.ServerMessage), global::Nitric.Proto.Websockets.v1.ServerMessage.Parser, new[]{ "Id", "RegistrationResponse", "WebsocketEventRequest" }, new[]{ "Content" }, null, null, null), + new pbr::GeneratedClrTypeInfo(typeof(global::Nitric.Proto.Websockets.v1.WebsocketEventResponse), global::Nitric.Proto.Websockets.v1.WebsocketEventResponse.Parser, new[]{ "ConnectionResponse" }, new[]{ "WebsocketResponse" }, null, null, null), + new pbr::GeneratedClrTypeInfo(typeof(global::Nitric.Proto.Websockets.v1.WebsocketConnectionEvent), global::Nitric.Proto.Websockets.v1.WebsocketConnectionEvent.Parser, new[]{ "QueryParams" }, null, null, null, new pbr::GeneratedClrTypeInfo[] { null, }), + new pbr::GeneratedClrTypeInfo(typeof(global::Nitric.Proto.Websockets.v1.WebsocketConnectionResponse), global::Nitric.Proto.Websockets.v1.WebsocketConnectionResponse.Parser, new[]{ "Reject" }, null, null, null, null), + new pbr::GeneratedClrTypeInfo(typeof(global::Nitric.Proto.Websockets.v1.WebsocketDisconnectionEvent), global::Nitric.Proto.Websockets.v1.WebsocketDisconnectionEvent.Parser, null, null, null, null, null), + new pbr::GeneratedClrTypeInfo(typeof(global::Nitric.Proto.Websockets.v1.WebsocketMessageEvent), global::Nitric.Proto.Websockets.v1.WebsocketMessageEvent.Parser, new[]{ "Body" }, null, null, null, null) })); } #endregion } + #region Enums + public enum WebsocketEventType { + /// + /// Specialised Event for handling new client connections + /// + [pbr::OriginalName("Connect")] Connect = 0, + /// + /// Specialised Event for handling existing client connections + /// + [pbr::OriginalName("Disconnect")] Disconnect = 1, + /// + /// All other types of events are messages + /// + [pbr::OriginalName("Message")] Message = 2, + } + + #endregion + #region Messages - /// - /// Provides a Collection type for storing documents - /// - public sealed partial class Collection : pb::IMessage + public sealed partial class WebsocketDetailsRequest : pb::IMessage #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE , pb::IBufferMessage #endif { - private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new Collection()); + private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new WebsocketDetailsRequest()); private pb::UnknownFieldSet _unknownFields; [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public static pb::MessageParser Parser { get { return _parser; } } + public static pb::MessageParser Parser { get { return _parser; } } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public static pbr::MessageDescriptor Descriptor { - get { return global::Nitric.Proto.Document.v1.DocumentReflection.Descriptor.MessageTypes[0]; } + get { return global::Nitric.Proto.Websockets.v1.WebsocketsReflection.Descriptor.MessageTypes[0]; } } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] @@ -127,75 +144,227 @@ public sealed partial class Collection : pb::IMessage } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public Collection() { + public WebsocketDetailsRequest() { OnConstruction(); } partial void OnConstruction(); [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public Collection(Collection other) : this() { - name_ = other.name_; - parent_ = other.parent_ != null ? other.parent_.Clone() : null; + public WebsocketDetailsRequest(WebsocketDetailsRequest other) : this() { + socketName_ = other.socketName_; _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public Collection Clone() { - return new Collection(this); + public WebsocketDetailsRequest Clone() { + return new WebsocketDetailsRequest(this); } - /// Field number for the "name" field. - public const int NameFieldNumber = 1; - private string name_ = ""; - /// - /// The collection name - /// + /// Field number for the "socket_name" field. + public const int SocketNameFieldNumber = 1; + private string socketName_ = ""; [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public string Name { - get { return name_; } + public string SocketName { + get { return socketName_; } set { - name_ = pb::ProtoPreconditions.CheckNotNull(value, "value"); + socketName_ = pb::ProtoPreconditions.CheckNotNull(value, "value"); } } - /// Field number for the "parent" field. - public const int ParentFieldNumber = 2; - private global::Nitric.Proto.Document.v1.Key parent_; - /// - /// Optional parent key, required when the collection is a sub-collection of another document - /// [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public global::Nitric.Proto.Document.v1.Key Parent { - get { return parent_; } + public override bool Equals(object other) { + return Equals(other as WebsocketDetailsRequest); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public bool Equals(WebsocketDetailsRequest other) { + if (ReferenceEquals(other, null)) { + return false; + } + if (ReferenceEquals(other, this)) { + return true; + } + if (SocketName != other.SocketName) return false; + return Equals(_unknownFields, other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public override int GetHashCode() { + int hash = 1; + if (SocketName.Length != 0) hash ^= SocketName.GetHashCode(); + if (_unknownFields != null) { + hash ^= _unknownFields.GetHashCode(); + } + return hash; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public override string ToString() { + return pb::JsonFormatter.ToDiagnosticString(this); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public void WriteTo(pb::CodedOutputStream output) { + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + output.WriteRawMessage(this); + #else + if (SocketName.Length != 0) { + output.WriteRawTag(10); + output.WriteString(SocketName); + } + if (_unknownFields != null) { + _unknownFields.WriteTo(output); + } + #endif + } + + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + void pb::IBufferMessage.InternalWriteTo(ref pb::WriteContext output) { + if (SocketName.Length != 0) { + output.WriteRawTag(10); + output.WriteString(SocketName); + } + if (_unknownFields != null) { + _unknownFields.WriteTo(ref output); + } + } + #endif + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public int CalculateSize() { + int size = 0; + if (SocketName.Length != 0) { + size += 1 + pb::CodedOutputStream.ComputeStringSize(SocketName); + } + if (_unknownFields != null) { + size += _unknownFields.CalculateSize(); + } + return size; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public void MergeFrom(WebsocketDetailsRequest other) { + if (other == null) { + return; + } + if (other.SocketName.Length != 0) { + SocketName = other.SocketName; + } + _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public void MergeFrom(pb::CodedInputStream input) { + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + input.ReadRawMessage(this); + #else + uint tag; + while ((tag = input.ReadTag()) != 0) { + switch(tag) { + default: + _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input); + break; + case 10: { + SocketName = input.ReadString(); + break; + } + } + } + #endif + } + + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + void pb::IBufferMessage.InternalMergeFrom(ref pb::ParseContext input) { + uint tag; + while ((tag = input.ReadTag()) != 0) { + switch(tag) { + default: + _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, ref input); + break; + case 10: { + SocketName = input.ReadString(); + break; + } + } + } + } + #endif + + } + + public sealed partial class WebsocketDetailsResponse : pb::IMessage + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + , pb::IBufferMessage + #endif + { + private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new WebsocketDetailsResponse()); + private pb::UnknownFieldSet _unknownFields; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public static pb::MessageParser Parser { get { return _parser; } } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public static pbr::MessageDescriptor Descriptor { + get { return global::Nitric.Proto.Websockets.v1.WebsocketsReflection.Descriptor.MessageTypes[1]; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + pbr::MessageDescriptor pb::IMessage.Descriptor { + get { return Descriptor; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public WebsocketDetailsResponse() { + OnConstruction(); + } + + partial void OnConstruction(); + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public WebsocketDetailsResponse(WebsocketDetailsResponse other) : this() { + url_ = other.url_; + _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public WebsocketDetailsResponse Clone() { + return new WebsocketDetailsResponse(this); + } + + /// Field number for the "url" field. + public const int UrlFieldNumber = 1; + private string url_ = ""; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public string Url { + get { return url_; } set { - parent_ = value; + url_ = pb::ProtoPreconditions.CheckNotNull(value, "value"); } } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public override bool Equals(object other) { - return Equals(other as Collection); + return Equals(other as WebsocketDetailsResponse); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public bool Equals(Collection other) { + public bool Equals(WebsocketDetailsResponse other) { if (ReferenceEquals(other, null)) { return false; } if (ReferenceEquals(other, this)) { return true; } - if (Name != other.Name) return false; - if (!object.Equals(Parent, other.Parent)) return false; + if (Url != other.Url) return false; return Equals(_unknownFields, other._unknownFields); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public override int GetHashCode() { int hash = 1; - if (Name.Length != 0) hash ^= Name.GetHashCode(); - if (parent_ != null) hash ^= Parent.GetHashCode(); + if (Url.Length != 0) hash ^= Url.GetHashCode(); if (_unknownFields != null) { hash ^= _unknownFields.GetHashCode(); } @@ -212,13 +381,9 @@ public void WriteTo(pb::CodedOutputStream output) { #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE output.WriteRawMessage(this); #else - if (Name.Length != 0) { + if (Url.Length != 0) { output.WriteRawTag(10); - output.WriteString(Name); - } - if (parent_ != null) { - output.WriteRawTag(18); - output.WriteMessage(Parent); + output.WriteString(Url); } if (_unknownFields != null) { _unknownFields.WriteTo(output); @@ -229,13 +394,9 @@ public void WriteTo(pb::CodedOutputStream output) { #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE [global::System.Diagnostics.DebuggerNonUserCodeAttribute] void pb::IBufferMessage.InternalWriteTo(ref pb::WriteContext output) { - if (Name.Length != 0) { + if (Url.Length != 0) { output.WriteRawTag(10); - output.WriteString(Name); - } - if (parent_ != null) { - output.WriteRawTag(18); - output.WriteMessage(Parent); + output.WriteString(Url); } if (_unknownFields != null) { _unknownFields.WriteTo(ref output); @@ -246,11 +407,8 @@ public void WriteTo(pb::CodedOutputStream output) { [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public int CalculateSize() { int size = 0; - if (Name.Length != 0) { - size += 1 + pb::CodedOutputStream.ComputeStringSize(Name); - } - if (parent_ != null) { - size += 1 + pb::CodedOutputStream.ComputeMessageSize(Parent); + if (Url.Length != 0) { + size += 1 + pb::CodedOutputStream.ComputeStringSize(Url); } if (_unknownFields != null) { size += _unknownFields.CalculateSize(); @@ -259,18 +417,12 @@ public int CalculateSize() { } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void MergeFrom(Collection other) { + public void MergeFrom(WebsocketDetailsResponse other) { if (other == null) { return; } - if (other.Name.Length != 0) { - Name = other.Name; - } - if (other.parent_ != null) { - if (parent_ == null) { - Parent = new global::Nitric.Proto.Document.v1.Key(); - } - Parent.MergeFrom(other.Parent); + if (other.Url.Length != 0) { + Url = other.Url; } _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields); } @@ -287,14 +439,7 @@ public void MergeFrom(pb::CodedInputStream input) { _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input); break; case 10: { - Name = input.ReadString(); - break; - } - case 18: { - if (parent_ == null) { - Parent = new global::Nitric.Proto.Document.v1.Key(); - } - input.ReadMessage(Parent); + Url = input.ReadString(); break; } } @@ -312,14 +457,7 @@ public void MergeFrom(pb::CodedInputStream input) { _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, ref input); break; case 10: { - Name = input.ReadString(); - break; - } - case 18: { - if (parent_ == null) { - Parent = new global::Nitric.Proto.Document.v1.Key(); - } - input.ReadMessage(Parent); + Url = input.ReadString(); break; } } @@ -329,22 +467,19 @@ public void MergeFrom(pb::CodedInputStream input) { } - /// - /// Provides a document identifying key type - /// - public sealed partial class Key : pb::IMessage + public sealed partial class WebsocketSendRequest : pb::IMessage #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE , pb::IBufferMessage #endif { - private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new Key()); + private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new WebsocketSendRequest()); private pb::UnknownFieldSet _unknownFields; [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public static pb::MessageParser Parser { get { return _parser; } } + public static pb::MessageParser Parser { get { return _parser; } } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public static pbr::MessageDescriptor Descriptor { - get { return global::Nitric.Proto.Document.v1.DocumentReflection.Descriptor.MessageTypes[1]; } + get { return global::Nitric.Proto.Websockets.v1.WebsocketsReflection.Descriptor.MessageTypes[2]; } } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] @@ -353,75 +488,92 @@ public sealed partial class Key : pb::IMessage } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public Key() { + public WebsocketSendRequest() { OnConstruction(); } partial void OnConstruction(); [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public Key(Key other) : this() { - collection_ = other.collection_ != null ? other.collection_.Clone() : null; - id_ = other.id_; + public WebsocketSendRequest(WebsocketSendRequest other) : this() { + socketName_ = other.socketName_; + connectionId_ = other.connectionId_; + data_ = other.data_; _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public Key Clone() { - return new Key(this); + public WebsocketSendRequest Clone() { + return new WebsocketSendRequest(this); } - /// Field number for the "collection" field. - public const int CollectionFieldNumber = 1; - private global::Nitric.Proto.Document.v1.Collection collection_; + /// Field number for the "socket_name" field. + public const int SocketNameFieldNumber = 1; + private string socketName_ = ""; /// - /// The item collection + /// The nitric name of the socket to send on /// [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public global::Nitric.Proto.Document.v1.Collection Collection { - get { return collection_; } + public string SocketName { + get { return socketName_; } set { - collection_ = value; + socketName_ = pb::ProtoPreconditions.CheckNotNull(value, "value"); } } - /// Field number for the "id" field. - public const int IdFieldNumber = 2; - private string id_ = ""; + /// Field number for the "connection_id" field. + public const int ConnectionIdFieldNumber = 2; + private string connectionId_ = ""; /// - /// The items unique id + /// The connection ID of the client to send to /// [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public string Id { - get { return id_; } + public string ConnectionId { + get { return connectionId_; } set { - id_ = pb::ProtoPreconditions.CheckNotNull(value, "value"); + connectionId_ = pb::ProtoPreconditions.CheckNotNull(value, "value"); + } + } + + /// Field number for the "data" field. + public const int DataFieldNumber = 3; + private pb::ByteString data_ = pb::ByteString.Empty; + /// + /// The data to send to the socket + /// + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public pb::ByteString Data { + get { return data_; } + set { + data_ = pb::ProtoPreconditions.CheckNotNull(value, "value"); } } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public override bool Equals(object other) { - return Equals(other as Key); + return Equals(other as WebsocketSendRequest); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public bool Equals(Key other) { + public bool Equals(WebsocketSendRequest other) { if (ReferenceEquals(other, null)) { return false; } if (ReferenceEquals(other, this)) { return true; } - if (!object.Equals(Collection, other.Collection)) return false; - if (Id != other.Id) return false; + if (SocketName != other.SocketName) return false; + if (ConnectionId != other.ConnectionId) return false; + if (Data != other.Data) return false; return Equals(_unknownFields, other._unknownFields); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public override int GetHashCode() { int hash = 1; - if (collection_ != null) hash ^= Collection.GetHashCode(); - if (Id.Length != 0) hash ^= Id.GetHashCode(); + if (SocketName.Length != 0) hash ^= SocketName.GetHashCode(); + if (ConnectionId.Length != 0) hash ^= ConnectionId.GetHashCode(); + if (Data.Length != 0) hash ^= Data.GetHashCode(); if (_unknownFields != null) { hash ^= _unknownFields.GetHashCode(); } @@ -438,13 +590,17 @@ public void WriteTo(pb::CodedOutputStream output) { #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE output.WriteRawMessage(this); #else - if (collection_ != null) { + if (SocketName.Length != 0) { output.WriteRawTag(10); - output.WriteMessage(Collection); + output.WriteString(SocketName); } - if (Id.Length != 0) { + if (ConnectionId.Length != 0) { output.WriteRawTag(18); - output.WriteString(Id); + output.WriteString(ConnectionId); + } + if (Data.Length != 0) { + output.WriteRawTag(26); + output.WriteBytes(Data); } if (_unknownFields != null) { _unknownFields.WriteTo(output); @@ -455,13 +611,17 @@ public void WriteTo(pb::CodedOutputStream output) { #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE [global::System.Diagnostics.DebuggerNonUserCodeAttribute] void pb::IBufferMessage.InternalWriteTo(ref pb::WriteContext output) { - if (collection_ != null) { + if (SocketName.Length != 0) { output.WriteRawTag(10); - output.WriteMessage(Collection); + output.WriteString(SocketName); } - if (Id.Length != 0) { + if (ConnectionId.Length != 0) { output.WriteRawTag(18); - output.WriteString(Id); + output.WriteString(ConnectionId); + } + if (Data.Length != 0) { + output.WriteRawTag(26); + output.WriteBytes(Data); } if (_unknownFields != null) { _unknownFields.WriteTo(ref output); @@ -472,11 +632,14 @@ public void WriteTo(pb::CodedOutputStream output) { [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public int CalculateSize() { int size = 0; - if (collection_ != null) { - size += 1 + pb::CodedOutputStream.ComputeMessageSize(Collection); + if (SocketName.Length != 0) { + size += 1 + pb::CodedOutputStream.ComputeStringSize(SocketName); } - if (Id.Length != 0) { - size += 1 + pb::CodedOutputStream.ComputeStringSize(Id); + if (ConnectionId.Length != 0) { + size += 1 + pb::CodedOutputStream.ComputeStringSize(ConnectionId); + } + if (Data.Length != 0) { + size += 1 + pb::CodedOutputStream.ComputeBytesSize(Data); } if (_unknownFields != null) { size += _unknownFields.CalculateSize(); @@ -485,18 +648,178 @@ public int CalculateSize() { } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void MergeFrom(Key other) { + public void MergeFrom(WebsocketSendRequest other) { if (other == null) { return; } - if (other.collection_ != null) { - if (collection_ == null) { - Collection = new global::Nitric.Proto.Document.v1.Collection(); + if (other.SocketName.Length != 0) { + SocketName = other.SocketName; + } + if (other.ConnectionId.Length != 0) { + ConnectionId = other.ConnectionId; + } + if (other.Data.Length != 0) { + Data = other.Data; + } + _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public void MergeFrom(pb::CodedInputStream input) { + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + input.ReadRawMessage(this); + #else + uint tag; + while ((tag = input.ReadTag()) != 0) { + switch(tag) { + default: + _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input); + break; + case 10: { + SocketName = input.ReadString(); + break; + } + case 18: { + ConnectionId = input.ReadString(); + break; + } + case 26: { + Data = input.ReadBytes(); + break; + } } - Collection.MergeFrom(other.Collection); } - if (other.Id.Length != 0) { - Id = other.Id; + #endif + } + + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + void pb::IBufferMessage.InternalMergeFrom(ref pb::ParseContext input) { + uint tag; + while ((tag = input.ReadTag()) != 0) { + switch(tag) { + default: + _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, ref input); + break; + case 10: { + SocketName = input.ReadString(); + break; + } + case 18: { + ConnectionId = input.ReadString(); + break; + } + case 26: { + Data = input.ReadBytes(); + break; + } + } + } + } + #endif + + } + + public sealed partial class WebsocketSendResponse : pb::IMessage + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + , pb::IBufferMessage + #endif + { + private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new WebsocketSendResponse()); + private pb::UnknownFieldSet _unknownFields; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public static pb::MessageParser Parser { get { return _parser; } } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public static pbr::MessageDescriptor Descriptor { + get { return global::Nitric.Proto.Websockets.v1.WebsocketsReflection.Descriptor.MessageTypes[3]; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + pbr::MessageDescriptor pb::IMessage.Descriptor { + get { return Descriptor; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public WebsocketSendResponse() { + OnConstruction(); + } + + partial void OnConstruction(); + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public WebsocketSendResponse(WebsocketSendResponse other) : this() { + _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public WebsocketSendResponse Clone() { + return new WebsocketSendResponse(this); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public override bool Equals(object other) { + return Equals(other as WebsocketSendResponse); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public bool Equals(WebsocketSendResponse other) { + if (ReferenceEquals(other, null)) { + return false; + } + if (ReferenceEquals(other, this)) { + return true; + } + return Equals(_unknownFields, other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public override int GetHashCode() { + int hash = 1; + if (_unknownFields != null) { + hash ^= _unknownFields.GetHashCode(); + } + return hash; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public override string ToString() { + return pb::JsonFormatter.ToDiagnosticString(this); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public void WriteTo(pb::CodedOutputStream output) { + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + output.WriteRawMessage(this); + #else + if (_unknownFields != null) { + _unknownFields.WriteTo(output); + } + #endif + } + + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + void pb::IBufferMessage.InternalWriteTo(ref pb::WriteContext output) { + if (_unknownFields != null) { + _unknownFields.WriteTo(ref output); + } + } + #endif + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public int CalculateSize() { + int size = 0; + if (_unknownFields != null) { + size += _unknownFields.CalculateSize(); + } + return size; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public void MergeFrom(WebsocketSendResponse other) { + if (other == null) { + return; } _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields); } @@ -512,17 +835,6 @@ public void MergeFrom(pb::CodedInputStream input) { default: _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input); break; - case 10: { - if (collection_ == null) { - Collection = new global::Nitric.Proto.Document.v1.Collection(); - } - input.ReadMessage(Collection); - break; - } - case 18: { - Id = input.ReadString(); - break; - } } } #endif @@ -537,17 +849,6 @@ public void MergeFrom(pb::CodedInputStream input) { default: _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, ref input); break; - case 10: { - if (collection_ == null) { - Collection = new global::Nitric.Proto.Document.v1.Collection(); - } - input.ReadMessage(Collection); - break; - } - case 18: { - Id = input.ReadString(); - break; - } } } } @@ -555,22 +856,19 @@ public void MergeFrom(pb::CodedInputStream input) { } - /// - /// Provides a return document type - /// - public sealed partial class Document : pb::IMessage + public sealed partial class WebsocketCloseRequest : pb::IMessage #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE , pb::IBufferMessage #endif { - private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new Document()); + private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new WebsocketCloseRequest()); private pb::UnknownFieldSet _unknownFields; [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public static pb::MessageParser Parser { get { return _parser; } } + public static pb::MessageParser Parser { get { return _parser; } } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public static pbr::MessageDescriptor Descriptor { - get { return global::Nitric.Proto.Document.v1.DocumentReflection.Descriptor.MessageTypes[2]; } + get { return global::Nitric.Proto.Websockets.v1.WebsocketsReflection.Descriptor.MessageTypes[4]; } } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] @@ -579,75 +877,75 @@ public sealed partial class Document : pb::IMessage } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public Document() { + public WebsocketCloseRequest() { OnConstruction(); } partial void OnConstruction(); [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public Document(Document other) : this() { - content_ = other.content_ != null ? other.content_.Clone() : null; - key_ = other.key_ != null ? other.key_.Clone() : null; + public WebsocketCloseRequest(WebsocketCloseRequest other) : this() { + socketName_ = other.socketName_; + connectionId_ = other.connectionId_; _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public Document Clone() { - return new Document(this); + public WebsocketCloseRequest Clone() { + return new WebsocketCloseRequest(this); } - /// Field number for the "content" field. - public const int ContentFieldNumber = 1; - private global::Google.Protobuf.WellKnownTypes.Struct content_; + /// Field number for the "socket_name" field. + public const int SocketNameFieldNumber = 1; + private string socketName_ = ""; /// - /// The document content (JSON object) + /// The nitric name of the socket to send on /// [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public global::Google.Protobuf.WellKnownTypes.Struct Content { - get { return content_; } + public string SocketName { + get { return socketName_; } set { - content_ = value; + socketName_ = pb::ProtoPreconditions.CheckNotNull(value, "value"); } } - /// Field number for the "key" field. - public const int KeyFieldNumber = 2; - private global::Nitric.Proto.Document.v1.Key key_; + /// Field number for the "connection_id" field. + public const int ConnectionIdFieldNumber = 2; + private string connectionId_ = ""; /// - /// The document's unique key, including collection/sub-collections + /// The connection ID of the client to send to /// [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public global::Nitric.Proto.Document.v1.Key Key { - get { return key_; } + public string ConnectionId { + get { return connectionId_; } set { - key_ = value; + connectionId_ = pb::ProtoPreconditions.CheckNotNull(value, "value"); } } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public override bool Equals(object other) { - return Equals(other as Document); + return Equals(other as WebsocketCloseRequest); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public bool Equals(Document other) { + public bool Equals(WebsocketCloseRequest other) { if (ReferenceEquals(other, null)) { return false; } if (ReferenceEquals(other, this)) { return true; } - if (!object.Equals(Content, other.Content)) return false; - if (!object.Equals(Key, other.Key)) return false; + if (SocketName != other.SocketName) return false; + if (ConnectionId != other.ConnectionId) return false; return Equals(_unknownFields, other._unknownFields); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public override int GetHashCode() { int hash = 1; - if (content_ != null) hash ^= Content.GetHashCode(); - if (key_ != null) hash ^= Key.GetHashCode(); + if (SocketName.Length != 0) hash ^= SocketName.GetHashCode(); + if (ConnectionId.Length != 0) hash ^= ConnectionId.GetHashCode(); if (_unknownFields != null) { hash ^= _unknownFields.GetHashCode(); } @@ -664,13 +962,13 @@ public void WriteTo(pb::CodedOutputStream output) { #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE output.WriteRawMessage(this); #else - if (content_ != null) { + if (SocketName.Length != 0) { output.WriteRawTag(10); - output.WriteMessage(Content); + output.WriteString(SocketName); } - if (key_ != null) { + if (ConnectionId.Length != 0) { output.WriteRawTag(18); - output.WriteMessage(Key); + output.WriteString(ConnectionId); } if (_unknownFields != null) { _unknownFields.WriteTo(output); @@ -681,13 +979,13 @@ public void WriteTo(pb::CodedOutputStream output) { #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE [global::System.Diagnostics.DebuggerNonUserCodeAttribute] void pb::IBufferMessage.InternalWriteTo(ref pb::WriteContext output) { - if (content_ != null) { + if (SocketName.Length != 0) { output.WriteRawTag(10); - output.WriteMessage(Content); + output.WriteString(SocketName); } - if (key_ != null) { + if (ConnectionId.Length != 0) { output.WriteRawTag(18); - output.WriteMessage(Key); + output.WriteString(ConnectionId); } if (_unknownFields != null) { _unknownFields.WriteTo(ref output); @@ -698,11 +996,11 @@ public void WriteTo(pb::CodedOutputStream output) { [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public int CalculateSize() { int size = 0; - if (content_ != null) { - size += 1 + pb::CodedOutputStream.ComputeMessageSize(Content); + if (SocketName.Length != 0) { + size += 1 + pb::CodedOutputStream.ComputeStringSize(SocketName); } - if (key_ != null) { - size += 1 + pb::CodedOutputStream.ComputeMessageSize(Key); + if (ConnectionId.Length != 0) { + size += 1 + pb::CodedOutputStream.ComputeStringSize(ConnectionId); } if (_unknownFields != null) { size += _unknownFields.CalculateSize(); @@ -711,21 +1009,15 @@ public int CalculateSize() { } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void MergeFrom(Document other) { + public void MergeFrom(WebsocketCloseRequest other) { if (other == null) { return; } - if (other.content_ != null) { - if (content_ == null) { - Content = new global::Google.Protobuf.WellKnownTypes.Struct(); - } - Content.MergeFrom(other.Content); + if (other.SocketName.Length != 0) { + SocketName = other.SocketName; } - if (other.key_ != null) { - if (key_ == null) { - Key = new global::Nitric.Proto.Document.v1.Key(); - } - Key.MergeFrom(other.Key); + if (other.ConnectionId.Length != 0) { + ConnectionId = other.ConnectionId; } _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields); } @@ -742,17 +1034,11 @@ public void MergeFrom(pb::CodedInputStream input) { _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input); break; case 10: { - if (content_ == null) { - Content = new global::Google.Protobuf.WellKnownTypes.Struct(); - } - input.ReadMessage(Content); + SocketName = input.ReadString(); break; } case 18: { - if (key_ == null) { - Key = new global::Nitric.Proto.Document.v1.Key(); - } - input.ReadMessage(Key); + ConnectionId = input.ReadString(); break; } } @@ -770,17 +1056,11 @@ public void MergeFrom(pb::CodedInputStream input) { _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, ref input); break; case 10: { - if (content_ == null) { - Content = new global::Google.Protobuf.WellKnownTypes.Struct(); - } - input.ReadMessage(Content); + SocketName = input.ReadString(); break; } case 18: { - if (key_ == null) { - Key = new global::Nitric.Proto.Document.v1.Key(); - } - input.ReadMessage(Key); + ConnectionId = input.ReadString(); break; } } @@ -790,19 +1070,19 @@ public void MergeFrom(pb::CodedInputStream input) { } - public sealed partial class ExpressionValue : pb::IMessage + public sealed partial class WebsocketCloseResponse : pb::IMessage #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE , pb::IBufferMessage #endif { - private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new ExpressionValue()); + private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new WebsocketCloseResponse()); private pb::UnknownFieldSet _unknownFields; [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public static pb::MessageParser Parser { get { return _parser; } } + public static pb::MessageParser Parser { get { return _parser; } } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public static pbr::MessageDescriptor Descriptor { - get { return global::Nitric.Proto.Document.v1.DocumentReflection.Descriptor.MessageTypes[3]; } + get { return global::Nitric.Proto.Websockets.v1.WebsocketsReflection.Descriptor.MessageTypes[5]; } } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] @@ -811,143 +1091,41 @@ public sealed partial class ExpressionValue : pb::IMessage } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public ExpressionValue() { + public WebsocketCloseResponse() { OnConstruction(); } partial void OnConstruction(); [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public ExpressionValue(ExpressionValue other) : this() { - switch (other.KindCase) { - case KindOneofCase.IntValue: - IntValue = other.IntValue; - break; - case KindOneofCase.DoubleValue: - DoubleValue = other.DoubleValue; - break; - case KindOneofCase.StringValue: - StringValue = other.StringValue; - break; - case KindOneofCase.BoolValue: - BoolValue = other.BoolValue; - break; - } - + public WebsocketCloseResponse(WebsocketCloseResponse other) : this() { _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public ExpressionValue Clone() { - return new ExpressionValue(this); - } - - /// Field number for the "int_value" field. - public const int IntValueFieldNumber = 1; - /// - /// Represents an integer value. - /// - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public long IntValue { - get { return kindCase_ == KindOneofCase.IntValue ? (long) kind_ : 0L; } - set { - kind_ = value; - kindCase_ = KindOneofCase.IntValue; - } - } - - /// Field number for the "double_value" field. - public const int DoubleValueFieldNumber = 2; - /// - /// Represents a double value. - /// - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public double DoubleValue { - get { return kindCase_ == KindOneofCase.DoubleValue ? (double) kind_ : 0D; } - set { - kind_ = value; - kindCase_ = KindOneofCase.DoubleValue; - } - } - - /// Field number for the "string_value" field. - public const int StringValueFieldNumber = 3; - /// - /// Represents a string value. - /// - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public string StringValue { - get { return kindCase_ == KindOneofCase.StringValue ? (string) kind_ : ""; } - set { - kind_ = pb::ProtoPreconditions.CheckNotNull(value, "value"); - kindCase_ = KindOneofCase.StringValue; - } - } - - /// Field number for the "bool_value" field. - public const int BoolValueFieldNumber = 4; - /// - /// Represents a boolean value. - /// - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public bool BoolValue { - get { return kindCase_ == KindOneofCase.BoolValue ? (bool) kind_ : false; } - set { - kind_ = value; - kindCase_ = KindOneofCase.BoolValue; - } - } - - private object kind_; - /// Enum of possible cases for the "kind" oneof. - public enum KindOneofCase { - None = 0, - IntValue = 1, - DoubleValue = 2, - StringValue = 3, - BoolValue = 4, - } - private KindOneofCase kindCase_ = KindOneofCase.None; - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public KindOneofCase KindCase { - get { return kindCase_; } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void ClearKind() { - kindCase_ = KindOneofCase.None; - kind_ = null; + public WebsocketCloseResponse Clone() { + return new WebsocketCloseResponse(this); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public override bool Equals(object other) { - return Equals(other as ExpressionValue); + return Equals(other as WebsocketCloseResponse); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public bool Equals(ExpressionValue other) { + public bool Equals(WebsocketCloseResponse other) { if (ReferenceEquals(other, null)) { return false; } if (ReferenceEquals(other, this)) { return true; } - if (IntValue != other.IntValue) return false; - if (!pbc::ProtobufEqualityComparers.BitwiseDoubleEqualityComparer.Equals(DoubleValue, other.DoubleValue)) return false; - if (StringValue != other.StringValue) return false; - if (BoolValue != other.BoolValue) return false; - if (KindCase != other.KindCase) return false; return Equals(_unknownFields, other._unknownFields); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public override int GetHashCode() { int hash = 1; - if (kindCase_ == KindOneofCase.IntValue) hash ^= IntValue.GetHashCode(); - if (kindCase_ == KindOneofCase.DoubleValue) hash ^= pbc::ProtobufEqualityComparers.BitwiseDoubleEqualityComparer.GetHashCode(DoubleValue); - if (kindCase_ == KindOneofCase.StringValue) hash ^= StringValue.GetHashCode(); - if (kindCase_ == KindOneofCase.BoolValue) hash ^= BoolValue.GetHashCode(); - hash ^= (int) kindCase_; if (_unknownFields != null) { hash ^= _unknownFields.GetHashCode(); } @@ -964,22 +1142,6 @@ public void WriteTo(pb::CodedOutputStream output) { #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE output.WriteRawMessage(this); #else - if (kindCase_ == KindOneofCase.IntValue) { - output.WriteRawTag(8); - output.WriteInt64(IntValue); - } - if (kindCase_ == KindOneofCase.DoubleValue) { - output.WriteRawTag(17); - output.WriteDouble(DoubleValue); - } - if (kindCase_ == KindOneofCase.StringValue) { - output.WriteRawTag(26); - output.WriteString(StringValue); - } - if (kindCase_ == KindOneofCase.BoolValue) { - output.WriteRawTag(32); - output.WriteBool(BoolValue); - } if (_unknownFields != null) { _unknownFields.WriteTo(output); } @@ -989,22 +1151,6 @@ public void WriteTo(pb::CodedOutputStream output) { #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE [global::System.Diagnostics.DebuggerNonUserCodeAttribute] void pb::IBufferMessage.InternalWriteTo(ref pb::WriteContext output) { - if (kindCase_ == KindOneofCase.IntValue) { - output.WriteRawTag(8); - output.WriteInt64(IntValue); - } - if (kindCase_ == KindOneofCase.DoubleValue) { - output.WriteRawTag(17); - output.WriteDouble(DoubleValue); - } - if (kindCase_ == KindOneofCase.StringValue) { - output.WriteRawTag(26); - output.WriteString(StringValue); - } - if (kindCase_ == KindOneofCase.BoolValue) { - output.WriteRawTag(32); - output.WriteBool(BoolValue); - } if (_unknownFields != null) { _unknownFields.WriteTo(ref output); } @@ -1014,18 +1160,6 @@ public void WriteTo(pb::CodedOutputStream output) { [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public int CalculateSize() { int size = 0; - if (kindCase_ == KindOneofCase.IntValue) { - size += 1 + pb::CodedOutputStream.ComputeInt64Size(IntValue); - } - if (kindCase_ == KindOneofCase.DoubleValue) { - size += 1 + 8; - } - if (kindCase_ == KindOneofCase.StringValue) { - size += 1 + pb::CodedOutputStream.ComputeStringSize(StringValue); - } - if (kindCase_ == KindOneofCase.BoolValue) { - size += 1 + 1; - } if (_unknownFields != null) { size += _unknownFields.CalculateSize(); } @@ -1033,25 +1167,10 @@ public int CalculateSize() { } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void MergeFrom(ExpressionValue other) { + public void MergeFrom(WebsocketCloseResponse other) { if (other == null) { return; } - switch (other.KindCase) { - case KindOneofCase.IntValue: - IntValue = other.IntValue; - break; - case KindOneofCase.DoubleValue: - DoubleValue = other.DoubleValue; - break; - case KindOneofCase.StringValue: - StringValue = other.StringValue; - break; - case KindOneofCase.BoolValue: - BoolValue = other.BoolValue; - break; - } - _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields); } @@ -1066,22 +1185,6 @@ public void MergeFrom(pb::CodedInputStream input) { default: _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input); break; - case 8: { - IntValue = input.ReadInt64(); - break; - } - case 17: { - DoubleValue = input.ReadDouble(); - break; - } - case 26: { - StringValue = input.ReadString(); - break; - } - case 32: { - BoolValue = input.ReadBool(); - break; - } } } #endif @@ -1096,22 +1199,6 @@ public void MergeFrom(pb::CodedInputStream input) { default: _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, ref input); break; - case 8: { - IntValue = input.ReadInt64(); - break; - } - case 17: { - DoubleValue = input.ReadDouble(); - break; - } - case 26: { - StringValue = input.ReadString(); - break; - } - case 32: { - BoolValue = input.ReadBool(); - break; - } } } } @@ -1120,21 +1207,21 @@ public void MergeFrom(pb::CodedInputStream input) { } /// - /// Provides a query expression type + /// Messages the client is able to send to the server /// - public sealed partial class Expression : pb::IMessage + public sealed partial class ClientMessage : pb::IMessage #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE , pb::IBufferMessage #endif { - private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new Expression()); + private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new ClientMessage()); private pb::UnknownFieldSet _unknownFields; [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public static pb::MessageParser Parser { get { return _parser; } } + public static pb::MessageParser Parser { get { return _parser; } } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public static pbr::MessageDescriptor Descriptor { - get { return global::Nitric.Proto.Document.v1.DocumentReflection.Descriptor.MessageTypes[4]; } + get { return global::Nitric.Proto.Websockets.v1.WebsocketsReflection.Descriptor.MessageTypes[6]; } } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] @@ -1143,92 +1230,122 @@ public sealed partial class Expression : pb::IMessage } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public Expression() { + public ClientMessage() { OnConstruction(); } partial void OnConstruction(); [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public Expression(Expression other) : this() { - operand_ = other.operand_; - operator_ = other.operator_; - value_ = other.value_ != null ? other.value_.Clone() : null; + public ClientMessage(ClientMessage other) : this() { + id_ = other.id_; + switch (other.ContentCase) { + case ContentOneofCase.RegistrationRequest: + RegistrationRequest = other.RegistrationRequest.Clone(); + break; + case ContentOneofCase.WebsocketEventResponse: + WebsocketEventResponse = other.WebsocketEventResponse.Clone(); + break; + } + _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public Expression Clone() { - return new Expression(this); + public ClientMessage Clone() { + return new ClientMessage(this); } - /// Field number for the "operand" field. - public const int OperandFieldNumber = 1; - private string operand_ = ""; + /// Field number for the "id" field. + public const int IdFieldNumber = 1; + private string id_ = ""; /// - /// The query operand or attribute + /// Client message ID, used to pair requests/responses /// [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public string Operand { - get { return operand_; } + public string Id { + get { return id_; } set { - operand_ = pb::ProtoPreconditions.CheckNotNull(value, "value"); + id_ = pb::ProtoPreconditions.CheckNotNull(value, "value"); } } - /// Field number for the "operator" field. - public const int OperatorFieldNumber = 2; - private string operator_ = ""; + /// Field number for the "registration_request" field. + public const int RegistrationRequestFieldNumber = 2; /// - /// The query operator [ == | < | <= | > | >= | startsWith ] + /// Client initialisation request + /// A worker will not be eligible for triggers + /// until it has identified itself /// [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public string Operator { - get { return operator_; } + public global::Nitric.Proto.Websockets.v1.RegistrationRequest RegistrationRequest { + get { return contentCase_ == ContentOneofCase.RegistrationRequest ? (global::Nitric.Proto.Websockets.v1.RegistrationRequest) content_ : null; } set { - operator_ = pb::ProtoPreconditions.CheckNotNull(value, "value"); + content_ = value; + contentCase_ = value == null ? ContentOneofCase.None : ContentOneofCase.RegistrationRequest; } } - /// Field number for the "value" field. - public const int ValueFieldNumber = 3; - private global::Nitric.Proto.Document.v1.ExpressionValue value_; + /// Field number for the "websocket_event_response" field. + public const int WebsocketEventResponseFieldNumber = 3; /// - /// The query expression value + /// Client responding with result of a trigger /// [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public global::Nitric.Proto.Document.v1.ExpressionValue Value { - get { return value_; } + public global::Nitric.Proto.Websockets.v1.WebsocketEventResponse WebsocketEventResponse { + get { return contentCase_ == ContentOneofCase.WebsocketEventResponse ? (global::Nitric.Proto.Websockets.v1.WebsocketEventResponse) content_ : null; } set { - value_ = value; + content_ = value; + contentCase_ = value == null ? ContentOneofCase.None : ContentOneofCase.WebsocketEventResponse; } } + private object content_; + /// Enum of possible cases for the "content" oneof. + public enum ContentOneofCase { + None = 0, + RegistrationRequest = 2, + WebsocketEventResponse = 3, + } + private ContentOneofCase contentCase_ = ContentOneofCase.None; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public ContentOneofCase ContentCase { + get { return contentCase_; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public void ClearContent() { + contentCase_ = ContentOneofCase.None; + content_ = null; + } + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public override bool Equals(object other) { - return Equals(other as Expression); + return Equals(other as ClientMessage); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public bool Equals(Expression other) { + public bool Equals(ClientMessage other) { if (ReferenceEquals(other, null)) { return false; } if (ReferenceEquals(other, this)) { return true; } - if (Operand != other.Operand) return false; - if (Operator != other.Operator) return false; - if (!object.Equals(Value, other.Value)) return false; + if (Id != other.Id) return false; + if (!object.Equals(RegistrationRequest, other.RegistrationRequest)) return false; + if (!object.Equals(WebsocketEventResponse, other.WebsocketEventResponse)) return false; + if (ContentCase != other.ContentCase) return false; return Equals(_unknownFields, other._unknownFields); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public override int GetHashCode() { int hash = 1; - if (Operand.Length != 0) hash ^= Operand.GetHashCode(); - if (Operator.Length != 0) hash ^= Operator.GetHashCode(); - if (value_ != null) hash ^= Value.GetHashCode(); + if (Id.Length != 0) hash ^= Id.GetHashCode(); + if (contentCase_ == ContentOneofCase.RegistrationRequest) hash ^= RegistrationRequest.GetHashCode(); + if (contentCase_ == ContentOneofCase.WebsocketEventResponse) hash ^= WebsocketEventResponse.GetHashCode(); + hash ^= (int) contentCase_; if (_unknownFields != null) { hash ^= _unknownFields.GetHashCode(); } @@ -1245,17 +1362,17 @@ public void WriteTo(pb::CodedOutputStream output) { #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE output.WriteRawMessage(this); #else - if (Operand.Length != 0) { + if (Id.Length != 0) { output.WriteRawTag(10); - output.WriteString(Operand); + output.WriteString(Id); } - if (Operator.Length != 0) { + if (contentCase_ == ContentOneofCase.RegistrationRequest) { output.WriteRawTag(18); - output.WriteString(Operator); + output.WriteMessage(RegistrationRequest); } - if (value_ != null) { + if (contentCase_ == ContentOneofCase.WebsocketEventResponse) { output.WriteRawTag(26); - output.WriteMessage(Value); + output.WriteMessage(WebsocketEventResponse); } if (_unknownFields != null) { _unknownFields.WriteTo(output); @@ -1266,17 +1383,17 @@ public void WriteTo(pb::CodedOutputStream output) { #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE [global::System.Diagnostics.DebuggerNonUserCodeAttribute] void pb::IBufferMessage.InternalWriteTo(ref pb::WriteContext output) { - if (Operand.Length != 0) { + if (Id.Length != 0) { output.WriteRawTag(10); - output.WriteString(Operand); + output.WriteString(Id); } - if (Operator.Length != 0) { + if (contentCase_ == ContentOneofCase.RegistrationRequest) { output.WriteRawTag(18); - output.WriteString(Operator); + output.WriteMessage(RegistrationRequest); } - if (value_ != null) { + if (contentCase_ == ContentOneofCase.WebsocketEventResponse) { output.WriteRawTag(26); - output.WriteMessage(Value); + output.WriteMessage(WebsocketEventResponse); } if (_unknownFields != null) { _unknownFields.WriteTo(ref output); @@ -1287,14 +1404,14 @@ public void WriteTo(pb::CodedOutputStream output) { [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public int CalculateSize() { int size = 0; - if (Operand.Length != 0) { - size += 1 + pb::CodedOutputStream.ComputeStringSize(Operand); + if (Id.Length != 0) { + size += 1 + pb::CodedOutputStream.ComputeStringSize(Id); } - if (Operator.Length != 0) { - size += 1 + pb::CodedOutputStream.ComputeStringSize(Operator); + if (contentCase_ == ContentOneofCase.RegistrationRequest) { + size += 1 + pb::CodedOutputStream.ComputeMessageSize(RegistrationRequest); } - if (value_ != null) { - size += 1 + pb::CodedOutputStream.ComputeMessageSize(Value); + if (contentCase_ == ContentOneofCase.WebsocketEventResponse) { + size += 1 + pb::CodedOutputStream.ComputeMessageSize(WebsocketEventResponse); } if (_unknownFields != null) { size += _unknownFields.CalculateSize(); @@ -1303,22 +1420,28 @@ public int CalculateSize() { } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void MergeFrom(Expression other) { + public void MergeFrom(ClientMessage other) { if (other == null) { return; } - if (other.Operand.Length != 0) { - Operand = other.Operand; - } - if (other.Operator.Length != 0) { - Operator = other.Operator; + if (other.Id.Length != 0) { + Id = other.Id; } - if (other.value_ != null) { - if (value_ == null) { - Value = new global::Nitric.Proto.Document.v1.ExpressionValue(); - } - Value.MergeFrom(other.Value); + switch (other.ContentCase) { + case ContentOneofCase.RegistrationRequest: + if (RegistrationRequest == null) { + RegistrationRequest = new global::Nitric.Proto.Websockets.v1.RegistrationRequest(); + } + RegistrationRequest.MergeFrom(other.RegistrationRequest); + break; + case ContentOneofCase.WebsocketEventResponse: + if (WebsocketEventResponse == null) { + WebsocketEventResponse = new global::Nitric.Proto.Websockets.v1.WebsocketEventResponse(); + } + WebsocketEventResponse.MergeFrom(other.WebsocketEventResponse); + break; } + _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields); } @@ -1334,18 +1457,25 @@ public void MergeFrom(pb::CodedInputStream input) { _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input); break; case 10: { - Operand = input.ReadString(); + Id = input.ReadString(); break; } case 18: { - Operator = input.ReadString(); + global::Nitric.Proto.Websockets.v1.RegistrationRequest subBuilder = new global::Nitric.Proto.Websockets.v1.RegistrationRequest(); + if (contentCase_ == ContentOneofCase.RegistrationRequest) { + subBuilder.MergeFrom(RegistrationRequest); + } + input.ReadMessage(subBuilder); + RegistrationRequest = subBuilder; break; } case 26: { - if (value_ == null) { - Value = new global::Nitric.Proto.Document.v1.ExpressionValue(); + global::Nitric.Proto.Websockets.v1.WebsocketEventResponse subBuilder = new global::Nitric.Proto.Websockets.v1.WebsocketEventResponse(); + if (contentCase_ == ContentOneofCase.WebsocketEventResponse) { + subBuilder.MergeFrom(WebsocketEventResponse); } - input.ReadMessage(Value); + input.ReadMessage(subBuilder); + WebsocketEventResponse = subBuilder; break; } } @@ -1363,18 +1493,25 @@ public void MergeFrom(pb::CodedInputStream input) { _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, ref input); break; case 10: { - Operand = input.ReadString(); + Id = input.ReadString(); break; } case 18: { - Operator = input.ReadString(); + global::Nitric.Proto.Websockets.v1.RegistrationRequest subBuilder = new global::Nitric.Proto.Websockets.v1.RegistrationRequest(); + if (contentCase_ == ContentOneofCase.RegistrationRequest) { + subBuilder.MergeFrom(RegistrationRequest); + } + input.ReadMessage(subBuilder); + RegistrationRequest = subBuilder; break; } case 26: { - if (value_ == null) { - Value = new global::Nitric.Proto.Document.v1.ExpressionValue(); + global::Nitric.Proto.Websockets.v1.WebsocketEventResponse subBuilder = new global::Nitric.Proto.Websockets.v1.WebsocketEventResponse(); + if (contentCase_ == ContentOneofCase.WebsocketEventResponse) { + subBuilder.MergeFrom(WebsocketEventResponse); } - input.ReadMessage(Value); + input.ReadMessage(subBuilder); + WebsocketEventResponse = subBuilder; break; } } @@ -1384,19 +1521,22 @@ public void MergeFrom(pb::CodedInputStream input) { } - public sealed partial class DocumentGetRequest : pb::IMessage + /// + /// Placeholder message + /// + public sealed partial class RegistrationResponse : pb::IMessage #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE , pb::IBufferMessage #endif { - private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new DocumentGetRequest()); + private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new RegistrationResponse()); private pb::UnknownFieldSet _unknownFields; [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public static pb::MessageParser Parser { get { return _parser; } } + public static pb::MessageParser Parser { get { return _parser; } } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public static pbr::MessageDescriptor Descriptor { - get { return global::Nitric.Proto.Document.v1.DocumentReflection.Descriptor.MessageTypes[5]; } + get { return global::Nitric.Proto.Websockets.v1.WebsocketsReflection.Descriptor.MessageTypes[7]; } } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] @@ -1405,58 +1545,41 @@ public sealed partial class DocumentGetRequest : pb::IMessageField number for the "key" field. - public const int KeyFieldNumber = 1; - private global::Nitric.Proto.Document.v1.Key key_; - /// - /// Key of the document to retrieve - /// - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public global::Nitric.Proto.Document.v1.Key Key { - get { return key_; } - set { - key_ = value; - } + public RegistrationResponse Clone() { + return new RegistrationResponse(this); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public override bool Equals(object other) { - return Equals(other as DocumentGetRequest); + return Equals(other as RegistrationResponse); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public bool Equals(DocumentGetRequest other) { + public bool Equals(RegistrationResponse other) { if (ReferenceEquals(other, null)) { return false; } if (ReferenceEquals(other, this)) { return true; } - if (!object.Equals(Key, other.Key)) return false; return Equals(_unknownFields, other._unknownFields); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public override int GetHashCode() { int hash = 1; - if (key_ != null) hash ^= Key.GetHashCode(); if (_unknownFields != null) { hash ^= _unknownFields.GetHashCode(); } @@ -1473,10 +1596,6 @@ public void WriteTo(pb::CodedOutputStream output) { #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE output.WriteRawMessage(this); #else - if (key_ != null) { - output.WriteRawTag(10); - output.WriteMessage(Key); - } if (_unknownFields != null) { _unknownFields.WriteTo(output); } @@ -1486,10 +1605,6 @@ public void WriteTo(pb::CodedOutputStream output) { #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE [global::System.Diagnostics.DebuggerNonUserCodeAttribute] void pb::IBufferMessage.InternalWriteTo(ref pb::WriteContext output) { - if (key_ != null) { - output.WriteRawTag(10); - output.WriteMessage(Key); - } if (_unknownFields != null) { _unknownFields.WriteTo(ref output); } @@ -1499,9 +1614,6 @@ public void WriteTo(pb::CodedOutputStream output) { [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public int CalculateSize() { int size = 0; - if (key_ != null) { - size += 1 + pb::CodedOutputStream.ComputeMessageSize(Key); - } if (_unknownFields != null) { size += _unknownFields.CalculateSize(); } @@ -1509,16 +1621,10 @@ public int CalculateSize() { } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void MergeFrom(DocumentGetRequest other) { + public void MergeFrom(RegistrationResponse other) { if (other == null) { return; } - if (other.key_ != null) { - if (key_ == null) { - Key = new global::Nitric.Proto.Document.v1.Key(); - } - Key.MergeFrom(other.Key); - } _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields); } @@ -1533,13 +1639,6 @@ public void MergeFrom(pb::CodedInputStream input) { default: _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input); break; - case 10: { - if (key_ == null) { - Key = new global::Nitric.Proto.Document.v1.Key(); - } - input.ReadMessage(Key); - break; - } } } #endif @@ -1554,13 +1653,6 @@ public void MergeFrom(pb::CodedInputStream input) { default: _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, ref input); break; - case 10: { - if (key_ == null) { - Key = new global::Nitric.Proto.Document.v1.Key(); - } - input.ReadMessage(Key); - break; - } } } } @@ -1568,19 +1660,19 @@ public void MergeFrom(pb::CodedInputStream input) { } - public sealed partial class DocumentGetResponse : pb::IMessage + public sealed partial class RegistrationRequest : pb::IMessage #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE , pb::IBufferMessage #endif { - private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new DocumentGetResponse()); + private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new RegistrationRequest()); private pb::UnknownFieldSet _unknownFields; [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public static pb::MessageParser Parser { get { return _parser; } } + public static pb::MessageParser Parser { get { return _parser; } } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public static pbr::MessageDescriptor Descriptor { - get { return global::Nitric.Proto.Document.v1.DocumentReflection.Descriptor.MessageTypes[6]; } + get { return global::Nitric.Proto.Websockets.v1.WebsocketsReflection.Descriptor.MessageTypes[8]; } } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] @@ -1589,58 +1681,75 @@ public sealed partial class DocumentGetResponse : pb::IMessageField number for the "socket_name" field. + public const int SocketNameFieldNumber = 1; + private string socketName_ = ""; + /// + /// The nitric name of the socket that this worker listens on + /// + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public string SocketName { + get { return socketName_; } + set { + socketName_ = pb::ProtoPreconditions.CheckNotNull(value, "value"); + } } - /// Field number for the "document" field. - public const int DocumentFieldNumber = 1; - private global::Nitric.Proto.Document.v1.Document document_; + /// Field number for the "event_type" field. + public const int EventTypeFieldNumber = 2; + private global::Nitric.Proto.Websockets.v1.WebsocketEventType eventType_ = global::Nitric.Proto.Websockets.v1.WebsocketEventType.Connect; /// - /// The retrieved value + /// The type of event that this worker handles /// [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public global::Nitric.Proto.Document.v1.Document Document { - get { return document_; } + public global::Nitric.Proto.Websockets.v1.WebsocketEventType EventType { + get { return eventType_; } set { - document_ = value; + eventType_ = value; } } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public override bool Equals(object other) { - return Equals(other as DocumentGetResponse); + return Equals(other as RegistrationRequest); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public bool Equals(DocumentGetResponse other) { + public bool Equals(RegistrationRequest other) { if (ReferenceEquals(other, null)) { return false; } if (ReferenceEquals(other, this)) { return true; } - if (!object.Equals(Document, other.Document)) return false; + if (SocketName != other.SocketName) return false; + if (EventType != other.EventType) return false; return Equals(_unknownFields, other._unknownFields); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public override int GetHashCode() { int hash = 1; - if (document_ != null) hash ^= Document.GetHashCode(); + if (SocketName.Length != 0) hash ^= SocketName.GetHashCode(); + if (EventType != global::Nitric.Proto.Websockets.v1.WebsocketEventType.Connect) hash ^= EventType.GetHashCode(); if (_unknownFields != null) { hash ^= _unknownFields.GetHashCode(); } @@ -1657,9 +1766,13 @@ public void WriteTo(pb::CodedOutputStream output) { #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE output.WriteRawMessage(this); #else - if (document_ != null) { + if (SocketName.Length != 0) { output.WriteRawTag(10); - output.WriteMessage(Document); + output.WriteString(SocketName); + } + if (EventType != global::Nitric.Proto.Websockets.v1.WebsocketEventType.Connect) { + output.WriteRawTag(16); + output.WriteEnum((int) EventType); } if (_unknownFields != null) { _unknownFields.WriteTo(output); @@ -1670,9 +1783,13 @@ public void WriteTo(pb::CodedOutputStream output) { #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE [global::System.Diagnostics.DebuggerNonUserCodeAttribute] void pb::IBufferMessage.InternalWriteTo(ref pb::WriteContext output) { - if (document_ != null) { + if (SocketName.Length != 0) { output.WriteRawTag(10); - output.WriteMessage(Document); + output.WriteString(SocketName); + } + if (EventType != global::Nitric.Proto.Websockets.v1.WebsocketEventType.Connect) { + output.WriteRawTag(16); + output.WriteEnum((int) EventType); } if (_unknownFields != null) { _unknownFields.WriteTo(ref output); @@ -1683,8 +1800,11 @@ public void WriteTo(pb::CodedOutputStream output) { [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public int CalculateSize() { int size = 0; - if (document_ != null) { - size += 1 + pb::CodedOutputStream.ComputeMessageSize(Document); + if (SocketName.Length != 0) { + size += 1 + pb::CodedOutputStream.ComputeStringSize(SocketName); + } + if (EventType != global::Nitric.Proto.Websockets.v1.WebsocketEventType.Connect) { + size += 1 + pb::CodedOutputStream.ComputeEnumSize((int) EventType); } if (_unknownFields != null) { size += _unknownFields.CalculateSize(); @@ -1693,15 +1813,15 @@ public int CalculateSize() { } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void MergeFrom(DocumentGetResponse other) { + public void MergeFrom(RegistrationRequest other) { if (other == null) { return; } - if (other.document_ != null) { - if (document_ == null) { - Document = new global::Nitric.Proto.Document.v1.Document(); - } - Document.MergeFrom(other.Document); + if (other.SocketName.Length != 0) { + SocketName = other.SocketName; + } + if (other.EventType != global::Nitric.Proto.Websockets.v1.WebsocketEventType.Connect) { + EventType = other.EventType; } _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields); } @@ -1718,10 +1838,11 @@ public void MergeFrom(pb::CodedInputStream input) { _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input); break; case 10: { - if (document_ == null) { - Document = new global::Nitric.Proto.Document.v1.Document(); - } - input.ReadMessage(Document); + SocketName = input.ReadString(); + break; + } + case 16: { + EventType = (global::Nitric.Proto.Websockets.v1.WebsocketEventType) input.ReadEnum(); break; } } @@ -1739,10 +1860,11 @@ public void MergeFrom(pb::CodedInputStream input) { _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, ref input); break; case 10: { - if (document_ == null) { - Document = new global::Nitric.Proto.Document.v1.Document(); - } - input.ReadMessage(Document); + SocketName = input.ReadString(); + break; + } + case 16: { + EventType = (global::Nitric.Proto.Websockets.v1.WebsocketEventType) input.ReadEnum(); break; } } @@ -1752,19 +1874,19 @@ public void MergeFrom(pb::CodedInputStream input) { } - public sealed partial class DocumentSetRequest : pb::IMessage + public sealed partial class WebsocketEventRequest : pb::IMessage #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE , pb::IBufferMessage #endif { - private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new DocumentSetRequest()); + private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new WebsocketEventRequest()); private pb::UnknownFieldSet _unknownFields; [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public static pb::MessageParser Parser { get { return _parser; } } + public static pb::MessageParser Parser { get { return _parser; } } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public static pbr::MessageDescriptor Descriptor { - get { return global::Nitric.Proto.Document.v1.DocumentReflection.Descriptor.MessageTypes[7]; } + get { return global::Nitric.Proto.Websockets.v1.WebsocketsReflection.Descriptor.MessageTypes[9]; } } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] @@ -1773,75 +1895,148 @@ public sealed partial class DocumentSetRequest : pb::IMessageField number for the "key" field. - public const int KeyFieldNumber = 1; - private global::Nitric.Proto.Document.v1.Key key_; + /// Field number for the "socket_name" field. + public const int SocketNameFieldNumber = 1; + private string socketName_ = ""; /// - /// Key of the document to set + /// The nitric name of the socket that this worker listens on /// [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public global::Nitric.Proto.Document.v1.Key Key { - get { return key_; } + public string SocketName { + get { return socketName_; } set { - key_ = value; + socketName_ = pb::ProtoPreconditions.CheckNotNull(value, "value"); } } - /// Field number for the "content" field. - public const int ContentFieldNumber = 3; - private global::Google.Protobuf.WellKnownTypes.Struct content_; + /// Field number for the "connectionId" field. + public const int ConnectionIdFieldNumber = 2; + private string connectionId_ = ""; /// - /// The document content to store (JSON object) + /// The connection this trigger came from /// [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public global::Google.Protobuf.WellKnownTypes.Struct Content { - get { return content_; } + public string ConnectionId { + get { return connectionId_; } set { - content_ = value; + connectionId_ = pb::ProtoPreconditions.CheckNotNull(value, "value"); + } + } + + /// Field number for the "connection" field. + public const int ConnectionFieldNumber = 10; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public global::Nitric.Proto.Websockets.v1.WebsocketConnectionEvent Connection { + get { return websocketEventCase_ == WebsocketEventOneofCase.Connection ? (global::Nitric.Proto.Websockets.v1.WebsocketConnectionEvent) websocketEvent_ : null; } + set { + websocketEvent_ = value; + websocketEventCase_ = value == null ? WebsocketEventOneofCase.None : WebsocketEventOneofCase.Connection; + } + } + + /// Field number for the "disconnection" field. + public const int DisconnectionFieldNumber = 11; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public global::Nitric.Proto.Websockets.v1.WebsocketDisconnectionEvent Disconnection { + get { return websocketEventCase_ == WebsocketEventOneofCase.Disconnection ? (global::Nitric.Proto.Websockets.v1.WebsocketDisconnectionEvent) websocketEvent_ : null; } + set { + websocketEvent_ = value; + websocketEventCase_ = value == null ? WebsocketEventOneofCase.None : WebsocketEventOneofCase.Disconnection; + } + } + + /// Field number for the "message" field. + public const int MessageFieldNumber = 12; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public global::Nitric.Proto.Websockets.v1.WebsocketMessageEvent Message { + get { return websocketEventCase_ == WebsocketEventOneofCase.Message ? (global::Nitric.Proto.Websockets.v1.WebsocketMessageEvent) websocketEvent_ : null; } + set { + websocketEvent_ = value; + websocketEventCase_ = value == null ? WebsocketEventOneofCase.None : WebsocketEventOneofCase.Message; } } + private object websocketEvent_; + /// Enum of possible cases for the "websocket_event" oneof. + public enum WebsocketEventOneofCase { + None = 0, + Connection = 10, + Disconnection = 11, + Message = 12, + } + private WebsocketEventOneofCase websocketEventCase_ = WebsocketEventOneofCase.None; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public WebsocketEventOneofCase WebsocketEventCase { + get { return websocketEventCase_; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public void ClearWebsocketEvent() { + websocketEventCase_ = WebsocketEventOneofCase.None; + websocketEvent_ = null; + } + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public override bool Equals(object other) { - return Equals(other as DocumentSetRequest); + return Equals(other as WebsocketEventRequest); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public bool Equals(DocumentSetRequest other) { + public bool Equals(WebsocketEventRequest other) { if (ReferenceEquals(other, null)) { return false; } if (ReferenceEquals(other, this)) { return true; } - if (!object.Equals(Key, other.Key)) return false; - if (!object.Equals(Content, other.Content)) return false; + if (SocketName != other.SocketName) return false; + if (ConnectionId != other.ConnectionId) return false; + if (!object.Equals(Connection, other.Connection)) return false; + if (!object.Equals(Disconnection, other.Disconnection)) return false; + if (!object.Equals(Message, other.Message)) return false; + if (WebsocketEventCase != other.WebsocketEventCase) return false; return Equals(_unknownFields, other._unknownFields); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public override int GetHashCode() { int hash = 1; - if (key_ != null) hash ^= Key.GetHashCode(); - if (content_ != null) hash ^= Content.GetHashCode(); + if (SocketName.Length != 0) hash ^= SocketName.GetHashCode(); + if (ConnectionId.Length != 0) hash ^= ConnectionId.GetHashCode(); + if (websocketEventCase_ == WebsocketEventOneofCase.Connection) hash ^= Connection.GetHashCode(); + if (websocketEventCase_ == WebsocketEventOneofCase.Disconnection) hash ^= Disconnection.GetHashCode(); + if (websocketEventCase_ == WebsocketEventOneofCase.Message) hash ^= Message.GetHashCode(); + hash ^= (int) websocketEventCase_; if (_unknownFields != null) { hash ^= _unknownFields.GetHashCode(); } @@ -1858,13 +2053,25 @@ public void WriteTo(pb::CodedOutputStream output) { #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE output.WriteRawMessage(this); #else - if (key_ != null) { + if (SocketName.Length != 0) { output.WriteRawTag(10); - output.WriteMessage(Key); + output.WriteString(SocketName); } - if (content_ != null) { - output.WriteRawTag(26); - output.WriteMessage(Content); + if (ConnectionId.Length != 0) { + output.WriteRawTag(18); + output.WriteString(ConnectionId); + } + if (websocketEventCase_ == WebsocketEventOneofCase.Connection) { + output.WriteRawTag(82); + output.WriteMessage(Connection); + } + if (websocketEventCase_ == WebsocketEventOneofCase.Disconnection) { + output.WriteRawTag(90); + output.WriteMessage(Disconnection); + } + if (websocketEventCase_ == WebsocketEventOneofCase.Message) { + output.WriteRawTag(98); + output.WriteMessage(Message); } if (_unknownFields != null) { _unknownFields.WriteTo(output); @@ -1875,13 +2082,25 @@ public void WriteTo(pb::CodedOutputStream output) { #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE [global::System.Diagnostics.DebuggerNonUserCodeAttribute] void pb::IBufferMessage.InternalWriteTo(ref pb::WriteContext output) { - if (key_ != null) { + if (SocketName.Length != 0) { output.WriteRawTag(10); - output.WriteMessage(Key); + output.WriteString(SocketName); } - if (content_ != null) { - output.WriteRawTag(26); - output.WriteMessage(Content); + if (ConnectionId.Length != 0) { + output.WriteRawTag(18); + output.WriteString(ConnectionId); + } + if (websocketEventCase_ == WebsocketEventOneofCase.Connection) { + output.WriteRawTag(82); + output.WriteMessage(Connection); + } + if (websocketEventCase_ == WebsocketEventOneofCase.Disconnection) { + output.WriteRawTag(90); + output.WriteMessage(Disconnection); + } + if (websocketEventCase_ == WebsocketEventOneofCase.Message) { + output.WriteRawTag(98); + output.WriteMessage(Message); } if (_unknownFields != null) { _unknownFields.WriteTo(ref output); @@ -1892,11 +2111,20 @@ public void WriteTo(pb::CodedOutputStream output) { [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public int CalculateSize() { int size = 0; - if (key_ != null) { - size += 1 + pb::CodedOutputStream.ComputeMessageSize(Key); + if (SocketName.Length != 0) { + size += 1 + pb::CodedOutputStream.ComputeStringSize(SocketName); + } + if (ConnectionId.Length != 0) { + size += 1 + pb::CodedOutputStream.ComputeStringSize(ConnectionId); } - if (content_ != null) { - size += 1 + pb::CodedOutputStream.ComputeMessageSize(Content); + if (websocketEventCase_ == WebsocketEventOneofCase.Connection) { + size += 1 + pb::CodedOutputStream.ComputeMessageSize(Connection); + } + if (websocketEventCase_ == WebsocketEventOneofCase.Disconnection) { + size += 1 + pb::CodedOutputStream.ComputeMessageSize(Disconnection); + } + if (websocketEventCase_ == WebsocketEventOneofCase.Message) { + size += 1 + pb::CodedOutputStream.ComputeMessageSize(Message); } if (_unknownFields != null) { size += _unknownFields.CalculateSize(); @@ -1905,22 +2133,37 @@ public int CalculateSize() { } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void MergeFrom(DocumentSetRequest other) { + public void MergeFrom(WebsocketEventRequest other) { if (other == null) { return; } - if (other.key_ != null) { - if (key_ == null) { - Key = new global::Nitric.Proto.Document.v1.Key(); - } - Key.MergeFrom(other.Key); + if (other.SocketName.Length != 0) { + SocketName = other.SocketName; } - if (other.content_ != null) { - if (content_ == null) { - Content = new global::Google.Protobuf.WellKnownTypes.Struct(); - } - Content.MergeFrom(other.Content); + if (other.ConnectionId.Length != 0) { + ConnectionId = other.ConnectionId; } + switch (other.WebsocketEventCase) { + case WebsocketEventOneofCase.Connection: + if (Connection == null) { + Connection = new global::Nitric.Proto.Websockets.v1.WebsocketConnectionEvent(); + } + Connection.MergeFrom(other.Connection); + break; + case WebsocketEventOneofCase.Disconnection: + if (Disconnection == null) { + Disconnection = new global::Nitric.Proto.Websockets.v1.WebsocketDisconnectionEvent(); + } + Disconnection.MergeFrom(other.Disconnection); + break; + case WebsocketEventOneofCase.Message: + if (Message == null) { + Message = new global::Nitric.Proto.Websockets.v1.WebsocketMessageEvent(); + } + Message.MergeFrom(other.Message); + break; + } + _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields); } @@ -1935,18 +2178,39 @@ public void MergeFrom(pb::CodedInputStream input) { default: _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input); break; - case 10: { - if (key_ == null) { - Key = new global::Nitric.Proto.Document.v1.Key(); + case 10: { + SocketName = input.ReadString(); + break; + } + case 18: { + ConnectionId = input.ReadString(); + break; + } + case 82: { + global::Nitric.Proto.Websockets.v1.WebsocketConnectionEvent subBuilder = new global::Nitric.Proto.Websockets.v1.WebsocketConnectionEvent(); + if (websocketEventCase_ == WebsocketEventOneofCase.Connection) { + subBuilder.MergeFrom(Connection); + } + input.ReadMessage(subBuilder); + Connection = subBuilder; + break; + } + case 90: { + global::Nitric.Proto.Websockets.v1.WebsocketDisconnectionEvent subBuilder = new global::Nitric.Proto.Websockets.v1.WebsocketDisconnectionEvent(); + if (websocketEventCase_ == WebsocketEventOneofCase.Disconnection) { + subBuilder.MergeFrom(Disconnection); } - input.ReadMessage(Key); + input.ReadMessage(subBuilder); + Disconnection = subBuilder; break; } - case 26: { - if (content_ == null) { - Content = new global::Google.Protobuf.WellKnownTypes.Struct(); + case 98: { + global::Nitric.Proto.Websockets.v1.WebsocketMessageEvent subBuilder = new global::Nitric.Proto.Websockets.v1.WebsocketMessageEvent(); + if (websocketEventCase_ == WebsocketEventOneofCase.Message) { + subBuilder.MergeFrom(Message); } - input.ReadMessage(Content); + input.ReadMessage(subBuilder); + Message = subBuilder; break; } } @@ -1964,17 +2228,38 @@ public void MergeFrom(pb::CodedInputStream input) { _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, ref input); break; case 10: { - if (key_ == null) { - Key = new global::Nitric.Proto.Document.v1.Key(); + SocketName = input.ReadString(); + break; + } + case 18: { + ConnectionId = input.ReadString(); + break; + } + case 82: { + global::Nitric.Proto.Websockets.v1.WebsocketConnectionEvent subBuilder = new global::Nitric.Proto.Websockets.v1.WebsocketConnectionEvent(); + if (websocketEventCase_ == WebsocketEventOneofCase.Connection) { + subBuilder.MergeFrom(Connection); } - input.ReadMessage(Key); + input.ReadMessage(subBuilder); + Connection = subBuilder; break; } - case 26: { - if (content_ == null) { - Content = new global::Google.Protobuf.WellKnownTypes.Struct(); + case 90: { + global::Nitric.Proto.Websockets.v1.WebsocketDisconnectionEvent subBuilder = new global::Nitric.Proto.Websockets.v1.WebsocketDisconnectionEvent(); + if (websocketEventCase_ == WebsocketEventOneofCase.Disconnection) { + subBuilder.MergeFrom(Disconnection); + } + input.ReadMessage(subBuilder); + Disconnection = subBuilder; + break; + } + case 98: { + global::Nitric.Proto.Websockets.v1.WebsocketMessageEvent subBuilder = new global::Nitric.Proto.Websockets.v1.WebsocketMessageEvent(); + if (websocketEventCase_ == WebsocketEventOneofCase.Message) { + subBuilder.MergeFrom(Message); } - input.ReadMessage(Content); + input.ReadMessage(subBuilder); + Message = subBuilder; break; } } @@ -1984,19 +2269,19 @@ public void MergeFrom(pb::CodedInputStream input) { } - public sealed partial class DocumentSetResponse : pb::IMessage + public sealed partial class QueryValue : pb::IMessage #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE , pb::IBufferMessage #endif { - private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new DocumentSetResponse()); + private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new QueryValue()); private pb::UnknownFieldSet _unknownFields; [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public static pb::MessageParser Parser { get { return _parser; } } + public static pb::MessageParser Parser { get { return _parser; } } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public static pbr::MessageDescriptor Descriptor { - get { return global::Nitric.Proto.Document.v1.DocumentReflection.Descriptor.MessageTypes[8]; } + get { return global::Nitric.Proto.Websockets.v1.WebsocketsReflection.Descriptor.MessageTypes[10]; } } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] @@ -2005,41 +2290,54 @@ public sealed partial class DocumentSetResponse : pb::IMessageField number for the "value" field. + public const int ValueFieldNumber = 1; + private static readonly pb::FieldCodec _repeated_value_codec + = pb::FieldCodec.ForString(10); + private readonly pbc::RepeatedField value_ = new pbc::RepeatedField(); + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public pbc::RepeatedField Value { + get { return value_; } } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public override bool Equals(object other) { - return Equals(other as DocumentSetResponse); + return Equals(other as QueryValue); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public bool Equals(DocumentSetResponse other) { + public bool Equals(QueryValue other) { if (ReferenceEquals(other, null)) { return false; } if (ReferenceEquals(other, this)) { return true; } + if(!value_.Equals(other.value_)) return false; return Equals(_unknownFields, other._unknownFields); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public override int GetHashCode() { int hash = 1; + hash ^= value_.GetHashCode(); if (_unknownFields != null) { hash ^= _unknownFields.GetHashCode(); } @@ -2056,6 +2354,7 @@ public void WriteTo(pb::CodedOutputStream output) { #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE output.WriteRawMessage(this); #else + value_.WriteTo(output, _repeated_value_codec); if (_unknownFields != null) { _unknownFields.WriteTo(output); } @@ -2065,6 +2364,7 @@ public void WriteTo(pb::CodedOutputStream output) { #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE [global::System.Diagnostics.DebuggerNonUserCodeAttribute] void pb::IBufferMessage.InternalWriteTo(ref pb::WriteContext output) { + value_.WriteTo(ref output, _repeated_value_codec); if (_unknownFields != null) { _unknownFields.WriteTo(ref output); } @@ -2074,6 +2374,7 @@ public void WriteTo(pb::CodedOutputStream output) { [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public int CalculateSize() { int size = 0; + size += value_.CalculateSize(_repeated_value_codec); if (_unknownFields != null) { size += _unknownFields.CalculateSize(); } @@ -2081,10 +2382,11 @@ public int CalculateSize() { } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void MergeFrom(DocumentSetResponse other) { + public void MergeFrom(QueryValue other) { if (other == null) { return; } + value_.Add(other.value_); _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields); } @@ -2099,6 +2401,10 @@ public void MergeFrom(pb::CodedInputStream input) { default: _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input); break; + case 10: { + value_.AddEntriesFrom(input, _repeated_value_codec); + break; + } } } #endif @@ -2113,6 +2419,10 @@ public void MergeFrom(pb::CodedInputStream input) { default: _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, ref input); break; + case 10: { + value_.AddEntriesFrom(ref input, _repeated_value_codec); + break; + } } } } @@ -2120,19 +2430,22 @@ public void MergeFrom(pb::CodedInputStream input) { } - public sealed partial class DocumentDeleteRequest : pb::IMessage + /// + /// Messages the server is able to send to the client + /// + public sealed partial class ServerMessage : pb::IMessage #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE , pb::IBufferMessage #endif { - private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new DocumentDeleteRequest()); + private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new ServerMessage()); private pb::UnknownFieldSet _unknownFields; [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public static pb::MessageParser Parser { get { return _parser; } } + public static pb::MessageParser Parser { get { return _parser; } } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public static pbr::MessageDescriptor Descriptor { - get { return global::Nitric.Proto.Document.v1.DocumentReflection.Descriptor.MessageTypes[9]; } + get { return global::Nitric.Proto.Websockets.v1.WebsocketsReflection.Descriptor.MessageTypes[11]; } } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] @@ -2141,58 +2454,122 @@ public sealed partial class DocumentDeleteRequest : pb::IMessageField number for the "id" field. + public const int IdFieldNumber = 1; + private string id_ = ""; + /// + /// Server message ID, used to pair requests/responses + /// + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public string Id { + get { return id_; } + set { + id_ = pb::ProtoPreconditions.CheckNotNull(value, "value"); + } + } + + /// Field number for the "registration_response" field. + public const int RegistrationResponseFieldNumber = 2; + /// + /// Server responding + /// with client configuration details to an + /// InitRequest + /// + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public global::Nitric.Proto.Websockets.v1.RegistrationResponse RegistrationResponse { + get { return contentCase_ == ContentOneofCase.RegistrationResponse ? (global::Nitric.Proto.Websockets.v1.RegistrationResponse) content_ : null; } + set { + content_ = value; + contentCase_ = value == null ? ContentOneofCase.None : ContentOneofCase.RegistrationResponse; + } } - /// Field number for the "key" field. - public const int KeyFieldNumber = 1; - private global::Nitric.Proto.Document.v1.Key key_; + /// Field number for the "websocket_event_request" field. + public const int WebsocketEventRequestFieldNumber = 3; /// - /// Key of the document to delete + /// Server requesting client to process an event /// [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public global::Nitric.Proto.Document.v1.Key Key { - get { return key_; } + public global::Nitric.Proto.Websockets.v1.WebsocketEventRequest WebsocketEventRequest { + get { return contentCase_ == ContentOneofCase.WebsocketEventRequest ? (global::Nitric.Proto.Websockets.v1.WebsocketEventRequest) content_ : null; } set { - key_ = value; + content_ = value; + contentCase_ = value == null ? ContentOneofCase.None : ContentOneofCase.WebsocketEventRequest; } } + private object content_; + /// Enum of possible cases for the "content" oneof. + public enum ContentOneofCase { + None = 0, + RegistrationResponse = 2, + WebsocketEventRequest = 3, + } + private ContentOneofCase contentCase_ = ContentOneofCase.None; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public ContentOneofCase ContentCase { + get { return contentCase_; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public void ClearContent() { + contentCase_ = ContentOneofCase.None; + content_ = null; + } + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public override bool Equals(object other) { - return Equals(other as DocumentDeleteRequest); + return Equals(other as ServerMessage); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public bool Equals(DocumentDeleteRequest other) { + public bool Equals(ServerMessage other) { if (ReferenceEquals(other, null)) { return false; } if (ReferenceEquals(other, this)) { return true; } - if (!object.Equals(Key, other.Key)) return false; + if (Id != other.Id) return false; + if (!object.Equals(RegistrationResponse, other.RegistrationResponse)) return false; + if (!object.Equals(WebsocketEventRequest, other.WebsocketEventRequest)) return false; + if (ContentCase != other.ContentCase) return false; return Equals(_unknownFields, other._unknownFields); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public override int GetHashCode() { int hash = 1; - if (key_ != null) hash ^= Key.GetHashCode(); + if (Id.Length != 0) hash ^= Id.GetHashCode(); + if (contentCase_ == ContentOneofCase.RegistrationResponse) hash ^= RegistrationResponse.GetHashCode(); + if (contentCase_ == ContentOneofCase.WebsocketEventRequest) hash ^= WebsocketEventRequest.GetHashCode(); + hash ^= (int) contentCase_; if (_unknownFields != null) { hash ^= _unknownFields.GetHashCode(); } @@ -2209,9 +2586,17 @@ public void WriteTo(pb::CodedOutputStream output) { #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE output.WriteRawMessage(this); #else - if (key_ != null) { + if (Id.Length != 0) { output.WriteRawTag(10); - output.WriteMessage(Key); + output.WriteString(Id); + } + if (contentCase_ == ContentOneofCase.RegistrationResponse) { + output.WriteRawTag(18); + output.WriteMessage(RegistrationResponse); + } + if (contentCase_ == ContentOneofCase.WebsocketEventRequest) { + output.WriteRawTag(26); + output.WriteMessage(WebsocketEventRequest); } if (_unknownFields != null) { _unknownFields.WriteTo(output); @@ -2222,9 +2607,17 @@ public void WriteTo(pb::CodedOutputStream output) { #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE [global::System.Diagnostics.DebuggerNonUserCodeAttribute] void pb::IBufferMessage.InternalWriteTo(ref pb::WriteContext output) { - if (key_ != null) { + if (Id.Length != 0) { output.WriteRawTag(10); - output.WriteMessage(Key); + output.WriteString(Id); + } + if (contentCase_ == ContentOneofCase.RegistrationResponse) { + output.WriteRawTag(18); + output.WriteMessage(RegistrationResponse); + } + if (contentCase_ == ContentOneofCase.WebsocketEventRequest) { + output.WriteRawTag(26); + output.WriteMessage(WebsocketEventRequest); } if (_unknownFields != null) { _unknownFields.WriteTo(ref output); @@ -2235,8 +2628,14 @@ public void WriteTo(pb::CodedOutputStream output) { [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public int CalculateSize() { int size = 0; - if (key_ != null) { - size += 1 + pb::CodedOutputStream.ComputeMessageSize(Key); + if (Id.Length != 0) { + size += 1 + pb::CodedOutputStream.ComputeStringSize(Id); + } + if (contentCase_ == ContentOneofCase.RegistrationResponse) { + size += 1 + pb::CodedOutputStream.ComputeMessageSize(RegistrationResponse); + } + if (contentCase_ == ContentOneofCase.WebsocketEventRequest) { + size += 1 + pb::CodedOutputStream.ComputeMessageSize(WebsocketEventRequest); } if (_unknownFields != null) { size += _unknownFields.CalculateSize(); @@ -2245,16 +2644,28 @@ public int CalculateSize() { } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void MergeFrom(DocumentDeleteRequest other) { + public void MergeFrom(ServerMessage other) { if (other == null) { return; } - if (other.key_ != null) { - if (key_ == null) { - Key = new global::Nitric.Proto.Document.v1.Key(); - } - Key.MergeFrom(other.Key); + if (other.Id.Length != 0) { + Id = other.Id; } + switch (other.ContentCase) { + case ContentOneofCase.RegistrationResponse: + if (RegistrationResponse == null) { + RegistrationResponse = new global::Nitric.Proto.Websockets.v1.RegistrationResponse(); + } + RegistrationResponse.MergeFrom(other.RegistrationResponse); + break; + case ContentOneofCase.WebsocketEventRequest: + if (WebsocketEventRequest == null) { + WebsocketEventRequest = new global::Nitric.Proto.Websockets.v1.WebsocketEventRequest(); + } + WebsocketEventRequest.MergeFrom(other.WebsocketEventRequest); + break; + } + _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields); } @@ -2270,10 +2681,25 @@ public void MergeFrom(pb::CodedInputStream input) { _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input); break; case 10: { - if (key_ == null) { - Key = new global::Nitric.Proto.Document.v1.Key(); + Id = input.ReadString(); + break; + } + case 18: { + global::Nitric.Proto.Websockets.v1.RegistrationResponse subBuilder = new global::Nitric.Proto.Websockets.v1.RegistrationResponse(); + if (contentCase_ == ContentOneofCase.RegistrationResponse) { + subBuilder.MergeFrom(RegistrationResponse); + } + input.ReadMessage(subBuilder); + RegistrationResponse = subBuilder; + break; + } + case 26: { + global::Nitric.Proto.Websockets.v1.WebsocketEventRequest subBuilder = new global::Nitric.Proto.Websockets.v1.WebsocketEventRequest(); + if (contentCase_ == ContentOneofCase.WebsocketEventRequest) { + subBuilder.MergeFrom(WebsocketEventRequest); } - input.ReadMessage(Key); + input.ReadMessage(subBuilder); + WebsocketEventRequest = subBuilder; break; } } @@ -2291,10 +2717,25 @@ public void MergeFrom(pb::CodedInputStream input) { _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, ref input); break; case 10: { - if (key_ == null) { - Key = new global::Nitric.Proto.Document.v1.Key(); + Id = input.ReadString(); + break; + } + case 18: { + global::Nitric.Proto.Websockets.v1.RegistrationResponse subBuilder = new global::Nitric.Proto.Websockets.v1.RegistrationResponse(); + if (contentCase_ == ContentOneofCase.RegistrationResponse) { + subBuilder.MergeFrom(RegistrationResponse); + } + input.ReadMessage(subBuilder); + RegistrationResponse = subBuilder; + break; + } + case 26: { + global::Nitric.Proto.Websockets.v1.WebsocketEventRequest subBuilder = new global::Nitric.Proto.Websockets.v1.WebsocketEventRequest(); + if (contentCase_ == ContentOneofCase.WebsocketEventRequest) { + subBuilder.MergeFrom(WebsocketEventRequest); } - input.ReadMessage(Key); + input.ReadMessage(subBuilder); + WebsocketEventRequest = subBuilder; break; } } @@ -2304,19 +2745,19 @@ public void MergeFrom(pb::CodedInputStream input) { } - public sealed partial class DocumentDeleteResponse : pb::IMessage + public sealed partial class WebsocketEventResponse : pb::IMessage #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE , pb::IBufferMessage #endif { - private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new DocumentDeleteResponse()); + private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new WebsocketEventResponse()); private pb::UnknownFieldSet _unknownFields; [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public static pb::MessageParser Parser { get { return _parser; } } + public static pb::MessageParser Parser { get { return _parser; } } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public static pbr::MessageDescriptor Descriptor { - get { return global::Nitric.Proto.Document.v1.DocumentReflection.Descriptor.MessageTypes[10]; } + get { return global::Nitric.Proto.Websockets.v1.WebsocketsReflection.Descriptor.MessageTypes[12]; } } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] @@ -2325,41 +2766,84 @@ public sealed partial class DocumentDeleteResponse : pb::IMessageField number for the "connection_response" field. + public const int ConnectionResponseFieldNumber = 10; + /// + /// WebsocketDisconnectionResponse disconnection_response = 11; + /// WebsocketMessageEventResponse message_response = 12; + /// + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public global::Nitric.Proto.Websockets.v1.WebsocketConnectionResponse ConnectionResponse { + get { return websocketResponseCase_ == WebsocketResponseOneofCase.ConnectionResponse ? (global::Nitric.Proto.Websockets.v1.WebsocketConnectionResponse) websocketResponse_ : null; } + set { + websocketResponse_ = value; + websocketResponseCase_ = value == null ? WebsocketResponseOneofCase.None : WebsocketResponseOneofCase.ConnectionResponse; + } + } + + private object websocketResponse_; + /// Enum of possible cases for the "websocket_response" oneof. + public enum WebsocketResponseOneofCase { + None = 0, + ConnectionResponse = 10, + } + private WebsocketResponseOneofCase websocketResponseCase_ = WebsocketResponseOneofCase.None; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public WebsocketResponseOneofCase WebsocketResponseCase { + get { return websocketResponseCase_; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public void ClearWebsocketResponse() { + websocketResponseCase_ = WebsocketResponseOneofCase.None; + websocketResponse_ = null; } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public override bool Equals(object other) { - return Equals(other as DocumentDeleteResponse); + return Equals(other as WebsocketEventResponse); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public bool Equals(DocumentDeleteResponse other) { + public bool Equals(WebsocketEventResponse other) { if (ReferenceEquals(other, null)) { return false; } if (ReferenceEquals(other, this)) { return true; } + if (!object.Equals(ConnectionResponse, other.ConnectionResponse)) return false; + if (WebsocketResponseCase != other.WebsocketResponseCase) return false; return Equals(_unknownFields, other._unknownFields); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public override int GetHashCode() { int hash = 1; + if (websocketResponseCase_ == WebsocketResponseOneofCase.ConnectionResponse) hash ^= ConnectionResponse.GetHashCode(); + hash ^= (int) websocketResponseCase_; if (_unknownFields != null) { hash ^= _unknownFields.GetHashCode(); } @@ -2376,6 +2860,10 @@ public void WriteTo(pb::CodedOutputStream output) { #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE output.WriteRawMessage(this); #else + if (websocketResponseCase_ == WebsocketResponseOneofCase.ConnectionResponse) { + output.WriteRawTag(82); + output.WriteMessage(ConnectionResponse); + } if (_unknownFields != null) { _unknownFields.WriteTo(output); } @@ -2385,6 +2873,10 @@ public void WriteTo(pb::CodedOutputStream output) { #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE [global::System.Diagnostics.DebuggerNonUserCodeAttribute] void pb::IBufferMessage.InternalWriteTo(ref pb::WriteContext output) { + if (websocketResponseCase_ == WebsocketResponseOneofCase.ConnectionResponse) { + output.WriteRawTag(82); + output.WriteMessage(ConnectionResponse); + } if (_unknownFields != null) { _unknownFields.WriteTo(ref output); } @@ -2394,6 +2886,9 @@ public void WriteTo(pb::CodedOutputStream output) { [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public int CalculateSize() { int size = 0; + if (websocketResponseCase_ == WebsocketResponseOneofCase.ConnectionResponse) { + size += 1 + pb::CodedOutputStream.ComputeMessageSize(ConnectionResponse); + } if (_unknownFields != null) { size += _unknownFields.CalculateSize(); } @@ -2401,10 +2896,19 @@ public int CalculateSize() { } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void MergeFrom(DocumentDeleteResponse other) { + public void MergeFrom(WebsocketEventResponse other) { if (other == null) { return; } + switch (other.WebsocketResponseCase) { + case WebsocketResponseOneofCase.ConnectionResponse: + if (ConnectionResponse == null) { + ConnectionResponse = new global::Nitric.Proto.Websockets.v1.WebsocketConnectionResponse(); + } + ConnectionResponse.MergeFrom(other.ConnectionResponse); + break; + } + _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields); } @@ -2419,6 +2923,15 @@ public void MergeFrom(pb::CodedInputStream input) { default: _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input); break; + case 82: { + global::Nitric.Proto.Websockets.v1.WebsocketConnectionResponse subBuilder = new global::Nitric.Proto.Websockets.v1.WebsocketConnectionResponse(); + if (websocketResponseCase_ == WebsocketResponseOneofCase.ConnectionResponse) { + subBuilder.MergeFrom(ConnectionResponse); + } + input.ReadMessage(subBuilder); + ConnectionResponse = subBuilder; + break; + } } } #endif @@ -2433,6 +2946,15 @@ public void MergeFrom(pb::CodedInputStream input) { default: _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, ref input); break; + case 82: { + global::Nitric.Proto.Websockets.v1.WebsocketConnectionResponse subBuilder = new global::Nitric.Proto.Websockets.v1.WebsocketConnectionResponse(); + if (websocketResponseCase_ == WebsocketResponseOneofCase.ConnectionResponse) { + subBuilder.MergeFrom(ConnectionResponse); + } + input.ReadMessage(subBuilder); + ConnectionResponse = subBuilder; + break; + } } } } @@ -2440,19 +2962,19 @@ public void MergeFrom(pb::CodedInputStream input) { } - public sealed partial class DocumentQueryRequest : pb::IMessage + public sealed partial class WebsocketConnectionEvent : pb::IMessage #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE , pb::IBufferMessage #endif { - private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new DocumentQueryRequest()); + private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new WebsocketConnectionEvent()); private pb::UnknownFieldSet _unknownFields; [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public static pb::MessageParser Parser { get { return _parser; } } + public static pb::MessageParser Parser { get { return _parser; } } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public static pbr::MessageDescriptor Descriptor { - get { return global::Nitric.Proto.Document.v1.DocumentReflection.Descriptor.MessageTypes[11]; } + get { return global::Nitric.Proto.Websockets.v1.WebsocketsReflection.Descriptor.MessageTypes[13]; } } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] @@ -2461,107 +2983,57 @@ public sealed partial class DocumentQueryRequest : pb::IMessageField number for the "collection" field. - public const int CollectionFieldNumber = 1; - private global::Nitric.Proto.Document.v1.Collection collection_; - /// - /// The collection to query - /// - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public global::Nitric.Proto.Document.v1.Collection Collection { - get { return collection_; } - set { - collection_ = value; - } - } - - /// Field number for the "expressions" field. - public const int ExpressionsFieldNumber = 3; - private static readonly pb::FieldCodec _repeated_expressions_codec - = pb::FieldCodec.ForMessage(26, global::Nitric.Proto.Document.v1.Expression.Parser); - private readonly pbc::RepeatedField expressions_ = new pbc::RepeatedField(); - /// - /// Optional query expressions - /// - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public pbc::RepeatedField Expressions { - get { return expressions_; } - } - - /// Field number for the "limit" field. - public const int LimitFieldNumber = 4; - private int limit_; - /// - /// Optional query fetch limit - /// - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public int Limit { - get { return limit_; } - set { - limit_ = value; - } + public WebsocketConnectionEvent Clone() { + return new WebsocketConnectionEvent(this); } - /// Field number for the "paging_token" field. - public const int PagingTokenFieldNumber = 5; - private static readonly pbc::MapField.Codec _map_pagingToken_codec - = new pbc::MapField.Codec(pb::FieldCodec.ForString(10, ""), pb::FieldCodec.ForString(18, ""), 42); - private readonly pbc::MapField pagingToken_ = new pbc::MapField(); + /// Field number for the "query_params" field. + public const int QueryParamsFieldNumber = 1; + private static readonly pbc::MapField.Codec _map_queryParams_codec + = new pbc::MapField.Codec(pb::FieldCodec.ForString(10, ""), pb::FieldCodec.ForMessage(18, global::Nitric.Proto.Websockets.v1.QueryValue.Parser), 10); + private readonly pbc::MapField queryParams_ = new pbc::MapField(); /// - /// Optional query paging continuation token + /// The query params available in the connection request /// [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public pbc::MapField PagingToken { - get { return pagingToken_; } + public pbc::MapField QueryParams { + get { return queryParams_; } } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public override bool Equals(object other) { - return Equals(other as DocumentQueryRequest); + return Equals(other as WebsocketConnectionEvent); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public bool Equals(DocumentQueryRequest other) { + public bool Equals(WebsocketConnectionEvent other) { if (ReferenceEquals(other, null)) { return false; } if (ReferenceEquals(other, this)) { return true; } - if (!object.Equals(Collection, other.Collection)) return false; - if(!expressions_.Equals(other.expressions_)) return false; - if (Limit != other.Limit) return false; - if (!PagingToken.Equals(other.PagingToken)) return false; + if (!QueryParams.Equals(other.QueryParams)) return false; return Equals(_unknownFields, other._unknownFields); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public override int GetHashCode() { int hash = 1; - if (collection_ != null) hash ^= Collection.GetHashCode(); - hash ^= expressions_.GetHashCode(); - if (Limit != 0) hash ^= Limit.GetHashCode(); - hash ^= PagingToken.GetHashCode(); + hash ^= QueryParams.GetHashCode(); if (_unknownFields != null) { hash ^= _unknownFields.GetHashCode(); } @@ -2578,16 +3050,7 @@ public void WriteTo(pb::CodedOutputStream output) { #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE output.WriteRawMessage(this); #else - if (collection_ != null) { - output.WriteRawTag(10); - output.WriteMessage(Collection); - } - expressions_.WriteTo(output, _repeated_expressions_codec); - if (Limit != 0) { - output.WriteRawTag(32); - output.WriteInt32(Limit); - } - pagingToken_.WriteTo(output, _map_pagingToken_codec); + queryParams_.WriteTo(output, _map_queryParams_codec); if (_unknownFields != null) { _unknownFields.WriteTo(output); } @@ -2597,16 +3060,7 @@ public void WriteTo(pb::CodedOutputStream output) { #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE [global::System.Diagnostics.DebuggerNonUserCodeAttribute] void pb::IBufferMessage.InternalWriteTo(ref pb::WriteContext output) { - if (collection_ != null) { - output.WriteRawTag(10); - output.WriteMessage(Collection); - } - expressions_.WriteTo(ref output, _repeated_expressions_codec); - if (Limit != 0) { - output.WriteRawTag(32); - output.WriteInt32(Limit); - } - pagingToken_.WriteTo(ref output, _map_pagingToken_codec); + queryParams_.WriteTo(ref output, _map_queryParams_codec); if (_unknownFields != null) { _unknownFields.WriteTo(ref output); } @@ -2616,14 +3070,7 @@ public void WriteTo(pb::CodedOutputStream output) { [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public int CalculateSize() { int size = 0; - if (collection_ != null) { - size += 1 + pb::CodedOutputStream.ComputeMessageSize(Collection); - } - size += expressions_.CalculateSize(_repeated_expressions_codec); - if (Limit != 0) { - size += 1 + pb::CodedOutputStream.ComputeInt32Size(Limit); - } - size += pagingToken_.CalculateSize(_map_pagingToken_codec); + size += queryParams_.CalculateSize(_map_queryParams_codec); if (_unknownFields != null) { size += _unknownFields.CalculateSize(); } @@ -2631,21 +3078,11 @@ public int CalculateSize() { } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void MergeFrom(DocumentQueryRequest other) { + public void MergeFrom(WebsocketConnectionEvent other) { if (other == null) { return; } - if (other.collection_ != null) { - if (collection_ == null) { - Collection = new global::Nitric.Proto.Document.v1.Collection(); - } - Collection.MergeFrom(other.Collection); - } - expressions_.Add(other.expressions_); - if (other.Limit != 0) { - Limit = other.Limit; - } - pagingToken_.Add(other.pagingToken_); + queryParams_.Add(other.queryParams_); _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields); } @@ -2661,22 +3098,7 @@ public void MergeFrom(pb::CodedInputStream input) { _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input); break; case 10: { - if (collection_ == null) { - Collection = new global::Nitric.Proto.Document.v1.Collection(); - } - input.ReadMessage(Collection); - break; - } - case 26: { - expressions_.AddEntriesFrom(input, _repeated_expressions_codec); - break; - } - case 32: { - Limit = input.ReadInt32(); - break; - } - case 42: { - pagingToken_.AddEntriesFrom(input, _map_pagingToken_codec); + queryParams_.AddEntriesFrom(input, _map_queryParams_codec); break; } } @@ -2694,22 +3116,7 @@ public void MergeFrom(pb::CodedInputStream input) { _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, ref input); break; case 10: { - if (collection_ == null) { - Collection = new global::Nitric.Proto.Document.v1.Collection(); - } - input.ReadMessage(Collection); - break; - } - case 26: { - expressions_.AddEntriesFrom(ref input, _repeated_expressions_codec); - break; - } - case 32: { - Limit = input.ReadInt32(); - break; - } - case 42: { - pagingToken_.AddEntriesFrom(ref input, _map_pagingToken_codec); + queryParams_.AddEntriesFrom(ref input, _map_queryParams_codec); break; } } @@ -2719,19 +3126,19 @@ public void MergeFrom(pb::CodedInputStream input) { } - public sealed partial class DocumentQueryResponse : pb::IMessage + public sealed partial class WebsocketConnectionResponse : pb::IMessage #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE , pb::IBufferMessage #endif { - private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new DocumentQueryResponse()); + private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new WebsocketConnectionResponse()); private pb::UnknownFieldSet _unknownFields; [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public static pb::MessageParser Parser { get { return _parser; } } + public static pb::MessageParser Parser { get { return _parser; } } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public static pbr::MessageDescriptor Descriptor { - get { return global::Nitric.Proto.Document.v1.DocumentReflection.Descriptor.MessageTypes[12]; } + get { return global::Nitric.Proto.Websockets.v1.WebsocketsReflection.Descriptor.MessageTypes[14]; } } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] @@ -2740,73 +3147,55 @@ public sealed partial class DocumentQueryResponse : pb::IMessageField number for the "documents" field. - public const int DocumentsFieldNumber = 1; - private static readonly pb::FieldCodec _repeated_documents_codec - = pb::FieldCodec.ForMessage(10, global::Nitric.Proto.Document.v1.Document.Parser); - private readonly pbc::RepeatedField documents_ = new pbc::RepeatedField(); - /// - /// The retrieved values - /// - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public pbc::RepeatedField Documents { - get { return documents_; } + public WebsocketConnectionResponse Clone() { + return new WebsocketConnectionResponse(this); } - /// Field number for the "paging_token" field. - public const int PagingTokenFieldNumber = 2; - private static readonly pbc::MapField.Codec _map_pagingToken_codec - = new pbc::MapField.Codec(pb::FieldCodec.ForString(10, ""), pb::FieldCodec.ForString(18, ""), 18); - private readonly pbc::MapField pagingToken_ = new pbc::MapField(); - /// - /// The query paging continuation token, when empty no further results are available - /// + /// Field number for the "reject" field. + public const int RejectFieldNumber = 1; + private bool reject_; [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public pbc::MapField PagingToken { - get { return pagingToken_; } + public bool Reject { + get { return reject_; } + set { + reject_ = value; + } } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public override bool Equals(object other) { - return Equals(other as DocumentQueryResponse); + return Equals(other as WebsocketConnectionResponse); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public bool Equals(DocumentQueryResponse other) { + public bool Equals(WebsocketConnectionResponse other) { if (ReferenceEquals(other, null)) { return false; } if (ReferenceEquals(other, this)) { return true; } - if(!documents_.Equals(other.documents_)) return false; - if (!PagingToken.Equals(other.PagingToken)) return false; + if (Reject != other.Reject) return false; return Equals(_unknownFields, other._unknownFields); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public override int GetHashCode() { int hash = 1; - hash ^= documents_.GetHashCode(); - hash ^= PagingToken.GetHashCode(); + if (Reject != false) hash ^= Reject.GetHashCode(); if (_unknownFields != null) { hash ^= _unknownFields.GetHashCode(); } @@ -2823,8 +3212,10 @@ public void WriteTo(pb::CodedOutputStream output) { #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE output.WriteRawMessage(this); #else - documents_.WriteTo(output, _repeated_documents_codec); - pagingToken_.WriteTo(output, _map_pagingToken_codec); + if (Reject != false) { + output.WriteRawTag(8); + output.WriteBool(Reject); + } if (_unknownFields != null) { _unknownFields.WriteTo(output); } @@ -2834,8 +3225,10 @@ public void WriteTo(pb::CodedOutputStream output) { #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE [global::System.Diagnostics.DebuggerNonUserCodeAttribute] void pb::IBufferMessage.InternalWriteTo(ref pb::WriteContext output) { - documents_.WriteTo(ref output, _repeated_documents_codec); - pagingToken_.WriteTo(ref output, _map_pagingToken_codec); + if (Reject != false) { + output.WriteRawTag(8); + output.WriteBool(Reject); + } if (_unknownFields != null) { _unknownFields.WriteTo(ref output); } @@ -2845,8 +3238,9 @@ public void WriteTo(pb::CodedOutputStream output) { [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public int CalculateSize() { int size = 0; - size += documents_.CalculateSize(_repeated_documents_codec); - size += pagingToken_.CalculateSize(_map_pagingToken_codec); + if (Reject != false) { + size += 1 + 1; + } if (_unknownFields != null) { size += _unknownFields.CalculateSize(); } @@ -2854,12 +3248,13 @@ public int CalculateSize() { } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void MergeFrom(DocumentQueryResponse other) { + public void MergeFrom(WebsocketConnectionResponse other) { if (other == null) { return; } - documents_.Add(other.documents_); - pagingToken_.Add(other.pagingToken_); + if (other.Reject != false) { + Reject = other.Reject; + } _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields); } @@ -2874,12 +3269,8 @@ public void MergeFrom(pb::CodedInputStream input) { default: _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input); break; - case 10: { - documents_.AddEntriesFrom(input, _repeated_documents_codec); - break; - } - case 18: { - pagingToken_.AddEntriesFrom(input, _map_pagingToken_codec); + case 8: { + Reject = input.ReadBool(); break; } } @@ -2896,12 +3287,8 @@ public void MergeFrom(pb::CodedInputStream input) { default: _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, ref input); break; - case 10: { - documents_.AddEntriesFrom(ref input, _repeated_documents_codec); - break; - } - case 18: { - pagingToken_.AddEntriesFrom(ref input, _map_pagingToken_codec); + case 8: { + Reject = input.ReadBool(); break; } } @@ -2911,19 +3298,19 @@ public void MergeFrom(pb::CodedInputStream input) { } - public sealed partial class DocumentQueryStreamRequest : pb::IMessage + public sealed partial class WebsocketDisconnectionEvent : pb::IMessage #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE , pb::IBufferMessage #endif { - private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new DocumentQueryStreamRequest()); + private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new WebsocketDisconnectionEvent()); private pb::UnknownFieldSet _unknownFields; [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public static pb::MessageParser Parser { get { return _parser; } } + public static pb::MessageParser Parser { get { return _parser; } } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public static pbr::MessageDescriptor Descriptor { - get { return global::Nitric.Proto.Document.v1.DocumentReflection.Descriptor.MessageTypes[13]; } + get { return global::Nitric.Proto.Websockets.v1.WebsocketsReflection.Descriptor.MessageTypes[15]; } } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] @@ -2932,91 +3319,41 @@ public sealed partial class DocumentQueryStreamRequest : pb::IMessageField number for the "collection" field. - public const int CollectionFieldNumber = 1; - private global::Nitric.Proto.Document.v1.Collection collection_; - /// - /// The collection to query - /// - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public global::Nitric.Proto.Document.v1.Collection Collection { - get { return collection_; } - set { - collection_ = value; - } - } - - /// Field number for the "expressions" field. - public const int ExpressionsFieldNumber = 3; - private static readonly pb::FieldCodec _repeated_expressions_codec - = pb::FieldCodec.ForMessage(26, global::Nitric.Proto.Document.v1.Expression.Parser); - private readonly pbc::RepeatedField expressions_ = new pbc::RepeatedField(); - /// - /// Optional query expressions - /// - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public pbc::RepeatedField Expressions { - get { return expressions_; } - } - - /// Field number for the "limit" field. - public const int LimitFieldNumber = 4; - private int limit_; - /// - /// Optional query fetch limit - /// - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public int Limit { - get { return limit_; } - set { - limit_ = value; - } + public WebsocketDisconnectionEvent Clone() { + return new WebsocketDisconnectionEvent(this); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public override bool Equals(object other) { - return Equals(other as DocumentQueryStreamRequest); + return Equals(other as WebsocketDisconnectionEvent); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public bool Equals(DocumentQueryStreamRequest other) { + public bool Equals(WebsocketDisconnectionEvent other) { if (ReferenceEquals(other, null)) { return false; } if (ReferenceEquals(other, this)) { return true; } - if (!object.Equals(Collection, other.Collection)) return false; - if(!expressions_.Equals(other.expressions_)) return false; - if (Limit != other.Limit) return false; return Equals(_unknownFields, other._unknownFields); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public override int GetHashCode() { int hash = 1; - if (collection_ != null) hash ^= Collection.GetHashCode(); - hash ^= expressions_.GetHashCode(); - if (Limit != 0) hash ^= Limit.GetHashCode(); if (_unknownFields != null) { hash ^= _unknownFields.GetHashCode(); } @@ -3033,15 +3370,6 @@ public void WriteTo(pb::CodedOutputStream output) { #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE output.WriteRawMessage(this); #else - if (collection_ != null) { - output.WriteRawTag(10); - output.WriteMessage(Collection); - } - expressions_.WriteTo(output, _repeated_expressions_codec); - if (Limit != 0) { - output.WriteRawTag(32); - output.WriteInt32(Limit); - } if (_unknownFields != null) { _unknownFields.WriteTo(output); } @@ -3051,15 +3379,6 @@ public void WriteTo(pb::CodedOutputStream output) { #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE [global::System.Diagnostics.DebuggerNonUserCodeAttribute] void pb::IBufferMessage.InternalWriteTo(ref pb::WriteContext output) { - if (collection_ != null) { - output.WriteRawTag(10); - output.WriteMessage(Collection); - } - expressions_.WriteTo(ref output, _repeated_expressions_codec); - if (Limit != 0) { - output.WriteRawTag(32); - output.WriteInt32(Limit); - } if (_unknownFields != null) { _unknownFields.WriteTo(ref output); } @@ -3069,13 +3388,6 @@ public void WriteTo(pb::CodedOutputStream output) { [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public int CalculateSize() { int size = 0; - if (collection_ != null) { - size += 1 + pb::CodedOutputStream.ComputeMessageSize(Collection); - } - size += expressions_.CalculateSize(_repeated_expressions_codec); - if (Limit != 0) { - size += 1 + pb::CodedOutputStream.ComputeInt32Size(Limit); - } if (_unknownFields != null) { size += _unknownFields.CalculateSize(); } @@ -3083,20 +3395,10 @@ public int CalculateSize() { } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void MergeFrom(DocumentQueryStreamRequest other) { + public void MergeFrom(WebsocketDisconnectionEvent other) { if (other == null) { return; } - if (other.collection_ != null) { - if (collection_ == null) { - Collection = new global::Nitric.Proto.Document.v1.Collection(); - } - Collection.MergeFrom(other.Collection); - } - expressions_.Add(other.expressions_); - if (other.Limit != 0) { - Limit = other.Limit; - } _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields); } @@ -3111,21 +3413,6 @@ public void MergeFrom(pb::CodedInputStream input) { default: _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input); break; - case 10: { - if (collection_ == null) { - Collection = new global::Nitric.Proto.Document.v1.Collection(); - } - input.ReadMessage(Collection); - break; - } - case 26: { - expressions_.AddEntriesFrom(input, _repeated_expressions_codec); - break; - } - case 32: { - Limit = input.ReadInt32(); - break; - } } } #endif @@ -3140,21 +3427,6 @@ public void MergeFrom(pb::CodedInputStream input) { default: _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, ref input); break; - case 10: { - if (collection_ == null) { - Collection = new global::Nitric.Proto.Document.v1.Collection(); - } - input.ReadMessage(Collection); - break; - } - case 26: { - expressions_.AddEntriesFrom(ref input, _repeated_expressions_codec); - break; - } - case 32: { - Limit = input.ReadInt32(); - break; - } } } } @@ -3162,19 +3434,19 @@ public void MergeFrom(pb::CodedInputStream input) { } - public sealed partial class DocumentQueryStreamResponse : pb::IMessage + public sealed partial class WebsocketMessageEvent : pb::IMessage #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE , pb::IBufferMessage #endif { - private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new DocumentQueryStreamResponse()); + private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new WebsocketMessageEvent()); private pb::UnknownFieldSet _unknownFields; [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public static pb::MessageParser Parser { get { return _parser; } } + public static pb::MessageParser Parser { get { return _parser; } } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public static pbr::MessageDescriptor Descriptor { - get { return global::Nitric.Proto.Document.v1.DocumentReflection.Descriptor.MessageTypes[14]; } + get { return global::Nitric.Proto.Websockets.v1.WebsocketsReflection.Descriptor.MessageTypes[16]; } } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] @@ -3183,58 +3455,58 @@ public sealed partial class DocumentQueryStreamResponse : pb::IMessageField number for the "document" field. - public const int DocumentFieldNumber = 1; - private global::Nitric.Proto.Document.v1.Document document_; + /// Field number for the "body" field. + public const int BodyFieldNumber = 1; + private pb::ByteString body_ = pb::ByteString.Empty; /// - /// The stream document + /// Data available on /// [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public global::Nitric.Proto.Document.v1.Document Document { - get { return document_; } + public pb::ByteString Body { + get { return body_; } set { - document_ = value; + body_ = pb::ProtoPreconditions.CheckNotNull(value, "value"); } } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public override bool Equals(object other) { - return Equals(other as DocumentQueryStreamResponse); + return Equals(other as WebsocketMessageEvent); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public bool Equals(DocumentQueryStreamResponse other) { + public bool Equals(WebsocketMessageEvent other) { if (ReferenceEquals(other, null)) { return false; } if (ReferenceEquals(other, this)) { return true; } - if (!object.Equals(Document, other.Document)) return false; + if (Body != other.Body) return false; return Equals(_unknownFields, other._unknownFields); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public override int GetHashCode() { int hash = 1; - if (document_ != null) hash ^= Document.GetHashCode(); + if (Body.Length != 0) hash ^= Body.GetHashCode(); if (_unknownFields != null) { hash ^= _unknownFields.GetHashCode(); } @@ -3251,9 +3523,9 @@ public void WriteTo(pb::CodedOutputStream output) { #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE output.WriteRawMessage(this); #else - if (document_ != null) { + if (Body.Length != 0) { output.WriteRawTag(10); - output.WriteMessage(Document); + output.WriteBytes(Body); } if (_unknownFields != null) { _unknownFields.WriteTo(output); @@ -3264,9 +3536,9 @@ public void WriteTo(pb::CodedOutputStream output) { #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE [global::System.Diagnostics.DebuggerNonUserCodeAttribute] void pb::IBufferMessage.InternalWriteTo(ref pb::WriteContext output) { - if (document_ != null) { + if (Body.Length != 0) { output.WriteRawTag(10); - output.WriteMessage(Document); + output.WriteBytes(Body); } if (_unknownFields != null) { _unknownFields.WriteTo(ref output); @@ -3277,8 +3549,8 @@ public void WriteTo(pb::CodedOutputStream output) { [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public int CalculateSize() { int size = 0; - if (document_ != null) { - size += 1 + pb::CodedOutputStream.ComputeMessageSize(Document); + if (Body.Length != 0) { + size += 1 + pb::CodedOutputStream.ComputeBytesSize(Body); } if (_unknownFields != null) { size += _unknownFields.CalculateSize(); @@ -3287,15 +3559,12 @@ public int CalculateSize() { } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void MergeFrom(DocumentQueryStreamResponse other) { + public void MergeFrom(WebsocketMessageEvent other) { if (other == null) { return; } - if (other.document_ != null) { - if (document_ == null) { - Document = new global::Nitric.Proto.Document.v1.Document(); - } - Document.MergeFrom(other.Document); + if (other.Body.Length != 0) { + Body = other.Body; } _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields); } @@ -3312,10 +3581,7 @@ public void MergeFrom(pb::CodedInputStream input) { _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input); break; case 10: { - if (document_ == null) { - Document = new global::Nitric.Proto.Document.v1.Document(); - } - input.ReadMessage(Document); + Body = input.ReadBytes(); break; } } @@ -3333,10 +3599,7 @@ public void MergeFrom(pb::CodedInputStream input) { _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, ref input); break; case 10: { - if (document_ == null) { - Document = new global::Nitric.Proto.Document.v1.Document(); - } - input.ReadMessage(Document); + Body = input.ReadBytes(); break; } } diff --git a/src/Nitric.Sdk/Proto/nitric/proto/websockets/v1/WebsocketsGrpc.cs b/src/Nitric.Sdk/Proto/nitric/proto/websockets/v1/WebsocketsGrpc.cs new file mode 100644 index 0000000..5bae226 --- /dev/null +++ b/src/Nitric.Sdk/Proto/nitric/proto/websockets/v1/WebsocketsGrpc.cs @@ -0,0 +1,444 @@ +// +// Generated by the protocol buffer compiler. DO NOT EDIT! +// source: nitric/proto/websockets/v1/websockets.proto +// +#pragma warning disable 0414, 1591 +#region Designer generated code + +using grpc = global::Grpc.Core; + +namespace Nitric.Proto.Websockets.v1 { + public static partial class Websocket + { + static readonly string __ServiceName = "nitric.proto.websockets.v1.Websocket"; + + static void __Helper_SerializeMessage(global::Google.Protobuf.IMessage message, grpc::SerializationContext context) + { + #if !GRPC_DISABLE_PROTOBUF_BUFFER_SERIALIZATION + if (message is global::Google.Protobuf.IBufferMessage) + { + context.SetPayloadLength(message.CalculateSize()); + global::Google.Protobuf.MessageExtensions.WriteTo(message, context.GetBufferWriter()); + context.Complete(); + return; + } + #endif + context.Complete(global::Google.Protobuf.MessageExtensions.ToByteArray(message)); + } + + static class __Helper_MessageCache + { + public static readonly bool IsBufferMessage = global::System.Reflection.IntrospectionExtensions.GetTypeInfo(typeof(global::Google.Protobuf.IBufferMessage)).IsAssignableFrom(typeof(T)); + } + + static T __Helper_DeserializeMessage(grpc::DeserializationContext context, global::Google.Protobuf.MessageParser parser) where T : global::Google.Protobuf.IMessage + { + #if !GRPC_DISABLE_PROTOBUF_BUFFER_SERIALIZATION + if (__Helper_MessageCache.IsBufferMessage) + { + return parser.ParseFrom(context.PayloadAsReadOnlySequence()); + } + #endif + return parser.ParseFrom(context.PayloadAsNewBuffer()); + } + + static readonly grpc::Marshaller __Marshaller_nitric_proto_websockets_v1_WebsocketSendRequest = grpc::Marshallers.Create(__Helper_SerializeMessage, context => __Helper_DeserializeMessage(context, global::Nitric.Proto.Websockets.v1.WebsocketSendRequest.Parser)); + static readonly grpc::Marshaller __Marshaller_nitric_proto_websockets_v1_WebsocketSendResponse = grpc::Marshallers.Create(__Helper_SerializeMessage, context => __Helper_DeserializeMessage(context, global::Nitric.Proto.Websockets.v1.WebsocketSendResponse.Parser)); + static readonly grpc::Marshaller __Marshaller_nitric_proto_websockets_v1_WebsocketCloseRequest = grpc::Marshallers.Create(__Helper_SerializeMessage, context => __Helper_DeserializeMessage(context, global::Nitric.Proto.Websockets.v1.WebsocketCloseRequest.Parser)); + static readonly grpc::Marshaller __Marshaller_nitric_proto_websockets_v1_WebsocketCloseResponse = grpc::Marshallers.Create(__Helper_SerializeMessage, context => __Helper_DeserializeMessage(context, global::Nitric.Proto.Websockets.v1.WebsocketCloseResponse.Parser)); + static readonly grpc::Marshaller __Marshaller_nitric_proto_websockets_v1_WebsocketDetailsRequest = grpc::Marshallers.Create(__Helper_SerializeMessage, context => __Helper_DeserializeMessage(context, global::Nitric.Proto.Websockets.v1.WebsocketDetailsRequest.Parser)); + static readonly grpc::Marshaller __Marshaller_nitric_proto_websockets_v1_WebsocketDetailsResponse = grpc::Marshallers.Create(__Helper_SerializeMessage, context => __Helper_DeserializeMessage(context, global::Nitric.Proto.Websockets.v1.WebsocketDetailsResponse.Parser)); + + static readonly grpc::Method __Method_Send = new grpc::Method( + grpc::MethodType.Unary, + __ServiceName, + "Send", + __Marshaller_nitric_proto_websockets_v1_WebsocketSendRequest, + __Marshaller_nitric_proto_websockets_v1_WebsocketSendResponse); + + static readonly grpc::Method __Method_Close = new grpc::Method( + grpc::MethodType.Unary, + __ServiceName, + "Close", + __Marshaller_nitric_proto_websockets_v1_WebsocketCloseRequest, + __Marshaller_nitric_proto_websockets_v1_WebsocketCloseResponse); + + static readonly grpc::Method __Method_Details = new grpc::Method( + grpc::MethodType.Unary, + __ServiceName, + "Details", + __Marshaller_nitric_proto_websockets_v1_WebsocketDetailsRequest, + __Marshaller_nitric_proto_websockets_v1_WebsocketDetailsResponse); + + /// Service descriptor + public static global::Google.Protobuf.Reflection.ServiceDescriptor Descriptor + { + get { return global::Nitric.Proto.Websockets.v1.WebsocketsReflection.Descriptor.Services[0]; } + } + + /// Base class for server-side implementations of Websocket + [grpc::BindServiceMethod(typeof(Websocket), "BindService")] + public abstract partial class WebsocketBase + { + /// + /// Send a messages to a websocket + /// + /// The request received from the client. + /// The context of the server-side call handler being invoked. + /// The response to send back to the client (wrapped by a task). + public virtual global::System.Threading.Tasks.Task Send(global::Nitric.Proto.Websockets.v1.WebsocketSendRequest request, grpc::ServerCallContext context) + { + throw new grpc::RpcException(new grpc::Status(grpc::StatusCode.Unimplemented, "")); + } + + /// + /// Close a websocket connection + /// This can be used to force a client to disconnect + /// + /// The request received from the client. + /// The context of the server-side call handler being invoked. + /// The response to send back to the client (wrapped by a task). + public virtual global::System.Threading.Tasks.Task Close(global::Nitric.Proto.Websockets.v1.WebsocketCloseRequest request, grpc::ServerCallContext context) + { + throw new grpc::RpcException(new grpc::Status(grpc::StatusCode.Unimplemented, "")); + } + + /// + /// Retrieve details about an API + /// + /// The request received from the client. + /// The context of the server-side call handler being invoked. + /// The response to send back to the client (wrapped by a task). + public virtual global::System.Threading.Tasks.Task Details(global::Nitric.Proto.Websockets.v1.WebsocketDetailsRequest request, grpc::ServerCallContext context) + { + throw new grpc::RpcException(new grpc::Status(grpc::StatusCode.Unimplemented, "")); + } + + } + + /// Client for Websocket + public partial class WebsocketClient : grpc::ClientBase + { + /// Creates a new client for Websocket + /// The channel to use to make remote calls. + public WebsocketClient(grpc::ChannelBase channel) : base(channel) + { + } + /// Creates a new client for Websocket that uses a custom CallInvoker. + /// The callInvoker to use to make remote calls. + public WebsocketClient(grpc::CallInvoker callInvoker) : base(callInvoker) + { + } + /// Protected parameterless constructor to allow creation of test doubles. + protected WebsocketClient() : base() + { + } + /// Protected constructor to allow creation of configured clients. + /// The client configuration. + protected WebsocketClient(ClientBaseConfiguration configuration) : base(configuration) + { + } + + /// + /// Send a messages to a websocket + /// + /// The request to send to the server. + /// The initial metadata to send with the call. This parameter is optional. + /// An optional deadline for the call. The call will be cancelled if deadline is hit. + /// An optional token for canceling the call. + /// The response received from the server. + public virtual global::Nitric.Proto.Websockets.v1.WebsocketSendResponse Send(global::Nitric.Proto.Websockets.v1.WebsocketSendRequest request, grpc::Metadata headers = null, global::System.DateTime? deadline = null, global::System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken)) + { + return Send(request, new grpc::CallOptions(headers, deadline, cancellationToken)); + } + /// + /// Send a messages to a websocket + /// + /// The request to send to the server. + /// The options for the call. + /// The response received from the server. + public virtual global::Nitric.Proto.Websockets.v1.WebsocketSendResponse Send(global::Nitric.Proto.Websockets.v1.WebsocketSendRequest request, grpc::CallOptions options) + { + return CallInvoker.BlockingUnaryCall(__Method_Send, null, options, request); + } + /// + /// Send a messages to a websocket + /// + /// The request to send to the server. + /// The initial metadata to send with the call. This parameter is optional. + /// An optional deadline for the call. The call will be cancelled if deadline is hit. + /// An optional token for canceling the call. + /// The call object. + public virtual grpc::AsyncUnaryCall SendAsync(global::Nitric.Proto.Websockets.v1.WebsocketSendRequest request, grpc::Metadata headers = null, global::System.DateTime? deadline = null, global::System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken)) + { + return SendAsync(request, new grpc::CallOptions(headers, deadline, cancellationToken)); + } + /// + /// Send a messages to a websocket + /// + /// The request to send to the server. + /// The options for the call. + /// The call object. + public virtual grpc::AsyncUnaryCall SendAsync(global::Nitric.Proto.Websockets.v1.WebsocketSendRequest request, grpc::CallOptions options) + { + return CallInvoker.AsyncUnaryCall(__Method_Send, null, options, request); + } + /// + /// Close a websocket connection + /// This can be used to force a client to disconnect + /// + /// The request to send to the server. + /// The initial metadata to send with the call. This parameter is optional. + /// An optional deadline for the call. The call will be cancelled if deadline is hit. + /// An optional token for canceling the call. + /// The response received from the server. + public virtual global::Nitric.Proto.Websockets.v1.WebsocketCloseResponse Close(global::Nitric.Proto.Websockets.v1.WebsocketCloseRequest request, grpc::Metadata headers = null, global::System.DateTime? deadline = null, global::System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken)) + { + return Close(request, new grpc::CallOptions(headers, deadline, cancellationToken)); + } + /// + /// Close a websocket connection + /// This can be used to force a client to disconnect + /// + /// The request to send to the server. + /// The options for the call. + /// The response received from the server. + public virtual global::Nitric.Proto.Websockets.v1.WebsocketCloseResponse Close(global::Nitric.Proto.Websockets.v1.WebsocketCloseRequest request, grpc::CallOptions options) + { + return CallInvoker.BlockingUnaryCall(__Method_Close, null, options, request); + } + /// + /// Close a websocket connection + /// This can be used to force a client to disconnect + /// + /// The request to send to the server. + /// The initial metadata to send with the call. This parameter is optional. + /// An optional deadline for the call. The call will be cancelled if deadline is hit. + /// An optional token for canceling the call. + /// The call object. + public virtual grpc::AsyncUnaryCall CloseAsync(global::Nitric.Proto.Websockets.v1.WebsocketCloseRequest request, grpc::Metadata headers = null, global::System.DateTime? deadline = null, global::System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken)) + { + return CloseAsync(request, new grpc::CallOptions(headers, deadline, cancellationToken)); + } + /// + /// Close a websocket connection + /// This can be used to force a client to disconnect + /// + /// The request to send to the server. + /// The options for the call. + /// The call object. + public virtual grpc::AsyncUnaryCall CloseAsync(global::Nitric.Proto.Websockets.v1.WebsocketCloseRequest request, grpc::CallOptions options) + { + return CallInvoker.AsyncUnaryCall(__Method_Close, null, options, request); + } + /// + /// Retrieve details about an API + /// + /// The request to send to the server. + /// The initial metadata to send with the call. This parameter is optional. + /// An optional deadline for the call. The call will be cancelled if deadline is hit. + /// An optional token for canceling the call. + /// The response received from the server. + public virtual global::Nitric.Proto.Websockets.v1.WebsocketDetailsResponse Details(global::Nitric.Proto.Websockets.v1.WebsocketDetailsRequest request, grpc::Metadata headers = null, global::System.DateTime? deadline = null, global::System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken)) + { + return Details(request, new grpc::CallOptions(headers, deadline, cancellationToken)); + } + /// + /// Retrieve details about an API + /// + /// The request to send to the server. + /// The options for the call. + /// The response received from the server. + public virtual global::Nitric.Proto.Websockets.v1.WebsocketDetailsResponse Details(global::Nitric.Proto.Websockets.v1.WebsocketDetailsRequest request, grpc::CallOptions options) + { + return CallInvoker.BlockingUnaryCall(__Method_Details, null, options, request); + } + /// + /// Retrieve details about an API + /// + /// The request to send to the server. + /// The initial metadata to send with the call. This parameter is optional. + /// An optional deadline for the call. The call will be cancelled if deadline is hit. + /// An optional token for canceling the call. + /// The call object. + public virtual grpc::AsyncUnaryCall DetailsAsync(global::Nitric.Proto.Websockets.v1.WebsocketDetailsRequest request, grpc::Metadata headers = null, global::System.DateTime? deadline = null, global::System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken)) + { + return DetailsAsync(request, new grpc::CallOptions(headers, deadline, cancellationToken)); + } + /// + /// Retrieve details about an API + /// + /// The request to send to the server. + /// The options for the call. + /// The call object. + public virtual grpc::AsyncUnaryCall DetailsAsync(global::Nitric.Proto.Websockets.v1.WebsocketDetailsRequest request, grpc::CallOptions options) + { + return CallInvoker.AsyncUnaryCall(__Method_Details, null, options, request); + } + /// Creates a new instance of client from given ClientBaseConfiguration. + protected override WebsocketClient NewInstance(ClientBaseConfiguration configuration) + { + return new WebsocketClient(configuration); + } + } + + /// Creates service definition that can be registered with a server + /// An object implementing the server-side handling logic. + public static grpc::ServerServiceDefinition BindService(WebsocketBase serviceImpl) + { + return grpc::ServerServiceDefinition.CreateBuilder() + .AddMethod(__Method_Send, serviceImpl.Send) + .AddMethod(__Method_Close, serviceImpl.Close) + .AddMethod(__Method_Details, serviceImpl.Details).Build(); + } + + /// Register service method with a service binder with or without implementation. Useful when customizing the service binding logic. + /// Note: this method is part of an experimental API that can change or be removed without any prior notice. + /// Service methods will be bound by calling AddMethod on this object. + /// An object implementing the server-side handling logic. + public static void BindService(grpc::ServiceBinderBase serviceBinder, WebsocketBase serviceImpl) + { + serviceBinder.AddMethod(__Method_Send, serviceImpl == null ? null : new grpc::UnaryServerMethod(serviceImpl.Send)); + serviceBinder.AddMethod(__Method_Close, serviceImpl == null ? null : new grpc::UnaryServerMethod(serviceImpl.Close)); + serviceBinder.AddMethod(__Method_Details, serviceImpl == null ? null : new grpc::UnaryServerMethod(serviceImpl.Details)); + } + + } + public static partial class WebsocketHandler + { + static readonly string __ServiceName = "nitric.proto.websockets.v1.WebsocketHandler"; + + static void __Helper_SerializeMessage(global::Google.Protobuf.IMessage message, grpc::SerializationContext context) + { + #if !GRPC_DISABLE_PROTOBUF_BUFFER_SERIALIZATION + if (message is global::Google.Protobuf.IBufferMessage) + { + context.SetPayloadLength(message.CalculateSize()); + global::Google.Protobuf.MessageExtensions.WriteTo(message, context.GetBufferWriter()); + context.Complete(); + return; + } + #endif + context.Complete(global::Google.Protobuf.MessageExtensions.ToByteArray(message)); + } + + static class __Helper_MessageCache + { + public static readonly bool IsBufferMessage = global::System.Reflection.IntrospectionExtensions.GetTypeInfo(typeof(global::Google.Protobuf.IBufferMessage)).IsAssignableFrom(typeof(T)); + } + + static T __Helper_DeserializeMessage(grpc::DeserializationContext context, global::Google.Protobuf.MessageParser parser) where T : global::Google.Protobuf.IMessage + { + #if !GRPC_DISABLE_PROTOBUF_BUFFER_SERIALIZATION + if (__Helper_MessageCache.IsBufferMessage) + { + return parser.ParseFrom(context.PayloadAsReadOnlySequence()); + } + #endif + return parser.ParseFrom(context.PayloadAsNewBuffer()); + } + + static readonly grpc::Marshaller __Marshaller_nitric_proto_websockets_v1_ClientMessage = grpc::Marshallers.Create(__Helper_SerializeMessage, context => __Helper_DeserializeMessage(context, global::Nitric.Proto.Websockets.v1.ClientMessage.Parser)); + static readonly grpc::Marshaller __Marshaller_nitric_proto_websockets_v1_ServerMessage = grpc::Marshallers.Create(__Helper_SerializeMessage, context => __Helper_DeserializeMessage(context, global::Nitric.Proto.Websockets.v1.ServerMessage.Parser)); + + static readonly grpc::Method __Method_HandleEvents = new grpc::Method( + grpc::MethodType.DuplexStreaming, + __ServiceName, + "HandleEvents", + __Marshaller_nitric_proto_websockets_v1_ClientMessage, + __Marshaller_nitric_proto_websockets_v1_ServerMessage); + + /// Service descriptor + public static global::Google.Protobuf.Reflection.ServiceDescriptor Descriptor + { + get { return global::Nitric.Proto.Websockets.v1.WebsocketsReflection.Descriptor.Services[1]; } + } + + /// Base class for server-side implementations of WebsocketHandler + [grpc::BindServiceMethod(typeof(WebsocketHandler), "BindService")] + public abstract partial class WebsocketHandlerBase + { + /// + /// Handle incoming websocket events + /// + /// Used for reading requests from the client. + /// Used for sending responses back to the client. + /// The context of the server-side call handler being invoked. + /// A task indicating completion of the handler. + public virtual global::System.Threading.Tasks.Task HandleEvents(grpc::IAsyncStreamReader requestStream, grpc::IServerStreamWriter responseStream, grpc::ServerCallContext context) + { + throw new grpc::RpcException(new grpc::Status(grpc::StatusCode.Unimplemented, "")); + } + + } + + /// Client for WebsocketHandler + public partial class WebsocketHandlerClient : grpc::ClientBase + { + /// Creates a new client for WebsocketHandler + /// The channel to use to make remote calls. + public WebsocketHandlerClient(grpc::ChannelBase channel) : base(channel) + { + } + /// Creates a new client for WebsocketHandler that uses a custom CallInvoker. + /// The callInvoker to use to make remote calls. + public WebsocketHandlerClient(grpc::CallInvoker callInvoker) : base(callInvoker) + { + } + /// Protected parameterless constructor to allow creation of test doubles. + protected WebsocketHandlerClient() : base() + { + } + /// Protected constructor to allow creation of configured clients. + /// The client configuration. + protected WebsocketHandlerClient(ClientBaseConfiguration configuration) : base(configuration) + { + } + + /// + /// Handle incoming websocket events + /// + /// The initial metadata to send with the call. This parameter is optional. + /// An optional deadline for the call. The call will be cancelled if deadline is hit. + /// An optional token for canceling the call. + /// The call object. + public virtual grpc::AsyncDuplexStreamingCall HandleEvents(grpc::Metadata headers = null, global::System.DateTime? deadline = null, global::System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken)) + { + return HandleEvents(new grpc::CallOptions(headers, deadline, cancellationToken)); + } + /// + /// Handle incoming websocket events + /// + /// The options for the call. + /// The call object. + public virtual grpc::AsyncDuplexStreamingCall HandleEvents(grpc::CallOptions options) + { + return CallInvoker.AsyncDuplexStreamingCall(__Method_HandleEvents, null, options); + } + /// Creates a new instance of client from given ClientBaseConfiguration. + protected override WebsocketHandlerClient NewInstance(ClientBaseConfiguration configuration) + { + return new WebsocketHandlerClient(configuration); + } + } + + /// Creates service definition that can be registered with a server + /// An object implementing the server-side handling logic. + public static grpc::ServerServiceDefinition BindService(WebsocketHandlerBase serviceImpl) + { + return grpc::ServerServiceDefinition.CreateBuilder() + .AddMethod(__Method_HandleEvents, serviceImpl.HandleEvents).Build(); + } + + /// Register service method with a service binder with or without implementation. Useful when customizing the service binding logic. + /// Note: this method is part of an experimental API that can change or be removed without any prior notice. + /// Service methods will be bound by calling AddMethod on this object. + /// An object implementing the server-side handling logic. + public static void BindService(grpc::ServiceBinderBase serviceBinder, WebsocketHandlerBase serviceImpl) + { + serviceBinder.AddMethod(__Method_HandleEvents, serviceImpl == null ? null : new grpc::DuplexStreamingServerMethod(serviceImpl.HandleEvents)); + } + + } +} +#endregion diff --git a/src/Nitric.Sdk/Proto/proto/document/v1/DocumentGrpc.cs b/src/Nitric.Sdk/Proto/proto/document/v1/DocumentGrpc.cs deleted file mode 100644 index 0ea44f2..0000000 --- a/src/Nitric.Sdk/Proto/proto/document/v1/DocumentGrpc.cs +++ /dev/null @@ -1,417 +0,0 @@ -// -// Generated by the protocol buffer compiler. DO NOT EDIT! -// source: proto/document/v1/document.proto -// -#pragma warning disable 0414, 1591 -#region Designer generated code - -using grpc = global::Grpc.Core; - -namespace Nitric.Proto.Document.v1 { - /// - /// Service for storage and retrieval of simple JSON keyValue - /// - public static partial class DocumentService - { - static readonly string __ServiceName = "nitric.document.v1.DocumentService"; - - static void __Helper_SerializeMessage(global::Google.Protobuf.IMessage message, grpc::SerializationContext context) - { - #if !GRPC_DISABLE_PROTOBUF_BUFFER_SERIALIZATION - if (message is global::Google.Protobuf.IBufferMessage) - { - context.SetPayloadLength(message.CalculateSize()); - global::Google.Protobuf.MessageExtensions.WriteTo(message, context.GetBufferWriter()); - context.Complete(); - return; - } - #endif - context.Complete(global::Google.Protobuf.MessageExtensions.ToByteArray(message)); - } - - static class __Helper_MessageCache - { - public static readonly bool IsBufferMessage = global::System.Reflection.IntrospectionExtensions.GetTypeInfo(typeof(global::Google.Protobuf.IBufferMessage)).IsAssignableFrom(typeof(T)); - } - - static T __Helper_DeserializeMessage(grpc::DeserializationContext context, global::Google.Protobuf.MessageParser parser) where T : global::Google.Protobuf.IMessage - { - #if !GRPC_DISABLE_PROTOBUF_BUFFER_SERIALIZATION - if (__Helper_MessageCache.IsBufferMessage) - { - return parser.ParseFrom(context.PayloadAsReadOnlySequence()); - } - #endif - return parser.ParseFrom(context.PayloadAsNewBuffer()); - } - - static readonly grpc::Marshaller __Marshaller_nitric_document_v1_DocumentGetRequest = grpc::Marshallers.Create(__Helper_SerializeMessage, context => __Helper_DeserializeMessage(context, global::Nitric.Proto.Document.v1.DocumentGetRequest.Parser)); - static readonly grpc::Marshaller __Marshaller_nitric_document_v1_DocumentGetResponse = grpc::Marshallers.Create(__Helper_SerializeMessage, context => __Helper_DeserializeMessage(context, global::Nitric.Proto.Document.v1.DocumentGetResponse.Parser)); - static readonly grpc::Marshaller __Marshaller_nitric_document_v1_DocumentSetRequest = grpc::Marshallers.Create(__Helper_SerializeMessage, context => __Helper_DeserializeMessage(context, global::Nitric.Proto.Document.v1.DocumentSetRequest.Parser)); - static readonly grpc::Marshaller __Marshaller_nitric_document_v1_DocumentSetResponse = grpc::Marshallers.Create(__Helper_SerializeMessage, context => __Helper_DeserializeMessage(context, global::Nitric.Proto.Document.v1.DocumentSetResponse.Parser)); - static readonly grpc::Marshaller __Marshaller_nitric_document_v1_DocumentDeleteRequest = grpc::Marshallers.Create(__Helper_SerializeMessage, context => __Helper_DeserializeMessage(context, global::Nitric.Proto.Document.v1.DocumentDeleteRequest.Parser)); - static readonly grpc::Marshaller __Marshaller_nitric_document_v1_DocumentDeleteResponse = grpc::Marshallers.Create(__Helper_SerializeMessage, context => __Helper_DeserializeMessage(context, global::Nitric.Proto.Document.v1.DocumentDeleteResponse.Parser)); - static readonly grpc::Marshaller __Marshaller_nitric_document_v1_DocumentQueryRequest = grpc::Marshallers.Create(__Helper_SerializeMessage, context => __Helper_DeserializeMessage(context, global::Nitric.Proto.Document.v1.DocumentQueryRequest.Parser)); - static readonly grpc::Marshaller __Marshaller_nitric_document_v1_DocumentQueryResponse = grpc::Marshallers.Create(__Helper_SerializeMessage, context => __Helper_DeserializeMessage(context, global::Nitric.Proto.Document.v1.DocumentQueryResponse.Parser)); - static readonly grpc::Marshaller __Marshaller_nitric_document_v1_DocumentQueryStreamRequest = grpc::Marshallers.Create(__Helper_SerializeMessage, context => __Helper_DeserializeMessage(context, global::Nitric.Proto.Document.v1.DocumentQueryStreamRequest.Parser)); - static readonly grpc::Marshaller __Marshaller_nitric_document_v1_DocumentQueryStreamResponse = grpc::Marshallers.Create(__Helper_SerializeMessage, context => __Helper_DeserializeMessage(context, global::Nitric.Proto.Document.v1.DocumentQueryStreamResponse.Parser)); - - static readonly grpc::Method __Method_Get = new grpc::Method( - grpc::MethodType.Unary, - __ServiceName, - "Get", - __Marshaller_nitric_document_v1_DocumentGetRequest, - __Marshaller_nitric_document_v1_DocumentGetResponse); - - static readonly grpc::Method __Method_Set = new grpc::Method( - grpc::MethodType.Unary, - __ServiceName, - "Set", - __Marshaller_nitric_document_v1_DocumentSetRequest, - __Marshaller_nitric_document_v1_DocumentSetResponse); - - static readonly grpc::Method __Method_Delete = new grpc::Method( - grpc::MethodType.Unary, - __ServiceName, - "Delete", - __Marshaller_nitric_document_v1_DocumentDeleteRequest, - __Marshaller_nitric_document_v1_DocumentDeleteResponse); - - static readonly grpc::Method __Method_Query = new grpc::Method( - grpc::MethodType.Unary, - __ServiceName, - "Query", - __Marshaller_nitric_document_v1_DocumentQueryRequest, - __Marshaller_nitric_document_v1_DocumentQueryResponse); - - static readonly grpc::Method __Method_QueryStream = new grpc::Method( - grpc::MethodType.ServerStreaming, - __ServiceName, - "QueryStream", - __Marshaller_nitric_document_v1_DocumentQueryStreamRequest, - __Marshaller_nitric_document_v1_DocumentQueryStreamResponse); - - /// Service descriptor - public static global::Google.Protobuf.Reflection.ServiceDescriptor Descriptor - { - get { return global::Nitric.Proto.Document.v1.DocumentReflection.Descriptor.Services[0]; } - } - - /// Base class for server-side implementations of DocumentService - [grpc::BindServiceMethod(typeof(DocumentService), "BindService")] - public abstract partial class DocumentServiceBase - { - /// - /// Get an existing document - /// - /// The request received from the client. - /// The context of the server-side call handler being invoked. - /// The response to send back to the client (wrapped by a task). - public virtual global::System.Threading.Tasks.Task Get(global::Nitric.Proto.Document.v1.DocumentGetRequest request, grpc::ServerCallContext context) - { - throw new grpc::RpcException(new grpc::Status(grpc::StatusCode.Unimplemented, "")); - } - - /// - /// Create a new or overwrite an existing document - /// - /// The request received from the client. - /// The context of the server-side call handler being invoked. - /// The response to send back to the client (wrapped by a task). - public virtual global::System.Threading.Tasks.Task Set(global::Nitric.Proto.Document.v1.DocumentSetRequest request, grpc::ServerCallContext context) - { - throw new grpc::RpcException(new grpc::Status(grpc::StatusCode.Unimplemented, "")); - } - - /// - /// Delete an existing document - /// - /// The request received from the client. - /// The context of the server-side call handler being invoked. - /// The response to send back to the client (wrapped by a task). - public virtual global::System.Threading.Tasks.Task Delete(global::Nitric.Proto.Document.v1.DocumentDeleteRequest request, grpc::ServerCallContext context) - { - throw new grpc::RpcException(new grpc::Status(grpc::StatusCode.Unimplemented, "")); - } - - /// - /// Query the document collection (supports pagination) - /// - /// The request received from the client. - /// The context of the server-side call handler being invoked. - /// The response to send back to the client (wrapped by a task). - public virtual global::System.Threading.Tasks.Task Query(global::Nitric.Proto.Document.v1.DocumentQueryRequest request, grpc::ServerCallContext context) - { - throw new grpc::RpcException(new grpc::Status(grpc::StatusCode.Unimplemented, "")); - } - - /// - /// Query the document collection (supports streaming) - /// - /// The request received from the client. - /// Used for sending responses back to the client. - /// The context of the server-side call handler being invoked. - /// A task indicating completion of the handler. - public virtual global::System.Threading.Tasks.Task QueryStream(global::Nitric.Proto.Document.v1.DocumentQueryStreamRequest request, grpc::IServerStreamWriter responseStream, grpc::ServerCallContext context) - { - throw new grpc::RpcException(new grpc::Status(grpc::StatusCode.Unimplemented, "")); - } - - } - - /// Client for DocumentService - public partial class DocumentServiceClient : grpc::ClientBase - { - /// Creates a new client for DocumentService - /// The channel to use to make remote calls. - public DocumentServiceClient(grpc::ChannelBase channel) : base(channel) - { - } - /// Creates a new client for DocumentService that uses a custom CallInvoker. - /// The callInvoker to use to make remote calls. - public DocumentServiceClient(grpc::CallInvoker callInvoker) : base(callInvoker) - { - } - /// Protected parameterless constructor to allow creation of test doubles. - protected DocumentServiceClient() : base() - { - } - /// Protected constructor to allow creation of configured clients. - /// The client configuration. - protected DocumentServiceClient(ClientBaseConfiguration configuration) : base(configuration) - { - } - - /// - /// Get an existing document - /// - /// The request to send to the server. - /// The initial metadata to send with the call. This parameter is optional. - /// An optional deadline for the call. The call will be cancelled if deadline is hit. - /// An optional token for canceling the call. - /// The response received from the server. - public virtual global::Nitric.Proto.Document.v1.DocumentGetResponse Get(global::Nitric.Proto.Document.v1.DocumentGetRequest request, grpc::Metadata headers = null, global::System.DateTime? deadline = null, global::System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken)) - { - return Get(request, new grpc::CallOptions(headers, deadline, cancellationToken)); - } - /// - /// Get an existing document - /// - /// The request to send to the server. - /// The options for the call. - /// The response received from the server. - public virtual global::Nitric.Proto.Document.v1.DocumentGetResponse Get(global::Nitric.Proto.Document.v1.DocumentGetRequest request, grpc::CallOptions options) - { - return CallInvoker.BlockingUnaryCall(__Method_Get, null, options, request); - } - /// - /// Get an existing document - /// - /// The request to send to the server. - /// The initial metadata to send with the call. This parameter is optional. - /// An optional deadline for the call. The call will be cancelled if deadline is hit. - /// An optional token for canceling the call. - /// The call object. - public virtual grpc::AsyncUnaryCall GetAsync(global::Nitric.Proto.Document.v1.DocumentGetRequest request, grpc::Metadata headers = null, global::System.DateTime? deadline = null, global::System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken)) - { - return GetAsync(request, new grpc::CallOptions(headers, deadline, cancellationToken)); - } - /// - /// Get an existing document - /// - /// The request to send to the server. - /// The options for the call. - /// The call object. - public virtual grpc::AsyncUnaryCall GetAsync(global::Nitric.Proto.Document.v1.DocumentGetRequest request, grpc::CallOptions options) - { - return CallInvoker.AsyncUnaryCall(__Method_Get, null, options, request); - } - /// - /// Create a new or overwrite an existing document - /// - /// The request to send to the server. - /// The initial metadata to send with the call. This parameter is optional. - /// An optional deadline for the call. The call will be cancelled if deadline is hit. - /// An optional token for canceling the call. - /// The response received from the server. - public virtual global::Nitric.Proto.Document.v1.DocumentSetResponse Set(global::Nitric.Proto.Document.v1.DocumentSetRequest request, grpc::Metadata headers = null, global::System.DateTime? deadline = null, global::System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken)) - { - return Set(request, new grpc::CallOptions(headers, deadline, cancellationToken)); - } - /// - /// Create a new or overwrite an existing document - /// - /// The request to send to the server. - /// The options for the call. - /// The response received from the server. - public virtual global::Nitric.Proto.Document.v1.DocumentSetResponse Set(global::Nitric.Proto.Document.v1.DocumentSetRequest request, grpc::CallOptions options) - { - return CallInvoker.BlockingUnaryCall(__Method_Set, null, options, request); - } - /// - /// Create a new or overwrite an existing document - /// - /// The request to send to the server. - /// The initial metadata to send with the call. This parameter is optional. - /// An optional deadline for the call. The call will be cancelled if deadline is hit. - /// An optional token for canceling the call. - /// The call object. - public virtual grpc::AsyncUnaryCall SetAsync(global::Nitric.Proto.Document.v1.DocumentSetRequest request, grpc::Metadata headers = null, global::System.DateTime? deadline = null, global::System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken)) - { - return SetAsync(request, new grpc::CallOptions(headers, deadline, cancellationToken)); - } - /// - /// Create a new or overwrite an existing document - /// - /// The request to send to the server. - /// The options for the call. - /// The call object. - public virtual grpc::AsyncUnaryCall SetAsync(global::Nitric.Proto.Document.v1.DocumentSetRequest request, grpc::CallOptions options) - { - return CallInvoker.AsyncUnaryCall(__Method_Set, null, options, request); - } - /// - /// Delete an existing document - /// - /// The request to send to the server. - /// The initial metadata to send with the call. This parameter is optional. - /// An optional deadline for the call. The call will be cancelled if deadline is hit. - /// An optional token for canceling the call. - /// The response received from the server. - public virtual global::Nitric.Proto.Document.v1.DocumentDeleteResponse Delete(global::Nitric.Proto.Document.v1.DocumentDeleteRequest request, grpc::Metadata headers = null, global::System.DateTime? deadline = null, global::System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken)) - { - return Delete(request, new grpc::CallOptions(headers, deadline, cancellationToken)); - } - /// - /// Delete an existing document - /// - /// The request to send to the server. - /// The options for the call. - /// The response received from the server. - public virtual global::Nitric.Proto.Document.v1.DocumentDeleteResponse Delete(global::Nitric.Proto.Document.v1.DocumentDeleteRequest request, grpc::CallOptions options) - { - return CallInvoker.BlockingUnaryCall(__Method_Delete, null, options, request); - } - /// - /// Delete an existing document - /// - /// The request to send to the server. - /// The initial metadata to send with the call. This parameter is optional. - /// An optional deadline for the call. The call will be cancelled if deadline is hit. - /// An optional token for canceling the call. - /// The call object. - public virtual grpc::AsyncUnaryCall DeleteAsync(global::Nitric.Proto.Document.v1.DocumentDeleteRequest request, grpc::Metadata headers = null, global::System.DateTime? deadline = null, global::System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken)) - { - return DeleteAsync(request, new grpc::CallOptions(headers, deadline, cancellationToken)); - } - /// - /// Delete an existing document - /// - /// The request to send to the server. - /// The options for the call. - /// The call object. - public virtual grpc::AsyncUnaryCall DeleteAsync(global::Nitric.Proto.Document.v1.DocumentDeleteRequest request, grpc::CallOptions options) - { - return CallInvoker.AsyncUnaryCall(__Method_Delete, null, options, request); - } - /// - /// Query the document collection (supports pagination) - /// - /// The request to send to the server. - /// The initial metadata to send with the call. This parameter is optional. - /// An optional deadline for the call. The call will be cancelled if deadline is hit. - /// An optional token for canceling the call. - /// The response received from the server. - public virtual global::Nitric.Proto.Document.v1.DocumentQueryResponse Query(global::Nitric.Proto.Document.v1.DocumentQueryRequest request, grpc::Metadata headers = null, global::System.DateTime? deadline = null, global::System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken)) - { - return Query(request, new grpc::CallOptions(headers, deadline, cancellationToken)); - } - /// - /// Query the document collection (supports pagination) - /// - /// The request to send to the server. - /// The options for the call. - /// The response received from the server. - public virtual global::Nitric.Proto.Document.v1.DocumentQueryResponse Query(global::Nitric.Proto.Document.v1.DocumentQueryRequest request, grpc::CallOptions options) - { - return CallInvoker.BlockingUnaryCall(__Method_Query, null, options, request); - } - /// - /// Query the document collection (supports pagination) - /// - /// The request to send to the server. - /// The initial metadata to send with the call. This parameter is optional. - /// An optional deadline for the call. The call will be cancelled if deadline is hit. - /// An optional token for canceling the call. - /// The call object. - public virtual grpc::AsyncUnaryCall QueryAsync(global::Nitric.Proto.Document.v1.DocumentQueryRequest request, grpc::Metadata headers = null, global::System.DateTime? deadline = null, global::System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken)) - { - return QueryAsync(request, new grpc::CallOptions(headers, deadline, cancellationToken)); - } - /// - /// Query the document collection (supports pagination) - /// - /// The request to send to the server. - /// The options for the call. - /// The call object. - public virtual grpc::AsyncUnaryCall QueryAsync(global::Nitric.Proto.Document.v1.DocumentQueryRequest request, grpc::CallOptions options) - { - return CallInvoker.AsyncUnaryCall(__Method_Query, null, options, request); - } - /// - /// Query the document collection (supports streaming) - /// - /// The request to send to the server. - /// The initial metadata to send with the call. This parameter is optional. - /// An optional deadline for the call. The call will be cancelled if deadline is hit. - /// An optional token for canceling the call. - /// The call object. - public virtual grpc::AsyncServerStreamingCall QueryStream(global::Nitric.Proto.Document.v1.DocumentQueryStreamRequest request, grpc::Metadata headers = null, global::System.DateTime? deadline = null, global::System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken)) - { - return QueryStream(request, new grpc::CallOptions(headers, deadline, cancellationToken)); - } - /// - /// Query the document collection (supports streaming) - /// - /// The request to send to the server. - /// The options for the call. - /// The call object. - public virtual grpc::AsyncServerStreamingCall QueryStream(global::Nitric.Proto.Document.v1.DocumentQueryStreamRequest request, grpc::CallOptions options) - { - return CallInvoker.AsyncServerStreamingCall(__Method_QueryStream, null, options, request); - } - /// Creates a new instance of client from given ClientBaseConfiguration. - protected override DocumentServiceClient NewInstance(ClientBaseConfiguration configuration) - { - return new DocumentServiceClient(configuration); - } - } - - /// Creates service definition that can be registered with a server - /// An object implementing the server-side handling logic. - public static grpc::ServerServiceDefinition BindService(DocumentServiceBase serviceImpl) - { - return grpc::ServerServiceDefinition.CreateBuilder() - .AddMethod(__Method_Get, serviceImpl.Get) - .AddMethod(__Method_Set, serviceImpl.Set) - .AddMethod(__Method_Delete, serviceImpl.Delete) - .AddMethod(__Method_Query, serviceImpl.Query) - .AddMethod(__Method_QueryStream, serviceImpl.QueryStream).Build(); - } - - /// Register service method with a service binder with or without implementation. Useful when customizing the service binding logic. - /// Note: this method is part of an experimental API that can change or be removed without any prior notice. - /// Service methods will be bound by calling AddMethod on this object. - /// An object implementing the server-side handling logic. - public static void BindService(grpc::ServiceBinderBase serviceBinder, DocumentServiceBase serviceImpl) - { - serviceBinder.AddMethod(__Method_Get, serviceImpl == null ? null : new grpc::UnaryServerMethod(serviceImpl.Get)); - serviceBinder.AddMethod(__Method_Set, serviceImpl == null ? null : new grpc::UnaryServerMethod(serviceImpl.Set)); - serviceBinder.AddMethod(__Method_Delete, serviceImpl == null ? null : new grpc::UnaryServerMethod(serviceImpl.Delete)); - serviceBinder.AddMethod(__Method_Query, serviceImpl == null ? null : new grpc::UnaryServerMethod(serviceImpl.Query)); - serviceBinder.AddMethod(__Method_QueryStream, serviceImpl == null ? null : new grpc::ServerStreamingServerMethod(serviceImpl.QueryStream)); - } - - } -} -#endregion diff --git a/src/Nitric.Sdk/Proto/proto/event/v1/Event.cs b/src/Nitric.Sdk/Proto/proto/event/v1/Event.cs deleted file mode 100644 index dd04bab..0000000 --- a/src/Nitric.Sdk/Proto/proto/event/v1/Event.cs +++ /dev/null @@ -1,1259 +0,0 @@ -// -// Generated by the protocol buffer compiler. DO NOT EDIT! -// source: proto/event/v1/event.proto -// -#pragma warning disable 1591, 0612, 3021 -#region Designer generated code - -using pb = global::Google.Protobuf; -using pbc = global::Google.Protobuf.Collections; -using pbr = global::Google.Protobuf.Reflection; -using scg = global::System.Collections.Generic; -namespace Nitric.Proto.Event.v1 { - - /// Holder for reflection information generated from proto/event/v1/event.proto - public static partial class EventReflection { - - #region Descriptor - /// File descriptor for proto/event/v1/event.proto - public static pbr::FileDescriptor Descriptor { - get { return descriptor; } - } - private static pbr::FileDescriptor descriptor; - - static EventReflection() { - byte[] descriptorData = global::System.Convert.FromBase64String( - string.Concat( - "Chpwcm90by9ldmVudC92MS9ldmVudC5wcm90bxIPbml0cmljLmV2ZW50LnYx", - "Ghxnb29nbGUvcHJvdG9idWYvc3RydWN0LnByb3RvGhd2YWxpZGF0ZS92YWxp", - "ZGF0ZS5wcm90byJ6ChNFdmVudFB1Ymxpc2hSZXF1ZXN0Eg0KBXRvcGljGAEg", - "ASgJEjUKBWV2ZW50GAIgASgLMhwubml0cmljLmV2ZW50LnYxLk5pdHJpY0V2", - "ZW50Qgj6QgWKAQIQARIdCgVkZWxheRgDIAEoDUIO+kILKgkYgJqeASgKQAEi", - "IgoURXZlbnRQdWJsaXNoUmVzcG9uc2USCgoCaWQYASABKAkiEgoQVG9waWNM", - "aXN0UmVxdWVzdCJBChFUb3BpY0xpc3RSZXNwb25zZRIsCgZ0b3BpY3MYASAD", - "KAsyHC5uaXRyaWMuZXZlbnQudjEuTml0cmljVG9waWMiGwoLTml0cmljVG9w", - "aWMSDAoEbmFtZRgBIAEoCSJZCgtOaXRyaWNFdmVudBIKCgJpZBgBIAEoCRIU", - "CgxwYXlsb2FkX3R5cGUYAiABKAkSKAoHcGF5bG9hZBgDIAEoCzIXLmdvb2ds", - "ZS5wcm90b2J1Zi5TdHJ1Y3QyZgoMRXZlbnRTZXJ2aWNlElYKB1B1Ymxpc2gS", - "JC5uaXRyaWMuZXZlbnQudjEuRXZlbnRQdWJsaXNoUmVxdWVzdBolLm5pdHJp", - "Yy5ldmVudC52MS5FdmVudFB1Ymxpc2hSZXNwb25zZTJdCgxUb3BpY1NlcnZp", - "Y2USTQoETGlzdBIhLm5pdHJpYy5ldmVudC52MS5Ub3BpY0xpc3RSZXF1ZXN0", - "GiIubml0cmljLmV2ZW50LnYxLlRvcGljTGlzdFJlc3BvbnNlQokBChhpby5u", - "aXRyaWMucHJvdG8uZXZlbnQudjFCBkV2ZW50c1ABWjNnaXRodWIuY29tL25p", - "dHJpY3RlY2gvbml0cmljL2NvcmUvcGtnL2FwaS9uaXRyaWMvdjGqAhVOaXRy", - "aWMuUHJvdG8uRXZlbnQudjHKAhVOaXRyaWNcUHJvdG9cRXZlbnRcVjFiBnBy", - "b3RvMw==")); - descriptor = pbr::FileDescriptor.FromGeneratedCode(descriptorData, - new pbr::FileDescriptor[] { global::Google.Protobuf.WellKnownTypes.StructReflection.Descriptor, global::Validate.ValidateReflection.Descriptor, }, - new pbr::GeneratedClrTypeInfo(null, null, new pbr::GeneratedClrTypeInfo[] { - new pbr::GeneratedClrTypeInfo(typeof(global::Nitric.Proto.Event.v1.EventPublishRequest), global::Nitric.Proto.Event.v1.EventPublishRequest.Parser, new[]{ "Topic", "Event", "Delay" }, null, null, null, null), - new pbr::GeneratedClrTypeInfo(typeof(global::Nitric.Proto.Event.v1.EventPublishResponse), global::Nitric.Proto.Event.v1.EventPublishResponse.Parser, new[]{ "Id" }, null, null, null, null), - new pbr::GeneratedClrTypeInfo(typeof(global::Nitric.Proto.Event.v1.TopicListRequest), global::Nitric.Proto.Event.v1.TopicListRequest.Parser, null, null, null, null, null), - new pbr::GeneratedClrTypeInfo(typeof(global::Nitric.Proto.Event.v1.TopicListResponse), global::Nitric.Proto.Event.v1.TopicListResponse.Parser, new[]{ "Topics" }, null, null, null, null), - new pbr::GeneratedClrTypeInfo(typeof(global::Nitric.Proto.Event.v1.NitricTopic), global::Nitric.Proto.Event.v1.NitricTopic.Parser, new[]{ "Name" }, null, null, null, null), - new pbr::GeneratedClrTypeInfo(typeof(global::Nitric.Proto.Event.v1.NitricEvent), global::Nitric.Proto.Event.v1.NitricEvent.Parser, new[]{ "Id", "PayloadType", "Payload" }, null, null, null, null) - })); - } - #endregion - - } - #region Messages - /// - /// Request to publish an event to a topic - /// - public sealed partial class EventPublishRequest : pb::IMessage - #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE - , pb::IBufferMessage - #endif - { - private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new EventPublishRequest()); - private pb::UnknownFieldSet _unknownFields; - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public static pb::MessageParser Parser { get { return _parser; } } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public static pbr::MessageDescriptor Descriptor { - get { return global::Nitric.Proto.Event.v1.EventReflection.Descriptor.MessageTypes[0]; } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - pbr::MessageDescriptor pb::IMessage.Descriptor { - get { return Descriptor; } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public EventPublishRequest() { - OnConstruction(); - } - - partial void OnConstruction(); - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public EventPublishRequest(EventPublishRequest other) : this() { - topic_ = other.topic_; - event_ = other.event_ != null ? other.event_.Clone() : null; - delay_ = other.delay_; - _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public EventPublishRequest Clone() { - return new EventPublishRequest(this); - } - - /// Field number for the "topic" field. - public const int TopicFieldNumber = 1; - private string topic_ = ""; - /// - /// The name of the topic to publish the event to - /// - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public string Topic { - get { return topic_; } - set { - topic_ = pb::ProtoPreconditions.CheckNotNull(value, "value"); - } - } - - /// Field number for the "event" field. - public const int EventFieldNumber = 2; - private global::Nitric.Proto.Event.v1.NitricEvent event_; - /// - /// The event to be published - /// - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public global::Nitric.Proto.Event.v1.NitricEvent Event { - get { return event_; } - set { - event_ = value; - } - } - - /// Field number for the "delay" field. - public const int DelayFieldNumber = 3; - private uint delay_; - /// - /// An optional delay specified in seconds (minimum 10 seconds) - /// - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public uint Delay { - get { return delay_; } - set { - delay_ = value; - } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public override bool Equals(object other) { - return Equals(other as EventPublishRequest); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public bool Equals(EventPublishRequest other) { - if (ReferenceEquals(other, null)) { - return false; - } - if (ReferenceEquals(other, this)) { - return true; - } - if (Topic != other.Topic) return false; - if (!object.Equals(Event, other.Event)) return false; - if (Delay != other.Delay) return false; - return Equals(_unknownFields, other._unknownFields); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public override int GetHashCode() { - int hash = 1; - if (Topic.Length != 0) hash ^= Topic.GetHashCode(); - if (event_ != null) hash ^= Event.GetHashCode(); - if (Delay != 0) hash ^= Delay.GetHashCode(); - if (_unknownFields != null) { - hash ^= _unknownFields.GetHashCode(); - } - return hash; - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public override string ToString() { - return pb::JsonFormatter.ToDiagnosticString(this); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void WriteTo(pb::CodedOutputStream output) { - #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE - output.WriteRawMessage(this); - #else - if (Topic.Length != 0) { - output.WriteRawTag(10); - output.WriteString(Topic); - } - if (event_ != null) { - output.WriteRawTag(18); - output.WriteMessage(Event); - } - if (Delay != 0) { - output.WriteRawTag(24); - output.WriteUInt32(Delay); - } - if (_unknownFields != null) { - _unknownFields.WriteTo(output); - } - #endif - } - - #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - void pb::IBufferMessage.InternalWriteTo(ref pb::WriteContext output) { - if (Topic.Length != 0) { - output.WriteRawTag(10); - output.WriteString(Topic); - } - if (event_ != null) { - output.WriteRawTag(18); - output.WriteMessage(Event); - } - if (Delay != 0) { - output.WriteRawTag(24); - output.WriteUInt32(Delay); - } - if (_unknownFields != null) { - _unknownFields.WriteTo(ref output); - } - } - #endif - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public int CalculateSize() { - int size = 0; - if (Topic.Length != 0) { - size += 1 + pb::CodedOutputStream.ComputeStringSize(Topic); - } - if (event_ != null) { - size += 1 + pb::CodedOutputStream.ComputeMessageSize(Event); - } - if (Delay != 0) { - size += 1 + pb::CodedOutputStream.ComputeUInt32Size(Delay); - } - if (_unknownFields != null) { - size += _unknownFields.CalculateSize(); - } - return size; - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void MergeFrom(EventPublishRequest other) { - if (other == null) { - return; - } - if (other.Topic.Length != 0) { - Topic = other.Topic; - } - if (other.event_ != null) { - if (event_ == null) { - Event = new global::Nitric.Proto.Event.v1.NitricEvent(); - } - Event.MergeFrom(other.Event); - } - if (other.Delay != 0) { - Delay = other.Delay; - } - _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void MergeFrom(pb::CodedInputStream input) { - #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE - input.ReadRawMessage(this); - #else - uint tag; - while ((tag = input.ReadTag()) != 0) { - switch(tag) { - default: - _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input); - break; - case 10: { - Topic = input.ReadString(); - break; - } - case 18: { - if (event_ == null) { - Event = new global::Nitric.Proto.Event.v1.NitricEvent(); - } - input.ReadMessage(Event); - break; - } - case 24: { - Delay = input.ReadUInt32(); - break; - } - } - } - #endif - } - - #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - void pb::IBufferMessage.InternalMergeFrom(ref pb::ParseContext input) { - uint tag; - while ((tag = input.ReadTag()) != 0) { - switch(tag) { - default: - _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, ref input); - break; - case 10: { - Topic = input.ReadString(); - break; - } - case 18: { - if (event_ == null) { - Event = new global::Nitric.Proto.Event.v1.NitricEvent(); - } - input.ReadMessage(Event); - break; - } - case 24: { - Delay = input.ReadUInt32(); - break; - } - } - } - } - #endif - - } - - /// - /// Result of publishing an event - /// - public sealed partial class EventPublishResponse : pb::IMessage - #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE - , pb::IBufferMessage - #endif - { - private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new EventPublishResponse()); - private pb::UnknownFieldSet _unknownFields; - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public static pb::MessageParser Parser { get { return _parser; } } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public static pbr::MessageDescriptor Descriptor { - get { return global::Nitric.Proto.Event.v1.EventReflection.Descriptor.MessageTypes[1]; } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - pbr::MessageDescriptor pb::IMessage.Descriptor { - get { return Descriptor; } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public EventPublishResponse() { - OnConstruction(); - } - - partial void OnConstruction(); - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public EventPublishResponse(EventPublishResponse other) : this() { - id_ = other.id_; - _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public EventPublishResponse Clone() { - return new EventPublishResponse(this); - } - - /// Field number for the "id" field. - public const int IdFieldNumber = 1; - private string id_ = ""; - /// - /// The id of the published message - /// When an id was not supplied - /// one should be automatically generated - /// - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public string Id { - get { return id_; } - set { - id_ = pb::ProtoPreconditions.CheckNotNull(value, "value"); - } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public override bool Equals(object other) { - return Equals(other as EventPublishResponse); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public bool Equals(EventPublishResponse other) { - if (ReferenceEquals(other, null)) { - return false; - } - if (ReferenceEquals(other, this)) { - return true; - } - if (Id != other.Id) return false; - return Equals(_unknownFields, other._unknownFields); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public override int GetHashCode() { - int hash = 1; - if (Id.Length != 0) hash ^= Id.GetHashCode(); - if (_unknownFields != null) { - hash ^= _unknownFields.GetHashCode(); - } - return hash; - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public override string ToString() { - return pb::JsonFormatter.ToDiagnosticString(this); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void WriteTo(pb::CodedOutputStream output) { - #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE - output.WriteRawMessage(this); - #else - if (Id.Length != 0) { - output.WriteRawTag(10); - output.WriteString(Id); - } - if (_unknownFields != null) { - _unknownFields.WriteTo(output); - } - #endif - } - - #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - void pb::IBufferMessage.InternalWriteTo(ref pb::WriteContext output) { - if (Id.Length != 0) { - output.WriteRawTag(10); - output.WriteString(Id); - } - if (_unknownFields != null) { - _unknownFields.WriteTo(ref output); - } - } - #endif - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public int CalculateSize() { - int size = 0; - if (Id.Length != 0) { - size += 1 + pb::CodedOutputStream.ComputeStringSize(Id); - } - if (_unknownFields != null) { - size += _unknownFields.CalculateSize(); - } - return size; - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void MergeFrom(EventPublishResponse other) { - if (other == null) { - return; - } - if (other.Id.Length != 0) { - Id = other.Id; - } - _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void MergeFrom(pb::CodedInputStream input) { - #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE - input.ReadRawMessage(this); - #else - uint tag; - while ((tag = input.ReadTag()) != 0) { - switch(tag) { - default: - _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input); - break; - case 10: { - Id = input.ReadString(); - break; - } - } - } - #endif - } - - #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - void pb::IBufferMessage.InternalMergeFrom(ref pb::ParseContext input) { - uint tag; - while ((tag = input.ReadTag()) != 0) { - switch(tag) { - default: - _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, ref input); - break; - case 10: { - Id = input.ReadString(); - break; - } - } - } - } - #endif - - } - - /// - /// Request for the Topic List method - /// - public sealed partial class TopicListRequest : pb::IMessage - #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE - , pb::IBufferMessage - #endif - { - private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new TopicListRequest()); - private pb::UnknownFieldSet _unknownFields; - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public static pb::MessageParser Parser { get { return _parser; } } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public static pbr::MessageDescriptor Descriptor { - get { return global::Nitric.Proto.Event.v1.EventReflection.Descriptor.MessageTypes[2]; } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - pbr::MessageDescriptor pb::IMessage.Descriptor { - get { return Descriptor; } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public TopicListRequest() { - OnConstruction(); - } - - partial void OnConstruction(); - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public TopicListRequest(TopicListRequest other) : this() { - _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public TopicListRequest Clone() { - return new TopicListRequest(this); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public override bool Equals(object other) { - return Equals(other as TopicListRequest); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public bool Equals(TopicListRequest other) { - if (ReferenceEquals(other, null)) { - return false; - } - if (ReferenceEquals(other, this)) { - return true; - } - return Equals(_unknownFields, other._unknownFields); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public override int GetHashCode() { - int hash = 1; - if (_unknownFields != null) { - hash ^= _unknownFields.GetHashCode(); - } - return hash; - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public override string ToString() { - return pb::JsonFormatter.ToDiagnosticString(this); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void WriteTo(pb::CodedOutputStream output) { - #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE - output.WriteRawMessage(this); - #else - if (_unknownFields != null) { - _unknownFields.WriteTo(output); - } - #endif - } - - #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - void pb::IBufferMessage.InternalWriteTo(ref pb::WriteContext output) { - if (_unknownFields != null) { - _unknownFields.WriteTo(ref output); - } - } - #endif - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public int CalculateSize() { - int size = 0; - if (_unknownFields != null) { - size += _unknownFields.CalculateSize(); - } - return size; - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void MergeFrom(TopicListRequest other) { - if (other == null) { - return; - } - _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void MergeFrom(pb::CodedInputStream input) { - #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE - input.ReadRawMessage(this); - #else - uint tag; - while ((tag = input.ReadTag()) != 0) { - switch(tag) { - default: - _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input); - break; - } - } - #endif - } - - #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - void pb::IBufferMessage.InternalMergeFrom(ref pb::ParseContext input) { - uint tag; - while ((tag = input.ReadTag()) != 0) { - switch(tag) { - default: - _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, ref input); - break; - } - } - } - #endif - - } - - /// - /// Topic List Response - /// - public sealed partial class TopicListResponse : pb::IMessage - #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE - , pb::IBufferMessage - #endif - { - private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new TopicListResponse()); - private pb::UnknownFieldSet _unknownFields; - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public static pb::MessageParser Parser { get { return _parser; } } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public static pbr::MessageDescriptor Descriptor { - get { return global::Nitric.Proto.Event.v1.EventReflection.Descriptor.MessageTypes[3]; } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - pbr::MessageDescriptor pb::IMessage.Descriptor { - get { return Descriptor; } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public TopicListResponse() { - OnConstruction(); - } - - partial void OnConstruction(); - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public TopicListResponse(TopicListResponse other) : this() { - topics_ = other.topics_.Clone(); - _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public TopicListResponse Clone() { - return new TopicListResponse(this); - } - - /// Field number for the "topics" field. - public const int TopicsFieldNumber = 1; - private static readonly pb::FieldCodec _repeated_topics_codec - = pb::FieldCodec.ForMessage(10, global::Nitric.Proto.Event.v1.NitricTopic.Parser); - private readonly pbc::RepeatedField topics_ = new pbc::RepeatedField(); - /// - /// The list of found topics - /// - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public pbc::RepeatedField Topics { - get { return topics_; } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public override bool Equals(object other) { - return Equals(other as TopicListResponse); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public bool Equals(TopicListResponse other) { - if (ReferenceEquals(other, null)) { - return false; - } - if (ReferenceEquals(other, this)) { - return true; - } - if(!topics_.Equals(other.topics_)) return false; - return Equals(_unknownFields, other._unknownFields); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public override int GetHashCode() { - int hash = 1; - hash ^= topics_.GetHashCode(); - if (_unknownFields != null) { - hash ^= _unknownFields.GetHashCode(); - } - return hash; - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public override string ToString() { - return pb::JsonFormatter.ToDiagnosticString(this); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void WriteTo(pb::CodedOutputStream output) { - #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE - output.WriteRawMessage(this); - #else - topics_.WriteTo(output, _repeated_topics_codec); - if (_unknownFields != null) { - _unknownFields.WriteTo(output); - } - #endif - } - - #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - void pb::IBufferMessage.InternalWriteTo(ref pb::WriteContext output) { - topics_.WriteTo(ref output, _repeated_topics_codec); - if (_unknownFields != null) { - _unknownFields.WriteTo(ref output); - } - } - #endif - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public int CalculateSize() { - int size = 0; - size += topics_.CalculateSize(_repeated_topics_codec); - if (_unknownFields != null) { - size += _unknownFields.CalculateSize(); - } - return size; - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void MergeFrom(TopicListResponse other) { - if (other == null) { - return; - } - topics_.Add(other.topics_); - _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void MergeFrom(pb::CodedInputStream input) { - #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE - input.ReadRawMessage(this); - #else - uint tag; - while ((tag = input.ReadTag()) != 0) { - switch(tag) { - default: - _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input); - break; - case 10: { - topics_.AddEntriesFrom(input, _repeated_topics_codec); - break; - } - } - } - #endif - } - - #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - void pb::IBufferMessage.InternalMergeFrom(ref pb::ParseContext input) { - uint tag; - while ((tag = input.ReadTag()) != 0) { - switch(tag) { - default: - _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, ref input); - break; - case 10: { - topics_.AddEntriesFrom(ref input, _repeated_topics_codec); - break; - } - } - } - } - #endif - - } - - /// - /// Represents an event topic - /// - public sealed partial class NitricTopic : pb::IMessage - #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE - , pb::IBufferMessage - #endif - { - private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new NitricTopic()); - private pb::UnknownFieldSet _unknownFields; - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public static pb::MessageParser Parser { get { return _parser; } } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public static pbr::MessageDescriptor Descriptor { - get { return global::Nitric.Proto.Event.v1.EventReflection.Descriptor.MessageTypes[4]; } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - pbr::MessageDescriptor pb::IMessage.Descriptor { - get { return Descriptor; } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public NitricTopic() { - OnConstruction(); - } - - partial void OnConstruction(); - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public NitricTopic(NitricTopic other) : this() { - name_ = other.name_; - _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public NitricTopic Clone() { - return new NitricTopic(this); - } - - /// Field number for the "name" field. - public const int NameFieldNumber = 1; - private string name_ = ""; - /// - /// The Nitric name for the topic - /// - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public string Name { - get { return name_; } - set { - name_ = pb::ProtoPreconditions.CheckNotNull(value, "value"); - } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public override bool Equals(object other) { - return Equals(other as NitricTopic); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public bool Equals(NitricTopic other) { - if (ReferenceEquals(other, null)) { - return false; - } - if (ReferenceEquals(other, this)) { - return true; - } - if (Name != other.Name) return false; - return Equals(_unknownFields, other._unknownFields); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public override int GetHashCode() { - int hash = 1; - if (Name.Length != 0) hash ^= Name.GetHashCode(); - if (_unknownFields != null) { - hash ^= _unknownFields.GetHashCode(); - } - return hash; - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public override string ToString() { - return pb::JsonFormatter.ToDiagnosticString(this); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void WriteTo(pb::CodedOutputStream output) { - #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE - output.WriteRawMessage(this); - #else - if (Name.Length != 0) { - output.WriteRawTag(10); - output.WriteString(Name); - } - if (_unknownFields != null) { - _unknownFields.WriteTo(output); - } - #endif - } - - #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - void pb::IBufferMessage.InternalWriteTo(ref pb::WriteContext output) { - if (Name.Length != 0) { - output.WriteRawTag(10); - output.WriteString(Name); - } - if (_unknownFields != null) { - _unknownFields.WriteTo(ref output); - } - } - #endif - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public int CalculateSize() { - int size = 0; - if (Name.Length != 0) { - size += 1 + pb::CodedOutputStream.ComputeStringSize(Name); - } - if (_unknownFields != null) { - size += _unknownFields.CalculateSize(); - } - return size; - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void MergeFrom(NitricTopic other) { - if (other == null) { - return; - } - if (other.Name.Length != 0) { - Name = other.Name; - } - _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void MergeFrom(pb::CodedInputStream input) { - #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE - input.ReadRawMessage(this); - #else - uint tag; - while ((tag = input.ReadTag()) != 0) { - switch(tag) { - default: - _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input); - break; - case 10: { - Name = input.ReadString(); - break; - } - } - } - #endif - } - - #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - void pb::IBufferMessage.InternalMergeFrom(ref pb::ParseContext input) { - uint tag; - while ((tag = input.ReadTag()) != 0) { - switch(tag) { - default: - _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, ref input); - break; - case 10: { - Name = input.ReadString(); - break; - } - } - } - } - #endif - - } - - /// - /// Nitric Event Model - /// - public sealed partial class NitricEvent : pb::IMessage - #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE - , pb::IBufferMessage - #endif - { - private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new NitricEvent()); - private pb::UnknownFieldSet _unknownFields; - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public static pb::MessageParser Parser { get { return _parser; } } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public static pbr::MessageDescriptor Descriptor { - get { return global::Nitric.Proto.Event.v1.EventReflection.Descriptor.MessageTypes[5]; } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - pbr::MessageDescriptor pb::IMessage.Descriptor { - get { return Descriptor; } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public NitricEvent() { - OnConstruction(); - } - - partial void OnConstruction(); - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public NitricEvent(NitricEvent other) : this() { - id_ = other.id_; - payloadType_ = other.payloadType_; - payload_ = other.payload_ != null ? other.payload_.Clone() : null; - _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public NitricEvent Clone() { - return new NitricEvent(this); - } - - /// Field number for the "id" field. - public const int IdFieldNumber = 1; - private string id_ = ""; - /// - /// A Unique ID for the Nitric Event - /// - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public string Id { - get { return id_; } - set { - id_ = pb::ProtoPreconditions.CheckNotNull(value, "value"); - } - } - - /// Field number for the "payload_type" field. - public const int PayloadTypeFieldNumber = 2; - private string payloadType_ = ""; - /// - /// A content hint for the events payload - /// - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public string PayloadType { - get { return payloadType_; } - set { - payloadType_ = pb::ProtoPreconditions.CheckNotNull(value, "value"); - } - } - - /// Field number for the "payload" field. - public const int PayloadFieldNumber = 3; - private global::Google.Protobuf.WellKnownTypes.Struct payload_; - /// - /// The payload of the event - /// - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public global::Google.Protobuf.WellKnownTypes.Struct Payload { - get { return payload_; } - set { - payload_ = value; - } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public override bool Equals(object other) { - return Equals(other as NitricEvent); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public bool Equals(NitricEvent other) { - if (ReferenceEquals(other, null)) { - return false; - } - if (ReferenceEquals(other, this)) { - return true; - } - if (Id != other.Id) return false; - if (PayloadType != other.PayloadType) return false; - if (!object.Equals(Payload, other.Payload)) return false; - return Equals(_unknownFields, other._unknownFields); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public override int GetHashCode() { - int hash = 1; - if (Id.Length != 0) hash ^= Id.GetHashCode(); - if (PayloadType.Length != 0) hash ^= PayloadType.GetHashCode(); - if (payload_ != null) hash ^= Payload.GetHashCode(); - if (_unknownFields != null) { - hash ^= _unknownFields.GetHashCode(); - } - return hash; - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public override string ToString() { - return pb::JsonFormatter.ToDiagnosticString(this); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void WriteTo(pb::CodedOutputStream output) { - #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE - output.WriteRawMessage(this); - #else - if (Id.Length != 0) { - output.WriteRawTag(10); - output.WriteString(Id); - } - if (PayloadType.Length != 0) { - output.WriteRawTag(18); - output.WriteString(PayloadType); - } - if (payload_ != null) { - output.WriteRawTag(26); - output.WriteMessage(Payload); - } - if (_unknownFields != null) { - _unknownFields.WriteTo(output); - } - #endif - } - - #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - void pb::IBufferMessage.InternalWriteTo(ref pb::WriteContext output) { - if (Id.Length != 0) { - output.WriteRawTag(10); - output.WriteString(Id); - } - if (PayloadType.Length != 0) { - output.WriteRawTag(18); - output.WriteString(PayloadType); - } - if (payload_ != null) { - output.WriteRawTag(26); - output.WriteMessage(Payload); - } - if (_unknownFields != null) { - _unknownFields.WriteTo(ref output); - } - } - #endif - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public int CalculateSize() { - int size = 0; - if (Id.Length != 0) { - size += 1 + pb::CodedOutputStream.ComputeStringSize(Id); - } - if (PayloadType.Length != 0) { - size += 1 + pb::CodedOutputStream.ComputeStringSize(PayloadType); - } - if (payload_ != null) { - size += 1 + pb::CodedOutputStream.ComputeMessageSize(Payload); - } - if (_unknownFields != null) { - size += _unknownFields.CalculateSize(); - } - return size; - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void MergeFrom(NitricEvent other) { - if (other == null) { - return; - } - if (other.Id.Length != 0) { - Id = other.Id; - } - if (other.PayloadType.Length != 0) { - PayloadType = other.PayloadType; - } - if (other.payload_ != null) { - if (payload_ == null) { - Payload = new global::Google.Protobuf.WellKnownTypes.Struct(); - } - Payload.MergeFrom(other.Payload); - } - _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void MergeFrom(pb::CodedInputStream input) { - #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE - input.ReadRawMessage(this); - #else - uint tag; - while ((tag = input.ReadTag()) != 0) { - switch(tag) { - default: - _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input); - break; - case 10: { - Id = input.ReadString(); - break; - } - case 18: { - PayloadType = input.ReadString(); - break; - } - case 26: { - if (payload_ == null) { - Payload = new global::Google.Protobuf.WellKnownTypes.Struct(); - } - input.ReadMessage(Payload); - break; - } - } - } - #endif - } - - #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - void pb::IBufferMessage.InternalMergeFrom(ref pb::ParseContext input) { - uint tag; - while ((tag = input.ReadTag()) != 0) { - switch(tag) { - default: - _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, ref input); - break; - case 10: { - Id = input.ReadString(); - break; - } - case 18: { - PayloadType = input.ReadString(); - break; - } - case 26: { - if (payload_ == null) { - Payload = new global::Google.Protobuf.WellKnownTypes.Struct(); - } - input.ReadMessage(Payload); - break; - } - } - } - } - #endif - - } - - #endregion - -} - -#endregion Designer generated code diff --git a/src/Nitric.Sdk/Proto/proto/faas/v1/Faas.cs b/src/Nitric.Sdk/Proto/proto/faas/v1/Faas.cs deleted file mode 100644 index 6a2ef23..0000000 --- a/src/Nitric.Sdk/Proto/proto/faas/v1/Faas.cs +++ /dev/null @@ -1,7168 +0,0 @@ -// -// Generated by the protocol buffer compiler. DO NOT EDIT! -// source: proto/faas/v1/faas.proto -// -#pragma warning disable 1591, 0612, 3021 -#region Designer generated code - -using pb = global::Google.Protobuf; -using pbc = global::Google.Protobuf.Collections; -using pbr = global::Google.Protobuf.Reflection; -using scg = global::System.Collections.Generic; -namespace Nitric.Proto.Faas.v1 { - - /// Holder for reflection information generated from proto/faas/v1/faas.proto - public static partial class FaasReflection { - - #region Descriptor - /// File descriptor for proto/faas/v1/faas.proto - public static pbr::FileDescriptor Descriptor { - get { return descriptor; } - } - private static pbr::FileDescriptor descriptor; - - static FaasReflection() { - byte[] descriptorData = global::System.Convert.FromBase64String( - string.Concat( - "Chhwcm90by9mYWFzL3YxL2ZhYXMucHJvdG8SDm5pdHJpYy5mYWFzLnYxIpgB", - "Cg1DbGllbnRNZXNzYWdlEgoKAmlkGAEgASgJEjMKDGluaXRfcmVxdWVzdBgC", - "IAEoCzIbLm5pdHJpYy5mYWFzLnYxLkluaXRSZXF1ZXN0SAASOwoQdHJpZ2dl", - "cl9yZXNwb25zZRgDIAEoCzIfLm5pdHJpYy5mYWFzLnYxLlRyaWdnZXJSZXNw", - "b25zZUgAQgkKB2NvbnRlbnQimAEKDVNlcnZlck1lc3NhZ2USCgoCaWQYASAB", - "KAkSNQoNaW5pdF9yZXNwb25zZRgCIAEoCzIcLm5pdHJpYy5mYWFzLnYxLklu", - "aXRSZXNwb25zZUgAEjkKD3RyaWdnZXJfcmVxdWVzdBgDIAEoCzIeLm5pdHJp", - "Yy5mYWFzLnYxLlRyaWdnZXJSZXF1ZXN0SABCCQoHY29udGVudCIhCg9BcGlX", - "b3JrZXJTY29wZXMSDgoGc2NvcGVzGAEgAygJIsEBChBBcGlXb3JrZXJPcHRp", - "b25zEkAKCHNlY3VyaXR5GAEgAygLMi4ubml0cmljLmZhYXMudjEuQXBpV29y", - "a2VyT3B0aW9ucy5TZWN1cml0eUVudHJ5EhkKEXNlY3VyaXR5X2Rpc2FibGVk", - "GAIgASgIGlAKDVNlY3VyaXR5RW50cnkSCwoDa2V5GAEgASgJEi4KBXZhbHVl", - "GAIgASgLMh8ubml0cmljLmZhYXMudjEuQXBpV29ya2VyU2NvcGVzOgI4ASJq", - "CglBcGlXb3JrZXISCwoDYXBpGAEgASgJEgwKBHBhdGgYAiABKAkSDwoHbWV0", - "aG9kcxgDIAMoCRIxCgdvcHRpb25zGAQgASgLMiAubml0cmljLmZhYXMudjEu", - "QXBpV29ya2VyT3B0aW9ucyIjChJTdWJzY3JpcHRpb25Xb3JrZXISDQoFdG9w", - "aWMYASABKAkihAEKDlNjaGVkdWxlV29ya2VyEgsKA2tleRgBIAEoCRIsCgRy", - "YXRlGAogASgLMhwubml0cmljLmZhYXMudjEuU2NoZWR1bGVSYXRlSAASLAoE", - "Y3JvbhgLIAEoCzIcLm5pdHJpYy5mYWFzLnYxLlNjaGVkdWxlQ3JvbkgAQgkK", - "B2NhZGVuY2UiHAoMU2NoZWR1bGVSYXRlEgwKBHJhdGUYASABKAkiHAoMU2No", - "ZWR1bGVDcm9uEgwKBGNyb24YASABKAkiGgoKSHR0cFdvcmtlchIMCgRwb3J0", - "GAEgASgFImQKGEJ1Y2tldE5vdGlmaWNhdGlvbldvcmtlchIOCgZidWNrZXQY", - "ASABKAkSOAoGY29uZmlnGAIgASgLMigubml0cmljLmZhYXMudjEuQnVja2V0", - "Tm90aWZpY2F0aW9uQ29uZmlnIoEBChhCdWNrZXROb3RpZmljYXRpb25Db25m", - "aWcSQQoRbm90aWZpY2F0aW9uX3R5cGUYASABKA4yJi5uaXRyaWMuZmFhcy52", - "MS5CdWNrZXROb3RpZmljYXRpb25UeXBlEiIKGm5vdGlmaWNhdGlvbl9wcmVm", - "aXhfZmlsdGVyGAIgASgJIlAKD1dlYnNvY2tldFdvcmtlchIOCgZzb2NrZXQY", - "ASABKAkSLQoFZXZlbnQYAiABKA4yHi5uaXRyaWMuZmFhcy52MS5XZWJzb2Nr", - "ZXRFdmVudCLjAgoLSW5pdFJlcXVlc3QSKAoDYXBpGAogASgLMhkubml0cmlj", - "LmZhYXMudjEuQXBpV29ya2VySAASOgoMc3Vic2NyaXB0aW9uGAsgASgLMiIu", - "bml0cmljLmZhYXMudjEuU3Vic2NyaXB0aW9uV29ya2VySAASMgoIc2NoZWR1", - "bGUYDCABKAsyHi5uaXRyaWMuZmFhcy52MS5TY2hlZHVsZVdvcmtlckgAEkcK", - "E2J1Y2tldF9ub3RpZmljYXRpb24YDSABKAsyKC5uaXRyaWMuZmFhcy52MS5C", - "dWNrZXROb3RpZmljYXRpb25Xb3JrZXJIABI0Cgl3ZWJzb2NrZXQYDiABKAsy", - "Hy5uaXRyaWMuZmFhcy52MS5XZWJzb2NrZXRXb3JrZXJIABIxCgtodHRwX3dv", - "cmtlchgPIAEoCzIaLm5pdHJpYy5mYWFzLnYxLkh0dHBXb3JrZXJIAEIICgZX", - "b3JrZXIiDgoMSW5pdFJlc3BvbnNlIncKDFRyYWNlQ29udGV4dBI4CgZ2YWx1", - "ZXMYASADKAsyKC5uaXRyaWMuZmFhcy52MS5UcmFjZUNvbnRleHQuVmFsdWVz", - "RW50cnkaLQoLVmFsdWVzRW50cnkSCwoDa2V5GAEgASgJEg0KBXZhbHVlGAIg", - "ASgJOgI4ASLdAgoOVHJpZ2dlclJlcXVlc3QSDAoEZGF0YRgBIAEoDBIRCglt", - "aW1lX3R5cGUYAiABKAkSMwoNdHJhY2VfY29udGV4dBgKIAEoCzIcLm5pdHJp", - "Yy5mYWFzLnYxLlRyYWNlQ29udGV4dBIyCgRodHRwGAMgASgLMiIubml0cmlj", - "LmZhYXMudjEuSHR0cFRyaWdnZXJDb250ZXh0SAASNAoFdG9waWMYBCABKAsy", - "Iy5uaXRyaWMuZmFhcy52MS5Ub3BpY1RyaWdnZXJDb250ZXh0SAASQgoMbm90", - "aWZpY2F0aW9uGAUgASgLMioubml0cmljLmZhYXMudjEuTm90aWZpY2F0aW9u", - "VHJpZ2dlckNvbnRleHRIABI8Cgl3ZWJzb2NrZXQYBiABKAsyJy5uaXRyaWMu", - "ZmFhcy52MS5XZWJzb2NrZXRUcmlnZ2VyQ29udGV4dEgAQgkKB2NvbnRleHQi", - "HAoLSGVhZGVyVmFsdWUSDQoFdmFsdWUYASADKAkiGwoKUXVlcnlWYWx1ZRIN", - "CgV2YWx1ZRgBIAMoCSLlBQoSSHR0cFRyaWdnZXJDb250ZXh0Eg4KBm1ldGhv", - "ZBgBIAEoCRIMCgRwYXRoGAIgASgJEksKC2hlYWRlcnNfb2xkGAMgAygLMjIu", - "bml0cmljLmZhYXMudjEuSHR0cFRyaWdnZXJDb250ZXh0LkhlYWRlcnNPbGRF", - "bnRyeUICGAESVAoQcXVlcnlfcGFyYW1zX29sZBgEIAMoCzI2Lm5pdHJpYy5m", - "YWFzLnYxLkh0dHBUcmlnZ2VyQ29udGV4dC5RdWVyeVBhcmFtc09sZEVudHJ5", - "QgIYARJACgdoZWFkZXJzGAUgAygLMi8ubml0cmljLmZhYXMudjEuSHR0cFRy", - "aWdnZXJDb250ZXh0LkhlYWRlcnNFbnRyeRJJCgxxdWVyeV9wYXJhbXMYBiAD", - "KAsyMy5uaXRyaWMuZmFhcy52MS5IdHRwVHJpZ2dlckNvbnRleHQuUXVlcnlQ", - "YXJhbXNFbnRyeRJHCgtwYXRoX3BhcmFtcxgHIAMoCzIyLm5pdHJpYy5mYWFz", - "LnYxLkh0dHBUcmlnZ2VyQ29udGV4dC5QYXRoUGFyYW1zRW50cnkaMQoPSGVh", - "ZGVyc09sZEVudHJ5EgsKA2tleRgBIAEoCRINCgV2YWx1ZRgCIAEoCToCOAEa", - "NQoTUXVlcnlQYXJhbXNPbGRFbnRyeRILCgNrZXkYASABKAkSDQoFdmFsdWUY", - "AiABKAk6AjgBGksKDEhlYWRlcnNFbnRyeRILCgNrZXkYASABKAkSKgoFdmFs", - "dWUYAiABKAsyGy5uaXRyaWMuZmFhcy52MS5IZWFkZXJWYWx1ZToCOAEaTgoQ", - "UXVlcnlQYXJhbXNFbnRyeRILCgNrZXkYASABKAkSKQoFdmFsdWUYAiABKAsy", - "Gi5uaXRyaWMuZmFhcy52MS5RdWVyeVZhbHVlOgI4ARoxCg9QYXRoUGFyYW1z", - "RW50cnkSCwoDa2V5GAEgASgJEg0KBXZhbHVlGAIgASgJOgI4ASIkChNUb3Bp", - "Y1RyaWdnZXJDb250ZXh0Eg0KBXRvcGljGAEgASgJIlcKEkJ1Y2tldE5vdGlm", - "aWNhdGlvbhILCgNrZXkYASABKAkSNAoEdHlwZRgCIAEoDjImLm5pdHJpYy5m", - "YWFzLnYxLkJ1Y2tldE5vdGlmaWNhdGlvblR5cGUicgoaTm90aWZpY2F0aW9u", - "VHJpZ2dlckNvbnRleHQSDgoGc291cmNlGAEgASgJEjQKBmJ1Y2tldBgKIAEo", - "CzIiLm5pdHJpYy5mYWFzLnYxLkJ1Y2tldE5vdGlmaWNhdGlvbkgAQg4KDG5v", - "dGlmaWNhdGlvbiKOAgoXV2Vic29ja2V0VHJpZ2dlckNvbnRleHQSDgoGc29j", - "a2V0GAEgASgJEi0KBWV2ZW50GAIgASgOMh4ubml0cmljLmZhYXMudjEuV2Vi", - "c29ja2V0RXZlbnQSFAoMY29ubmVjdGlvbklkGAMgASgJEk4KDHF1ZXJ5X3Bh", - "cmFtcxgGIAMoCzI4Lm5pdHJpYy5mYWFzLnYxLldlYnNvY2tldFRyaWdnZXJD", - "b250ZXh0LlF1ZXJ5UGFyYW1zRW50cnkaTgoQUXVlcnlQYXJhbXNFbnRyeRIL", - "CgNrZXkYASABKAkSKQoFdmFsdWUYAiABKAsyGi5uaXRyaWMuZmFhcy52MS5R", - "dWVyeVZhbHVlOgI4ASKaAgoPVHJpZ2dlclJlc3BvbnNlEgwKBGRhdGEYASAB", - "KAwSMwoEaHR0cBgKIAEoCzIjLm5pdHJpYy5mYWFzLnYxLkh0dHBSZXNwb25z", - "ZUNvbnRleHRIABI1CgV0b3BpYxgLIAEoCzIkLm5pdHJpYy5mYWFzLnYxLlRv", - "cGljUmVzcG9uc2VDb250ZXh0SAASQwoMbm90aWZpY2F0aW9uGAwgASgLMisu", - "bml0cmljLmZhYXMudjEuTm90aWZpY2F0aW9uUmVzcG9uc2VDb250ZXh0SAAS", - "PQoJd2Vic29ja2V0GA0gASgLMigubml0cmljLmZhYXMudjEuV2Vic29ja2V0", - "UmVzcG9uc2VDb250ZXh0SABCCQoHY29udGV4dCK2AgoTSHR0cFJlc3BvbnNl", - "Q29udGV4dBJMCgtoZWFkZXJzX29sZBgBIAMoCzIzLm5pdHJpYy5mYWFzLnYx", - "Lkh0dHBSZXNwb25zZUNvbnRleHQuSGVhZGVyc09sZEVudHJ5QgIYARIOCgZz", - "dGF0dXMYAiABKAUSQQoHaGVhZGVycxgDIAMoCzIwLm5pdHJpYy5mYWFzLnYx", - "Lkh0dHBSZXNwb25zZUNvbnRleHQuSGVhZGVyc0VudHJ5GjEKD0hlYWRlcnNP", - "bGRFbnRyeRILCgNrZXkYASABKAkSDQoFdmFsdWUYAiABKAk6AjgBGksKDEhl", - "YWRlcnNFbnRyeRILCgNrZXkYASABKAkSKgoFdmFsdWUYAiABKAsyGy5uaXRy", - "aWMuZmFhcy52MS5IZWFkZXJWYWx1ZToCOAEiJwoUVG9waWNSZXNwb25zZUNv", - "bnRleHQSDwoHc3VjY2VzcxgBIAEoCCIuChtOb3RpZmljYXRpb25SZXNwb25z", - "ZUNvbnRleHQSDwoHc3VjY2VzcxgBIAEoCCIrChhXZWJzb2NrZXRSZXNwb25z", - "ZUNvbnRleHQSDwoHc3VjY2VzcxgBIAEoCCo7ChZCdWNrZXROb3RpZmljYXRp", - "b25UeXBlEgcKA0FsbBAAEgsKB0NyZWF0ZWQQARILCgdEZWxldGVkEAIqOgoO", - "V2Vic29ja2V0RXZlbnQSCwoHQ29ubmVjdBAAEg4KCkRpc2Nvbm5lY3QQARIL", - "CgdNZXNzYWdlEAIyYAoLRmFhc1NlcnZpY2USUQoNVHJpZ2dlclN0cmVhbRId", - "Lm5pdHJpYy5mYWFzLnYxLkNsaWVudE1lc3NhZ2UaHS5uaXRyaWMuZmFhcy52", - "MS5TZXJ2ZXJNZXNzYWdlKAEwAUKKAQoXaW8ubml0cmljLnByb3RvLmZhYXMu", - "djFCCk5pdHJpY0ZhYXNQAVozZ2l0aHViLmNvbS9uaXRyaWN0ZWNoL25pdHJp", - "Yy9jb3JlL3BrZy9hcGkvbml0cmljL3YxqgIUTml0cmljLlByb3RvLkZhYXMu", - "djHKAhROaXRyaWNcUHJvdG9cRmFhc1xWMWIGcHJvdG8z")); - descriptor = pbr::FileDescriptor.FromGeneratedCode(descriptorData, - new pbr::FileDescriptor[] { }, - new pbr::GeneratedClrTypeInfo(new[] {typeof(global::Nitric.Proto.Faas.v1.BucketNotificationType), typeof(global::Nitric.Proto.Faas.v1.WebsocketEvent), }, null, new pbr::GeneratedClrTypeInfo[] { - new pbr::GeneratedClrTypeInfo(typeof(global::Nitric.Proto.Faas.v1.ClientMessage), global::Nitric.Proto.Faas.v1.ClientMessage.Parser, new[]{ "Id", "InitRequest", "TriggerResponse" }, new[]{ "Content" }, null, null, null), - new pbr::GeneratedClrTypeInfo(typeof(global::Nitric.Proto.Faas.v1.ServerMessage), global::Nitric.Proto.Faas.v1.ServerMessage.Parser, new[]{ "Id", "InitResponse", "TriggerRequest" }, new[]{ "Content" }, null, null, null), - new pbr::GeneratedClrTypeInfo(typeof(global::Nitric.Proto.Faas.v1.ApiWorkerScopes), global::Nitric.Proto.Faas.v1.ApiWorkerScopes.Parser, new[]{ "Scopes" }, null, null, null, null), - new pbr::GeneratedClrTypeInfo(typeof(global::Nitric.Proto.Faas.v1.ApiWorkerOptions), global::Nitric.Proto.Faas.v1.ApiWorkerOptions.Parser, new[]{ "Security", "SecurityDisabled" }, null, null, null, new pbr::GeneratedClrTypeInfo[] { null, }), - new pbr::GeneratedClrTypeInfo(typeof(global::Nitric.Proto.Faas.v1.ApiWorker), global::Nitric.Proto.Faas.v1.ApiWorker.Parser, new[]{ "Api", "Path", "Methods", "Options" }, null, null, null, null), - new pbr::GeneratedClrTypeInfo(typeof(global::Nitric.Proto.Faas.v1.SubscriptionWorker), global::Nitric.Proto.Faas.v1.SubscriptionWorker.Parser, new[]{ "Topic" }, null, null, null, null), - new pbr::GeneratedClrTypeInfo(typeof(global::Nitric.Proto.Faas.v1.ScheduleWorker), global::Nitric.Proto.Faas.v1.ScheduleWorker.Parser, new[]{ "Key", "Rate", "Cron" }, new[]{ "Cadence" }, null, null, null), - new pbr::GeneratedClrTypeInfo(typeof(global::Nitric.Proto.Faas.v1.ScheduleRate), global::Nitric.Proto.Faas.v1.ScheduleRate.Parser, new[]{ "Rate" }, null, null, null, null), - new pbr::GeneratedClrTypeInfo(typeof(global::Nitric.Proto.Faas.v1.ScheduleCron), global::Nitric.Proto.Faas.v1.ScheduleCron.Parser, new[]{ "Cron" }, null, null, null, null), - new pbr::GeneratedClrTypeInfo(typeof(global::Nitric.Proto.Faas.v1.HttpWorker), global::Nitric.Proto.Faas.v1.HttpWorker.Parser, new[]{ "Port" }, null, null, null, null), - new pbr::GeneratedClrTypeInfo(typeof(global::Nitric.Proto.Faas.v1.BucketNotificationWorker), global::Nitric.Proto.Faas.v1.BucketNotificationWorker.Parser, new[]{ "Bucket", "Config" }, null, null, null, null), - new pbr::GeneratedClrTypeInfo(typeof(global::Nitric.Proto.Faas.v1.BucketNotificationConfig), global::Nitric.Proto.Faas.v1.BucketNotificationConfig.Parser, new[]{ "NotificationType", "NotificationPrefixFilter" }, null, null, null, null), - new pbr::GeneratedClrTypeInfo(typeof(global::Nitric.Proto.Faas.v1.WebsocketWorker), global::Nitric.Proto.Faas.v1.WebsocketWorker.Parser, new[]{ "Socket", "Event" }, null, null, null, null), - new pbr::GeneratedClrTypeInfo(typeof(global::Nitric.Proto.Faas.v1.InitRequest), global::Nitric.Proto.Faas.v1.InitRequest.Parser, new[]{ "Api", "Subscription", "Schedule", "BucketNotification", "Websocket", "HttpWorker" }, new[]{ "Worker" }, null, null, null), - new pbr::GeneratedClrTypeInfo(typeof(global::Nitric.Proto.Faas.v1.InitResponse), global::Nitric.Proto.Faas.v1.InitResponse.Parser, null, null, null, null, null), - new pbr::GeneratedClrTypeInfo(typeof(global::Nitric.Proto.Faas.v1.TraceContext), global::Nitric.Proto.Faas.v1.TraceContext.Parser, new[]{ "Values" }, null, null, null, new pbr::GeneratedClrTypeInfo[] { null, }), - new pbr::GeneratedClrTypeInfo(typeof(global::Nitric.Proto.Faas.v1.TriggerRequest), global::Nitric.Proto.Faas.v1.TriggerRequest.Parser, new[]{ "Data", "MimeType", "TraceContext", "Http", "Topic", "Notification", "Websocket" }, new[]{ "Context" }, null, null, null), - new pbr::GeneratedClrTypeInfo(typeof(global::Nitric.Proto.Faas.v1.HeaderValue), global::Nitric.Proto.Faas.v1.HeaderValue.Parser, new[]{ "Value" }, null, null, null, null), - new pbr::GeneratedClrTypeInfo(typeof(global::Nitric.Proto.Faas.v1.QueryValue), global::Nitric.Proto.Faas.v1.QueryValue.Parser, new[]{ "Value" }, null, null, null, null), - new pbr::GeneratedClrTypeInfo(typeof(global::Nitric.Proto.Faas.v1.HttpTriggerContext), global::Nitric.Proto.Faas.v1.HttpTriggerContext.Parser, new[]{ "Method", "Path", "HeadersOld", "QueryParamsOld", "Headers", "QueryParams", "PathParams" }, null, null, null, new pbr::GeneratedClrTypeInfo[] { null, null, null, null, null, }), - new pbr::GeneratedClrTypeInfo(typeof(global::Nitric.Proto.Faas.v1.TopicTriggerContext), global::Nitric.Proto.Faas.v1.TopicTriggerContext.Parser, new[]{ "Topic" }, null, null, null, null), - new pbr::GeneratedClrTypeInfo(typeof(global::Nitric.Proto.Faas.v1.BucketNotification), global::Nitric.Proto.Faas.v1.BucketNotification.Parser, new[]{ "Key", "Type" }, null, null, null, null), - new pbr::GeneratedClrTypeInfo(typeof(global::Nitric.Proto.Faas.v1.NotificationTriggerContext), global::Nitric.Proto.Faas.v1.NotificationTriggerContext.Parser, new[]{ "Source", "Bucket" }, new[]{ "Notification" }, null, null, null), - new pbr::GeneratedClrTypeInfo(typeof(global::Nitric.Proto.Faas.v1.WebsocketTriggerContext), global::Nitric.Proto.Faas.v1.WebsocketTriggerContext.Parser, new[]{ "Socket", "Event", "ConnectionId", "QueryParams" }, null, null, null, new pbr::GeneratedClrTypeInfo[] { null, }), - new pbr::GeneratedClrTypeInfo(typeof(global::Nitric.Proto.Faas.v1.TriggerResponse), global::Nitric.Proto.Faas.v1.TriggerResponse.Parser, new[]{ "Data", "Http", "Topic", "Notification", "Websocket" }, new[]{ "Context" }, null, null, null), - new pbr::GeneratedClrTypeInfo(typeof(global::Nitric.Proto.Faas.v1.HttpResponseContext), global::Nitric.Proto.Faas.v1.HttpResponseContext.Parser, new[]{ "HeadersOld", "Status", "Headers" }, null, null, null, new pbr::GeneratedClrTypeInfo[] { null, null, }), - new pbr::GeneratedClrTypeInfo(typeof(global::Nitric.Proto.Faas.v1.TopicResponseContext), global::Nitric.Proto.Faas.v1.TopicResponseContext.Parser, new[]{ "Success" }, null, null, null, null), - new pbr::GeneratedClrTypeInfo(typeof(global::Nitric.Proto.Faas.v1.NotificationResponseContext), global::Nitric.Proto.Faas.v1.NotificationResponseContext.Parser, new[]{ "Success" }, null, null, null, null), - new pbr::GeneratedClrTypeInfo(typeof(global::Nitric.Proto.Faas.v1.WebsocketResponseContext), global::Nitric.Proto.Faas.v1.WebsocketResponseContext.Parser, new[]{ "Success" }, null, null, null, null) - })); - } - #endregion - - } - #region Enums - /// - /// Notification Workers - /// - public enum BucketNotificationType { - [pbr::OriginalName("All")] All = 0, - [pbr::OriginalName("Created")] Created = 1, - [pbr::OriginalName("Deleted")] Deleted = 2, - } - - public enum WebsocketEvent { - /// - /// Specialised Event for handling new client connections - /// - [pbr::OriginalName("Connect")] Connect = 0, - /// - /// Specialised Event for handling existing client connections - /// - [pbr::OriginalName("Disconnect")] Disconnect = 1, - /// - /// All other types of events are messages - /// - [pbr::OriginalName("Message")] Message = 2, - } - - #endregion - - #region Messages - /// - /// Messages the client is able to send to the server - /// - public sealed partial class ClientMessage : pb::IMessage - #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE - , pb::IBufferMessage - #endif - { - private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new ClientMessage()); - private pb::UnknownFieldSet _unknownFields; - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public static pb::MessageParser Parser { get { return _parser; } } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public static pbr::MessageDescriptor Descriptor { - get { return global::Nitric.Proto.Faas.v1.FaasReflection.Descriptor.MessageTypes[0]; } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - pbr::MessageDescriptor pb::IMessage.Descriptor { - get { return Descriptor; } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public ClientMessage() { - OnConstruction(); - } - - partial void OnConstruction(); - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public ClientMessage(ClientMessage other) : this() { - id_ = other.id_; - switch (other.ContentCase) { - case ContentOneofCase.InitRequest: - InitRequest = other.InitRequest.Clone(); - break; - case ContentOneofCase.TriggerResponse: - TriggerResponse = other.TriggerResponse.Clone(); - break; - } - - _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public ClientMessage Clone() { - return new ClientMessage(this); - } - - /// Field number for the "id" field. - public const int IdFieldNumber = 1; - private string id_ = ""; - /// - /// Client message ID, used to pair requests/responses - /// - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public string Id { - get { return id_; } - set { - id_ = pb::ProtoPreconditions.CheckNotNull(value, "value"); - } - } - - /// Field number for the "init_request" field. - public const int InitRequestFieldNumber = 2; - /// - /// Client initialisation request - /// A worker will not be eligible for triggers - /// until it has identified itself - /// - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public global::Nitric.Proto.Faas.v1.InitRequest InitRequest { - get { return contentCase_ == ContentOneofCase.InitRequest ? (global::Nitric.Proto.Faas.v1.InitRequest) content_ : null; } - set { - content_ = value; - contentCase_ = value == null ? ContentOneofCase.None : ContentOneofCase.InitRequest; - } - } - - /// Field number for the "trigger_response" field. - public const int TriggerResponseFieldNumber = 3; - /// - /// Client responsding with result of - /// a trigger - /// - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public global::Nitric.Proto.Faas.v1.TriggerResponse TriggerResponse { - get { return contentCase_ == ContentOneofCase.TriggerResponse ? (global::Nitric.Proto.Faas.v1.TriggerResponse) content_ : null; } - set { - content_ = value; - contentCase_ = value == null ? ContentOneofCase.None : ContentOneofCase.TriggerResponse; - } - } - - private object content_; - /// Enum of possible cases for the "content" oneof. - public enum ContentOneofCase { - None = 0, - InitRequest = 2, - TriggerResponse = 3, - } - private ContentOneofCase contentCase_ = ContentOneofCase.None; - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public ContentOneofCase ContentCase { - get { return contentCase_; } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void ClearContent() { - contentCase_ = ContentOneofCase.None; - content_ = null; - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public override bool Equals(object other) { - return Equals(other as ClientMessage); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public bool Equals(ClientMessage other) { - if (ReferenceEquals(other, null)) { - return false; - } - if (ReferenceEquals(other, this)) { - return true; - } - if (Id != other.Id) return false; - if (!object.Equals(InitRequest, other.InitRequest)) return false; - if (!object.Equals(TriggerResponse, other.TriggerResponse)) return false; - if (ContentCase != other.ContentCase) return false; - return Equals(_unknownFields, other._unknownFields); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public override int GetHashCode() { - int hash = 1; - if (Id.Length != 0) hash ^= Id.GetHashCode(); - if (contentCase_ == ContentOneofCase.InitRequest) hash ^= InitRequest.GetHashCode(); - if (contentCase_ == ContentOneofCase.TriggerResponse) hash ^= TriggerResponse.GetHashCode(); - hash ^= (int) contentCase_; - if (_unknownFields != null) { - hash ^= _unknownFields.GetHashCode(); - } - return hash; - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public override string ToString() { - return pb::JsonFormatter.ToDiagnosticString(this); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void WriteTo(pb::CodedOutputStream output) { - #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE - output.WriteRawMessage(this); - #else - if (Id.Length != 0) { - output.WriteRawTag(10); - output.WriteString(Id); - } - if (contentCase_ == ContentOneofCase.InitRequest) { - output.WriteRawTag(18); - output.WriteMessage(InitRequest); - } - if (contentCase_ == ContentOneofCase.TriggerResponse) { - output.WriteRawTag(26); - output.WriteMessage(TriggerResponse); - } - if (_unknownFields != null) { - _unknownFields.WriteTo(output); - } - #endif - } - - #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - void pb::IBufferMessage.InternalWriteTo(ref pb::WriteContext output) { - if (Id.Length != 0) { - output.WriteRawTag(10); - output.WriteString(Id); - } - if (contentCase_ == ContentOneofCase.InitRequest) { - output.WriteRawTag(18); - output.WriteMessage(InitRequest); - } - if (contentCase_ == ContentOneofCase.TriggerResponse) { - output.WriteRawTag(26); - output.WriteMessage(TriggerResponse); - } - if (_unknownFields != null) { - _unknownFields.WriteTo(ref output); - } - } - #endif - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public int CalculateSize() { - int size = 0; - if (Id.Length != 0) { - size += 1 + pb::CodedOutputStream.ComputeStringSize(Id); - } - if (contentCase_ == ContentOneofCase.InitRequest) { - size += 1 + pb::CodedOutputStream.ComputeMessageSize(InitRequest); - } - if (contentCase_ == ContentOneofCase.TriggerResponse) { - size += 1 + pb::CodedOutputStream.ComputeMessageSize(TriggerResponse); - } - if (_unknownFields != null) { - size += _unknownFields.CalculateSize(); - } - return size; - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void MergeFrom(ClientMessage other) { - if (other == null) { - return; - } - if (other.Id.Length != 0) { - Id = other.Id; - } - switch (other.ContentCase) { - case ContentOneofCase.InitRequest: - if (InitRequest == null) { - InitRequest = new global::Nitric.Proto.Faas.v1.InitRequest(); - } - InitRequest.MergeFrom(other.InitRequest); - break; - case ContentOneofCase.TriggerResponse: - if (TriggerResponse == null) { - TriggerResponse = new global::Nitric.Proto.Faas.v1.TriggerResponse(); - } - TriggerResponse.MergeFrom(other.TriggerResponse); - break; - } - - _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void MergeFrom(pb::CodedInputStream input) { - #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE - input.ReadRawMessage(this); - #else - uint tag; - while ((tag = input.ReadTag()) != 0) { - switch(tag) { - default: - _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input); - break; - case 10: { - Id = input.ReadString(); - break; - } - case 18: { - global::Nitric.Proto.Faas.v1.InitRequest subBuilder = new global::Nitric.Proto.Faas.v1.InitRequest(); - if (contentCase_ == ContentOneofCase.InitRequest) { - subBuilder.MergeFrom(InitRequest); - } - input.ReadMessage(subBuilder); - InitRequest = subBuilder; - break; - } - case 26: { - global::Nitric.Proto.Faas.v1.TriggerResponse subBuilder = new global::Nitric.Proto.Faas.v1.TriggerResponse(); - if (contentCase_ == ContentOneofCase.TriggerResponse) { - subBuilder.MergeFrom(TriggerResponse); - } - input.ReadMessage(subBuilder); - TriggerResponse = subBuilder; - break; - } - } - } - #endif - } - - #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - void pb::IBufferMessage.InternalMergeFrom(ref pb::ParseContext input) { - uint tag; - while ((tag = input.ReadTag()) != 0) { - switch(tag) { - default: - _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, ref input); - break; - case 10: { - Id = input.ReadString(); - break; - } - case 18: { - global::Nitric.Proto.Faas.v1.InitRequest subBuilder = new global::Nitric.Proto.Faas.v1.InitRequest(); - if (contentCase_ == ContentOneofCase.InitRequest) { - subBuilder.MergeFrom(InitRequest); - } - input.ReadMessage(subBuilder); - InitRequest = subBuilder; - break; - } - case 26: { - global::Nitric.Proto.Faas.v1.TriggerResponse subBuilder = new global::Nitric.Proto.Faas.v1.TriggerResponse(); - if (contentCase_ == ContentOneofCase.TriggerResponse) { - subBuilder.MergeFrom(TriggerResponse); - } - input.ReadMessage(subBuilder); - TriggerResponse = subBuilder; - break; - } - } - } - } - #endif - - } - - /// - /// Messages the server is able to send to the client - /// - public sealed partial class ServerMessage : pb::IMessage - #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE - , pb::IBufferMessage - #endif - { - private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new ServerMessage()); - private pb::UnknownFieldSet _unknownFields; - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public static pb::MessageParser Parser { get { return _parser; } } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public static pbr::MessageDescriptor Descriptor { - get { return global::Nitric.Proto.Faas.v1.FaasReflection.Descriptor.MessageTypes[1]; } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - pbr::MessageDescriptor pb::IMessage.Descriptor { - get { return Descriptor; } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public ServerMessage() { - OnConstruction(); - } - - partial void OnConstruction(); - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public ServerMessage(ServerMessage other) : this() { - id_ = other.id_; - switch (other.ContentCase) { - case ContentOneofCase.InitResponse: - InitResponse = other.InitResponse.Clone(); - break; - case ContentOneofCase.TriggerRequest: - TriggerRequest = other.TriggerRequest.Clone(); - break; - } - - _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public ServerMessage Clone() { - return new ServerMessage(this); - } - - /// Field number for the "id" field. - public const int IdFieldNumber = 1; - private string id_ = ""; - /// - /// Server message ID, used to pair requests/responses - /// - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public string Id { - get { return id_; } - set { - id_ = pb::ProtoPreconditions.CheckNotNull(value, "value"); - } - } - - /// Field number for the "init_response" field. - public const int InitResponseFieldNumber = 2; - /// - /// Server responding - /// with client configuration details to an - /// InitRequest - /// - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public global::Nitric.Proto.Faas.v1.InitResponse InitResponse { - get { return contentCase_ == ContentOneofCase.InitResponse ? (global::Nitric.Proto.Faas.v1.InitResponse) content_ : null; } - set { - content_ = value; - contentCase_ = value == null ? ContentOneofCase.None : ContentOneofCase.InitResponse; - } - } - - /// Field number for the "trigger_request" field. - public const int TriggerRequestFieldNumber = 3; - /// - /// Server requesting client to - /// process a trigger - /// - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public global::Nitric.Proto.Faas.v1.TriggerRequest TriggerRequest { - get { return contentCase_ == ContentOneofCase.TriggerRequest ? (global::Nitric.Proto.Faas.v1.TriggerRequest) content_ : null; } - set { - content_ = value; - contentCase_ = value == null ? ContentOneofCase.None : ContentOneofCase.TriggerRequest; - } - } - - private object content_; - /// Enum of possible cases for the "content" oneof. - public enum ContentOneofCase { - None = 0, - InitResponse = 2, - TriggerRequest = 3, - } - private ContentOneofCase contentCase_ = ContentOneofCase.None; - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public ContentOneofCase ContentCase { - get { return contentCase_; } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void ClearContent() { - contentCase_ = ContentOneofCase.None; - content_ = null; - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public override bool Equals(object other) { - return Equals(other as ServerMessage); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public bool Equals(ServerMessage other) { - if (ReferenceEquals(other, null)) { - return false; - } - if (ReferenceEquals(other, this)) { - return true; - } - if (Id != other.Id) return false; - if (!object.Equals(InitResponse, other.InitResponse)) return false; - if (!object.Equals(TriggerRequest, other.TriggerRequest)) return false; - if (ContentCase != other.ContentCase) return false; - return Equals(_unknownFields, other._unknownFields); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public override int GetHashCode() { - int hash = 1; - if (Id.Length != 0) hash ^= Id.GetHashCode(); - if (contentCase_ == ContentOneofCase.InitResponse) hash ^= InitResponse.GetHashCode(); - if (contentCase_ == ContentOneofCase.TriggerRequest) hash ^= TriggerRequest.GetHashCode(); - hash ^= (int) contentCase_; - if (_unknownFields != null) { - hash ^= _unknownFields.GetHashCode(); - } - return hash; - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public override string ToString() { - return pb::JsonFormatter.ToDiagnosticString(this); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void WriteTo(pb::CodedOutputStream output) { - #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE - output.WriteRawMessage(this); - #else - if (Id.Length != 0) { - output.WriteRawTag(10); - output.WriteString(Id); - } - if (contentCase_ == ContentOneofCase.InitResponse) { - output.WriteRawTag(18); - output.WriteMessage(InitResponse); - } - if (contentCase_ == ContentOneofCase.TriggerRequest) { - output.WriteRawTag(26); - output.WriteMessage(TriggerRequest); - } - if (_unknownFields != null) { - _unknownFields.WriteTo(output); - } - #endif - } - - #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - void pb::IBufferMessage.InternalWriteTo(ref pb::WriteContext output) { - if (Id.Length != 0) { - output.WriteRawTag(10); - output.WriteString(Id); - } - if (contentCase_ == ContentOneofCase.InitResponse) { - output.WriteRawTag(18); - output.WriteMessage(InitResponse); - } - if (contentCase_ == ContentOneofCase.TriggerRequest) { - output.WriteRawTag(26); - output.WriteMessage(TriggerRequest); - } - if (_unknownFields != null) { - _unknownFields.WriteTo(ref output); - } - } - #endif - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public int CalculateSize() { - int size = 0; - if (Id.Length != 0) { - size += 1 + pb::CodedOutputStream.ComputeStringSize(Id); - } - if (contentCase_ == ContentOneofCase.InitResponse) { - size += 1 + pb::CodedOutputStream.ComputeMessageSize(InitResponse); - } - if (contentCase_ == ContentOneofCase.TriggerRequest) { - size += 1 + pb::CodedOutputStream.ComputeMessageSize(TriggerRequest); - } - if (_unknownFields != null) { - size += _unknownFields.CalculateSize(); - } - return size; - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void MergeFrom(ServerMessage other) { - if (other == null) { - return; - } - if (other.Id.Length != 0) { - Id = other.Id; - } - switch (other.ContentCase) { - case ContentOneofCase.InitResponse: - if (InitResponse == null) { - InitResponse = new global::Nitric.Proto.Faas.v1.InitResponse(); - } - InitResponse.MergeFrom(other.InitResponse); - break; - case ContentOneofCase.TriggerRequest: - if (TriggerRequest == null) { - TriggerRequest = new global::Nitric.Proto.Faas.v1.TriggerRequest(); - } - TriggerRequest.MergeFrom(other.TriggerRequest); - break; - } - - _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void MergeFrom(pb::CodedInputStream input) { - #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE - input.ReadRawMessage(this); - #else - uint tag; - while ((tag = input.ReadTag()) != 0) { - switch(tag) { - default: - _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input); - break; - case 10: { - Id = input.ReadString(); - break; - } - case 18: { - global::Nitric.Proto.Faas.v1.InitResponse subBuilder = new global::Nitric.Proto.Faas.v1.InitResponse(); - if (contentCase_ == ContentOneofCase.InitResponse) { - subBuilder.MergeFrom(InitResponse); - } - input.ReadMessage(subBuilder); - InitResponse = subBuilder; - break; - } - case 26: { - global::Nitric.Proto.Faas.v1.TriggerRequest subBuilder = new global::Nitric.Proto.Faas.v1.TriggerRequest(); - if (contentCase_ == ContentOneofCase.TriggerRequest) { - subBuilder.MergeFrom(TriggerRequest); - } - input.ReadMessage(subBuilder); - TriggerRequest = subBuilder; - break; - } - } - } - #endif - } - - #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - void pb::IBufferMessage.InternalMergeFrom(ref pb::ParseContext input) { - uint tag; - while ((tag = input.ReadTag()) != 0) { - switch(tag) { - default: - _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, ref input); - break; - case 10: { - Id = input.ReadString(); - break; - } - case 18: { - global::Nitric.Proto.Faas.v1.InitResponse subBuilder = new global::Nitric.Proto.Faas.v1.InitResponse(); - if (contentCase_ == ContentOneofCase.InitResponse) { - subBuilder.MergeFrom(InitResponse); - } - input.ReadMessage(subBuilder); - InitResponse = subBuilder; - break; - } - case 26: { - global::Nitric.Proto.Faas.v1.TriggerRequest subBuilder = new global::Nitric.Proto.Faas.v1.TriggerRequest(); - if (contentCase_ == ContentOneofCase.TriggerRequest) { - subBuilder.MergeFrom(TriggerRequest); - } - input.ReadMessage(subBuilder); - TriggerRequest = subBuilder; - break; - } - } - } - } - #endif - - } - - public sealed partial class ApiWorkerScopes : pb::IMessage - #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE - , pb::IBufferMessage - #endif - { - private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new ApiWorkerScopes()); - private pb::UnknownFieldSet _unknownFields; - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public static pb::MessageParser Parser { get { return _parser; } } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public static pbr::MessageDescriptor Descriptor { - get { return global::Nitric.Proto.Faas.v1.FaasReflection.Descriptor.MessageTypes[2]; } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - pbr::MessageDescriptor pb::IMessage.Descriptor { - get { return Descriptor; } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public ApiWorkerScopes() { - OnConstruction(); - } - - partial void OnConstruction(); - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public ApiWorkerScopes(ApiWorkerScopes other) : this() { - scopes_ = other.scopes_.Clone(); - _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public ApiWorkerScopes Clone() { - return new ApiWorkerScopes(this); - } - - /// Field number for the "scopes" field. - public const int ScopesFieldNumber = 1; - private static readonly pb::FieldCodec _repeated_scopes_codec - = pb::FieldCodec.ForString(10); - private readonly pbc::RepeatedField scopes_ = new pbc::RepeatedField(); - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public pbc::RepeatedField Scopes { - get { return scopes_; } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public override bool Equals(object other) { - return Equals(other as ApiWorkerScopes); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public bool Equals(ApiWorkerScopes other) { - if (ReferenceEquals(other, null)) { - return false; - } - if (ReferenceEquals(other, this)) { - return true; - } - if(!scopes_.Equals(other.scopes_)) return false; - return Equals(_unknownFields, other._unknownFields); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public override int GetHashCode() { - int hash = 1; - hash ^= scopes_.GetHashCode(); - if (_unknownFields != null) { - hash ^= _unknownFields.GetHashCode(); - } - return hash; - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public override string ToString() { - return pb::JsonFormatter.ToDiagnosticString(this); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void WriteTo(pb::CodedOutputStream output) { - #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE - output.WriteRawMessage(this); - #else - scopes_.WriteTo(output, _repeated_scopes_codec); - if (_unknownFields != null) { - _unknownFields.WriteTo(output); - } - #endif - } - - #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - void pb::IBufferMessage.InternalWriteTo(ref pb::WriteContext output) { - scopes_.WriteTo(ref output, _repeated_scopes_codec); - if (_unknownFields != null) { - _unknownFields.WriteTo(ref output); - } - } - #endif - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public int CalculateSize() { - int size = 0; - size += scopes_.CalculateSize(_repeated_scopes_codec); - if (_unknownFields != null) { - size += _unknownFields.CalculateSize(); - } - return size; - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void MergeFrom(ApiWorkerScopes other) { - if (other == null) { - return; - } - scopes_.Add(other.scopes_); - _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void MergeFrom(pb::CodedInputStream input) { - #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE - input.ReadRawMessage(this); - #else - uint tag; - while ((tag = input.ReadTag()) != 0) { - switch(tag) { - default: - _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input); - break; - case 10: { - scopes_.AddEntriesFrom(input, _repeated_scopes_codec); - break; - } - } - } - #endif - } - - #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - void pb::IBufferMessage.InternalMergeFrom(ref pb::ParseContext input) { - uint tag; - while ((tag = input.ReadTag()) != 0) { - switch(tag) { - default: - _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, ref input); - break; - case 10: { - scopes_.AddEntriesFrom(ref input, _repeated_scopes_codec); - break; - } - } - } - } - #endif - - } - - public sealed partial class ApiWorkerOptions : pb::IMessage - #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE - , pb::IBufferMessage - #endif - { - private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new ApiWorkerOptions()); - private pb::UnknownFieldSet _unknownFields; - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public static pb::MessageParser Parser { get { return _parser; } } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public static pbr::MessageDescriptor Descriptor { - get { return global::Nitric.Proto.Faas.v1.FaasReflection.Descriptor.MessageTypes[3]; } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - pbr::MessageDescriptor pb::IMessage.Descriptor { - get { return Descriptor; } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public ApiWorkerOptions() { - OnConstruction(); - } - - partial void OnConstruction(); - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public ApiWorkerOptions(ApiWorkerOptions other) : this() { - security_ = other.security_.Clone(); - securityDisabled_ = other.securityDisabled_; - _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public ApiWorkerOptions Clone() { - return new ApiWorkerOptions(this); - } - - /// Field number for the "security" field. - public const int SecurityFieldNumber = 1; - private static readonly pbc::MapField.Codec _map_security_codec - = new pbc::MapField.Codec(pb::FieldCodec.ForString(10, ""), pb::FieldCodec.ForMessage(18, global::Nitric.Proto.Faas.v1.ApiWorkerScopes.Parser), 10); - private readonly pbc::MapField security_ = new pbc::MapField(); - /// - /// Apply security definitions to this operation - /// - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public pbc::MapField Security { - get { return security_; } - } - - /// Field number for the "security_disabled" field. - public const int SecurityDisabledFieldNumber = 2; - private bool securityDisabled_; - /// - /// explicitly disable security for this endpoint - /// We need to do this as the default value of a repeated field - /// is always empty so there is no way of knowing if security is explicitly disabled - /// - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public bool SecurityDisabled { - get { return securityDisabled_; } - set { - securityDisabled_ = value; - } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public override bool Equals(object other) { - return Equals(other as ApiWorkerOptions); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public bool Equals(ApiWorkerOptions other) { - if (ReferenceEquals(other, null)) { - return false; - } - if (ReferenceEquals(other, this)) { - return true; - } - if (!Security.Equals(other.Security)) return false; - if (SecurityDisabled != other.SecurityDisabled) return false; - return Equals(_unknownFields, other._unknownFields); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public override int GetHashCode() { - int hash = 1; - hash ^= Security.GetHashCode(); - if (SecurityDisabled != false) hash ^= SecurityDisabled.GetHashCode(); - if (_unknownFields != null) { - hash ^= _unknownFields.GetHashCode(); - } - return hash; - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public override string ToString() { - return pb::JsonFormatter.ToDiagnosticString(this); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void WriteTo(pb::CodedOutputStream output) { - #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE - output.WriteRawMessage(this); - #else - security_.WriteTo(output, _map_security_codec); - if (SecurityDisabled != false) { - output.WriteRawTag(16); - output.WriteBool(SecurityDisabled); - } - if (_unknownFields != null) { - _unknownFields.WriteTo(output); - } - #endif - } - - #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - void pb::IBufferMessage.InternalWriteTo(ref pb::WriteContext output) { - security_.WriteTo(ref output, _map_security_codec); - if (SecurityDisabled != false) { - output.WriteRawTag(16); - output.WriteBool(SecurityDisabled); - } - if (_unknownFields != null) { - _unknownFields.WriteTo(ref output); - } - } - #endif - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public int CalculateSize() { - int size = 0; - size += security_.CalculateSize(_map_security_codec); - if (SecurityDisabled != false) { - size += 1 + 1; - } - if (_unknownFields != null) { - size += _unknownFields.CalculateSize(); - } - return size; - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void MergeFrom(ApiWorkerOptions other) { - if (other == null) { - return; - } - security_.Add(other.security_); - if (other.SecurityDisabled != false) { - SecurityDisabled = other.SecurityDisabled; - } - _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void MergeFrom(pb::CodedInputStream input) { - #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE - input.ReadRawMessage(this); - #else - uint tag; - while ((tag = input.ReadTag()) != 0) { - switch(tag) { - default: - _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input); - break; - case 10: { - security_.AddEntriesFrom(input, _map_security_codec); - break; - } - case 16: { - SecurityDisabled = input.ReadBool(); - break; - } - } - } - #endif - } - - #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - void pb::IBufferMessage.InternalMergeFrom(ref pb::ParseContext input) { - uint tag; - while ((tag = input.ReadTag()) != 0) { - switch(tag) { - default: - _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, ref input); - break; - case 10: { - security_.AddEntriesFrom(ref input, _map_security_codec); - break; - } - case 16: { - SecurityDisabled = input.ReadBool(); - break; - } - } - } - } - #endif - - } - - public sealed partial class ApiWorker : pb::IMessage - #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE - , pb::IBufferMessage - #endif - { - private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new ApiWorker()); - private pb::UnknownFieldSet _unknownFields; - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public static pb::MessageParser Parser { get { return _parser; } } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public static pbr::MessageDescriptor Descriptor { - get { return global::Nitric.Proto.Faas.v1.FaasReflection.Descriptor.MessageTypes[4]; } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - pbr::MessageDescriptor pb::IMessage.Descriptor { - get { return Descriptor; } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public ApiWorker() { - OnConstruction(); - } - - partial void OnConstruction(); - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public ApiWorker(ApiWorker other) : this() { - api_ = other.api_; - path_ = other.path_; - methods_ = other.methods_.Clone(); - options_ = other.options_ != null ? other.options_.Clone() : null; - _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public ApiWorker Clone() { - return new ApiWorker(this); - } - - /// Field number for the "api" field. - public const int ApiFieldNumber = 1; - private string api_ = ""; - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public string Api { - get { return api_; } - set { - api_ = pb::ProtoPreconditions.CheckNotNull(value, "value"); - } - } - - /// Field number for the "path" field. - public const int PathFieldNumber = 2; - private string path_ = ""; - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public string Path { - get { return path_; } - set { - path_ = pb::ProtoPreconditions.CheckNotNull(value, "value"); - } - } - - /// Field number for the "methods" field. - public const int MethodsFieldNumber = 3; - private static readonly pb::FieldCodec _repeated_methods_codec - = pb::FieldCodec.ForString(26); - private readonly pbc::RepeatedField methods_ = new pbc::RepeatedField(); - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public pbc::RepeatedField Methods { - get { return methods_; } - } - - /// Field number for the "options" field. - public const int OptionsFieldNumber = 4; - private global::Nitric.Proto.Faas.v1.ApiWorkerOptions options_; - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public global::Nitric.Proto.Faas.v1.ApiWorkerOptions Options { - get { return options_; } - set { - options_ = value; - } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public override bool Equals(object other) { - return Equals(other as ApiWorker); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public bool Equals(ApiWorker other) { - if (ReferenceEquals(other, null)) { - return false; - } - if (ReferenceEquals(other, this)) { - return true; - } - if (Api != other.Api) return false; - if (Path != other.Path) return false; - if(!methods_.Equals(other.methods_)) return false; - if (!object.Equals(Options, other.Options)) return false; - return Equals(_unknownFields, other._unknownFields); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public override int GetHashCode() { - int hash = 1; - if (Api.Length != 0) hash ^= Api.GetHashCode(); - if (Path.Length != 0) hash ^= Path.GetHashCode(); - hash ^= methods_.GetHashCode(); - if (options_ != null) hash ^= Options.GetHashCode(); - if (_unknownFields != null) { - hash ^= _unknownFields.GetHashCode(); - } - return hash; - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public override string ToString() { - return pb::JsonFormatter.ToDiagnosticString(this); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void WriteTo(pb::CodedOutputStream output) { - #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE - output.WriteRawMessage(this); - #else - if (Api.Length != 0) { - output.WriteRawTag(10); - output.WriteString(Api); - } - if (Path.Length != 0) { - output.WriteRawTag(18); - output.WriteString(Path); - } - methods_.WriteTo(output, _repeated_methods_codec); - if (options_ != null) { - output.WriteRawTag(34); - output.WriteMessage(Options); - } - if (_unknownFields != null) { - _unknownFields.WriteTo(output); - } - #endif - } - - #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - void pb::IBufferMessage.InternalWriteTo(ref pb::WriteContext output) { - if (Api.Length != 0) { - output.WriteRawTag(10); - output.WriteString(Api); - } - if (Path.Length != 0) { - output.WriteRawTag(18); - output.WriteString(Path); - } - methods_.WriteTo(ref output, _repeated_methods_codec); - if (options_ != null) { - output.WriteRawTag(34); - output.WriteMessage(Options); - } - if (_unknownFields != null) { - _unknownFields.WriteTo(ref output); - } - } - #endif - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public int CalculateSize() { - int size = 0; - if (Api.Length != 0) { - size += 1 + pb::CodedOutputStream.ComputeStringSize(Api); - } - if (Path.Length != 0) { - size += 1 + pb::CodedOutputStream.ComputeStringSize(Path); - } - size += methods_.CalculateSize(_repeated_methods_codec); - if (options_ != null) { - size += 1 + pb::CodedOutputStream.ComputeMessageSize(Options); - } - if (_unknownFields != null) { - size += _unknownFields.CalculateSize(); - } - return size; - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void MergeFrom(ApiWorker other) { - if (other == null) { - return; - } - if (other.Api.Length != 0) { - Api = other.Api; - } - if (other.Path.Length != 0) { - Path = other.Path; - } - methods_.Add(other.methods_); - if (other.options_ != null) { - if (options_ == null) { - Options = new global::Nitric.Proto.Faas.v1.ApiWorkerOptions(); - } - Options.MergeFrom(other.Options); - } - _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void MergeFrom(pb::CodedInputStream input) { - #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE - input.ReadRawMessage(this); - #else - uint tag; - while ((tag = input.ReadTag()) != 0) { - switch(tag) { - default: - _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input); - break; - case 10: { - Api = input.ReadString(); - break; - } - case 18: { - Path = input.ReadString(); - break; - } - case 26: { - methods_.AddEntriesFrom(input, _repeated_methods_codec); - break; - } - case 34: { - if (options_ == null) { - Options = new global::Nitric.Proto.Faas.v1.ApiWorkerOptions(); - } - input.ReadMessage(Options); - break; - } - } - } - #endif - } - - #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - void pb::IBufferMessage.InternalMergeFrom(ref pb::ParseContext input) { - uint tag; - while ((tag = input.ReadTag()) != 0) { - switch(tag) { - default: - _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, ref input); - break; - case 10: { - Api = input.ReadString(); - break; - } - case 18: { - Path = input.ReadString(); - break; - } - case 26: { - methods_.AddEntriesFrom(ref input, _repeated_methods_codec); - break; - } - case 34: { - if (options_ == null) { - Options = new global::Nitric.Proto.Faas.v1.ApiWorkerOptions(); - } - input.ReadMessage(Options); - break; - } - } - } - } - #endif - - } - - public sealed partial class SubscriptionWorker : pb::IMessage - #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE - , pb::IBufferMessage - #endif - { - private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new SubscriptionWorker()); - private pb::UnknownFieldSet _unknownFields; - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public static pb::MessageParser Parser { get { return _parser; } } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public static pbr::MessageDescriptor Descriptor { - get { return global::Nitric.Proto.Faas.v1.FaasReflection.Descriptor.MessageTypes[5]; } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - pbr::MessageDescriptor pb::IMessage.Descriptor { - get { return Descriptor; } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public SubscriptionWorker() { - OnConstruction(); - } - - partial void OnConstruction(); - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public SubscriptionWorker(SubscriptionWorker other) : this() { - topic_ = other.topic_; - _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public SubscriptionWorker Clone() { - return new SubscriptionWorker(this); - } - - /// Field number for the "topic" field. - public const int TopicFieldNumber = 1; - private string topic_ = ""; - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public string Topic { - get { return topic_; } - set { - topic_ = pb::ProtoPreconditions.CheckNotNull(value, "value"); - } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public override bool Equals(object other) { - return Equals(other as SubscriptionWorker); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public bool Equals(SubscriptionWorker other) { - if (ReferenceEquals(other, null)) { - return false; - } - if (ReferenceEquals(other, this)) { - return true; - } - if (Topic != other.Topic) return false; - return Equals(_unknownFields, other._unknownFields); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public override int GetHashCode() { - int hash = 1; - if (Topic.Length != 0) hash ^= Topic.GetHashCode(); - if (_unknownFields != null) { - hash ^= _unknownFields.GetHashCode(); - } - return hash; - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public override string ToString() { - return pb::JsonFormatter.ToDiagnosticString(this); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void WriteTo(pb::CodedOutputStream output) { - #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE - output.WriteRawMessage(this); - #else - if (Topic.Length != 0) { - output.WriteRawTag(10); - output.WriteString(Topic); - } - if (_unknownFields != null) { - _unknownFields.WriteTo(output); - } - #endif - } - - #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - void pb::IBufferMessage.InternalWriteTo(ref pb::WriteContext output) { - if (Topic.Length != 0) { - output.WriteRawTag(10); - output.WriteString(Topic); - } - if (_unknownFields != null) { - _unknownFields.WriteTo(ref output); - } - } - #endif - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public int CalculateSize() { - int size = 0; - if (Topic.Length != 0) { - size += 1 + pb::CodedOutputStream.ComputeStringSize(Topic); - } - if (_unknownFields != null) { - size += _unknownFields.CalculateSize(); - } - return size; - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void MergeFrom(SubscriptionWorker other) { - if (other == null) { - return; - } - if (other.Topic.Length != 0) { - Topic = other.Topic; - } - _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void MergeFrom(pb::CodedInputStream input) { - #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE - input.ReadRawMessage(this); - #else - uint tag; - while ((tag = input.ReadTag()) != 0) { - switch(tag) { - default: - _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input); - break; - case 10: { - Topic = input.ReadString(); - break; - } - } - } - #endif - } - - #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - void pb::IBufferMessage.InternalMergeFrom(ref pb::ParseContext input) { - uint tag; - while ((tag = input.ReadTag()) != 0) { - switch(tag) { - default: - _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, ref input); - break; - case 10: { - Topic = input.ReadString(); - break; - } - } - } - } - #endif - - } - - public sealed partial class ScheduleWorker : pb::IMessage - #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE - , pb::IBufferMessage - #endif - { - private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new ScheduleWorker()); - private pb::UnknownFieldSet _unknownFields; - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public static pb::MessageParser Parser { get { return _parser; } } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public static pbr::MessageDescriptor Descriptor { - get { return global::Nitric.Proto.Faas.v1.FaasReflection.Descriptor.MessageTypes[6]; } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - pbr::MessageDescriptor pb::IMessage.Descriptor { - get { return Descriptor; } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public ScheduleWorker() { - OnConstruction(); - } - - partial void OnConstruction(); - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public ScheduleWorker(ScheduleWorker other) : this() { - key_ = other.key_; - switch (other.CadenceCase) { - case CadenceOneofCase.Rate: - Rate = other.Rate.Clone(); - break; - case CadenceOneofCase.Cron: - Cron = other.Cron.Clone(); - break; - } - - _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public ScheduleWorker Clone() { - return new ScheduleWorker(this); - } - - /// Field number for the "key" field. - public const int KeyFieldNumber = 1; - private string key_ = ""; - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public string Key { - get { return key_; } - set { - key_ = pb::ProtoPreconditions.CheckNotNull(value, "value"); - } - } - - /// Field number for the "rate" field. - public const int RateFieldNumber = 10; - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public global::Nitric.Proto.Faas.v1.ScheduleRate Rate { - get { return cadenceCase_ == CadenceOneofCase.Rate ? (global::Nitric.Proto.Faas.v1.ScheduleRate) cadence_ : null; } - set { - cadence_ = value; - cadenceCase_ = value == null ? CadenceOneofCase.None : CadenceOneofCase.Rate; - } - } - - /// Field number for the "cron" field. - public const int CronFieldNumber = 11; - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public global::Nitric.Proto.Faas.v1.ScheduleCron Cron { - get { return cadenceCase_ == CadenceOneofCase.Cron ? (global::Nitric.Proto.Faas.v1.ScheduleCron) cadence_ : null; } - set { - cadence_ = value; - cadenceCase_ = value == null ? CadenceOneofCase.None : CadenceOneofCase.Cron; - } - } - - private object cadence_; - /// Enum of possible cases for the "cadence" oneof. - public enum CadenceOneofCase { - None = 0, - Rate = 10, - Cron = 11, - } - private CadenceOneofCase cadenceCase_ = CadenceOneofCase.None; - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public CadenceOneofCase CadenceCase { - get { return cadenceCase_; } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void ClearCadence() { - cadenceCase_ = CadenceOneofCase.None; - cadence_ = null; - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public override bool Equals(object other) { - return Equals(other as ScheduleWorker); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public bool Equals(ScheduleWorker other) { - if (ReferenceEquals(other, null)) { - return false; - } - if (ReferenceEquals(other, this)) { - return true; - } - if (Key != other.Key) return false; - if (!object.Equals(Rate, other.Rate)) return false; - if (!object.Equals(Cron, other.Cron)) return false; - if (CadenceCase != other.CadenceCase) return false; - return Equals(_unknownFields, other._unknownFields); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public override int GetHashCode() { - int hash = 1; - if (Key.Length != 0) hash ^= Key.GetHashCode(); - if (cadenceCase_ == CadenceOneofCase.Rate) hash ^= Rate.GetHashCode(); - if (cadenceCase_ == CadenceOneofCase.Cron) hash ^= Cron.GetHashCode(); - hash ^= (int) cadenceCase_; - if (_unknownFields != null) { - hash ^= _unknownFields.GetHashCode(); - } - return hash; - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public override string ToString() { - return pb::JsonFormatter.ToDiagnosticString(this); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void WriteTo(pb::CodedOutputStream output) { - #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE - output.WriteRawMessage(this); - #else - if (Key.Length != 0) { - output.WriteRawTag(10); - output.WriteString(Key); - } - if (cadenceCase_ == CadenceOneofCase.Rate) { - output.WriteRawTag(82); - output.WriteMessage(Rate); - } - if (cadenceCase_ == CadenceOneofCase.Cron) { - output.WriteRawTag(90); - output.WriteMessage(Cron); - } - if (_unknownFields != null) { - _unknownFields.WriteTo(output); - } - #endif - } - - #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - void pb::IBufferMessage.InternalWriteTo(ref pb::WriteContext output) { - if (Key.Length != 0) { - output.WriteRawTag(10); - output.WriteString(Key); - } - if (cadenceCase_ == CadenceOneofCase.Rate) { - output.WriteRawTag(82); - output.WriteMessage(Rate); - } - if (cadenceCase_ == CadenceOneofCase.Cron) { - output.WriteRawTag(90); - output.WriteMessage(Cron); - } - if (_unknownFields != null) { - _unknownFields.WriteTo(ref output); - } - } - #endif - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public int CalculateSize() { - int size = 0; - if (Key.Length != 0) { - size += 1 + pb::CodedOutputStream.ComputeStringSize(Key); - } - if (cadenceCase_ == CadenceOneofCase.Rate) { - size += 1 + pb::CodedOutputStream.ComputeMessageSize(Rate); - } - if (cadenceCase_ == CadenceOneofCase.Cron) { - size += 1 + pb::CodedOutputStream.ComputeMessageSize(Cron); - } - if (_unknownFields != null) { - size += _unknownFields.CalculateSize(); - } - return size; - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void MergeFrom(ScheduleWorker other) { - if (other == null) { - return; - } - if (other.Key.Length != 0) { - Key = other.Key; - } - switch (other.CadenceCase) { - case CadenceOneofCase.Rate: - if (Rate == null) { - Rate = new global::Nitric.Proto.Faas.v1.ScheduleRate(); - } - Rate.MergeFrom(other.Rate); - break; - case CadenceOneofCase.Cron: - if (Cron == null) { - Cron = new global::Nitric.Proto.Faas.v1.ScheduleCron(); - } - Cron.MergeFrom(other.Cron); - break; - } - - _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void MergeFrom(pb::CodedInputStream input) { - #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE - input.ReadRawMessage(this); - #else - uint tag; - while ((tag = input.ReadTag()) != 0) { - switch(tag) { - default: - _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input); - break; - case 10: { - Key = input.ReadString(); - break; - } - case 82: { - global::Nitric.Proto.Faas.v1.ScheduleRate subBuilder = new global::Nitric.Proto.Faas.v1.ScheduleRate(); - if (cadenceCase_ == CadenceOneofCase.Rate) { - subBuilder.MergeFrom(Rate); - } - input.ReadMessage(subBuilder); - Rate = subBuilder; - break; - } - case 90: { - global::Nitric.Proto.Faas.v1.ScheduleCron subBuilder = new global::Nitric.Proto.Faas.v1.ScheduleCron(); - if (cadenceCase_ == CadenceOneofCase.Cron) { - subBuilder.MergeFrom(Cron); - } - input.ReadMessage(subBuilder); - Cron = subBuilder; - break; - } - } - } - #endif - } - - #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - void pb::IBufferMessage.InternalMergeFrom(ref pb::ParseContext input) { - uint tag; - while ((tag = input.ReadTag()) != 0) { - switch(tag) { - default: - _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, ref input); - break; - case 10: { - Key = input.ReadString(); - break; - } - case 82: { - global::Nitric.Proto.Faas.v1.ScheduleRate subBuilder = new global::Nitric.Proto.Faas.v1.ScheduleRate(); - if (cadenceCase_ == CadenceOneofCase.Rate) { - subBuilder.MergeFrom(Rate); - } - input.ReadMessage(subBuilder); - Rate = subBuilder; - break; - } - case 90: { - global::Nitric.Proto.Faas.v1.ScheduleCron subBuilder = new global::Nitric.Proto.Faas.v1.ScheduleCron(); - if (cadenceCase_ == CadenceOneofCase.Cron) { - subBuilder.MergeFrom(Cron); - } - input.ReadMessage(subBuilder); - Cron = subBuilder; - break; - } - } - } - } - #endif - - } - - public sealed partial class ScheduleRate : pb::IMessage - #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE - , pb::IBufferMessage - #endif - { - private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new ScheduleRate()); - private pb::UnknownFieldSet _unknownFields; - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public static pb::MessageParser Parser { get { return _parser; } } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public static pbr::MessageDescriptor Descriptor { - get { return global::Nitric.Proto.Faas.v1.FaasReflection.Descriptor.MessageTypes[7]; } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - pbr::MessageDescriptor pb::IMessage.Descriptor { - get { return Descriptor; } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public ScheduleRate() { - OnConstruction(); - } - - partial void OnConstruction(); - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public ScheduleRate(ScheduleRate other) : this() { - rate_ = other.rate_; - _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public ScheduleRate Clone() { - return new ScheduleRate(this); - } - - /// Field number for the "rate" field. - public const int RateFieldNumber = 1; - private string rate_ = ""; - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public string Rate { - get { return rate_; } - set { - rate_ = pb::ProtoPreconditions.CheckNotNull(value, "value"); - } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public override bool Equals(object other) { - return Equals(other as ScheduleRate); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public bool Equals(ScheduleRate other) { - if (ReferenceEquals(other, null)) { - return false; - } - if (ReferenceEquals(other, this)) { - return true; - } - if (Rate != other.Rate) return false; - return Equals(_unknownFields, other._unknownFields); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public override int GetHashCode() { - int hash = 1; - if (Rate.Length != 0) hash ^= Rate.GetHashCode(); - if (_unknownFields != null) { - hash ^= _unknownFields.GetHashCode(); - } - return hash; - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public override string ToString() { - return pb::JsonFormatter.ToDiagnosticString(this); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void WriteTo(pb::CodedOutputStream output) { - #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE - output.WriteRawMessage(this); - #else - if (Rate.Length != 0) { - output.WriteRawTag(10); - output.WriteString(Rate); - } - if (_unknownFields != null) { - _unknownFields.WriteTo(output); - } - #endif - } - - #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - void pb::IBufferMessage.InternalWriteTo(ref pb::WriteContext output) { - if (Rate.Length != 0) { - output.WriteRawTag(10); - output.WriteString(Rate); - } - if (_unknownFields != null) { - _unknownFields.WriteTo(ref output); - } - } - #endif - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public int CalculateSize() { - int size = 0; - if (Rate.Length != 0) { - size += 1 + pb::CodedOutputStream.ComputeStringSize(Rate); - } - if (_unknownFields != null) { - size += _unknownFields.CalculateSize(); - } - return size; - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void MergeFrom(ScheduleRate other) { - if (other == null) { - return; - } - if (other.Rate.Length != 0) { - Rate = other.Rate; - } - _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void MergeFrom(pb::CodedInputStream input) { - #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE - input.ReadRawMessage(this); - #else - uint tag; - while ((tag = input.ReadTag()) != 0) { - switch(tag) { - default: - _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input); - break; - case 10: { - Rate = input.ReadString(); - break; - } - } - } - #endif - } - - #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - void pb::IBufferMessage.InternalMergeFrom(ref pb::ParseContext input) { - uint tag; - while ((tag = input.ReadTag()) != 0) { - switch(tag) { - default: - _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, ref input); - break; - case 10: { - Rate = input.ReadString(); - break; - } - } - } - } - #endif - - } - - public sealed partial class ScheduleCron : pb::IMessage - #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE - , pb::IBufferMessage - #endif - { - private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new ScheduleCron()); - private pb::UnknownFieldSet _unknownFields; - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public static pb::MessageParser Parser { get { return _parser; } } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public static pbr::MessageDescriptor Descriptor { - get { return global::Nitric.Proto.Faas.v1.FaasReflection.Descriptor.MessageTypes[8]; } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - pbr::MessageDescriptor pb::IMessage.Descriptor { - get { return Descriptor; } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public ScheduleCron() { - OnConstruction(); - } - - partial void OnConstruction(); - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public ScheduleCron(ScheduleCron other) : this() { - cron_ = other.cron_; - _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public ScheduleCron Clone() { - return new ScheduleCron(this); - } - - /// Field number for the "cron" field. - public const int CronFieldNumber = 1; - private string cron_ = ""; - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public string Cron { - get { return cron_; } - set { - cron_ = pb::ProtoPreconditions.CheckNotNull(value, "value"); - } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public override bool Equals(object other) { - return Equals(other as ScheduleCron); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public bool Equals(ScheduleCron other) { - if (ReferenceEquals(other, null)) { - return false; - } - if (ReferenceEquals(other, this)) { - return true; - } - if (Cron != other.Cron) return false; - return Equals(_unknownFields, other._unknownFields); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public override int GetHashCode() { - int hash = 1; - if (Cron.Length != 0) hash ^= Cron.GetHashCode(); - if (_unknownFields != null) { - hash ^= _unknownFields.GetHashCode(); - } - return hash; - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public override string ToString() { - return pb::JsonFormatter.ToDiagnosticString(this); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void WriteTo(pb::CodedOutputStream output) { - #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE - output.WriteRawMessage(this); - #else - if (Cron.Length != 0) { - output.WriteRawTag(10); - output.WriteString(Cron); - } - if (_unknownFields != null) { - _unknownFields.WriteTo(output); - } - #endif - } - - #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - void pb::IBufferMessage.InternalWriteTo(ref pb::WriteContext output) { - if (Cron.Length != 0) { - output.WriteRawTag(10); - output.WriteString(Cron); - } - if (_unknownFields != null) { - _unknownFields.WriteTo(ref output); - } - } - #endif - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public int CalculateSize() { - int size = 0; - if (Cron.Length != 0) { - size += 1 + pb::CodedOutputStream.ComputeStringSize(Cron); - } - if (_unknownFields != null) { - size += _unknownFields.CalculateSize(); - } - return size; - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void MergeFrom(ScheduleCron other) { - if (other == null) { - return; - } - if (other.Cron.Length != 0) { - Cron = other.Cron; - } - _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void MergeFrom(pb::CodedInputStream input) { - #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE - input.ReadRawMessage(this); - #else - uint tag; - while ((tag = input.ReadTag()) != 0) { - switch(tag) { - default: - _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input); - break; - case 10: { - Cron = input.ReadString(); - break; - } - } - } - #endif - } - - #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - void pb::IBufferMessage.InternalMergeFrom(ref pb::ParseContext input) { - uint tag; - while ((tag = input.ReadTag()) != 0) { - switch(tag) { - default: - _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, ref input); - break; - case 10: { - Cron = input.ReadString(); - break; - } - } - } - } - #endif - - } - - public sealed partial class HttpWorker : pb::IMessage - #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE - , pb::IBufferMessage - #endif - { - private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new HttpWorker()); - private pb::UnknownFieldSet _unknownFields; - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public static pb::MessageParser Parser { get { return _parser; } } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public static pbr::MessageDescriptor Descriptor { - get { return global::Nitric.Proto.Faas.v1.FaasReflection.Descriptor.MessageTypes[9]; } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - pbr::MessageDescriptor pb::IMessage.Descriptor { - get { return Descriptor; } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public HttpWorker() { - OnConstruction(); - } - - partial void OnConstruction(); - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public HttpWorker(HttpWorker other) : this() { - port_ = other.port_; - _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public HttpWorker Clone() { - return new HttpWorker(this); - } - - /// Field number for the "port" field. - public const int PortFieldNumber = 1; - private int port_; - /// - /// The local port the server can be accessed on - /// - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public int Port { - get { return port_; } - set { - port_ = value; - } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public override bool Equals(object other) { - return Equals(other as HttpWorker); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public bool Equals(HttpWorker other) { - if (ReferenceEquals(other, null)) { - return false; - } - if (ReferenceEquals(other, this)) { - return true; - } - if (Port != other.Port) return false; - return Equals(_unknownFields, other._unknownFields); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public override int GetHashCode() { - int hash = 1; - if (Port != 0) hash ^= Port.GetHashCode(); - if (_unknownFields != null) { - hash ^= _unknownFields.GetHashCode(); - } - return hash; - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public override string ToString() { - return pb::JsonFormatter.ToDiagnosticString(this); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void WriteTo(pb::CodedOutputStream output) { - #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE - output.WriteRawMessage(this); - #else - if (Port != 0) { - output.WriteRawTag(8); - output.WriteInt32(Port); - } - if (_unknownFields != null) { - _unknownFields.WriteTo(output); - } - #endif - } - - #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - void pb::IBufferMessage.InternalWriteTo(ref pb::WriteContext output) { - if (Port != 0) { - output.WriteRawTag(8); - output.WriteInt32(Port); - } - if (_unknownFields != null) { - _unknownFields.WriteTo(ref output); - } - } - #endif - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public int CalculateSize() { - int size = 0; - if (Port != 0) { - size += 1 + pb::CodedOutputStream.ComputeInt32Size(Port); - } - if (_unknownFields != null) { - size += _unknownFields.CalculateSize(); - } - return size; - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void MergeFrom(HttpWorker other) { - if (other == null) { - return; - } - if (other.Port != 0) { - Port = other.Port; - } - _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void MergeFrom(pb::CodedInputStream input) { - #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE - input.ReadRawMessage(this); - #else - uint tag; - while ((tag = input.ReadTag()) != 0) { - switch(tag) { - default: - _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input); - break; - case 8: { - Port = input.ReadInt32(); - break; - } - } - } - #endif - } - - #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - void pb::IBufferMessage.InternalMergeFrom(ref pb::ParseContext input) { - uint tag; - while ((tag = input.ReadTag()) != 0) { - switch(tag) { - default: - _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, ref input); - break; - case 8: { - Port = input.ReadInt32(); - break; - } - } - } - } - #endif - - } - - public sealed partial class BucketNotificationWorker : pb::IMessage - #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE - , pb::IBufferMessage - #endif - { - private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new BucketNotificationWorker()); - private pb::UnknownFieldSet _unknownFields; - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public static pb::MessageParser Parser { get { return _parser; } } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public static pbr::MessageDescriptor Descriptor { - get { return global::Nitric.Proto.Faas.v1.FaasReflection.Descriptor.MessageTypes[10]; } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - pbr::MessageDescriptor pb::IMessage.Descriptor { - get { return Descriptor; } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public BucketNotificationWorker() { - OnConstruction(); - } - - partial void OnConstruction(); - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public BucketNotificationWorker(BucketNotificationWorker other) : this() { - bucket_ = other.bucket_; - config_ = other.config_ != null ? other.config_.Clone() : null; - _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public BucketNotificationWorker Clone() { - return new BucketNotificationWorker(this); - } - - /// Field number for the "bucket" field. - public const int BucketFieldNumber = 1; - private string bucket_ = ""; - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public string Bucket { - get { return bucket_; } - set { - bucket_ = pb::ProtoPreconditions.CheckNotNull(value, "value"); - } - } - - /// Field number for the "config" field. - public const int ConfigFieldNumber = 2; - private global::Nitric.Proto.Faas.v1.BucketNotificationConfig config_; - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public global::Nitric.Proto.Faas.v1.BucketNotificationConfig Config { - get { return config_; } - set { - config_ = value; - } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public override bool Equals(object other) { - return Equals(other as BucketNotificationWorker); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public bool Equals(BucketNotificationWorker other) { - if (ReferenceEquals(other, null)) { - return false; - } - if (ReferenceEquals(other, this)) { - return true; - } - if (Bucket != other.Bucket) return false; - if (!object.Equals(Config, other.Config)) return false; - return Equals(_unknownFields, other._unknownFields); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public override int GetHashCode() { - int hash = 1; - if (Bucket.Length != 0) hash ^= Bucket.GetHashCode(); - if (config_ != null) hash ^= Config.GetHashCode(); - if (_unknownFields != null) { - hash ^= _unknownFields.GetHashCode(); - } - return hash; - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public override string ToString() { - return pb::JsonFormatter.ToDiagnosticString(this); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void WriteTo(pb::CodedOutputStream output) { - #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE - output.WriteRawMessage(this); - #else - if (Bucket.Length != 0) { - output.WriteRawTag(10); - output.WriteString(Bucket); - } - if (config_ != null) { - output.WriteRawTag(18); - output.WriteMessage(Config); - } - if (_unknownFields != null) { - _unknownFields.WriteTo(output); - } - #endif - } - - #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - void pb::IBufferMessage.InternalWriteTo(ref pb::WriteContext output) { - if (Bucket.Length != 0) { - output.WriteRawTag(10); - output.WriteString(Bucket); - } - if (config_ != null) { - output.WriteRawTag(18); - output.WriteMessage(Config); - } - if (_unknownFields != null) { - _unknownFields.WriteTo(ref output); - } - } - #endif - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public int CalculateSize() { - int size = 0; - if (Bucket.Length != 0) { - size += 1 + pb::CodedOutputStream.ComputeStringSize(Bucket); - } - if (config_ != null) { - size += 1 + pb::CodedOutputStream.ComputeMessageSize(Config); - } - if (_unknownFields != null) { - size += _unknownFields.CalculateSize(); - } - return size; - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void MergeFrom(BucketNotificationWorker other) { - if (other == null) { - return; - } - if (other.Bucket.Length != 0) { - Bucket = other.Bucket; - } - if (other.config_ != null) { - if (config_ == null) { - Config = new global::Nitric.Proto.Faas.v1.BucketNotificationConfig(); - } - Config.MergeFrom(other.Config); - } - _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void MergeFrom(pb::CodedInputStream input) { - #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE - input.ReadRawMessage(this); - #else - uint tag; - while ((tag = input.ReadTag()) != 0) { - switch(tag) { - default: - _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input); - break; - case 10: { - Bucket = input.ReadString(); - break; - } - case 18: { - if (config_ == null) { - Config = new global::Nitric.Proto.Faas.v1.BucketNotificationConfig(); - } - input.ReadMessage(Config); - break; - } - } - } - #endif - } - - #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - void pb::IBufferMessage.InternalMergeFrom(ref pb::ParseContext input) { - uint tag; - while ((tag = input.ReadTag()) != 0) { - switch(tag) { - default: - _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, ref input); - break; - case 10: { - Bucket = input.ReadString(); - break; - } - case 18: { - if (config_ == null) { - Config = new global::Nitric.Proto.Faas.v1.BucketNotificationConfig(); - } - input.ReadMessage(Config); - break; - } - } - } - } - #endif - - } - - public sealed partial class BucketNotificationConfig : pb::IMessage - #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE - , pb::IBufferMessage - #endif - { - private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new BucketNotificationConfig()); - private pb::UnknownFieldSet _unknownFields; - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public static pb::MessageParser Parser { get { return _parser; } } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public static pbr::MessageDescriptor Descriptor { - get { return global::Nitric.Proto.Faas.v1.FaasReflection.Descriptor.MessageTypes[11]; } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - pbr::MessageDescriptor pb::IMessage.Descriptor { - get { return Descriptor; } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public BucketNotificationConfig() { - OnConstruction(); - } - - partial void OnConstruction(); - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public BucketNotificationConfig(BucketNotificationConfig other) : this() { - notificationType_ = other.notificationType_; - notificationPrefixFilter_ = other.notificationPrefixFilter_; - _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public BucketNotificationConfig Clone() { - return new BucketNotificationConfig(this); - } - - /// Field number for the "notification_type" field. - public const int NotificationTypeFieldNumber = 1; - private global::Nitric.Proto.Faas.v1.BucketNotificationType notificationType_ = global::Nitric.Proto.Faas.v1.BucketNotificationType.All; - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public global::Nitric.Proto.Faas.v1.BucketNotificationType NotificationType { - get { return notificationType_; } - set { - notificationType_ = value; - } - } - - /// Field number for the "notification_prefix_filter" field. - public const int NotificationPrefixFilterFieldNumber = 2; - private string notificationPrefixFilter_ = ""; - /// - /// A notification filter is a prefix for a bucket object in which creations or deletions should trigger a notification: - /// e.g. Notification filter: /images/cat and Event Type: created, would trigger on creating /images/cat.png and /images/cat.jpg but not creating /cat.png - /// - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public string NotificationPrefixFilter { - get { return notificationPrefixFilter_; } - set { - notificationPrefixFilter_ = pb::ProtoPreconditions.CheckNotNull(value, "value"); - } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public override bool Equals(object other) { - return Equals(other as BucketNotificationConfig); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public bool Equals(BucketNotificationConfig other) { - if (ReferenceEquals(other, null)) { - return false; - } - if (ReferenceEquals(other, this)) { - return true; - } - if (NotificationType != other.NotificationType) return false; - if (NotificationPrefixFilter != other.NotificationPrefixFilter) return false; - return Equals(_unknownFields, other._unknownFields); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public override int GetHashCode() { - int hash = 1; - if (NotificationType != global::Nitric.Proto.Faas.v1.BucketNotificationType.All) hash ^= NotificationType.GetHashCode(); - if (NotificationPrefixFilter.Length != 0) hash ^= NotificationPrefixFilter.GetHashCode(); - if (_unknownFields != null) { - hash ^= _unknownFields.GetHashCode(); - } - return hash; - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public override string ToString() { - return pb::JsonFormatter.ToDiagnosticString(this); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void WriteTo(pb::CodedOutputStream output) { - #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE - output.WriteRawMessage(this); - #else - if (NotificationType != global::Nitric.Proto.Faas.v1.BucketNotificationType.All) { - output.WriteRawTag(8); - output.WriteEnum((int) NotificationType); - } - if (NotificationPrefixFilter.Length != 0) { - output.WriteRawTag(18); - output.WriteString(NotificationPrefixFilter); - } - if (_unknownFields != null) { - _unknownFields.WriteTo(output); - } - #endif - } - - #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - void pb::IBufferMessage.InternalWriteTo(ref pb::WriteContext output) { - if (NotificationType != global::Nitric.Proto.Faas.v1.BucketNotificationType.All) { - output.WriteRawTag(8); - output.WriteEnum((int) NotificationType); - } - if (NotificationPrefixFilter.Length != 0) { - output.WriteRawTag(18); - output.WriteString(NotificationPrefixFilter); - } - if (_unknownFields != null) { - _unknownFields.WriteTo(ref output); - } - } - #endif - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public int CalculateSize() { - int size = 0; - if (NotificationType != global::Nitric.Proto.Faas.v1.BucketNotificationType.All) { - size += 1 + pb::CodedOutputStream.ComputeEnumSize((int) NotificationType); - } - if (NotificationPrefixFilter.Length != 0) { - size += 1 + pb::CodedOutputStream.ComputeStringSize(NotificationPrefixFilter); - } - if (_unknownFields != null) { - size += _unknownFields.CalculateSize(); - } - return size; - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void MergeFrom(BucketNotificationConfig other) { - if (other == null) { - return; - } - if (other.NotificationType != global::Nitric.Proto.Faas.v1.BucketNotificationType.All) { - NotificationType = other.NotificationType; - } - if (other.NotificationPrefixFilter.Length != 0) { - NotificationPrefixFilter = other.NotificationPrefixFilter; - } - _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void MergeFrom(pb::CodedInputStream input) { - #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE - input.ReadRawMessage(this); - #else - uint tag; - while ((tag = input.ReadTag()) != 0) { - switch(tag) { - default: - _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input); - break; - case 8: { - NotificationType = (global::Nitric.Proto.Faas.v1.BucketNotificationType) input.ReadEnum(); - break; - } - case 18: { - NotificationPrefixFilter = input.ReadString(); - break; - } - } - } - #endif - } - - #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - void pb::IBufferMessage.InternalMergeFrom(ref pb::ParseContext input) { - uint tag; - while ((tag = input.ReadTag()) != 0) { - switch(tag) { - default: - _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, ref input); - break; - case 8: { - NotificationType = (global::Nitric.Proto.Faas.v1.BucketNotificationType) input.ReadEnum(); - break; - } - case 18: { - NotificationPrefixFilter = input.ReadString(); - break; - } - } - } - } - #endif - - } - - public sealed partial class WebsocketWorker : pb::IMessage - #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE - , pb::IBufferMessage - #endif - { - private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new WebsocketWorker()); - private pb::UnknownFieldSet _unknownFields; - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public static pb::MessageParser Parser { get { return _parser; } } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public static pbr::MessageDescriptor Descriptor { - get { return global::Nitric.Proto.Faas.v1.FaasReflection.Descriptor.MessageTypes[12]; } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - pbr::MessageDescriptor pb::IMessage.Descriptor { - get { return Descriptor; } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public WebsocketWorker() { - OnConstruction(); - } - - partial void OnConstruction(); - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public WebsocketWorker(WebsocketWorker other) : this() { - socket_ = other.socket_; - event_ = other.event_; - _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public WebsocketWorker Clone() { - return new WebsocketWorker(this); - } - - /// Field number for the "socket" field. - public const int SocketFieldNumber = 1; - private string socket_ = ""; - /// - /// The nitric name of the socket that this worker listens on - /// - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public string Socket { - get { return socket_; } - set { - socket_ = pb::ProtoPreconditions.CheckNotNull(value, "value"); - } - } - - /// Field number for the "event" field. - public const int EventFieldNumber = 2; - private global::Nitric.Proto.Faas.v1.WebsocketEvent event_ = global::Nitric.Proto.Faas.v1.WebsocketEvent.Connect; - /// - /// The type of event that this worker handles - /// - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public global::Nitric.Proto.Faas.v1.WebsocketEvent Event { - get { return event_; } - set { - event_ = value; - } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public override bool Equals(object other) { - return Equals(other as WebsocketWorker); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public bool Equals(WebsocketWorker other) { - if (ReferenceEquals(other, null)) { - return false; - } - if (ReferenceEquals(other, this)) { - return true; - } - if (Socket != other.Socket) return false; - if (Event != other.Event) return false; - return Equals(_unknownFields, other._unknownFields); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public override int GetHashCode() { - int hash = 1; - if (Socket.Length != 0) hash ^= Socket.GetHashCode(); - if (Event != global::Nitric.Proto.Faas.v1.WebsocketEvent.Connect) hash ^= Event.GetHashCode(); - if (_unknownFields != null) { - hash ^= _unknownFields.GetHashCode(); - } - return hash; - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public override string ToString() { - return pb::JsonFormatter.ToDiagnosticString(this); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void WriteTo(pb::CodedOutputStream output) { - #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE - output.WriteRawMessage(this); - #else - if (Socket.Length != 0) { - output.WriteRawTag(10); - output.WriteString(Socket); - } - if (Event != global::Nitric.Proto.Faas.v1.WebsocketEvent.Connect) { - output.WriteRawTag(16); - output.WriteEnum((int) Event); - } - if (_unknownFields != null) { - _unknownFields.WriteTo(output); - } - #endif - } - - #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - void pb::IBufferMessage.InternalWriteTo(ref pb::WriteContext output) { - if (Socket.Length != 0) { - output.WriteRawTag(10); - output.WriteString(Socket); - } - if (Event != global::Nitric.Proto.Faas.v1.WebsocketEvent.Connect) { - output.WriteRawTag(16); - output.WriteEnum((int) Event); - } - if (_unknownFields != null) { - _unknownFields.WriteTo(ref output); - } - } - #endif - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public int CalculateSize() { - int size = 0; - if (Socket.Length != 0) { - size += 1 + pb::CodedOutputStream.ComputeStringSize(Socket); - } - if (Event != global::Nitric.Proto.Faas.v1.WebsocketEvent.Connect) { - size += 1 + pb::CodedOutputStream.ComputeEnumSize((int) Event); - } - if (_unknownFields != null) { - size += _unknownFields.CalculateSize(); - } - return size; - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void MergeFrom(WebsocketWorker other) { - if (other == null) { - return; - } - if (other.Socket.Length != 0) { - Socket = other.Socket; - } - if (other.Event != global::Nitric.Proto.Faas.v1.WebsocketEvent.Connect) { - Event = other.Event; - } - _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void MergeFrom(pb::CodedInputStream input) { - #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE - input.ReadRawMessage(this); - #else - uint tag; - while ((tag = input.ReadTag()) != 0) { - switch(tag) { - default: - _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input); - break; - case 10: { - Socket = input.ReadString(); - break; - } - case 16: { - Event = (global::Nitric.Proto.Faas.v1.WebsocketEvent) input.ReadEnum(); - break; - } - } - } - #endif - } - - #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - void pb::IBufferMessage.InternalMergeFrom(ref pb::ParseContext input) { - uint tag; - while ((tag = input.ReadTag()) != 0) { - switch(tag) { - default: - _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, ref input); - break; - case 10: { - Socket = input.ReadString(); - break; - } - case 16: { - Event = (global::Nitric.Proto.Faas.v1.WebsocketEvent) input.ReadEnum(); - break; - } - } - } - } - #endif - - } - - /// - /// InitRequest - Identifies a worker as ready to recieve triggers - /// This message will contain information on the type of triggers that - /// a worker is capable of handling - /// - public sealed partial class InitRequest : pb::IMessage - #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE - , pb::IBufferMessage - #endif - { - private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new InitRequest()); - private pb::UnknownFieldSet _unknownFields; - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public static pb::MessageParser Parser { get { return _parser; } } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public static pbr::MessageDescriptor Descriptor { - get { return global::Nitric.Proto.Faas.v1.FaasReflection.Descriptor.MessageTypes[13]; } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - pbr::MessageDescriptor pb::IMessage.Descriptor { - get { return Descriptor; } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public InitRequest() { - OnConstruction(); - } - - partial void OnConstruction(); - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public InitRequest(InitRequest other) : this() { - switch (other.WorkerCase) { - case WorkerOneofCase.Api: - Api = other.Api.Clone(); - break; - case WorkerOneofCase.Subscription: - Subscription = other.Subscription.Clone(); - break; - case WorkerOneofCase.Schedule: - Schedule = other.Schedule.Clone(); - break; - case WorkerOneofCase.BucketNotification: - BucketNotification = other.BucketNotification.Clone(); - break; - case WorkerOneofCase.Websocket: - Websocket = other.Websocket.Clone(); - break; - case WorkerOneofCase.HttpWorker: - HttpWorker = other.HttpWorker.Clone(); - break; - } - - _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public InitRequest Clone() { - return new InitRequest(this); - } - - /// Field number for the "api" field. - public const int ApiFieldNumber = 10; - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public global::Nitric.Proto.Faas.v1.ApiWorker Api { - get { return workerCase_ == WorkerOneofCase.Api ? (global::Nitric.Proto.Faas.v1.ApiWorker) worker_ : null; } - set { - worker_ = value; - workerCase_ = value == null ? WorkerOneofCase.None : WorkerOneofCase.Api; - } - } - - /// Field number for the "subscription" field. - public const int SubscriptionFieldNumber = 11; - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public global::Nitric.Proto.Faas.v1.SubscriptionWorker Subscription { - get { return workerCase_ == WorkerOneofCase.Subscription ? (global::Nitric.Proto.Faas.v1.SubscriptionWorker) worker_ : null; } - set { - worker_ = value; - workerCase_ = value == null ? WorkerOneofCase.None : WorkerOneofCase.Subscription; - } - } - - /// Field number for the "schedule" field. - public const int ScheduleFieldNumber = 12; - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public global::Nitric.Proto.Faas.v1.ScheduleWorker Schedule { - get { return workerCase_ == WorkerOneofCase.Schedule ? (global::Nitric.Proto.Faas.v1.ScheduleWorker) worker_ : null; } - set { - worker_ = value; - workerCase_ = value == null ? WorkerOneofCase.None : WorkerOneofCase.Schedule; - } - } - - /// Field number for the "bucket_notification" field. - public const int BucketNotificationFieldNumber = 13; - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public global::Nitric.Proto.Faas.v1.BucketNotificationWorker BucketNotification { - get { return workerCase_ == WorkerOneofCase.BucketNotification ? (global::Nitric.Proto.Faas.v1.BucketNotificationWorker) worker_ : null; } - set { - worker_ = value; - workerCase_ = value == null ? WorkerOneofCase.None : WorkerOneofCase.BucketNotification; - } - } - - /// Field number for the "websocket" field. - public const int WebsocketFieldNumber = 14; - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public global::Nitric.Proto.Faas.v1.WebsocketWorker Websocket { - get { return workerCase_ == WorkerOneofCase.Websocket ? (global::Nitric.Proto.Faas.v1.WebsocketWorker) worker_ : null; } - set { - worker_ = value; - workerCase_ = value == null ? WorkerOneofCase.None : WorkerOneofCase.Websocket; - } - } - - /// Field number for the "http_worker" field. - public const int HttpWorkerFieldNumber = 15; - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public global::Nitric.Proto.Faas.v1.HttpWorker HttpWorker { - get { return workerCase_ == WorkerOneofCase.HttpWorker ? (global::Nitric.Proto.Faas.v1.HttpWorker) worker_ : null; } - set { - worker_ = value; - workerCase_ = value == null ? WorkerOneofCase.None : WorkerOneofCase.HttpWorker; - } - } - - private object worker_; - /// Enum of possible cases for the "Worker" oneof. - public enum WorkerOneofCase { - None = 0, - Api = 10, - Subscription = 11, - Schedule = 12, - BucketNotification = 13, - Websocket = 14, - HttpWorker = 15, - } - private WorkerOneofCase workerCase_ = WorkerOneofCase.None; - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public WorkerOneofCase WorkerCase { - get { return workerCase_; } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void ClearWorker() { - workerCase_ = WorkerOneofCase.None; - worker_ = null; - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public override bool Equals(object other) { - return Equals(other as InitRequest); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public bool Equals(InitRequest other) { - if (ReferenceEquals(other, null)) { - return false; - } - if (ReferenceEquals(other, this)) { - return true; - } - if (!object.Equals(Api, other.Api)) return false; - if (!object.Equals(Subscription, other.Subscription)) return false; - if (!object.Equals(Schedule, other.Schedule)) return false; - if (!object.Equals(BucketNotification, other.BucketNotification)) return false; - if (!object.Equals(Websocket, other.Websocket)) return false; - if (!object.Equals(HttpWorker, other.HttpWorker)) return false; - if (WorkerCase != other.WorkerCase) return false; - return Equals(_unknownFields, other._unknownFields); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public override int GetHashCode() { - int hash = 1; - if (workerCase_ == WorkerOneofCase.Api) hash ^= Api.GetHashCode(); - if (workerCase_ == WorkerOneofCase.Subscription) hash ^= Subscription.GetHashCode(); - if (workerCase_ == WorkerOneofCase.Schedule) hash ^= Schedule.GetHashCode(); - if (workerCase_ == WorkerOneofCase.BucketNotification) hash ^= BucketNotification.GetHashCode(); - if (workerCase_ == WorkerOneofCase.Websocket) hash ^= Websocket.GetHashCode(); - if (workerCase_ == WorkerOneofCase.HttpWorker) hash ^= HttpWorker.GetHashCode(); - hash ^= (int) workerCase_; - if (_unknownFields != null) { - hash ^= _unknownFields.GetHashCode(); - } - return hash; - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public override string ToString() { - return pb::JsonFormatter.ToDiagnosticString(this); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void WriteTo(pb::CodedOutputStream output) { - #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE - output.WriteRawMessage(this); - #else - if (workerCase_ == WorkerOneofCase.Api) { - output.WriteRawTag(82); - output.WriteMessage(Api); - } - if (workerCase_ == WorkerOneofCase.Subscription) { - output.WriteRawTag(90); - output.WriteMessage(Subscription); - } - if (workerCase_ == WorkerOneofCase.Schedule) { - output.WriteRawTag(98); - output.WriteMessage(Schedule); - } - if (workerCase_ == WorkerOneofCase.BucketNotification) { - output.WriteRawTag(106); - output.WriteMessage(BucketNotification); - } - if (workerCase_ == WorkerOneofCase.Websocket) { - output.WriteRawTag(114); - output.WriteMessage(Websocket); - } - if (workerCase_ == WorkerOneofCase.HttpWorker) { - output.WriteRawTag(122); - output.WriteMessage(HttpWorker); - } - if (_unknownFields != null) { - _unknownFields.WriteTo(output); - } - #endif - } - - #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - void pb::IBufferMessage.InternalWriteTo(ref pb::WriteContext output) { - if (workerCase_ == WorkerOneofCase.Api) { - output.WriteRawTag(82); - output.WriteMessage(Api); - } - if (workerCase_ == WorkerOneofCase.Subscription) { - output.WriteRawTag(90); - output.WriteMessage(Subscription); - } - if (workerCase_ == WorkerOneofCase.Schedule) { - output.WriteRawTag(98); - output.WriteMessage(Schedule); - } - if (workerCase_ == WorkerOneofCase.BucketNotification) { - output.WriteRawTag(106); - output.WriteMessage(BucketNotification); - } - if (workerCase_ == WorkerOneofCase.Websocket) { - output.WriteRawTag(114); - output.WriteMessage(Websocket); - } - if (workerCase_ == WorkerOneofCase.HttpWorker) { - output.WriteRawTag(122); - output.WriteMessage(HttpWorker); - } - if (_unknownFields != null) { - _unknownFields.WriteTo(ref output); - } - } - #endif - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public int CalculateSize() { - int size = 0; - if (workerCase_ == WorkerOneofCase.Api) { - size += 1 + pb::CodedOutputStream.ComputeMessageSize(Api); - } - if (workerCase_ == WorkerOneofCase.Subscription) { - size += 1 + pb::CodedOutputStream.ComputeMessageSize(Subscription); - } - if (workerCase_ == WorkerOneofCase.Schedule) { - size += 1 + pb::CodedOutputStream.ComputeMessageSize(Schedule); - } - if (workerCase_ == WorkerOneofCase.BucketNotification) { - size += 1 + pb::CodedOutputStream.ComputeMessageSize(BucketNotification); - } - if (workerCase_ == WorkerOneofCase.Websocket) { - size += 1 + pb::CodedOutputStream.ComputeMessageSize(Websocket); - } - if (workerCase_ == WorkerOneofCase.HttpWorker) { - size += 1 + pb::CodedOutputStream.ComputeMessageSize(HttpWorker); - } - if (_unknownFields != null) { - size += _unknownFields.CalculateSize(); - } - return size; - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void MergeFrom(InitRequest other) { - if (other == null) { - return; - } - switch (other.WorkerCase) { - case WorkerOneofCase.Api: - if (Api == null) { - Api = new global::Nitric.Proto.Faas.v1.ApiWorker(); - } - Api.MergeFrom(other.Api); - break; - case WorkerOneofCase.Subscription: - if (Subscription == null) { - Subscription = new global::Nitric.Proto.Faas.v1.SubscriptionWorker(); - } - Subscription.MergeFrom(other.Subscription); - break; - case WorkerOneofCase.Schedule: - if (Schedule == null) { - Schedule = new global::Nitric.Proto.Faas.v1.ScheduleWorker(); - } - Schedule.MergeFrom(other.Schedule); - break; - case WorkerOneofCase.BucketNotification: - if (BucketNotification == null) { - BucketNotification = new global::Nitric.Proto.Faas.v1.BucketNotificationWorker(); - } - BucketNotification.MergeFrom(other.BucketNotification); - break; - case WorkerOneofCase.Websocket: - if (Websocket == null) { - Websocket = new global::Nitric.Proto.Faas.v1.WebsocketWorker(); - } - Websocket.MergeFrom(other.Websocket); - break; - case WorkerOneofCase.HttpWorker: - if (HttpWorker == null) { - HttpWorker = new global::Nitric.Proto.Faas.v1.HttpWorker(); - } - HttpWorker.MergeFrom(other.HttpWorker); - break; - } - - _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void MergeFrom(pb::CodedInputStream input) { - #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE - input.ReadRawMessage(this); - #else - uint tag; - while ((tag = input.ReadTag()) != 0) { - switch(tag) { - default: - _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input); - break; - case 82: { - global::Nitric.Proto.Faas.v1.ApiWorker subBuilder = new global::Nitric.Proto.Faas.v1.ApiWorker(); - if (workerCase_ == WorkerOneofCase.Api) { - subBuilder.MergeFrom(Api); - } - input.ReadMessage(subBuilder); - Api = subBuilder; - break; - } - case 90: { - global::Nitric.Proto.Faas.v1.SubscriptionWorker subBuilder = new global::Nitric.Proto.Faas.v1.SubscriptionWorker(); - if (workerCase_ == WorkerOneofCase.Subscription) { - subBuilder.MergeFrom(Subscription); - } - input.ReadMessage(subBuilder); - Subscription = subBuilder; - break; - } - case 98: { - global::Nitric.Proto.Faas.v1.ScheduleWorker subBuilder = new global::Nitric.Proto.Faas.v1.ScheduleWorker(); - if (workerCase_ == WorkerOneofCase.Schedule) { - subBuilder.MergeFrom(Schedule); - } - input.ReadMessage(subBuilder); - Schedule = subBuilder; - break; - } - case 106: { - global::Nitric.Proto.Faas.v1.BucketNotificationWorker subBuilder = new global::Nitric.Proto.Faas.v1.BucketNotificationWorker(); - if (workerCase_ == WorkerOneofCase.BucketNotification) { - subBuilder.MergeFrom(BucketNotification); - } - input.ReadMessage(subBuilder); - BucketNotification = subBuilder; - break; - } - case 114: { - global::Nitric.Proto.Faas.v1.WebsocketWorker subBuilder = new global::Nitric.Proto.Faas.v1.WebsocketWorker(); - if (workerCase_ == WorkerOneofCase.Websocket) { - subBuilder.MergeFrom(Websocket); - } - input.ReadMessage(subBuilder); - Websocket = subBuilder; - break; - } - case 122: { - global::Nitric.Proto.Faas.v1.HttpWorker subBuilder = new global::Nitric.Proto.Faas.v1.HttpWorker(); - if (workerCase_ == WorkerOneofCase.HttpWorker) { - subBuilder.MergeFrom(HttpWorker); - } - input.ReadMessage(subBuilder); - HttpWorker = subBuilder; - break; - } - } - } - #endif - } - - #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - void pb::IBufferMessage.InternalMergeFrom(ref pb::ParseContext input) { - uint tag; - while ((tag = input.ReadTag()) != 0) { - switch(tag) { - default: - _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, ref input); - break; - case 82: { - global::Nitric.Proto.Faas.v1.ApiWorker subBuilder = new global::Nitric.Proto.Faas.v1.ApiWorker(); - if (workerCase_ == WorkerOneofCase.Api) { - subBuilder.MergeFrom(Api); - } - input.ReadMessage(subBuilder); - Api = subBuilder; - break; - } - case 90: { - global::Nitric.Proto.Faas.v1.SubscriptionWorker subBuilder = new global::Nitric.Proto.Faas.v1.SubscriptionWorker(); - if (workerCase_ == WorkerOneofCase.Subscription) { - subBuilder.MergeFrom(Subscription); - } - input.ReadMessage(subBuilder); - Subscription = subBuilder; - break; - } - case 98: { - global::Nitric.Proto.Faas.v1.ScheduleWorker subBuilder = new global::Nitric.Proto.Faas.v1.ScheduleWorker(); - if (workerCase_ == WorkerOneofCase.Schedule) { - subBuilder.MergeFrom(Schedule); - } - input.ReadMessage(subBuilder); - Schedule = subBuilder; - break; - } - case 106: { - global::Nitric.Proto.Faas.v1.BucketNotificationWorker subBuilder = new global::Nitric.Proto.Faas.v1.BucketNotificationWorker(); - if (workerCase_ == WorkerOneofCase.BucketNotification) { - subBuilder.MergeFrom(BucketNotification); - } - input.ReadMessage(subBuilder); - BucketNotification = subBuilder; - break; - } - case 114: { - global::Nitric.Proto.Faas.v1.WebsocketWorker subBuilder = new global::Nitric.Proto.Faas.v1.WebsocketWorker(); - if (workerCase_ == WorkerOneofCase.Websocket) { - subBuilder.MergeFrom(Websocket); - } - input.ReadMessage(subBuilder); - Websocket = subBuilder; - break; - } - case 122: { - global::Nitric.Proto.Faas.v1.HttpWorker subBuilder = new global::Nitric.Proto.Faas.v1.HttpWorker(); - if (workerCase_ == WorkerOneofCase.HttpWorker) { - subBuilder.MergeFrom(HttpWorker); - } - input.ReadMessage(subBuilder); - HttpWorker = subBuilder; - break; - } - } - } - } - #endif - - } - - /// - /// Placeholder message - /// - public sealed partial class InitResponse : pb::IMessage - #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE - , pb::IBufferMessage - #endif - { - private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new InitResponse()); - private pb::UnknownFieldSet _unknownFields; - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public static pb::MessageParser Parser { get { return _parser; } } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public static pbr::MessageDescriptor Descriptor { - get { return global::Nitric.Proto.Faas.v1.FaasReflection.Descriptor.MessageTypes[14]; } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - pbr::MessageDescriptor pb::IMessage.Descriptor { - get { return Descriptor; } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public InitResponse() { - OnConstruction(); - } - - partial void OnConstruction(); - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public InitResponse(InitResponse other) : this() { - _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public InitResponse Clone() { - return new InitResponse(this); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public override bool Equals(object other) { - return Equals(other as InitResponse); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public bool Equals(InitResponse other) { - if (ReferenceEquals(other, null)) { - return false; - } - if (ReferenceEquals(other, this)) { - return true; - } - return Equals(_unknownFields, other._unknownFields); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public override int GetHashCode() { - int hash = 1; - if (_unknownFields != null) { - hash ^= _unknownFields.GetHashCode(); - } - return hash; - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public override string ToString() { - return pb::JsonFormatter.ToDiagnosticString(this); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void WriteTo(pb::CodedOutputStream output) { - #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE - output.WriteRawMessage(this); - #else - if (_unknownFields != null) { - _unknownFields.WriteTo(output); - } - #endif - } - - #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - void pb::IBufferMessage.InternalWriteTo(ref pb::WriteContext output) { - if (_unknownFields != null) { - _unknownFields.WriteTo(ref output); - } - } - #endif - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public int CalculateSize() { - int size = 0; - if (_unknownFields != null) { - size += _unknownFields.CalculateSize(); - } - return size; - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void MergeFrom(InitResponse other) { - if (other == null) { - return; - } - _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void MergeFrom(pb::CodedInputStream input) { - #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE - input.ReadRawMessage(this); - #else - uint tag; - while ((tag = input.ReadTag()) != 0) { - switch(tag) { - default: - _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input); - break; - } - } - #endif - } - - #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - void pb::IBufferMessage.InternalMergeFrom(ref pb::ParseContext input) { - uint tag; - while ((tag = input.ReadTag()) != 0) { - switch(tag) { - default: - _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, ref input); - break; - } - } - } - #endif - - } - - public sealed partial class TraceContext : pb::IMessage - #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE - , pb::IBufferMessage - #endif - { - private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new TraceContext()); - private pb::UnknownFieldSet _unknownFields; - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public static pb::MessageParser Parser { get { return _parser; } } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public static pbr::MessageDescriptor Descriptor { - get { return global::Nitric.Proto.Faas.v1.FaasReflection.Descriptor.MessageTypes[15]; } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - pbr::MessageDescriptor pb::IMessage.Descriptor { - get { return Descriptor; } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public TraceContext() { - OnConstruction(); - } - - partial void OnConstruction(); - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public TraceContext(TraceContext other) : this() { - values_ = other.values_.Clone(); - _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public TraceContext Clone() { - return new TraceContext(this); - } - - /// Field number for the "values" field. - public const int ValuesFieldNumber = 1; - private static readonly pbc::MapField.Codec _map_values_codec - = new pbc::MapField.Codec(pb::FieldCodec.ForString(10, ""), pb::FieldCodec.ForString(18, ""), 10); - private readonly pbc::MapField values_ = new pbc::MapField(); - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public pbc::MapField Values { - get { return values_; } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public override bool Equals(object other) { - return Equals(other as TraceContext); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public bool Equals(TraceContext other) { - if (ReferenceEquals(other, null)) { - return false; - } - if (ReferenceEquals(other, this)) { - return true; - } - if (!Values.Equals(other.Values)) return false; - return Equals(_unknownFields, other._unknownFields); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public override int GetHashCode() { - int hash = 1; - hash ^= Values.GetHashCode(); - if (_unknownFields != null) { - hash ^= _unknownFields.GetHashCode(); - } - return hash; - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public override string ToString() { - return pb::JsonFormatter.ToDiagnosticString(this); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void WriteTo(pb::CodedOutputStream output) { - #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE - output.WriteRawMessage(this); - #else - values_.WriteTo(output, _map_values_codec); - if (_unknownFields != null) { - _unknownFields.WriteTo(output); - } - #endif - } - - #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - void pb::IBufferMessage.InternalWriteTo(ref pb::WriteContext output) { - values_.WriteTo(ref output, _map_values_codec); - if (_unknownFields != null) { - _unknownFields.WriteTo(ref output); - } - } - #endif - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public int CalculateSize() { - int size = 0; - size += values_.CalculateSize(_map_values_codec); - if (_unknownFields != null) { - size += _unknownFields.CalculateSize(); - } - return size; - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void MergeFrom(TraceContext other) { - if (other == null) { - return; - } - values_.Add(other.values_); - _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void MergeFrom(pb::CodedInputStream input) { - #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE - input.ReadRawMessage(this); - #else - uint tag; - while ((tag = input.ReadTag()) != 0) { - switch(tag) { - default: - _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input); - break; - case 10: { - values_.AddEntriesFrom(input, _map_values_codec); - break; - } - } - } - #endif - } - - #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - void pb::IBufferMessage.InternalMergeFrom(ref pb::ParseContext input) { - uint tag; - while ((tag = input.ReadTag()) != 0) { - switch(tag) { - default: - _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, ref input); - break; - case 10: { - values_.AddEntriesFrom(ref input, _map_values_codec); - break; - } - } - } - } - #endif - - } - - /// - /// The server has a trigger for the client to handle - /// - public sealed partial class TriggerRequest : pb::IMessage - #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE - , pb::IBufferMessage - #endif - { - private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new TriggerRequest()); - private pb::UnknownFieldSet _unknownFields; - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public static pb::MessageParser Parser { get { return _parser; } } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public static pbr::MessageDescriptor Descriptor { - get { return global::Nitric.Proto.Faas.v1.FaasReflection.Descriptor.MessageTypes[16]; } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - pbr::MessageDescriptor pb::IMessage.Descriptor { - get { return Descriptor; } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public TriggerRequest() { - OnConstruction(); - } - - partial void OnConstruction(); - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public TriggerRequest(TriggerRequest other) : this() { - data_ = other.data_; - mimeType_ = other.mimeType_; - traceContext_ = other.traceContext_ != null ? other.traceContext_.Clone() : null; - switch (other.ContextCase) { - case ContextOneofCase.Http: - Http = other.Http.Clone(); - break; - case ContextOneofCase.Topic: - Topic = other.Topic.Clone(); - break; - case ContextOneofCase.Notification: - Notification = other.Notification.Clone(); - break; - case ContextOneofCase.Websocket: - Websocket = other.Websocket.Clone(); - break; - } - - _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public TriggerRequest Clone() { - return new TriggerRequest(this); - } - - /// Field number for the "data" field. - public const int DataFieldNumber = 1; - private pb::ByteString data_ = pb::ByteString.Empty; - /// - /// The data in the trigger - /// - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public pb::ByteString Data { - get { return data_; } - set { - data_ = pb::ProtoPreconditions.CheckNotNull(value, "value"); - } - } - - /// Field number for the "mime_type" field. - public const int MimeTypeFieldNumber = 2; - private string mimeType_ = ""; - /// - /// Should we supply a mime type for the data? - /// Or rely on context? - /// - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public string MimeType { - get { return mimeType_; } - set { - mimeType_ = pb::ProtoPreconditions.CheckNotNull(value, "value"); - } - } - - /// Field number for the "trace_context" field. - public const int TraceContextFieldNumber = 10; - private global::Nitric.Proto.Faas.v1.TraceContext traceContext_; - /// - /// TraceInformation from the membrane - /// Allows tying traces from external triggers (e.g. HttpRequests) - /// into each event request/response pair of the Bidirectional stream. - /// which cannot be facilitated by OOTB stream interceptors from OTEL. - /// - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public global::Nitric.Proto.Faas.v1.TraceContext TraceContext { - get { return traceContext_; } - set { - traceContext_ = value; - } - } - - /// Field number for the "http" field. - public const int HttpFieldNumber = 3; - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public global::Nitric.Proto.Faas.v1.HttpTriggerContext Http { - get { return contextCase_ == ContextOneofCase.Http ? (global::Nitric.Proto.Faas.v1.HttpTriggerContext) context_ : null; } - set { - context_ = value; - contextCase_ = value == null ? ContextOneofCase.None : ContextOneofCase.Http; - } - } - - /// Field number for the "topic" field. - public const int TopicFieldNumber = 4; - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public global::Nitric.Proto.Faas.v1.TopicTriggerContext Topic { - get { return contextCase_ == ContextOneofCase.Topic ? (global::Nitric.Proto.Faas.v1.TopicTriggerContext) context_ : null; } - set { - context_ = value; - contextCase_ = value == null ? ContextOneofCase.None : ContextOneofCase.Topic; - } - } - - /// Field number for the "notification" field. - public const int NotificationFieldNumber = 5; - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public global::Nitric.Proto.Faas.v1.NotificationTriggerContext Notification { - get { return contextCase_ == ContextOneofCase.Notification ? (global::Nitric.Proto.Faas.v1.NotificationTriggerContext) context_ : null; } - set { - context_ = value; - contextCase_ = value == null ? ContextOneofCase.None : ContextOneofCase.Notification; - } - } - - /// Field number for the "websocket" field. - public const int WebsocketFieldNumber = 6; - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public global::Nitric.Proto.Faas.v1.WebsocketTriggerContext Websocket { - get { return contextCase_ == ContextOneofCase.Websocket ? (global::Nitric.Proto.Faas.v1.WebsocketTriggerContext) context_ : null; } - set { - context_ = value; - contextCase_ = value == null ? ContextOneofCase.None : ContextOneofCase.Websocket; - } - } - - private object context_; - /// Enum of possible cases for the "context" oneof. - public enum ContextOneofCase { - None = 0, - Http = 3, - Topic = 4, - Notification = 5, - Websocket = 6, - } - private ContextOneofCase contextCase_ = ContextOneofCase.None; - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public ContextOneofCase ContextCase { - get { return contextCase_; } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void ClearContext() { - contextCase_ = ContextOneofCase.None; - context_ = null; - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public override bool Equals(object other) { - return Equals(other as TriggerRequest); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public bool Equals(TriggerRequest other) { - if (ReferenceEquals(other, null)) { - return false; - } - if (ReferenceEquals(other, this)) { - return true; - } - if (Data != other.Data) return false; - if (MimeType != other.MimeType) return false; - if (!object.Equals(TraceContext, other.TraceContext)) return false; - if (!object.Equals(Http, other.Http)) return false; - if (!object.Equals(Topic, other.Topic)) return false; - if (!object.Equals(Notification, other.Notification)) return false; - if (!object.Equals(Websocket, other.Websocket)) return false; - if (ContextCase != other.ContextCase) return false; - return Equals(_unknownFields, other._unknownFields); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public override int GetHashCode() { - int hash = 1; - if (Data.Length != 0) hash ^= Data.GetHashCode(); - if (MimeType.Length != 0) hash ^= MimeType.GetHashCode(); - if (traceContext_ != null) hash ^= TraceContext.GetHashCode(); - if (contextCase_ == ContextOneofCase.Http) hash ^= Http.GetHashCode(); - if (contextCase_ == ContextOneofCase.Topic) hash ^= Topic.GetHashCode(); - if (contextCase_ == ContextOneofCase.Notification) hash ^= Notification.GetHashCode(); - if (contextCase_ == ContextOneofCase.Websocket) hash ^= Websocket.GetHashCode(); - hash ^= (int) contextCase_; - if (_unknownFields != null) { - hash ^= _unknownFields.GetHashCode(); - } - return hash; - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public override string ToString() { - return pb::JsonFormatter.ToDiagnosticString(this); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void WriteTo(pb::CodedOutputStream output) { - #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE - output.WriteRawMessage(this); - #else - if (Data.Length != 0) { - output.WriteRawTag(10); - output.WriteBytes(Data); - } - if (MimeType.Length != 0) { - output.WriteRawTag(18); - output.WriteString(MimeType); - } - if (contextCase_ == ContextOneofCase.Http) { - output.WriteRawTag(26); - output.WriteMessage(Http); - } - if (contextCase_ == ContextOneofCase.Topic) { - output.WriteRawTag(34); - output.WriteMessage(Topic); - } - if (contextCase_ == ContextOneofCase.Notification) { - output.WriteRawTag(42); - output.WriteMessage(Notification); - } - if (contextCase_ == ContextOneofCase.Websocket) { - output.WriteRawTag(50); - output.WriteMessage(Websocket); - } - if (traceContext_ != null) { - output.WriteRawTag(82); - output.WriteMessage(TraceContext); - } - if (_unknownFields != null) { - _unknownFields.WriteTo(output); - } - #endif - } - - #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - void pb::IBufferMessage.InternalWriteTo(ref pb::WriteContext output) { - if (Data.Length != 0) { - output.WriteRawTag(10); - output.WriteBytes(Data); - } - if (MimeType.Length != 0) { - output.WriteRawTag(18); - output.WriteString(MimeType); - } - if (contextCase_ == ContextOneofCase.Http) { - output.WriteRawTag(26); - output.WriteMessage(Http); - } - if (contextCase_ == ContextOneofCase.Topic) { - output.WriteRawTag(34); - output.WriteMessage(Topic); - } - if (contextCase_ == ContextOneofCase.Notification) { - output.WriteRawTag(42); - output.WriteMessage(Notification); - } - if (contextCase_ == ContextOneofCase.Websocket) { - output.WriteRawTag(50); - output.WriteMessage(Websocket); - } - if (traceContext_ != null) { - output.WriteRawTag(82); - output.WriteMessage(TraceContext); - } - if (_unknownFields != null) { - _unknownFields.WriteTo(ref output); - } - } - #endif - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public int CalculateSize() { - int size = 0; - if (Data.Length != 0) { - size += 1 + pb::CodedOutputStream.ComputeBytesSize(Data); - } - if (MimeType.Length != 0) { - size += 1 + pb::CodedOutputStream.ComputeStringSize(MimeType); - } - if (traceContext_ != null) { - size += 1 + pb::CodedOutputStream.ComputeMessageSize(TraceContext); - } - if (contextCase_ == ContextOneofCase.Http) { - size += 1 + pb::CodedOutputStream.ComputeMessageSize(Http); - } - if (contextCase_ == ContextOneofCase.Topic) { - size += 1 + pb::CodedOutputStream.ComputeMessageSize(Topic); - } - if (contextCase_ == ContextOneofCase.Notification) { - size += 1 + pb::CodedOutputStream.ComputeMessageSize(Notification); - } - if (contextCase_ == ContextOneofCase.Websocket) { - size += 1 + pb::CodedOutputStream.ComputeMessageSize(Websocket); - } - if (_unknownFields != null) { - size += _unknownFields.CalculateSize(); - } - return size; - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void MergeFrom(TriggerRequest other) { - if (other == null) { - return; - } - if (other.Data.Length != 0) { - Data = other.Data; - } - if (other.MimeType.Length != 0) { - MimeType = other.MimeType; - } - if (other.traceContext_ != null) { - if (traceContext_ == null) { - TraceContext = new global::Nitric.Proto.Faas.v1.TraceContext(); - } - TraceContext.MergeFrom(other.TraceContext); - } - switch (other.ContextCase) { - case ContextOneofCase.Http: - if (Http == null) { - Http = new global::Nitric.Proto.Faas.v1.HttpTriggerContext(); - } - Http.MergeFrom(other.Http); - break; - case ContextOneofCase.Topic: - if (Topic == null) { - Topic = new global::Nitric.Proto.Faas.v1.TopicTriggerContext(); - } - Topic.MergeFrom(other.Topic); - break; - case ContextOneofCase.Notification: - if (Notification == null) { - Notification = new global::Nitric.Proto.Faas.v1.NotificationTriggerContext(); - } - Notification.MergeFrom(other.Notification); - break; - case ContextOneofCase.Websocket: - if (Websocket == null) { - Websocket = new global::Nitric.Proto.Faas.v1.WebsocketTriggerContext(); - } - Websocket.MergeFrom(other.Websocket); - break; - } - - _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void MergeFrom(pb::CodedInputStream input) { - #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE - input.ReadRawMessage(this); - #else - uint tag; - while ((tag = input.ReadTag()) != 0) { - switch(tag) { - default: - _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input); - break; - case 10: { - Data = input.ReadBytes(); - break; - } - case 18: { - MimeType = input.ReadString(); - break; - } - case 26: { - global::Nitric.Proto.Faas.v1.HttpTriggerContext subBuilder = new global::Nitric.Proto.Faas.v1.HttpTriggerContext(); - if (contextCase_ == ContextOneofCase.Http) { - subBuilder.MergeFrom(Http); - } - input.ReadMessage(subBuilder); - Http = subBuilder; - break; - } - case 34: { - global::Nitric.Proto.Faas.v1.TopicTriggerContext subBuilder = new global::Nitric.Proto.Faas.v1.TopicTriggerContext(); - if (contextCase_ == ContextOneofCase.Topic) { - subBuilder.MergeFrom(Topic); - } - input.ReadMessage(subBuilder); - Topic = subBuilder; - break; - } - case 42: { - global::Nitric.Proto.Faas.v1.NotificationTriggerContext subBuilder = new global::Nitric.Proto.Faas.v1.NotificationTriggerContext(); - if (contextCase_ == ContextOneofCase.Notification) { - subBuilder.MergeFrom(Notification); - } - input.ReadMessage(subBuilder); - Notification = subBuilder; - break; - } - case 50: { - global::Nitric.Proto.Faas.v1.WebsocketTriggerContext subBuilder = new global::Nitric.Proto.Faas.v1.WebsocketTriggerContext(); - if (contextCase_ == ContextOneofCase.Websocket) { - subBuilder.MergeFrom(Websocket); - } - input.ReadMessage(subBuilder); - Websocket = subBuilder; - break; - } - case 82: { - if (traceContext_ == null) { - TraceContext = new global::Nitric.Proto.Faas.v1.TraceContext(); - } - input.ReadMessage(TraceContext); - break; - } - } - } - #endif - } - - #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - void pb::IBufferMessage.InternalMergeFrom(ref pb::ParseContext input) { - uint tag; - while ((tag = input.ReadTag()) != 0) { - switch(tag) { - default: - _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, ref input); - break; - case 10: { - Data = input.ReadBytes(); - break; - } - case 18: { - MimeType = input.ReadString(); - break; - } - case 26: { - global::Nitric.Proto.Faas.v1.HttpTriggerContext subBuilder = new global::Nitric.Proto.Faas.v1.HttpTriggerContext(); - if (contextCase_ == ContextOneofCase.Http) { - subBuilder.MergeFrom(Http); - } - input.ReadMessage(subBuilder); - Http = subBuilder; - break; - } - case 34: { - global::Nitric.Proto.Faas.v1.TopicTriggerContext subBuilder = new global::Nitric.Proto.Faas.v1.TopicTriggerContext(); - if (contextCase_ == ContextOneofCase.Topic) { - subBuilder.MergeFrom(Topic); - } - input.ReadMessage(subBuilder); - Topic = subBuilder; - break; - } - case 42: { - global::Nitric.Proto.Faas.v1.NotificationTriggerContext subBuilder = new global::Nitric.Proto.Faas.v1.NotificationTriggerContext(); - if (contextCase_ == ContextOneofCase.Notification) { - subBuilder.MergeFrom(Notification); - } - input.ReadMessage(subBuilder); - Notification = subBuilder; - break; - } - case 50: { - global::Nitric.Proto.Faas.v1.WebsocketTriggerContext subBuilder = new global::Nitric.Proto.Faas.v1.WebsocketTriggerContext(); - if (contextCase_ == ContextOneofCase.Websocket) { - subBuilder.MergeFrom(Websocket); - } - input.ReadMessage(subBuilder); - Websocket = subBuilder; - break; - } - case 82: { - if (traceContext_ == null) { - TraceContext = new global::Nitric.Proto.Faas.v1.TraceContext(); - } - input.ReadMessage(TraceContext); - break; - } - } - } - } - #endif - - } - - public sealed partial class HeaderValue : pb::IMessage - #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE - , pb::IBufferMessage - #endif - { - private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new HeaderValue()); - private pb::UnknownFieldSet _unknownFields; - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public static pb::MessageParser Parser { get { return _parser; } } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public static pbr::MessageDescriptor Descriptor { - get { return global::Nitric.Proto.Faas.v1.FaasReflection.Descriptor.MessageTypes[17]; } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - pbr::MessageDescriptor pb::IMessage.Descriptor { - get { return Descriptor; } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public HeaderValue() { - OnConstruction(); - } - - partial void OnConstruction(); - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public HeaderValue(HeaderValue other) : this() { - value_ = other.value_.Clone(); - _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public HeaderValue Clone() { - return new HeaderValue(this); - } - - /// Field number for the "value" field. - public const int ValueFieldNumber = 1; - private static readonly pb::FieldCodec _repeated_value_codec - = pb::FieldCodec.ForString(10); - private readonly pbc::RepeatedField value_ = new pbc::RepeatedField(); - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public pbc::RepeatedField Value { - get { return value_; } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public override bool Equals(object other) { - return Equals(other as HeaderValue); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public bool Equals(HeaderValue other) { - if (ReferenceEquals(other, null)) { - return false; - } - if (ReferenceEquals(other, this)) { - return true; - } - if(!value_.Equals(other.value_)) return false; - return Equals(_unknownFields, other._unknownFields); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public override int GetHashCode() { - int hash = 1; - hash ^= value_.GetHashCode(); - if (_unknownFields != null) { - hash ^= _unknownFields.GetHashCode(); - } - return hash; - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public override string ToString() { - return pb::JsonFormatter.ToDiagnosticString(this); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void WriteTo(pb::CodedOutputStream output) { - #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE - output.WriteRawMessage(this); - #else - value_.WriteTo(output, _repeated_value_codec); - if (_unknownFields != null) { - _unknownFields.WriteTo(output); - } - #endif - } - - #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - void pb::IBufferMessage.InternalWriteTo(ref pb::WriteContext output) { - value_.WriteTo(ref output, _repeated_value_codec); - if (_unknownFields != null) { - _unknownFields.WriteTo(ref output); - } - } - #endif - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public int CalculateSize() { - int size = 0; - size += value_.CalculateSize(_repeated_value_codec); - if (_unknownFields != null) { - size += _unknownFields.CalculateSize(); - } - return size; - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void MergeFrom(HeaderValue other) { - if (other == null) { - return; - } - value_.Add(other.value_); - _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void MergeFrom(pb::CodedInputStream input) { - #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE - input.ReadRawMessage(this); - #else - uint tag; - while ((tag = input.ReadTag()) != 0) { - switch(tag) { - default: - _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input); - break; - case 10: { - value_.AddEntriesFrom(input, _repeated_value_codec); - break; - } - } - } - #endif - } - - #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - void pb::IBufferMessage.InternalMergeFrom(ref pb::ParseContext input) { - uint tag; - while ((tag = input.ReadTag()) != 0) { - switch(tag) { - default: - _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, ref input); - break; - case 10: { - value_.AddEntriesFrom(ref input, _repeated_value_codec); - break; - } - } - } - } - #endif - - } - - public sealed partial class QueryValue : pb::IMessage - #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE - , pb::IBufferMessage - #endif - { - private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new QueryValue()); - private pb::UnknownFieldSet _unknownFields; - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public static pb::MessageParser Parser { get { return _parser; } } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public static pbr::MessageDescriptor Descriptor { - get { return global::Nitric.Proto.Faas.v1.FaasReflection.Descriptor.MessageTypes[18]; } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - pbr::MessageDescriptor pb::IMessage.Descriptor { - get { return Descriptor; } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public QueryValue() { - OnConstruction(); - } - - partial void OnConstruction(); - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public QueryValue(QueryValue other) : this() { - value_ = other.value_.Clone(); - _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public QueryValue Clone() { - return new QueryValue(this); - } - - /// Field number for the "value" field. - public const int ValueFieldNumber = 1; - private static readonly pb::FieldCodec _repeated_value_codec - = pb::FieldCodec.ForString(10); - private readonly pbc::RepeatedField value_ = new pbc::RepeatedField(); - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public pbc::RepeatedField Value { - get { return value_; } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public override bool Equals(object other) { - return Equals(other as QueryValue); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public bool Equals(QueryValue other) { - if (ReferenceEquals(other, null)) { - return false; - } - if (ReferenceEquals(other, this)) { - return true; - } - if(!value_.Equals(other.value_)) return false; - return Equals(_unknownFields, other._unknownFields); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public override int GetHashCode() { - int hash = 1; - hash ^= value_.GetHashCode(); - if (_unknownFields != null) { - hash ^= _unknownFields.GetHashCode(); - } - return hash; - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public override string ToString() { - return pb::JsonFormatter.ToDiagnosticString(this); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void WriteTo(pb::CodedOutputStream output) { - #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE - output.WriteRawMessage(this); - #else - value_.WriteTo(output, _repeated_value_codec); - if (_unknownFields != null) { - _unknownFields.WriteTo(output); - } - #endif - } - - #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - void pb::IBufferMessage.InternalWriteTo(ref pb::WriteContext output) { - value_.WriteTo(ref output, _repeated_value_codec); - if (_unknownFields != null) { - _unknownFields.WriteTo(ref output); - } - } - #endif - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public int CalculateSize() { - int size = 0; - size += value_.CalculateSize(_repeated_value_codec); - if (_unknownFields != null) { - size += _unknownFields.CalculateSize(); - } - return size; - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void MergeFrom(QueryValue other) { - if (other == null) { - return; - } - value_.Add(other.value_); - _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void MergeFrom(pb::CodedInputStream input) { - #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE - input.ReadRawMessage(this); - #else - uint tag; - while ((tag = input.ReadTag()) != 0) { - switch(tag) { - default: - _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input); - break; - case 10: { - value_.AddEntriesFrom(input, _repeated_value_codec); - break; - } - } - } - #endif - } - - #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - void pb::IBufferMessage.InternalMergeFrom(ref pb::ParseContext input) { - uint tag; - while ((tag = input.ReadTag()) != 0) { - switch(tag) { - default: - _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, ref input); - break; - case 10: { - value_.AddEntriesFrom(ref input, _repeated_value_codec); - break; - } - } - } - } - #endif - - } - - public sealed partial class HttpTriggerContext : pb::IMessage - #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE - , pb::IBufferMessage - #endif - { - private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new HttpTriggerContext()); - private pb::UnknownFieldSet _unknownFields; - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public static pb::MessageParser Parser { get { return _parser; } } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public static pbr::MessageDescriptor Descriptor { - get { return global::Nitric.Proto.Faas.v1.FaasReflection.Descriptor.MessageTypes[19]; } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - pbr::MessageDescriptor pb::IMessage.Descriptor { - get { return Descriptor; } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public HttpTriggerContext() { - OnConstruction(); - } - - partial void OnConstruction(); - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public HttpTriggerContext(HttpTriggerContext other) : this() { - method_ = other.method_; - path_ = other.path_; - headersOld_ = other.headersOld_.Clone(); - queryParamsOld_ = other.queryParamsOld_.Clone(); - headers_ = other.headers_.Clone(); - queryParams_ = other.queryParams_.Clone(); - pathParams_ = other.pathParams_.Clone(); - _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public HttpTriggerContext Clone() { - return new HttpTriggerContext(this); - } - - /// Field number for the "method" field. - public const int MethodFieldNumber = 1; - private string method_ = ""; - /// - /// The request method - /// - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public string Method { - get { return method_; } - set { - method_ = pb::ProtoPreconditions.CheckNotNull(value, "value"); - } - } - - /// Field number for the "path" field. - public const int PathFieldNumber = 2; - private string path_ = ""; - /// - /// The path of the request - /// - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public string Path { - get { return path_; } - set { - path_ = pb::ProtoPreconditions.CheckNotNull(value, "value"); - } - } - - /// Field number for the "headers_old" field. - public const int HeadersOldFieldNumber = 3; - private static readonly pbc::MapField.Codec _map_headersOld_codec - = new pbc::MapField.Codec(pb::FieldCodec.ForString(10, ""), pb::FieldCodec.ForString(18, ""), 26); - private readonly pbc::MapField headersOld_ = new pbc::MapField(); - /// - /// The old request headers (preserving for backwards compatibility) - /// TODO: Remove in 1.0 - /// - [global::System.ObsoleteAttribute] - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public pbc::MapField HeadersOld { - get { return headersOld_; } - } - - /// Field number for the "query_params_old" field. - public const int QueryParamsOldFieldNumber = 4; - private static readonly pbc::MapField.Codec _map_queryParamsOld_codec - = new pbc::MapField.Codec(pb::FieldCodec.ForString(10, ""), pb::FieldCodec.ForString(18, ""), 34); - private readonly pbc::MapField queryParamsOld_ = new pbc::MapField(); - /// - /// The old query params (preserving for backwards compatibility) - /// TODO: Remove in 1.0 - /// - [global::System.ObsoleteAttribute] - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public pbc::MapField QueryParamsOld { - get { return queryParamsOld_; } - } - - /// Field number for the "headers" field. - public const int HeadersFieldNumber = 5; - private static readonly pbc::MapField.Codec _map_headers_codec - = new pbc::MapField.Codec(pb::FieldCodec.ForString(10, ""), pb::FieldCodec.ForMessage(18, global::Nitric.Proto.Faas.v1.HeaderValue.Parser), 42); - private readonly pbc::MapField headers_ = new pbc::MapField(); - /// - /// HTTP request headers - /// - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public pbc::MapField Headers { - get { return headers_; } - } - - /// Field number for the "query_params" field. - public const int QueryParamsFieldNumber = 6; - private static readonly pbc::MapField.Codec _map_queryParams_codec - = new pbc::MapField.Codec(pb::FieldCodec.ForString(10, ""), pb::FieldCodec.ForMessage(18, global::Nitric.Proto.Faas.v1.QueryValue.Parser), 50); - private readonly pbc::MapField queryParams_ = new pbc::MapField(); - /// - /// HTTP Query params - /// - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public pbc::MapField QueryParams { - get { return queryParams_; } - } - - /// Field number for the "path_params" field. - public const int PathParamsFieldNumber = 7; - private static readonly pbc::MapField.Codec _map_pathParams_codec - = new pbc::MapField.Codec(pb::FieldCodec.ForString(10, ""), pb::FieldCodec.ForString(18, ""), 58); - private readonly pbc::MapField pathParams_ = new pbc::MapField(); - /// - /// HTTP Path parameters - /// - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public pbc::MapField PathParams { - get { return pathParams_; } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public override bool Equals(object other) { - return Equals(other as HttpTriggerContext); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public bool Equals(HttpTriggerContext other) { - if (ReferenceEquals(other, null)) { - return false; - } - if (ReferenceEquals(other, this)) { - return true; - } - if (Method != other.Method) return false; - if (Path != other.Path) return false; - if (!HeadersOld.Equals(other.HeadersOld)) return false; - if (!QueryParamsOld.Equals(other.QueryParamsOld)) return false; - if (!Headers.Equals(other.Headers)) return false; - if (!QueryParams.Equals(other.QueryParams)) return false; - if (!PathParams.Equals(other.PathParams)) return false; - return Equals(_unknownFields, other._unknownFields); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public override int GetHashCode() { - int hash = 1; - if (Method.Length != 0) hash ^= Method.GetHashCode(); - if (Path.Length != 0) hash ^= Path.GetHashCode(); - hash ^= HeadersOld.GetHashCode(); - hash ^= QueryParamsOld.GetHashCode(); - hash ^= Headers.GetHashCode(); - hash ^= QueryParams.GetHashCode(); - hash ^= PathParams.GetHashCode(); - if (_unknownFields != null) { - hash ^= _unknownFields.GetHashCode(); - } - return hash; - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public override string ToString() { - return pb::JsonFormatter.ToDiagnosticString(this); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void WriteTo(pb::CodedOutputStream output) { - #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE - output.WriteRawMessage(this); - #else - if (Method.Length != 0) { - output.WriteRawTag(10); - output.WriteString(Method); - } - if (Path.Length != 0) { - output.WriteRawTag(18); - output.WriteString(Path); - } - headersOld_.WriteTo(output, _map_headersOld_codec); - queryParamsOld_.WriteTo(output, _map_queryParamsOld_codec); - headers_.WriteTo(output, _map_headers_codec); - queryParams_.WriteTo(output, _map_queryParams_codec); - pathParams_.WriteTo(output, _map_pathParams_codec); - if (_unknownFields != null) { - _unknownFields.WriteTo(output); - } - #endif - } - - #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - void pb::IBufferMessage.InternalWriteTo(ref pb::WriteContext output) { - if (Method.Length != 0) { - output.WriteRawTag(10); - output.WriteString(Method); - } - if (Path.Length != 0) { - output.WriteRawTag(18); - output.WriteString(Path); - } - headersOld_.WriteTo(ref output, _map_headersOld_codec); - queryParamsOld_.WriteTo(ref output, _map_queryParamsOld_codec); - headers_.WriteTo(ref output, _map_headers_codec); - queryParams_.WriteTo(ref output, _map_queryParams_codec); - pathParams_.WriteTo(ref output, _map_pathParams_codec); - if (_unknownFields != null) { - _unknownFields.WriteTo(ref output); - } - } - #endif - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public int CalculateSize() { - int size = 0; - if (Method.Length != 0) { - size += 1 + pb::CodedOutputStream.ComputeStringSize(Method); - } - if (Path.Length != 0) { - size += 1 + pb::CodedOutputStream.ComputeStringSize(Path); - } - size += headersOld_.CalculateSize(_map_headersOld_codec); - size += queryParamsOld_.CalculateSize(_map_queryParamsOld_codec); - size += headers_.CalculateSize(_map_headers_codec); - size += queryParams_.CalculateSize(_map_queryParams_codec); - size += pathParams_.CalculateSize(_map_pathParams_codec); - if (_unknownFields != null) { - size += _unknownFields.CalculateSize(); - } - return size; - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void MergeFrom(HttpTriggerContext other) { - if (other == null) { - return; - } - if (other.Method.Length != 0) { - Method = other.Method; - } - if (other.Path.Length != 0) { - Path = other.Path; - } - headersOld_.Add(other.headersOld_); - queryParamsOld_.Add(other.queryParamsOld_); - headers_.Add(other.headers_); - queryParams_.Add(other.queryParams_); - pathParams_.Add(other.pathParams_); - _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void MergeFrom(pb::CodedInputStream input) { - #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE - input.ReadRawMessage(this); - #else - uint tag; - while ((tag = input.ReadTag()) != 0) { - switch(tag) { - default: - _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input); - break; - case 10: { - Method = input.ReadString(); - break; - } - case 18: { - Path = input.ReadString(); - break; - } - case 26: { - headersOld_.AddEntriesFrom(input, _map_headersOld_codec); - break; - } - case 34: { - queryParamsOld_.AddEntriesFrom(input, _map_queryParamsOld_codec); - break; - } - case 42: { - headers_.AddEntriesFrom(input, _map_headers_codec); - break; - } - case 50: { - queryParams_.AddEntriesFrom(input, _map_queryParams_codec); - break; - } - case 58: { - pathParams_.AddEntriesFrom(input, _map_pathParams_codec); - break; - } - } - } - #endif - } - - #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - void pb::IBufferMessage.InternalMergeFrom(ref pb::ParseContext input) { - uint tag; - while ((tag = input.ReadTag()) != 0) { - switch(tag) { - default: - _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, ref input); - break; - case 10: { - Method = input.ReadString(); - break; - } - case 18: { - Path = input.ReadString(); - break; - } - case 26: { - headersOld_.AddEntriesFrom(ref input, _map_headersOld_codec); - break; - } - case 34: { - queryParamsOld_.AddEntriesFrom(ref input, _map_queryParamsOld_codec); - break; - } - case 42: { - headers_.AddEntriesFrom(ref input, _map_headers_codec); - break; - } - case 50: { - queryParams_.AddEntriesFrom(ref input, _map_queryParams_codec); - break; - } - case 58: { - pathParams_.AddEntriesFrom(ref input, _map_pathParams_codec); - break; - } - } - } - } - #endif - - } - - public sealed partial class TopicTriggerContext : pb::IMessage - #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE - , pb::IBufferMessage - #endif - { - private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new TopicTriggerContext()); - private pb::UnknownFieldSet _unknownFields; - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public static pb::MessageParser Parser { get { return _parser; } } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public static pbr::MessageDescriptor Descriptor { - get { return global::Nitric.Proto.Faas.v1.FaasReflection.Descriptor.MessageTypes[20]; } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - pbr::MessageDescriptor pb::IMessage.Descriptor { - get { return Descriptor; } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public TopicTriggerContext() { - OnConstruction(); - } - - partial void OnConstruction(); - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public TopicTriggerContext(TopicTriggerContext other) : this() { - topic_ = other.topic_; - _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public TopicTriggerContext Clone() { - return new TopicTriggerContext(this); - } - - /// Field number for the "topic" field. - public const int TopicFieldNumber = 1; - private string topic_ = ""; - /// - /// The topic the message was published for - /// - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public string Topic { - get { return topic_; } - set { - topic_ = pb::ProtoPreconditions.CheckNotNull(value, "value"); - } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public override bool Equals(object other) { - return Equals(other as TopicTriggerContext); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public bool Equals(TopicTriggerContext other) { - if (ReferenceEquals(other, null)) { - return false; - } - if (ReferenceEquals(other, this)) { - return true; - } - if (Topic != other.Topic) return false; - return Equals(_unknownFields, other._unknownFields); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public override int GetHashCode() { - int hash = 1; - if (Topic.Length != 0) hash ^= Topic.GetHashCode(); - if (_unknownFields != null) { - hash ^= _unknownFields.GetHashCode(); - } - return hash; - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public override string ToString() { - return pb::JsonFormatter.ToDiagnosticString(this); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void WriteTo(pb::CodedOutputStream output) { - #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE - output.WriteRawMessage(this); - #else - if (Topic.Length != 0) { - output.WriteRawTag(10); - output.WriteString(Topic); - } - if (_unknownFields != null) { - _unknownFields.WriteTo(output); - } - #endif - } - - #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - void pb::IBufferMessage.InternalWriteTo(ref pb::WriteContext output) { - if (Topic.Length != 0) { - output.WriteRawTag(10); - output.WriteString(Topic); - } - if (_unknownFields != null) { - _unknownFields.WriteTo(ref output); - } - } - #endif - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public int CalculateSize() { - int size = 0; - if (Topic.Length != 0) { - size += 1 + pb::CodedOutputStream.ComputeStringSize(Topic); - } - if (_unknownFields != null) { - size += _unknownFields.CalculateSize(); - } - return size; - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void MergeFrom(TopicTriggerContext other) { - if (other == null) { - return; - } - if (other.Topic.Length != 0) { - Topic = other.Topic; - } - _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void MergeFrom(pb::CodedInputStream input) { - #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE - input.ReadRawMessage(this); - #else - uint tag; - while ((tag = input.ReadTag()) != 0) { - switch(tag) { - default: - _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input); - break; - case 10: { - Topic = input.ReadString(); - break; - } - } - } - #endif - } - - #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - void pb::IBufferMessage.InternalMergeFrom(ref pb::ParseContext input) { - uint tag; - while ((tag = input.ReadTag()) != 0) { - switch(tag) { - default: - _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, ref input); - break; - case 10: { - Topic = input.ReadString(); - break; - } - } - } - } - #endif - - } - - public sealed partial class BucketNotification : pb::IMessage - #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE - , pb::IBufferMessage - #endif - { - private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new BucketNotification()); - private pb::UnknownFieldSet _unknownFields; - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public static pb::MessageParser Parser { get { return _parser; } } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public static pbr::MessageDescriptor Descriptor { - get { return global::Nitric.Proto.Faas.v1.FaasReflection.Descriptor.MessageTypes[21]; } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - pbr::MessageDescriptor pb::IMessage.Descriptor { - get { return Descriptor; } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public BucketNotification() { - OnConstruction(); - } - - partial void OnConstruction(); - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public BucketNotification(BucketNotification other) : this() { - key_ = other.key_; - type_ = other.type_; - _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public BucketNotification Clone() { - return new BucketNotification(this); - } - - /// Field number for the "key" field. - public const int KeyFieldNumber = 1; - private string key_ = ""; - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public string Key { - get { return key_; } - set { - key_ = pb::ProtoPreconditions.CheckNotNull(value, "value"); - } - } - - /// Field number for the "type" field. - public const int TypeFieldNumber = 2; - private global::Nitric.Proto.Faas.v1.BucketNotificationType type_ = global::Nitric.Proto.Faas.v1.BucketNotificationType.All; - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public global::Nitric.Proto.Faas.v1.BucketNotificationType Type { - get { return type_; } - set { - type_ = value; - } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public override bool Equals(object other) { - return Equals(other as BucketNotification); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public bool Equals(BucketNotification other) { - if (ReferenceEquals(other, null)) { - return false; - } - if (ReferenceEquals(other, this)) { - return true; - } - if (Key != other.Key) return false; - if (Type != other.Type) return false; - return Equals(_unknownFields, other._unknownFields); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public override int GetHashCode() { - int hash = 1; - if (Key.Length != 0) hash ^= Key.GetHashCode(); - if (Type != global::Nitric.Proto.Faas.v1.BucketNotificationType.All) hash ^= Type.GetHashCode(); - if (_unknownFields != null) { - hash ^= _unknownFields.GetHashCode(); - } - return hash; - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public override string ToString() { - return pb::JsonFormatter.ToDiagnosticString(this); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void WriteTo(pb::CodedOutputStream output) { - #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE - output.WriteRawMessage(this); - #else - if (Key.Length != 0) { - output.WriteRawTag(10); - output.WriteString(Key); - } - if (Type != global::Nitric.Proto.Faas.v1.BucketNotificationType.All) { - output.WriteRawTag(16); - output.WriteEnum((int) Type); - } - if (_unknownFields != null) { - _unknownFields.WriteTo(output); - } - #endif - } - - #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - void pb::IBufferMessage.InternalWriteTo(ref pb::WriteContext output) { - if (Key.Length != 0) { - output.WriteRawTag(10); - output.WriteString(Key); - } - if (Type != global::Nitric.Proto.Faas.v1.BucketNotificationType.All) { - output.WriteRawTag(16); - output.WriteEnum((int) Type); - } - if (_unknownFields != null) { - _unknownFields.WriteTo(ref output); - } - } - #endif - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public int CalculateSize() { - int size = 0; - if (Key.Length != 0) { - size += 1 + pb::CodedOutputStream.ComputeStringSize(Key); - } - if (Type != global::Nitric.Proto.Faas.v1.BucketNotificationType.All) { - size += 1 + pb::CodedOutputStream.ComputeEnumSize((int) Type); - } - if (_unknownFields != null) { - size += _unknownFields.CalculateSize(); - } - return size; - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void MergeFrom(BucketNotification other) { - if (other == null) { - return; - } - if (other.Key.Length != 0) { - Key = other.Key; - } - if (other.Type != global::Nitric.Proto.Faas.v1.BucketNotificationType.All) { - Type = other.Type; - } - _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void MergeFrom(pb::CodedInputStream input) { - #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE - input.ReadRawMessage(this); - #else - uint tag; - while ((tag = input.ReadTag()) != 0) { - switch(tag) { - default: - _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input); - break; - case 10: { - Key = input.ReadString(); - break; - } - case 16: { - Type = (global::Nitric.Proto.Faas.v1.BucketNotificationType) input.ReadEnum(); - break; - } - } - } - #endif - } - - #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - void pb::IBufferMessage.InternalMergeFrom(ref pb::ParseContext input) { - uint tag; - while ((tag = input.ReadTag()) != 0) { - switch(tag) { - default: - _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, ref input); - break; - case 10: { - Key = input.ReadString(); - break; - } - case 16: { - Type = (global::Nitric.Proto.Faas.v1.BucketNotificationType) input.ReadEnum(); - break; - } - } - } - } - #endif - - } - - public sealed partial class NotificationTriggerContext : pb::IMessage - #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE - , pb::IBufferMessage - #endif - { - private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new NotificationTriggerContext()); - private pb::UnknownFieldSet _unknownFields; - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public static pb::MessageParser Parser { get { return _parser; } } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public static pbr::MessageDescriptor Descriptor { - get { return global::Nitric.Proto.Faas.v1.FaasReflection.Descriptor.MessageTypes[22]; } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - pbr::MessageDescriptor pb::IMessage.Descriptor { - get { return Descriptor; } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public NotificationTriggerContext() { - OnConstruction(); - } - - partial void OnConstruction(); - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public NotificationTriggerContext(NotificationTriggerContext other) : this() { - source_ = other.source_; - switch (other.NotificationCase) { - case NotificationOneofCase.Bucket: - Bucket = other.Bucket.Clone(); - break; - } - - _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public NotificationTriggerContext Clone() { - return new NotificationTriggerContext(this); - } - - /// Field number for the "source" field. - public const int SourceFieldNumber = 1; - private string source_ = ""; - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public string Source { - get { return source_; } - set { - source_ = pb::ProtoPreconditions.CheckNotNull(value, "value"); - } - } - - /// Field number for the "bucket" field. - public const int BucketFieldNumber = 10; - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public global::Nitric.Proto.Faas.v1.BucketNotification Bucket { - get { return notificationCase_ == NotificationOneofCase.Bucket ? (global::Nitric.Proto.Faas.v1.BucketNotification) notification_ : null; } - set { - notification_ = value; - notificationCase_ = value == null ? NotificationOneofCase.None : NotificationOneofCase.Bucket; - } - } - - private object notification_; - /// Enum of possible cases for the "notification" oneof. - public enum NotificationOneofCase { - None = 0, - Bucket = 10, - } - private NotificationOneofCase notificationCase_ = NotificationOneofCase.None; - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public NotificationOneofCase NotificationCase { - get { return notificationCase_; } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void ClearNotification() { - notificationCase_ = NotificationOneofCase.None; - notification_ = null; - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public override bool Equals(object other) { - return Equals(other as NotificationTriggerContext); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public bool Equals(NotificationTriggerContext other) { - if (ReferenceEquals(other, null)) { - return false; - } - if (ReferenceEquals(other, this)) { - return true; - } - if (Source != other.Source) return false; - if (!object.Equals(Bucket, other.Bucket)) return false; - if (NotificationCase != other.NotificationCase) return false; - return Equals(_unknownFields, other._unknownFields); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public override int GetHashCode() { - int hash = 1; - if (Source.Length != 0) hash ^= Source.GetHashCode(); - if (notificationCase_ == NotificationOneofCase.Bucket) hash ^= Bucket.GetHashCode(); - hash ^= (int) notificationCase_; - if (_unknownFields != null) { - hash ^= _unknownFields.GetHashCode(); - } - return hash; - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public override string ToString() { - return pb::JsonFormatter.ToDiagnosticString(this); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void WriteTo(pb::CodedOutputStream output) { - #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE - output.WriteRawMessage(this); - #else - if (Source.Length != 0) { - output.WriteRawTag(10); - output.WriteString(Source); - } - if (notificationCase_ == NotificationOneofCase.Bucket) { - output.WriteRawTag(82); - output.WriteMessage(Bucket); - } - if (_unknownFields != null) { - _unknownFields.WriteTo(output); - } - #endif - } - - #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - void pb::IBufferMessage.InternalWriteTo(ref pb::WriteContext output) { - if (Source.Length != 0) { - output.WriteRawTag(10); - output.WriteString(Source); - } - if (notificationCase_ == NotificationOneofCase.Bucket) { - output.WriteRawTag(82); - output.WriteMessage(Bucket); - } - if (_unknownFields != null) { - _unknownFields.WriteTo(ref output); - } - } - #endif - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public int CalculateSize() { - int size = 0; - if (Source.Length != 0) { - size += 1 + pb::CodedOutputStream.ComputeStringSize(Source); - } - if (notificationCase_ == NotificationOneofCase.Bucket) { - size += 1 + pb::CodedOutputStream.ComputeMessageSize(Bucket); - } - if (_unknownFields != null) { - size += _unknownFields.CalculateSize(); - } - return size; - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void MergeFrom(NotificationTriggerContext other) { - if (other == null) { - return; - } - if (other.Source.Length != 0) { - Source = other.Source; - } - switch (other.NotificationCase) { - case NotificationOneofCase.Bucket: - if (Bucket == null) { - Bucket = new global::Nitric.Proto.Faas.v1.BucketNotification(); - } - Bucket.MergeFrom(other.Bucket); - break; - } - - _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void MergeFrom(pb::CodedInputStream input) { - #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE - input.ReadRawMessage(this); - #else - uint tag; - while ((tag = input.ReadTag()) != 0) { - switch(tag) { - default: - _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input); - break; - case 10: { - Source = input.ReadString(); - break; - } - case 82: { - global::Nitric.Proto.Faas.v1.BucketNotification subBuilder = new global::Nitric.Proto.Faas.v1.BucketNotification(); - if (notificationCase_ == NotificationOneofCase.Bucket) { - subBuilder.MergeFrom(Bucket); - } - input.ReadMessage(subBuilder); - Bucket = subBuilder; - break; - } - } - } - #endif - } - - #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - void pb::IBufferMessage.InternalMergeFrom(ref pb::ParseContext input) { - uint tag; - while ((tag = input.ReadTag()) != 0) { - switch(tag) { - default: - _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, ref input); - break; - case 10: { - Source = input.ReadString(); - break; - } - case 82: { - global::Nitric.Proto.Faas.v1.BucketNotification subBuilder = new global::Nitric.Proto.Faas.v1.BucketNotification(); - if (notificationCase_ == NotificationOneofCase.Bucket) { - subBuilder.MergeFrom(Bucket); - } - input.ReadMessage(subBuilder); - Bucket = subBuilder; - break; - } - } - } - } - #endif - - } - - public sealed partial class WebsocketTriggerContext : pb::IMessage - #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE - , pb::IBufferMessage - #endif - { - private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new WebsocketTriggerContext()); - private pb::UnknownFieldSet _unknownFields; - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public static pb::MessageParser Parser { get { return _parser; } } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public static pbr::MessageDescriptor Descriptor { - get { return global::Nitric.Proto.Faas.v1.FaasReflection.Descriptor.MessageTypes[23]; } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - pbr::MessageDescriptor pb::IMessage.Descriptor { - get { return Descriptor; } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public WebsocketTriggerContext() { - OnConstruction(); - } - - partial void OnConstruction(); - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public WebsocketTriggerContext(WebsocketTriggerContext other) : this() { - socket_ = other.socket_; - event_ = other.event_; - connectionId_ = other.connectionId_; - queryParams_ = other.queryParams_.Clone(); - _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public WebsocketTriggerContext Clone() { - return new WebsocketTriggerContext(this); - } - - /// Field number for the "socket" field. - public const int SocketFieldNumber = 1; - private string socket_ = ""; - /// - /// The nitric name of the socket that this worker listens on - /// - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public string Socket { - get { return socket_; } - set { - socket_ = pb::ProtoPreconditions.CheckNotNull(value, "value"); - } - } - - /// Field number for the "event" field. - public const int EventFieldNumber = 2; - private global::Nitric.Proto.Faas.v1.WebsocketEvent event_ = global::Nitric.Proto.Faas.v1.WebsocketEvent.Connect; - /// - /// The type of websocket event - /// - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public global::Nitric.Proto.Faas.v1.WebsocketEvent Event { - get { return event_; } - set { - event_ = value; - } - } - - /// Field number for the "connectionId" field. - public const int ConnectionIdFieldNumber = 3; - private string connectionId_ = ""; - /// - /// The connection this trigger came from - /// - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public string ConnectionId { - get { return connectionId_; } - set { - connectionId_ = pb::ProtoPreconditions.CheckNotNull(value, "value"); - } - } - - /// Field number for the "query_params" field. - public const int QueryParamsFieldNumber = 6; - private static readonly pbc::MapField.Codec _map_queryParams_codec - = new pbc::MapField.Codec(pb::FieldCodec.ForString(10, ""), pb::FieldCodec.ForMessage(18, global::Nitric.Proto.Faas.v1.QueryValue.Parser), 50); - private readonly pbc::MapField queryParams_ = new pbc::MapField(); - /// - /// The query params available in the connection request - /// - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public pbc::MapField QueryParams { - get { return queryParams_; } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public override bool Equals(object other) { - return Equals(other as WebsocketTriggerContext); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public bool Equals(WebsocketTriggerContext other) { - if (ReferenceEquals(other, null)) { - return false; - } - if (ReferenceEquals(other, this)) { - return true; - } - if (Socket != other.Socket) return false; - if (Event != other.Event) return false; - if (ConnectionId != other.ConnectionId) return false; - if (!QueryParams.Equals(other.QueryParams)) return false; - return Equals(_unknownFields, other._unknownFields); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public override int GetHashCode() { - int hash = 1; - if (Socket.Length != 0) hash ^= Socket.GetHashCode(); - if (Event != global::Nitric.Proto.Faas.v1.WebsocketEvent.Connect) hash ^= Event.GetHashCode(); - if (ConnectionId.Length != 0) hash ^= ConnectionId.GetHashCode(); - hash ^= QueryParams.GetHashCode(); - if (_unknownFields != null) { - hash ^= _unknownFields.GetHashCode(); - } - return hash; - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public override string ToString() { - return pb::JsonFormatter.ToDiagnosticString(this); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void WriteTo(pb::CodedOutputStream output) { - #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE - output.WriteRawMessage(this); - #else - if (Socket.Length != 0) { - output.WriteRawTag(10); - output.WriteString(Socket); - } - if (Event != global::Nitric.Proto.Faas.v1.WebsocketEvent.Connect) { - output.WriteRawTag(16); - output.WriteEnum((int) Event); - } - if (ConnectionId.Length != 0) { - output.WriteRawTag(26); - output.WriteString(ConnectionId); - } - queryParams_.WriteTo(output, _map_queryParams_codec); - if (_unknownFields != null) { - _unknownFields.WriteTo(output); - } - #endif - } - - #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - void pb::IBufferMessage.InternalWriteTo(ref pb::WriteContext output) { - if (Socket.Length != 0) { - output.WriteRawTag(10); - output.WriteString(Socket); - } - if (Event != global::Nitric.Proto.Faas.v1.WebsocketEvent.Connect) { - output.WriteRawTag(16); - output.WriteEnum((int) Event); - } - if (ConnectionId.Length != 0) { - output.WriteRawTag(26); - output.WriteString(ConnectionId); - } - queryParams_.WriteTo(ref output, _map_queryParams_codec); - if (_unknownFields != null) { - _unknownFields.WriteTo(ref output); - } - } - #endif - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public int CalculateSize() { - int size = 0; - if (Socket.Length != 0) { - size += 1 + pb::CodedOutputStream.ComputeStringSize(Socket); - } - if (Event != global::Nitric.Proto.Faas.v1.WebsocketEvent.Connect) { - size += 1 + pb::CodedOutputStream.ComputeEnumSize((int) Event); - } - if (ConnectionId.Length != 0) { - size += 1 + pb::CodedOutputStream.ComputeStringSize(ConnectionId); - } - size += queryParams_.CalculateSize(_map_queryParams_codec); - if (_unknownFields != null) { - size += _unknownFields.CalculateSize(); - } - return size; - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void MergeFrom(WebsocketTriggerContext other) { - if (other == null) { - return; - } - if (other.Socket.Length != 0) { - Socket = other.Socket; - } - if (other.Event != global::Nitric.Proto.Faas.v1.WebsocketEvent.Connect) { - Event = other.Event; - } - if (other.ConnectionId.Length != 0) { - ConnectionId = other.ConnectionId; - } - queryParams_.Add(other.queryParams_); - _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void MergeFrom(pb::CodedInputStream input) { - #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE - input.ReadRawMessage(this); - #else - uint tag; - while ((tag = input.ReadTag()) != 0) { - switch(tag) { - default: - _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input); - break; - case 10: { - Socket = input.ReadString(); - break; - } - case 16: { - Event = (global::Nitric.Proto.Faas.v1.WebsocketEvent) input.ReadEnum(); - break; - } - case 26: { - ConnectionId = input.ReadString(); - break; - } - case 50: { - queryParams_.AddEntriesFrom(input, _map_queryParams_codec); - break; - } - } - } - #endif - } - - #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - void pb::IBufferMessage.InternalMergeFrom(ref pb::ParseContext input) { - uint tag; - while ((tag = input.ReadTag()) != 0) { - switch(tag) { - default: - _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, ref input); - break; - case 10: { - Socket = input.ReadString(); - break; - } - case 16: { - Event = (global::Nitric.Proto.Faas.v1.WebsocketEvent) input.ReadEnum(); - break; - } - case 26: { - ConnectionId = input.ReadString(); - break; - } - case 50: { - queryParams_.AddEntriesFrom(ref input, _map_queryParams_codec); - break; - } - } - } - } - #endif - - } - - /// - /// The worker has successfully processed a trigger - /// - public sealed partial class TriggerResponse : pb::IMessage - #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE - , pb::IBufferMessage - #endif - { - private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new TriggerResponse()); - private pb::UnknownFieldSet _unknownFields; - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public static pb::MessageParser Parser { get { return _parser; } } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public static pbr::MessageDescriptor Descriptor { - get { return global::Nitric.Proto.Faas.v1.FaasReflection.Descriptor.MessageTypes[24]; } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - pbr::MessageDescriptor pb::IMessage.Descriptor { - get { return Descriptor; } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public TriggerResponse() { - OnConstruction(); - } - - partial void OnConstruction(); - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public TriggerResponse(TriggerResponse other) : this() { - data_ = other.data_; - switch (other.ContextCase) { - case ContextOneofCase.Http: - Http = other.Http.Clone(); - break; - case ContextOneofCase.Topic: - Topic = other.Topic.Clone(); - break; - case ContextOneofCase.Notification: - Notification = other.Notification.Clone(); - break; - case ContextOneofCase.Websocket: - Websocket = other.Websocket.Clone(); - break; - } - - _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public TriggerResponse Clone() { - return new TriggerResponse(this); - } - - /// Field number for the "data" field. - public const int DataFieldNumber = 1; - private pb::ByteString data_ = pb::ByteString.Empty; - /// - /// The data returned in the response - /// - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public pb::ByteString Data { - get { return data_; } - set { - data_ = pb::ProtoPreconditions.CheckNotNull(value, "value"); - } - } - - /// Field number for the "http" field. - public const int HttpFieldNumber = 10; - /// - /// response to a http request - /// - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public global::Nitric.Proto.Faas.v1.HttpResponseContext Http { - get { return contextCase_ == ContextOneofCase.Http ? (global::Nitric.Proto.Faas.v1.HttpResponseContext) context_ : null; } - set { - context_ = value; - contextCase_ = value == null ? ContextOneofCase.None : ContextOneofCase.Http; - } - } - - /// Field number for the "topic" field. - public const int TopicFieldNumber = 11; - /// - /// response to a topic trigger - /// - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public global::Nitric.Proto.Faas.v1.TopicResponseContext Topic { - get { return contextCase_ == ContextOneofCase.Topic ? (global::Nitric.Proto.Faas.v1.TopicResponseContext) context_ : null; } - set { - context_ = value; - contextCase_ = value == null ? ContextOneofCase.None : ContextOneofCase.Topic; - } - } - - /// Field number for the "notification" field. - public const int NotificationFieldNumber = 12; - /// - /// response to a notification trigger - /// - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public global::Nitric.Proto.Faas.v1.NotificationResponseContext Notification { - get { return contextCase_ == ContextOneofCase.Notification ? (global::Nitric.Proto.Faas.v1.NotificationResponseContext) context_ : null; } - set { - context_ = value; - contextCase_ = value == null ? ContextOneofCase.None : ContextOneofCase.Notification; - } - } - - /// Field number for the "websocket" field. - public const int WebsocketFieldNumber = 13; - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public global::Nitric.Proto.Faas.v1.WebsocketResponseContext Websocket { - get { return contextCase_ == ContextOneofCase.Websocket ? (global::Nitric.Proto.Faas.v1.WebsocketResponseContext) context_ : null; } - set { - context_ = value; - contextCase_ = value == null ? ContextOneofCase.None : ContextOneofCase.Websocket; - } - } - - private object context_; - /// Enum of possible cases for the "context" oneof. - public enum ContextOneofCase { - None = 0, - Http = 10, - Topic = 11, - Notification = 12, - Websocket = 13, - } - private ContextOneofCase contextCase_ = ContextOneofCase.None; - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public ContextOneofCase ContextCase { - get { return contextCase_; } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void ClearContext() { - contextCase_ = ContextOneofCase.None; - context_ = null; - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public override bool Equals(object other) { - return Equals(other as TriggerResponse); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public bool Equals(TriggerResponse other) { - if (ReferenceEquals(other, null)) { - return false; - } - if (ReferenceEquals(other, this)) { - return true; - } - if (Data != other.Data) return false; - if (!object.Equals(Http, other.Http)) return false; - if (!object.Equals(Topic, other.Topic)) return false; - if (!object.Equals(Notification, other.Notification)) return false; - if (!object.Equals(Websocket, other.Websocket)) return false; - if (ContextCase != other.ContextCase) return false; - return Equals(_unknownFields, other._unknownFields); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public override int GetHashCode() { - int hash = 1; - if (Data.Length != 0) hash ^= Data.GetHashCode(); - if (contextCase_ == ContextOneofCase.Http) hash ^= Http.GetHashCode(); - if (contextCase_ == ContextOneofCase.Topic) hash ^= Topic.GetHashCode(); - if (contextCase_ == ContextOneofCase.Notification) hash ^= Notification.GetHashCode(); - if (contextCase_ == ContextOneofCase.Websocket) hash ^= Websocket.GetHashCode(); - hash ^= (int) contextCase_; - if (_unknownFields != null) { - hash ^= _unknownFields.GetHashCode(); - } - return hash; - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public override string ToString() { - return pb::JsonFormatter.ToDiagnosticString(this); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void WriteTo(pb::CodedOutputStream output) { - #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE - output.WriteRawMessage(this); - #else - if (Data.Length != 0) { - output.WriteRawTag(10); - output.WriteBytes(Data); - } - if (contextCase_ == ContextOneofCase.Http) { - output.WriteRawTag(82); - output.WriteMessage(Http); - } - if (contextCase_ == ContextOneofCase.Topic) { - output.WriteRawTag(90); - output.WriteMessage(Topic); - } - if (contextCase_ == ContextOneofCase.Notification) { - output.WriteRawTag(98); - output.WriteMessage(Notification); - } - if (contextCase_ == ContextOneofCase.Websocket) { - output.WriteRawTag(106); - output.WriteMessage(Websocket); - } - if (_unknownFields != null) { - _unknownFields.WriteTo(output); - } - #endif - } - - #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - void pb::IBufferMessage.InternalWriteTo(ref pb::WriteContext output) { - if (Data.Length != 0) { - output.WriteRawTag(10); - output.WriteBytes(Data); - } - if (contextCase_ == ContextOneofCase.Http) { - output.WriteRawTag(82); - output.WriteMessage(Http); - } - if (contextCase_ == ContextOneofCase.Topic) { - output.WriteRawTag(90); - output.WriteMessage(Topic); - } - if (contextCase_ == ContextOneofCase.Notification) { - output.WriteRawTag(98); - output.WriteMessage(Notification); - } - if (contextCase_ == ContextOneofCase.Websocket) { - output.WriteRawTag(106); - output.WriteMessage(Websocket); - } - if (_unknownFields != null) { - _unknownFields.WriteTo(ref output); - } - } - #endif - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public int CalculateSize() { - int size = 0; - if (Data.Length != 0) { - size += 1 + pb::CodedOutputStream.ComputeBytesSize(Data); - } - if (contextCase_ == ContextOneofCase.Http) { - size += 1 + pb::CodedOutputStream.ComputeMessageSize(Http); - } - if (contextCase_ == ContextOneofCase.Topic) { - size += 1 + pb::CodedOutputStream.ComputeMessageSize(Topic); - } - if (contextCase_ == ContextOneofCase.Notification) { - size += 1 + pb::CodedOutputStream.ComputeMessageSize(Notification); - } - if (contextCase_ == ContextOneofCase.Websocket) { - size += 1 + pb::CodedOutputStream.ComputeMessageSize(Websocket); - } - if (_unknownFields != null) { - size += _unknownFields.CalculateSize(); - } - return size; - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void MergeFrom(TriggerResponse other) { - if (other == null) { - return; - } - if (other.Data.Length != 0) { - Data = other.Data; - } - switch (other.ContextCase) { - case ContextOneofCase.Http: - if (Http == null) { - Http = new global::Nitric.Proto.Faas.v1.HttpResponseContext(); - } - Http.MergeFrom(other.Http); - break; - case ContextOneofCase.Topic: - if (Topic == null) { - Topic = new global::Nitric.Proto.Faas.v1.TopicResponseContext(); - } - Topic.MergeFrom(other.Topic); - break; - case ContextOneofCase.Notification: - if (Notification == null) { - Notification = new global::Nitric.Proto.Faas.v1.NotificationResponseContext(); - } - Notification.MergeFrom(other.Notification); - break; - case ContextOneofCase.Websocket: - if (Websocket == null) { - Websocket = new global::Nitric.Proto.Faas.v1.WebsocketResponseContext(); - } - Websocket.MergeFrom(other.Websocket); - break; - } - - _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void MergeFrom(pb::CodedInputStream input) { - #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE - input.ReadRawMessage(this); - #else - uint tag; - while ((tag = input.ReadTag()) != 0) { - switch(tag) { - default: - _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input); - break; - case 10: { - Data = input.ReadBytes(); - break; - } - case 82: { - global::Nitric.Proto.Faas.v1.HttpResponseContext subBuilder = new global::Nitric.Proto.Faas.v1.HttpResponseContext(); - if (contextCase_ == ContextOneofCase.Http) { - subBuilder.MergeFrom(Http); - } - input.ReadMessage(subBuilder); - Http = subBuilder; - break; - } - case 90: { - global::Nitric.Proto.Faas.v1.TopicResponseContext subBuilder = new global::Nitric.Proto.Faas.v1.TopicResponseContext(); - if (contextCase_ == ContextOneofCase.Topic) { - subBuilder.MergeFrom(Topic); - } - input.ReadMessage(subBuilder); - Topic = subBuilder; - break; - } - case 98: { - global::Nitric.Proto.Faas.v1.NotificationResponseContext subBuilder = new global::Nitric.Proto.Faas.v1.NotificationResponseContext(); - if (contextCase_ == ContextOneofCase.Notification) { - subBuilder.MergeFrom(Notification); - } - input.ReadMessage(subBuilder); - Notification = subBuilder; - break; - } - case 106: { - global::Nitric.Proto.Faas.v1.WebsocketResponseContext subBuilder = new global::Nitric.Proto.Faas.v1.WebsocketResponseContext(); - if (contextCase_ == ContextOneofCase.Websocket) { - subBuilder.MergeFrom(Websocket); - } - input.ReadMessage(subBuilder); - Websocket = subBuilder; - break; - } - } - } - #endif - } - - #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - void pb::IBufferMessage.InternalMergeFrom(ref pb::ParseContext input) { - uint tag; - while ((tag = input.ReadTag()) != 0) { - switch(tag) { - default: - _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, ref input); - break; - case 10: { - Data = input.ReadBytes(); - break; - } - case 82: { - global::Nitric.Proto.Faas.v1.HttpResponseContext subBuilder = new global::Nitric.Proto.Faas.v1.HttpResponseContext(); - if (contextCase_ == ContextOneofCase.Http) { - subBuilder.MergeFrom(Http); - } - input.ReadMessage(subBuilder); - Http = subBuilder; - break; - } - case 90: { - global::Nitric.Proto.Faas.v1.TopicResponseContext subBuilder = new global::Nitric.Proto.Faas.v1.TopicResponseContext(); - if (contextCase_ == ContextOneofCase.Topic) { - subBuilder.MergeFrom(Topic); - } - input.ReadMessage(subBuilder); - Topic = subBuilder; - break; - } - case 98: { - global::Nitric.Proto.Faas.v1.NotificationResponseContext subBuilder = new global::Nitric.Proto.Faas.v1.NotificationResponseContext(); - if (contextCase_ == ContextOneofCase.Notification) { - subBuilder.MergeFrom(Notification); - } - input.ReadMessage(subBuilder); - Notification = subBuilder; - break; - } - case 106: { - global::Nitric.Proto.Faas.v1.WebsocketResponseContext subBuilder = new global::Nitric.Proto.Faas.v1.WebsocketResponseContext(); - if (contextCase_ == ContextOneofCase.Websocket) { - subBuilder.MergeFrom(Websocket); - } - input.ReadMessage(subBuilder); - Websocket = subBuilder; - break; - } - } - } - } - #endif - - } - - /// - /// 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... - /// - public sealed partial class HttpResponseContext : pb::IMessage - #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE - , pb::IBufferMessage - #endif - { - private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new HttpResponseContext()); - private pb::UnknownFieldSet _unknownFields; - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public static pb::MessageParser Parser { get { return _parser; } } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public static pbr::MessageDescriptor Descriptor { - get { return global::Nitric.Proto.Faas.v1.FaasReflection.Descriptor.MessageTypes[25]; } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - pbr::MessageDescriptor pb::IMessage.Descriptor { - get { return Descriptor; } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public HttpResponseContext() { - OnConstruction(); - } - - partial void OnConstruction(); - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public HttpResponseContext(HttpResponseContext other) : this() { - headersOld_ = other.headersOld_.Clone(); - status_ = other.status_; - headers_ = other.headers_.Clone(); - _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public HttpResponseContext Clone() { - return new HttpResponseContext(this); - } - - /// Field number for the "headers_old" field. - public const int HeadersOldFieldNumber = 1; - private static readonly pbc::MapField.Codec _map_headersOld_codec - = new pbc::MapField.Codec(pb::FieldCodec.ForString(10, ""), pb::FieldCodec.ForString(18, ""), 10); - private readonly pbc::MapField headersOld_ = new pbc::MapField(); - /// - /// Old HTTP response headers (deprecated) - /// TODO: Remove in 1.0 - /// - [global::System.ObsoleteAttribute] - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public pbc::MapField HeadersOld { - get { return headersOld_; } - } - - /// Field number for the "status" field. - public const int StatusFieldNumber = 2; - private int status_; - /// - /// The HTTP status of the request - /// - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public int Status { - get { return status_; } - set { - status_ = value; - } - } - - /// Field number for the "headers" field. - public const int HeadersFieldNumber = 3; - private static readonly pbc::MapField.Codec _map_headers_codec - = new pbc::MapField.Codec(pb::FieldCodec.ForString(10, ""), pb::FieldCodec.ForMessage(18, global::Nitric.Proto.Faas.v1.HeaderValue.Parser), 26); - private readonly pbc::MapField headers_ = new pbc::MapField(); - /// - /// HTTP response headers - /// - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public pbc::MapField Headers { - get { return headers_; } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public override bool Equals(object other) { - return Equals(other as HttpResponseContext); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public bool Equals(HttpResponseContext other) { - if (ReferenceEquals(other, null)) { - return false; - } - if (ReferenceEquals(other, this)) { - return true; - } - if (!HeadersOld.Equals(other.HeadersOld)) return false; - if (Status != other.Status) return false; - if (!Headers.Equals(other.Headers)) return false; - return Equals(_unknownFields, other._unknownFields); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public override int GetHashCode() { - int hash = 1; - hash ^= HeadersOld.GetHashCode(); - if (Status != 0) hash ^= Status.GetHashCode(); - hash ^= Headers.GetHashCode(); - if (_unknownFields != null) { - hash ^= _unknownFields.GetHashCode(); - } - return hash; - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public override string ToString() { - return pb::JsonFormatter.ToDiagnosticString(this); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void WriteTo(pb::CodedOutputStream output) { - #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE - output.WriteRawMessage(this); - #else - headersOld_.WriteTo(output, _map_headersOld_codec); - if (Status != 0) { - output.WriteRawTag(16); - output.WriteInt32(Status); - } - headers_.WriteTo(output, _map_headers_codec); - if (_unknownFields != null) { - _unknownFields.WriteTo(output); - } - #endif - } - - #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - void pb::IBufferMessage.InternalWriteTo(ref pb::WriteContext output) { - headersOld_.WriteTo(ref output, _map_headersOld_codec); - if (Status != 0) { - output.WriteRawTag(16); - output.WriteInt32(Status); - } - headers_.WriteTo(ref output, _map_headers_codec); - if (_unknownFields != null) { - _unknownFields.WriteTo(ref output); - } - } - #endif - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public int CalculateSize() { - int size = 0; - size += headersOld_.CalculateSize(_map_headersOld_codec); - if (Status != 0) { - size += 1 + pb::CodedOutputStream.ComputeInt32Size(Status); - } - size += headers_.CalculateSize(_map_headers_codec); - if (_unknownFields != null) { - size += _unknownFields.CalculateSize(); - } - return size; - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void MergeFrom(HttpResponseContext other) { - if (other == null) { - return; - } - headersOld_.Add(other.headersOld_); - if (other.Status != 0) { - Status = other.Status; - } - headers_.Add(other.headers_); - _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void MergeFrom(pb::CodedInputStream input) { - #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE - input.ReadRawMessage(this); - #else - uint tag; - while ((tag = input.ReadTag()) != 0) { - switch(tag) { - default: - _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input); - break; - case 10: { - headersOld_.AddEntriesFrom(input, _map_headersOld_codec); - break; - } - case 16: { - Status = input.ReadInt32(); - break; - } - case 26: { - headers_.AddEntriesFrom(input, _map_headers_codec); - break; - } - } - } - #endif - } - - #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - void pb::IBufferMessage.InternalMergeFrom(ref pb::ParseContext input) { - uint tag; - while ((tag = input.ReadTag()) != 0) { - switch(tag) { - default: - _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, ref input); - break; - case 10: { - headersOld_.AddEntriesFrom(ref input, _map_headersOld_codec); - break; - } - case 16: { - Status = input.ReadInt32(); - break; - } - case 26: { - headers_.AddEntriesFrom(ref input, _map_headers_codec); - break; - } - } - } - } - #endif - - } - - /// - /// Specific event response message - /// We do not accept responses for events - /// only whether or not they were successfully processed - /// - public sealed partial class TopicResponseContext : pb::IMessage - #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE - , pb::IBufferMessage - #endif - { - private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new TopicResponseContext()); - private pb::UnknownFieldSet _unknownFields; - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public static pb::MessageParser Parser { get { return _parser; } } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public static pbr::MessageDescriptor Descriptor { - get { return global::Nitric.Proto.Faas.v1.FaasReflection.Descriptor.MessageTypes[26]; } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - pbr::MessageDescriptor pb::IMessage.Descriptor { - get { return Descriptor; } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public TopicResponseContext() { - OnConstruction(); - } - - partial void OnConstruction(); - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public TopicResponseContext(TopicResponseContext other) : this() { - success_ = other.success_; - _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public TopicResponseContext Clone() { - return new TopicResponseContext(this); - } - - /// Field number for the "success" field. - public const int SuccessFieldNumber = 1; - private bool success_; - /// - /// Success status of the handled event - /// - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public bool Success { - get { return success_; } - set { - success_ = value; - } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public override bool Equals(object other) { - return Equals(other as TopicResponseContext); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public bool Equals(TopicResponseContext other) { - if (ReferenceEquals(other, null)) { - return false; - } - if (ReferenceEquals(other, this)) { - return true; - } - if (Success != other.Success) return false; - return Equals(_unknownFields, other._unknownFields); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public override int GetHashCode() { - int hash = 1; - if (Success != false) hash ^= Success.GetHashCode(); - if (_unknownFields != null) { - hash ^= _unknownFields.GetHashCode(); - } - return hash; - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public override string ToString() { - return pb::JsonFormatter.ToDiagnosticString(this); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void WriteTo(pb::CodedOutputStream output) { - #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE - output.WriteRawMessage(this); - #else - if (Success != false) { - output.WriteRawTag(8); - output.WriteBool(Success); - } - if (_unknownFields != null) { - _unknownFields.WriteTo(output); - } - #endif - } - - #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - void pb::IBufferMessage.InternalWriteTo(ref pb::WriteContext output) { - if (Success != false) { - output.WriteRawTag(8); - output.WriteBool(Success); - } - if (_unknownFields != null) { - _unknownFields.WriteTo(ref output); - } - } - #endif - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public int CalculateSize() { - int size = 0; - if (Success != false) { - size += 1 + 1; - } - if (_unknownFields != null) { - size += _unknownFields.CalculateSize(); - } - return size; - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void MergeFrom(TopicResponseContext other) { - if (other == null) { - return; - } - if (other.Success != false) { - Success = other.Success; - } - _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void MergeFrom(pb::CodedInputStream input) { - #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE - input.ReadRawMessage(this); - #else - uint tag; - while ((tag = input.ReadTag()) != 0) { - switch(tag) { - default: - _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input); - break; - case 8: { - Success = input.ReadBool(); - break; - } - } - } - #endif - } - - #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - void pb::IBufferMessage.InternalMergeFrom(ref pb::ParseContext input) { - uint tag; - while ((tag = input.ReadTag()) != 0) { - switch(tag) { - default: - _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, ref input); - break; - case 8: { - Success = input.ReadBool(); - break; - } - } - } - } - #endif - - } - - public sealed partial class NotificationResponseContext : pb::IMessage - #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE - , pb::IBufferMessage - #endif - { - private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new NotificationResponseContext()); - private pb::UnknownFieldSet _unknownFields; - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public static pb::MessageParser Parser { get { return _parser; } } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public static pbr::MessageDescriptor Descriptor { - get { return global::Nitric.Proto.Faas.v1.FaasReflection.Descriptor.MessageTypes[27]; } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - pbr::MessageDescriptor pb::IMessage.Descriptor { - get { return Descriptor; } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public NotificationResponseContext() { - OnConstruction(); - } - - partial void OnConstruction(); - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public NotificationResponseContext(NotificationResponseContext other) : this() { - success_ = other.success_; - _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public NotificationResponseContext Clone() { - return new NotificationResponseContext(this); - } - - /// Field number for the "success" field. - public const int SuccessFieldNumber = 1; - private bool success_; - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public bool Success { - get { return success_; } - set { - success_ = value; - } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public override bool Equals(object other) { - return Equals(other as NotificationResponseContext); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public bool Equals(NotificationResponseContext other) { - if (ReferenceEquals(other, null)) { - return false; - } - if (ReferenceEquals(other, this)) { - return true; - } - if (Success != other.Success) return false; - return Equals(_unknownFields, other._unknownFields); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public override int GetHashCode() { - int hash = 1; - if (Success != false) hash ^= Success.GetHashCode(); - if (_unknownFields != null) { - hash ^= _unknownFields.GetHashCode(); - } - return hash; - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public override string ToString() { - return pb::JsonFormatter.ToDiagnosticString(this); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void WriteTo(pb::CodedOutputStream output) { - #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE - output.WriteRawMessage(this); - #else - if (Success != false) { - output.WriteRawTag(8); - output.WriteBool(Success); - } - if (_unknownFields != null) { - _unknownFields.WriteTo(output); - } - #endif - } - - #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - void pb::IBufferMessage.InternalWriteTo(ref pb::WriteContext output) { - if (Success != false) { - output.WriteRawTag(8); - output.WriteBool(Success); - } - if (_unknownFields != null) { - _unknownFields.WriteTo(ref output); - } - } - #endif - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public int CalculateSize() { - int size = 0; - if (Success != false) { - size += 1 + 1; - } - if (_unknownFields != null) { - size += _unknownFields.CalculateSize(); - } - return size; - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void MergeFrom(NotificationResponseContext other) { - if (other == null) { - return; - } - if (other.Success != false) { - Success = other.Success; - } - _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void MergeFrom(pb::CodedInputStream input) { - #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE - input.ReadRawMessage(this); - #else - uint tag; - while ((tag = input.ReadTag()) != 0) { - switch(tag) { - default: - _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input); - break; - case 8: { - Success = input.ReadBool(); - break; - } - } - } - #endif - } - - #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - void pb::IBufferMessage.InternalMergeFrom(ref pb::ParseContext input) { - uint tag; - while ((tag = input.ReadTag()) != 0) { - switch(tag) { - default: - _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, ref input); - break; - case 8: { - Success = input.ReadBool(); - break; - } - } - } - } - #endif - - } - - public sealed partial class WebsocketResponseContext : pb::IMessage - #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE - , pb::IBufferMessage - #endif - { - private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new WebsocketResponseContext()); - private pb::UnknownFieldSet _unknownFields; - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public static pb::MessageParser Parser { get { return _parser; } } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public static pbr::MessageDescriptor Descriptor { - get { return global::Nitric.Proto.Faas.v1.FaasReflection.Descriptor.MessageTypes[28]; } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - pbr::MessageDescriptor pb::IMessage.Descriptor { - get { return Descriptor; } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public WebsocketResponseContext() { - OnConstruction(); - } - - partial void OnConstruction(); - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public WebsocketResponseContext(WebsocketResponseContext other) : this() { - success_ = other.success_; - _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public WebsocketResponseContext Clone() { - return new WebsocketResponseContext(this); - } - - /// Field number for the "success" field. - public const int SuccessFieldNumber = 1; - private bool success_; - /// - /// There aren't really responses here, instead we need to provide a runtime - /// API for responding back and emitting/broadcasting on the websocket from the server - /// - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public bool Success { - get { return success_; } - set { - success_ = value; - } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public override bool Equals(object other) { - return Equals(other as WebsocketResponseContext); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public bool Equals(WebsocketResponseContext other) { - if (ReferenceEquals(other, null)) { - return false; - } - if (ReferenceEquals(other, this)) { - return true; - } - if (Success != other.Success) return false; - return Equals(_unknownFields, other._unknownFields); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public override int GetHashCode() { - int hash = 1; - if (Success != false) hash ^= Success.GetHashCode(); - if (_unknownFields != null) { - hash ^= _unknownFields.GetHashCode(); - } - return hash; - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public override string ToString() { - return pb::JsonFormatter.ToDiagnosticString(this); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void WriteTo(pb::CodedOutputStream output) { - #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE - output.WriteRawMessage(this); - #else - if (Success != false) { - output.WriteRawTag(8); - output.WriteBool(Success); - } - if (_unknownFields != null) { - _unknownFields.WriteTo(output); - } - #endif - } - - #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - void pb::IBufferMessage.InternalWriteTo(ref pb::WriteContext output) { - if (Success != false) { - output.WriteRawTag(8); - output.WriteBool(Success); - } - if (_unknownFields != null) { - _unknownFields.WriteTo(ref output); - } - } - #endif - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public int CalculateSize() { - int size = 0; - if (Success != false) { - size += 1 + 1; - } - if (_unknownFields != null) { - size += _unknownFields.CalculateSize(); - } - return size; - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void MergeFrom(WebsocketResponseContext other) { - if (other == null) { - return; - } - if (other.Success != false) { - Success = other.Success; - } - _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void MergeFrom(pb::CodedInputStream input) { - #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE - input.ReadRawMessage(this); - #else - uint tag; - while ((tag = input.ReadTag()) != 0) { - switch(tag) { - default: - _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input); - break; - case 8: { - Success = input.ReadBool(); - break; - } - } - } - #endif - } - - #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - void pb::IBufferMessage.InternalMergeFrom(ref pb::ParseContext input) { - uint tag; - while ((tag = input.ReadTag()) != 0) { - switch(tag) { - default: - _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, ref input); - break; - case 8: { - Success = input.ReadBool(); - break; - } - } - } - } - #endif - - } - - #endregion - -} - -#endregion Designer generated code diff --git a/src/Nitric.Sdk/Proto/proto/queue/v1/QueueGrpc.cs b/src/Nitric.Sdk/Proto/proto/queue/v1/QueueGrpc.cs deleted file mode 100644 index 46f19c9..0000000 --- a/src/Nitric.Sdk/Proto/proto/queue/v1/QueueGrpc.cs +++ /dev/null @@ -1,372 +0,0 @@ -// -// Generated by the protocol buffer compiler. DO NOT EDIT! -// source: proto/queue/v1/queue.proto -// -#pragma warning disable 0414, 1591 -#region Designer generated code - -using grpc = global::Grpc.Core; - -namespace Nitric.Proto.Queue.v1 { - /// - /// The Nitric Queue Service contract - /// - public static partial class QueueService - { - static readonly string __ServiceName = "nitric.queue.v1.QueueService"; - - static void __Helper_SerializeMessage(global::Google.Protobuf.IMessage message, grpc::SerializationContext context) - { - #if !GRPC_DISABLE_PROTOBUF_BUFFER_SERIALIZATION - if (message is global::Google.Protobuf.IBufferMessage) - { - context.SetPayloadLength(message.CalculateSize()); - global::Google.Protobuf.MessageExtensions.WriteTo(message, context.GetBufferWriter()); - context.Complete(); - return; - } - #endif - context.Complete(global::Google.Protobuf.MessageExtensions.ToByteArray(message)); - } - - static class __Helper_MessageCache - { - public static readonly bool IsBufferMessage = global::System.Reflection.IntrospectionExtensions.GetTypeInfo(typeof(global::Google.Protobuf.IBufferMessage)).IsAssignableFrom(typeof(T)); - } - - static T __Helper_DeserializeMessage(grpc::DeserializationContext context, global::Google.Protobuf.MessageParser parser) where T : global::Google.Protobuf.IMessage - { - #if !GRPC_DISABLE_PROTOBUF_BUFFER_SERIALIZATION - if (__Helper_MessageCache.IsBufferMessage) - { - return parser.ParseFrom(context.PayloadAsReadOnlySequence()); - } - #endif - return parser.ParseFrom(context.PayloadAsNewBuffer()); - } - - static readonly grpc::Marshaller __Marshaller_nitric_queue_v1_QueueSendRequest = grpc::Marshallers.Create(__Helper_SerializeMessage, context => __Helper_DeserializeMessage(context, global::Nitric.Proto.Queue.v1.QueueSendRequest.Parser)); - static readonly grpc::Marshaller __Marshaller_nitric_queue_v1_QueueSendResponse = grpc::Marshallers.Create(__Helper_SerializeMessage, context => __Helper_DeserializeMessage(context, global::Nitric.Proto.Queue.v1.QueueSendResponse.Parser)); - static readonly grpc::Marshaller __Marshaller_nitric_queue_v1_QueueSendBatchRequest = grpc::Marshallers.Create(__Helper_SerializeMessage, context => __Helper_DeserializeMessage(context, global::Nitric.Proto.Queue.v1.QueueSendBatchRequest.Parser)); - static readonly grpc::Marshaller __Marshaller_nitric_queue_v1_QueueSendBatchResponse = grpc::Marshallers.Create(__Helper_SerializeMessage, context => __Helper_DeserializeMessage(context, global::Nitric.Proto.Queue.v1.QueueSendBatchResponse.Parser)); - static readonly grpc::Marshaller __Marshaller_nitric_queue_v1_QueueReceiveRequest = grpc::Marshallers.Create(__Helper_SerializeMessage, context => __Helper_DeserializeMessage(context, global::Nitric.Proto.Queue.v1.QueueReceiveRequest.Parser)); - static readonly grpc::Marshaller __Marshaller_nitric_queue_v1_QueueReceiveResponse = grpc::Marshallers.Create(__Helper_SerializeMessage, context => __Helper_DeserializeMessage(context, global::Nitric.Proto.Queue.v1.QueueReceiveResponse.Parser)); - static readonly grpc::Marshaller __Marshaller_nitric_queue_v1_QueueCompleteRequest = grpc::Marshallers.Create(__Helper_SerializeMessage, context => __Helper_DeserializeMessage(context, global::Nitric.Proto.Queue.v1.QueueCompleteRequest.Parser)); - static readonly grpc::Marshaller __Marshaller_nitric_queue_v1_QueueCompleteResponse = grpc::Marshallers.Create(__Helper_SerializeMessage, context => __Helper_DeserializeMessage(context, global::Nitric.Proto.Queue.v1.QueueCompleteResponse.Parser)); - - static readonly grpc::Method __Method_Send = new grpc::Method( - grpc::MethodType.Unary, - __ServiceName, - "Send", - __Marshaller_nitric_queue_v1_QueueSendRequest, - __Marshaller_nitric_queue_v1_QueueSendResponse); - - static readonly grpc::Method __Method_SendBatch = new grpc::Method( - grpc::MethodType.Unary, - __ServiceName, - "SendBatch", - __Marshaller_nitric_queue_v1_QueueSendBatchRequest, - __Marshaller_nitric_queue_v1_QueueSendBatchResponse); - - static readonly grpc::Method __Method_Receive = new grpc::Method( - grpc::MethodType.Unary, - __ServiceName, - "Receive", - __Marshaller_nitric_queue_v1_QueueReceiveRequest, - __Marshaller_nitric_queue_v1_QueueReceiveResponse); - - static readonly grpc::Method __Method_Complete = new grpc::Method( - grpc::MethodType.Unary, - __ServiceName, - "Complete", - __Marshaller_nitric_queue_v1_QueueCompleteRequest, - __Marshaller_nitric_queue_v1_QueueCompleteResponse); - - /// Service descriptor - public static global::Google.Protobuf.Reflection.ServiceDescriptor Descriptor - { - get { return global::Nitric.Proto.Queue.v1.QueueReflection.Descriptor.Services[0]; } - } - - /// Base class for server-side implementations of QueueService - [grpc::BindServiceMethod(typeof(QueueService), "BindService")] - public abstract partial class QueueServiceBase - { - /// - /// Send a single event to a queue - /// - /// The request received from the client. - /// The context of the server-side call handler being invoked. - /// The response to send back to the client (wrapped by a task). - public virtual global::System.Threading.Tasks.Task Send(global::Nitric.Proto.Queue.v1.QueueSendRequest request, grpc::ServerCallContext context) - { - throw new grpc::RpcException(new grpc::Status(grpc::StatusCode.Unimplemented, "")); - } - - /// - /// Send multiple events to a queue - /// - /// The request received from the client. - /// The context of the server-side call handler being invoked. - /// The response to send back to the client (wrapped by a task). - public virtual global::System.Threading.Tasks.Task SendBatch(global::Nitric.Proto.Queue.v1.QueueSendBatchRequest request, grpc::ServerCallContext context) - { - throw new grpc::RpcException(new grpc::Status(grpc::StatusCode.Unimplemented, "")); - } - - /// - /// Receive event(s) off a queue - /// - /// The request received from the client. - /// The context of the server-side call handler being invoked. - /// The response to send back to the client (wrapped by a task). - public virtual global::System.Threading.Tasks.Task Receive(global::Nitric.Proto.Queue.v1.QueueReceiveRequest request, grpc::ServerCallContext context) - { - throw new grpc::RpcException(new grpc::Status(grpc::StatusCode.Unimplemented, "")); - } - - /// - /// Complete an event previously popped from a queue - /// - /// The request received from the client. - /// The context of the server-side call handler being invoked. - /// The response to send back to the client (wrapped by a task). - public virtual global::System.Threading.Tasks.Task Complete(global::Nitric.Proto.Queue.v1.QueueCompleteRequest request, grpc::ServerCallContext context) - { - throw new grpc::RpcException(new grpc::Status(grpc::StatusCode.Unimplemented, "")); - } - - } - - /// Client for QueueService - public partial class QueueServiceClient : grpc::ClientBase - { - /// Creates a new client for QueueService - /// The channel to use to make remote calls. - public QueueServiceClient(grpc::ChannelBase channel) : base(channel) - { - } - /// Creates a new client for QueueService that uses a custom CallInvoker. - /// The callInvoker to use to make remote calls. - public QueueServiceClient(grpc::CallInvoker callInvoker) : base(callInvoker) - { - } - /// Protected parameterless constructor to allow creation of test doubles. - protected QueueServiceClient() : base() - { - } - /// Protected constructor to allow creation of configured clients. - /// The client configuration. - protected QueueServiceClient(ClientBaseConfiguration configuration) : base(configuration) - { - } - - /// - /// Send a single event to a queue - /// - /// The request to send to the server. - /// The initial metadata to send with the call. This parameter is optional. - /// An optional deadline for the call. The call will be cancelled if deadline is hit. - /// An optional token for canceling the call. - /// The response received from the server. - public virtual global::Nitric.Proto.Queue.v1.QueueSendResponse Send(global::Nitric.Proto.Queue.v1.QueueSendRequest request, grpc::Metadata headers = null, global::System.DateTime? deadline = null, global::System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken)) - { - return Send(request, new grpc::CallOptions(headers, deadline, cancellationToken)); - } - /// - /// Send a single event to a queue - /// - /// The request to send to the server. - /// The options for the call. - /// The response received from the server. - public virtual global::Nitric.Proto.Queue.v1.QueueSendResponse Send(global::Nitric.Proto.Queue.v1.QueueSendRequest request, grpc::CallOptions options) - { - return CallInvoker.BlockingUnaryCall(__Method_Send, null, options, request); - } - /// - /// Send a single event to a queue - /// - /// The request to send to the server. - /// The initial metadata to send with the call. This parameter is optional. - /// An optional deadline for the call. The call will be cancelled if deadline is hit. - /// An optional token for canceling the call. - /// The call object. - public virtual grpc::AsyncUnaryCall SendAsync(global::Nitric.Proto.Queue.v1.QueueSendRequest request, grpc::Metadata headers = null, global::System.DateTime? deadline = null, global::System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken)) - { - return SendAsync(request, new grpc::CallOptions(headers, deadline, cancellationToken)); - } - /// - /// Send a single event to a queue - /// - /// The request to send to the server. - /// The options for the call. - /// The call object. - public virtual grpc::AsyncUnaryCall SendAsync(global::Nitric.Proto.Queue.v1.QueueSendRequest request, grpc::CallOptions options) - { - return CallInvoker.AsyncUnaryCall(__Method_Send, null, options, request); - } - /// - /// Send multiple events to a queue - /// - /// The request to send to the server. - /// The initial metadata to send with the call. This parameter is optional. - /// An optional deadline for the call. The call will be cancelled if deadline is hit. - /// An optional token for canceling the call. - /// The response received from the server. - public virtual global::Nitric.Proto.Queue.v1.QueueSendBatchResponse SendBatch(global::Nitric.Proto.Queue.v1.QueueSendBatchRequest request, grpc::Metadata headers = null, global::System.DateTime? deadline = null, global::System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken)) - { - return SendBatch(request, new grpc::CallOptions(headers, deadline, cancellationToken)); - } - /// - /// Send multiple events to a queue - /// - /// The request to send to the server. - /// The options for the call. - /// The response received from the server. - public virtual global::Nitric.Proto.Queue.v1.QueueSendBatchResponse SendBatch(global::Nitric.Proto.Queue.v1.QueueSendBatchRequest request, grpc::CallOptions options) - { - return CallInvoker.BlockingUnaryCall(__Method_SendBatch, null, options, request); - } - /// - /// Send multiple events to a queue - /// - /// The request to send to the server. - /// The initial metadata to send with the call. This parameter is optional. - /// An optional deadline for the call. The call will be cancelled if deadline is hit. - /// An optional token for canceling the call. - /// The call object. - public virtual grpc::AsyncUnaryCall SendBatchAsync(global::Nitric.Proto.Queue.v1.QueueSendBatchRequest request, grpc::Metadata headers = null, global::System.DateTime? deadline = null, global::System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken)) - { - return SendBatchAsync(request, new grpc::CallOptions(headers, deadline, cancellationToken)); - } - /// - /// Send multiple events to a queue - /// - /// The request to send to the server. - /// The options for the call. - /// The call object. - public virtual grpc::AsyncUnaryCall SendBatchAsync(global::Nitric.Proto.Queue.v1.QueueSendBatchRequest request, grpc::CallOptions options) - { - return CallInvoker.AsyncUnaryCall(__Method_SendBatch, null, options, request); - } - /// - /// Receive event(s) off a queue - /// - /// The request to send to the server. - /// The initial metadata to send with the call. This parameter is optional. - /// An optional deadline for the call. The call will be cancelled if deadline is hit. - /// An optional token for canceling the call. - /// The response received from the server. - public virtual global::Nitric.Proto.Queue.v1.QueueReceiveResponse Receive(global::Nitric.Proto.Queue.v1.QueueReceiveRequest request, grpc::Metadata headers = null, global::System.DateTime? deadline = null, global::System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken)) - { - return Receive(request, new grpc::CallOptions(headers, deadline, cancellationToken)); - } - /// - /// Receive event(s) off a queue - /// - /// The request to send to the server. - /// The options for the call. - /// The response received from the server. - public virtual global::Nitric.Proto.Queue.v1.QueueReceiveResponse Receive(global::Nitric.Proto.Queue.v1.QueueReceiveRequest request, grpc::CallOptions options) - { - return CallInvoker.BlockingUnaryCall(__Method_Receive, null, options, request); - } - /// - /// Receive event(s) off a queue - /// - /// The request to send to the server. - /// The initial metadata to send with the call. This parameter is optional. - /// An optional deadline for the call. The call will be cancelled if deadline is hit. - /// An optional token for canceling the call. - /// The call object. - public virtual grpc::AsyncUnaryCall ReceiveAsync(global::Nitric.Proto.Queue.v1.QueueReceiveRequest request, grpc::Metadata headers = null, global::System.DateTime? deadline = null, global::System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken)) - { - return ReceiveAsync(request, new grpc::CallOptions(headers, deadline, cancellationToken)); - } - /// - /// Receive event(s) off a queue - /// - /// The request to send to the server. - /// The options for the call. - /// The call object. - public virtual grpc::AsyncUnaryCall ReceiveAsync(global::Nitric.Proto.Queue.v1.QueueReceiveRequest request, grpc::CallOptions options) - { - return CallInvoker.AsyncUnaryCall(__Method_Receive, null, options, request); - } - /// - /// Complete an event previously popped from a queue - /// - /// The request to send to the server. - /// The initial metadata to send with the call. This parameter is optional. - /// An optional deadline for the call. The call will be cancelled if deadline is hit. - /// An optional token for canceling the call. - /// The response received from the server. - public virtual global::Nitric.Proto.Queue.v1.QueueCompleteResponse Complete(global::Nitric.Proto.Queue.v1.QueueCompleteRequest request, grpc::Metadata headers = null, global::System.DateTime? deadline = null, global::System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken)) - { - return Complete(request, new grpc::CallOptions(headers, deadline, cancellationToken)); - } - /// - /// Complete an event previously popped from a queue - /// - /// The request to send to the server. - /// The options for the call. - /// The response received from the server. - public virtual global::Nitric.Proto.Queue.v1.QueueCompleteResponse Complete(global::Nitric.Proto.Queue.v1.QueueCompleteRequest request, grpc::CallOptions options) - { - return CallInvoker.BlockingUnaryCall(__Method_Complete, null, options, request); - } - /// - /// Complete an event previously popped from a queue - /// - /// The request to send to the server. - /// The initial metadata to send with the call. This parameter is optional. - /// An optional deadline for the call. The call will be cancelled if deadline is hit. - /// An optional token for canceling the call. - /// The call object. - public virtual grpc::AsyncUnaryCall CompleteAsync(global::Nitric.Proto.Queue.v1.QueueCompleteRequest request, grpc::Metadata headers = null, global::System.DateTime? deadline = null, global::System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken)) - { - return CompleteAsync(request, new grpc::CallOptions(headers, deadline, cancellationToken)); - } - /// - /// Complete an event previously popped from a queue - /// - /// The request to send to the server. - /// The options for the call. - /// The call object. - public virtual grpc::AsyncUnaryCall CompleteAsync(global::Nitric.Proto.Queue.v1.QueueCompleteRequest request, grpc::CallOptions options) - { - return CallInvoker.AsyncUnaryCall(__Method_Complete, null, options, request); - } - /// Creates a new instance of client from given ClientBaseConfiguration. - protected override QueueServiceClient NewInstance(ClientBaseConfiguration configuration) - { - return new QueueServiceClient(configuration); - } - } - - /// Creates service definition that can be registered with a server - /// An object implementing the server-side handling logic. - public static grpc::ServerServiceDefinition BindService(QueueServiceBase serviceImpl) - { - return grpc::ServerServiceDefinition.CreateBuilder() - .AddMethod(__Method_Send, serviceImpl.Send) - .AddMethod(__Method_SendBatch, serviceImpl.SendBatch) - .AddMethod(__Method_Receive, serviceImpl.Receive) - .AddMethod(__Method_Complete, serviceImpl.Complete).Build(); - } - - /// Register service method with a service binder with or without implementation. Useful when customizing the service binding logic. - /// Note: this method is part of an experimental API that can change or be removed without any prior notice. - /// Service methods will be bound by calling AddMethod on this object. - /// An object implementing the server-side handling logic. - public static void BindService(grpc::ServiceBinderBase serviceBinder, QueueServiceBase serviceImpl) - { - serviceBinder.AddMethod(__Method_Send, serviceImpl == null ? null : new grpc::UnaryServerMethod(serviceImpl.Send)); - serviceBinder.AddMethod(__Method_SendBatch, serviceImpl == null ? null : new grpc::UnaryServerMethod(serviceImpl.SendBatch)); - serviceBinder.AddMethod(__Method_Receive, serviceImpl == null ? null : new grpc::UnaryServerMethod(serviceImpl.Receive)); - serviceBinder.AddMethod(__Method_Complete, serviceImpl == null ? null : new grpc::UnaryServerMethod(serviceImpl.Complete)); - } - - } -} -#endregion diff --git a/src/Nitric.Sdk/Proto/proto/resource/v1/ResourceGrpc.cs b/src/Nitric.Sdk/Proto/proto/resource/v1/ResourceGrpc.cs deleted file mode 100644 index 59f0099..0000000 --- a/src/Nitric.Sdk/Proto/proto/resource/v1/ResourceGrpc.cs +++ /dev/null @@ -1,251 +0,0 @@ -// -// Generated by the protocol buffer compiler. DO NOT EDIT! -// source: proto/resource/v1/resource.proto -// -#pragma warning disable 0414, 1591 -#region Designer generated code - -using grpc = global::Grpc.Core; - -namespace Nitric.Proto.Resource.v1 { - /// - /// Nitric Resource Service - /// The service definition exists to allow a nitric application to declare peripheral dependencies - /// - public static partial class ResourceService - { - static readonly string __ServiceName = "nitric.resource.v1.ResourceService"; - - static void __Helper_SerializeMessage(global::Google.Protobuf.IMessage message, grpc::SerializationContext context) - { - #if !GRPC_DISABLE_PROTOBUF_BUFFER_SERIALIZATION - if (message is global::Google.Protobuf.IBufferMessage) - { - context.SetPayloadLength(message.CalculateSize()); - global::Google.Protobuf.MessageExtensions.WriteTo(message, context.GetBufferWriter()); - context.Complete(); - return; - } - #endif - context.Complete(global::Google.Protobuf.MessageExtensions.ToByteArray(message)); - } - - static class __Helper_MessageCache - { - public static readonly bool IsBufferMessage = global::System.Reflection.IntrospectionExtensions.GetTypeInfo(typeof(global::Google.Protobuf.IBufferMessage)).IsAssignableFrom(typeof(T)); - } - - static T __Helper_DeserializeMessage(grpc::DeserializationContext context, global::Google.Protobuf.MessageParser parser) where T : global::Google.Protobuf.IMessage - { - #if !GRPC_DISABLE_PROTOBUF_BUFFER_SERIALIZATION - if (__Helper_MessageCache.IsBufferMessage) - { - return parser.ParseFrom(context.PayloadAsReadOnlySequence()); - } - #endif - return parser.ParseFrom(context.PayloadAsNewBuffer()); - } - - static readonly grpc::Marshaller __Marshaller_nitric_resource_v1_ResourceDeclareRequest = grpc::Marshallers.Create(__Helper_SerializeMessage, context => __Helper_DeserializeMessage(context, global::Nitric.Proto.Resource.v1.ResourceDeclareRequest.Parser)); - static readonly grpc::Marshaller __Marshaller_nitric_resource_v1_ResourceDeclareResponse = grpc::Marshallers.Create(__Helper_SerializeMessage, context => __Helper_DeserializeMessage(context, global::Nitric.Proto.Resource.v1.ResourceDeclareResponse.Parser)); - static readonly grpc::Marshaller __Marshaller_nitric_resource_v1_ResourceDetailsRequest = grpc::Marshallers.Create(__Helper_SerializeMessage, context => __Helper_DeserializeMessage(context, global::Nitric.Proto.Resource.v1.ResourceDetailsRequest.Parser)); - static readonly grpc::Marshaller __Marshaller_nitric_resource_v1_ResourceDetailsResponse = grpc::Marshallers.Create(__Helper_SerializeMessage, context => __Helper_DeserializeMessage(context, global::Nitric.Proto.Resource.v1.ResourceDetailsResponse.Parser)); - - static readonly grpc::Method __Method_Declare = new grpc::Method( - grpc::MethodType.Unary, - __ServiceName, - "Declare", - __Marshaller_nitric_resource_v1_ResourceDeclareRequest, - __Marshaller_nitric_resource_v1_ResourceDeclareResponse); - - static readonly grpc::Method __Method_Details = new grpc::Method( - grpc::MethodType.Unary, - __ServiceName, - "Details", - __Marshaller_nitric_resource_v1_ResourceDetailsRequest, - __Marshaller_nitric_resource_v1_ResourceDetailsResponse); - - /// Service descriptor - public static global::Google.Protobuf.Reflection.ServiceDescriptor Descriptor - { - get { return global::Nitric.Proto.Resource.v1.ResourceReflection.Descriptor.Services[0]; } - } - - /// Base class for server-side implementations of ResourceService - [grpc::BindServiceMethod(typeof(ResourceService), "BindService")] - public abstract partial class ResourceServiceBase - { - /// - /// Declare a resource for the nitric application - /// At Deploy time this will create resources as part of the nitric stacks dependency graph - /// At runtime - /// - /// The request received from the client. - /// The context of the server-side call handler being invoked. - /// The response to send back to the client (wrapped by a task). - public virtual global::System.Threading.Tasks.Task Declare(global::Nitric.Proto.Resource.v1.ResourceDeclareRequest request, grpc::ServerCallContext context) - { - throw new grpc::RpcException(new grpc::Status(grpc::StatusCode.Unimplemented, "")); - } - - /// - /// Retrieve details about a resource at runtime - /// - /// The request received from the client. - /// The context of the server-side call handler being invoked. - /// The response to send back to the client (wrapped by a task). - public virtual global::System.Threading.Tasks.Task Details(global::Nitric.Proto.Resource.v1.ResourceDetailsRequest request, grpc::ServerCallContext context) - { - throw new grpc::RpcException(new grpc::Status(grpc::StatusCode.Unimplemented, "")); - } - - } - - /// Client for ResourceService - public partial class ResourceServiceClient : grpc::ClientBase - { - /// Creates a new client for ResourceService - /// The channel to use to make remote calls. - public ResourceServiceClient(grpc::ChannelBase channel) : base(channel) - { - } - /// Creates a new client for ResourceService that uses a custom CallInvoker. - /// The callInvoker to use to make remote calls. - public ResourceServiceClient(grpc::CallInvoker callInvoker) : base(callInvoker) - { - } - /// Protected parameterless constructor to allow creation of test doubles. - protected ResourceServiceClient() : base() - { - } - /// Protected constructor to allow creation of configured clients. - /// The client configuration. - protected ResourceServiceClient(ClientBaseConfiguration configuration) : base(configuration) - { - } - - /// - /// Declare a resource for the nitric application - /// At Deploy time this will create resources as part of the nitric stacks dependency graph - /// At runtime - /// - /// The request to send to the server. - /// The initial metadata to send with the call. This parameter is optional. - /// An optional deadline for the call. The call will be cancelled if deadline is hit. - /// An optional token for canceling the call. - /// The response received from the server. - public virtual global::Nitric.Proto.Resource.v1.ResourceDeclareResponse Declare(global::Nitric.Proto.Resource.v1.ResourceDeclareRequest request, grpc::Metadata headers = null, global::System.DateTime? deadline = null, global::System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken)) - { - return Declare(request, new grpc::CallOptions(headers, deadline, cancellationToken)); - } - /// - /// Declare a resource for the nitric application - /// At Deploy time this will create resources as part of the nitric stacks dependency graph - /// At runtime - /// - /// The request to send to the server. - /// The options for the call. - /// The response received from the server. - public virtual global::Nitric.Proto.Resource.v1.ResourceDeclareResponse Declare(global::Nitric.Proto.Resource.v1.ResourceDeclareRequest request, grpc::CallOptions options) - { - return CallInvoker.BlockingUnaryCall(__Method_Declare, null, options, request); - } - /// - /// Declare a resource for the nitric application - /// At Deploy time this will create resources as part of the nitric stacks dependency graph - /// At runtime - /// - /// The request to send to the server. - /// The initial metadata to send with the call. This parameter is optional. - /// An optional deadline for the call. The call will be cancelled if deadline is hit. - /// An optional token for canceling the call. - /// The call object. - public virtual grpc::AsyncUnaryCall DeclareAsync(global::Nitric.Proto.Resource.v1.ResourceDeclareRequest request, grpc::Metadata headers = null, global::System.DateTime? deadline = null, global::System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken)) - { - return DeclareAsync(request, new grpc::CallOptions(headers, deadline, cancellationToken)); - } - /// - /// Declare a resource for the nitric application - /// At Deploy time this will create resources as part of the nitric stacks dependency graph - /// At runtime - /// - /// The request to send to the server. - /// The options for the call. - /// The call object. - public virtual grpc::AsyncUnaryCall DeclareAsync(global::Nitric.Proto.Resource.v1.ResourceDeclareRequest request, grpc::CallOptions options) - { - return CallInvoker.AsyncUnaryCall(__Method_Declare, null, options, request); - } - /// - /// Retrieve details about a resource at runtime - /// - /// The request to send to the server. - /// The initial metadata to send with the call. This parameter is optional. - /// An optional deadline for the call. The call will be cancelled if deadline is hit. - /// An optional token for canceling the call. - /// The response received from the server. - public virtual global::Nitric.Proto.Resource.v1.ResourceDetailsResponse Details(global::Nitric.Proto.Resource.v1.ResourceDetailsRequest request, grpc::Metadata headers = null, global::System.DateTime? deadline = null, global::System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken)) - { - return Details(request, new grpc::CallOptions(headers, deadline, cancellationToken)); - } - /// - /// Retrieve details about a resource at runtime - /// - /// The request to send to the server. - /// The options for the call. - /// The response received from the server. - public virtual global::Nitric.Proto.Resource.v1.ResourceDetailsResponse Details(global::Nitric.Proto.Resource.v1.ResourceDetailsRequest request, grpc::CallOptions options) - { - return CallInvoker.BlockingUnaryCall(__Method_Details, null, options, request); - } - /// - /// Retrieve details about a resource at runtime - /// - /// The request to send to the server. - /// The initial metadata to send with the call. This parameter is optional. - /// An optional deadline for the call. The call will be cancelled if deadline is hit. - /// An optional token for canceling the call. - /// The call object. - public virtual grpc::AsyncUnaryCall DetailsAsync(global::Nitric.Proto.Resource.v1.ResourceDetailsRequest request, grpc::Metadata headers = null, global::System.DateTime? deadline = null, global::System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken)) - { - return DetailsAsync(request, new grpc::CallOptions(headers, deadline, cancellationToken)); - } - /// - /// Retrieve details about a resource at runtime - /// - /// The request to send to the server. - /// The options for the call. - /// The call object. - public virtual grpc::AsyncUnaryCall DetailsAsync(global::Nitric.Proto.Resource.v1.ResourceDetailsRequest request, grpc::CallOptions options) - { - return CallInvoker.AsyncUnaryCall(__Method_Details, null, options, request); - } - /// Creates a new instance of client from given ClientBaseConfiguration. - protected override ResourceServiceClient NewInstance(ClientBaseConfiguration configuration) - { - return new ResourceServiceClient(configuration); - } - } - - /// Creates service definition that can be registered with a server - /// An object implementing the server-side handling logic. - public static grpc::ServerServiceDefinition BindService(ResourceServiceBase serviceImpl) - { - return grpc::ServerServiceDefinition.CreateBuilder() - .AddMethod(__Method_Declare, serviceImpl.Declare) - .AddMethod(__Method_Details, serviceImpl.Details).Build(); - } - - /// Register service method with a service binder with or without implementation. Useful when customizing the service binding logic. - /// Note: this method is part of an experimental API that can change or be removed without any prior notice. - /// Service methods will be bound by calling AddMethod on this object. - /// An object implementing the server-side handling logic. - public static void BindService(grpc::ServiceBinderBase serviceBinder, ResourceServiceBase serviceImpl) - { - serviceBinder.AddMethod(__Method_Declare, serviceImpl == null ? null : new grpc::UnaryServerMethod(serviceImpl.Declare)); - serviceBinder.AddMethod(__Method_Details, serviceImpl == null ? null : new grpc::UnaryServerMethod(serviceImpl.Details)); - } - - } -} -#endregion diff --git a/src/Nitric.Sdk/Proto/proto/websocket/v1/Websocket.cs b/src/Nitric.Sdk/Proto/proto/websocket/v1/Websocket.cs deleted file mode 100644 index 21796b0..0000000 --- a/src/Nitric.Sdk/Proto/proto/websocket/v1/Websocket.cs +++ /dev/null @@ -1,799 +0,0 @@ -// -// Generated by the protocol buffer compiler. DO NOT EDIT! -// source: proto/websocket/v1/websocket.proto -// -#pragma warning disable 1591, 0612, 3021 -#region Designer generated code - -using pb = global::Google.Protobuf; -using pbc = global::Google.Protobuf.Collections; -using pbr = global::Google.Protobuf.Reflection; -using scg = global::System.Collections.Generic; -namespace Nitric.Proto.Websocket.v1 { - - /// Holder for reflection information generated from proto/websocket/v1/websocket.proto - public static partial class WebsocketReflection { - - #region Descriptor - /// File descriptor for proto/websocket/v1/websocket.proto - public static pbr::FileDescriptor Descriptor { - get { return descriptor; } - } - private static pbr::FileDescriptor descriptor; - - static WebsocketReflection() { - byte[] descriptorData = global::System.Convert.FromBase64String( - string.Concat( - "CiJwcm90by93ZWJzb2NrZXQvdjEvd2Vic29ja2V0LnByb3RvEhNuaXRyaWMu", - "d2Vic29ja2V0LnYxGhd2YWxpZGF0ZS92YWxpZGF0ZS5wcm90byJdChRXZWJz", - "b2NrZXRTZW5kUmVxdWVzdBIXCgZzb2NrZXQYASABKAlCB/pCBHICEAESHgoN", - "Y29ubmVjdGlvbl9pZBgCIAEoCUIH+kIEcgIQARIMCgRkYXRhGAMgASgMIhcK", - "FVdlYnNvY2tldFNlbmRSZXNwb25zZSJQChVXZWJzb2NrZXRDbG9zZVJlcXVl", - "c3QSFwoGc29ja2V0GAEgASgJQgf6QgRyAhABEh4KDWNvbm5lY3Rpb25faWQY", - "AiABKAlCB/pCBHICEAEiGAoWV2Vic29ja2V0Q2xvc2VSZXNwb25zZTLTAQoQ", - "V2Vic29ja2V0U2VydmljZRJdCgRTZW5kEikubml0cmljLndlYnNvY2tldC52", - "MS5XZWJzb2NrZXRTZW5kUmVxdWVzdBoqLm5pdHJpYy53ZWJzb2NrZXQudjEu", - "V2Vic29ja2V0U2VuZFJlc3BvbnNlEmAKBUNsb3NlEioubml0cmljLndlYnNv", - "Y2tldC52MS5XZWJzb2NrZXRDbG9zZVJlcXVlc3QaKy5uaXRyaWMud2Vic29j", - "a2V0LnYxLldlYnNvY2tldENsb3NlUmVzcG9uc2VCowEKHGlvLm5pdHJpYy5w", - "cm90by53ZWJzb2NrZXQudjFCCldlYnNvY2tldHNQAVo9Z2l0aHViLmNvbS9u", - "aXRyaWN0ZWNoL25pdHJpYy9jb3JlL3BrZy9hcGkvbml0cmljL3dlYnNvY2tl", - "dC92MaoCGU5pdHJpYy5Qcm90by5XZWJzb2NrZXQudjHKAhlOaXRyaWNcUHJv", - "dG9cV2Vic29ja2V0XFYxYgZwcm90bzM=")); - descriptor = pbr::FileDescriptor.FromGeneratedCode(descriptorData, - new pbr::FileDescriptor[] { global::Validate.ValidateReflection.Descriptor, }, - new pbr::GeneratedClrTypeInfo(null, null, new pbr::GeneratedClrTypeInfo[] { - new pbr::GeneratedClrTypeInfo(typeof(global::Nitric.Proto.Websocket.v1.WebsocketSendRequest), global::Nitric.Proto.Websocket.v1.WebsocketSendRequest.Parser, new[]{ "Socket", "ConnectionId", "Data" }, null, null, null, null), - new pbr::GeneratedClrTypeInfo(typeof(global::Nitric.Proto.Websocket.v1.WebsocketSendResponse), global::Nitric.Proto.Websocket.v1.WebsocketSendResponse.Parser, null, null, null, null, null), - new pbr::GeneratedClrTypeInfo(typeof(global::Nitric.Proto.Websocket.v1.WebsocketCloseRequest), global::Nitric.Proto.Websocket.v1.WebsocketCloseRequest.Parser, new[]{ "Socket", "ConnectionId" }, null, null, null, null), - new pbr::GeneratedClrTypeInfo(typeof(global::Nitric.Proto.Websocket.v1.WebsocketCloseResponse), global::Nitric.Proto.Websocket.v1.WebsocketCloseResponse.Parser, null, null, null, null, null) - })); - } - #endregion - - } - #region Messages - public sealed partial class WebsocketSendRequest : pb::IMessage - #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE - , pb::IBufferMessage - #endif - { - private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new WebsocketSendRequest()); - private pb::UnknownFieldSet _unknownFields; - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public static pb::MessageParser Parser { get { return _parser; } } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public static pbr::MessageDescriptor Descriptor { - get { return global::Nitric.Proto.Websocket.v1.WebsocketReflection.Descriptor.MessageTypes[0]; } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - pbr::MessageDescriptor pb::IMessage.Descriptor { - get { return Descriptor; } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public WebsocketSendRequest() { - OnConstruction(); - } - - partial void OnConstruction(); - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public WebsocketSendRequest(WebsocketSendRequest other) : this() { - socket_ = other.socket_; - connectionId_ = other.connectionId_; - data_ = other.data_; - _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public WebsocketSendRequest Clone() { - return new WebsocketSendRequest(this); - } - - /// Field number for the "socket" field. - public const int SocketFieldNumber = 1; - private string socket_ = ""; - /// - /// The nitric name of the socket to send on - /// - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public string Socket { - get { return socket_; } - set { - socket_ = pb::ProtoPreconditions.CheckNotNull(value, "value"); - } - } - - /// Field number for the "connection_id" field. - public const int ConnectionIdFieldNumber = 2; - private string connectionId_ = ""; - /// - /// The connection ID of the client to send to - /// - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public string ConnectionId { - get { return connectionId_; } - set { - connectionId_ = pb::ProtoPreconditions.CheckNotNull(value, "value"); - } - } - - /// Field number for the "data" field. - public const int DataFieldNumber = 3; - private pb::ByteString data_ = pb::ByteString.Empty; - /// - /// The data to send to the socket - /// - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public pb::ByteString Data { - get { return data_; } - set { - data_ = pb::ProtoPreconditions.CheckNotNull(value, "value"); - } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public override bool Equals(object other) { - return Equals(other as WebsocketSendRequest); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public bool Equals(WebsocketSendRequest other) { - if (ReferenceEquals(other, null)) { - return false; - } - if (ReferenceEquals(other, this)) { - return true; - } - if (Socket != other.Socket) return false; - if (ConnectionId != other.ConnectionId) return false; - if (Data != other.Data) return false; - return Equals(_unknownFields, other._unknownFields); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public override int GetHashCode() { - int hash = 1; - if (Socket.Length != 0) hash ^= Socket.GetHashCode(); - if (ConnectionId.Length != 0) hash ^= ConnectionId.GetHashCode(); - if (Data.Length != 0) hash ^= Data.GetHashCode(); - if (_unknownFields != null) { - hash ^= _unknownFields.GetHashCode(); - } - return hash; - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public override string ToString() { - return pb::JsonFormatter.ToDiagnosticString(this); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void WriteTo(pb::CodedOutputStream output) { - #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE - output.WriteRawMessage(this); - #else - if (Socket.Length != 0) { - output.WriteRawTag(10); - output.WriteString(Socket); - } - if (ConnectionId.Length != 0) { - output.WriteRawTag(18); - output.WriteString(ConnectionId); - } - if (Data.Length != 0) { - output.WriteRawTag(26); - output.WriteBytes(Data); - } - if (_unknownFields != null) { - _unknownFields.WriteTo(output); - } - #endif - } - - #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - void pb::IBufferMessage.InternalWriteTo(ref pb::WriteContext output) { - if (Socket.Length != 0) { - output.WriteRawTag(10); - output.WriteString(Socket); - } - if (ConnectionId.Length != 0) { - output.WriteRawTag(18); - output.WriteString(ConnectionId); - } - if (Data.Length != 0) { - output.WriteRawTag(26); - output.WriteBytes(Data); - } - if (_unknownFields != null) { - _unknownFields.WriteTo(ref output); - } - } - #endif - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public int CalculateSize() { - int size = 0; - if (Socket.Length != 0) { - size += 1 + pb::CodedOutputStream.ComputeStringSize(Socket); - } - if (ConnectionId.Length != 0) { - size += 1 + pb::CodedOutputStream.ComputeStringSize(ConnectionId); - } - if (Data.Length != 0) { - size += 1 + pb::CodedOutputStream.ComputeBytesSize(Data); - } - if (_unknownFields != null) { - size += _unknownFields.CalculateSize(); - } - return size; - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void MergeFrom(WebsocketSendRequest other) { - if (other == null) { - return; - } - if (other.Socket.Length != 0) { - Socket = other.Socket; - } - if (other.ConnectionId.Length != 0) { - ConnectionId = other.ConnectionId; - } - if (other.Data.Length != 0) { - Data = other.Data; - } - _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void MergeFrom(pb::CodedInputStream input) { - #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE - input.ReadRawMessage(this); - #else - uint tag; - while ((tag = input.ReadTag()) != 0) { - switch(tag) { - default: - _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input); - break; - case 10: { - Socket = input.ReadString(); - break; - } - case 18: { - ConnectionId = input.ReadString(); - break; - } - case 26: { - Data = input.ReadBytes(); - break; - } - } - } - #endif - } - - #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - void pb::IBufferMessage.InternalMergeFrom(ref pb::ParseContext input) { - uint tag; - while ((tag = input.ReadTag()) != 0) { - switch(tag) { - default: - _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, ref input); - break; - case 10: { - Socket = input.ReadString(); - break; - } - case 18: { - ConnectionId = input.ReadString(); - break; - } - case 26: { - Data = input.ReadBytes(); - break; - } - } - } - } - #endif - - } - - public sealed partial class WebsocketSendResponse : pb::IMessage - #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE - , pb::IBufferMessage - #endif - { - private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new WebsocketSendResponse()); - private pb::UnknownFieldSet _unknownFields; - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public static pb::MessageParser Parser { get { return _parser; } } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public static pbr::MessageDescriptor Descriptor { - get { return global::Nitric.Proto.Websocket.v1.WebsocketReflection.Descriptor.MessageTypes[1]; } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - pbr::MessageDescriptor pb::IMessage.Descriptor { - get { return Descriptor; } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public WebsocketSendResponse() { - OnConstruction(); - } - - partial void OnConstruction(); - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public WebsocketSendResponse(WebsocketSendResponse other) : this() { - _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public WebsocketSendResponse Clone() { - return new WebsocketSendResponse(this); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public override bool Equals(object other) { - return Equals(other as WebsocketSendResponse); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public bool Equals(WebsocketSendResponse other) { - if (ReferenceEquals(other, null)) { - return false; - } - if (ReferenceEquals(other, this)) { - return true; - } - return Equals(_unknownFields, other._unknownFields); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public override int GetHashCode() { - int hash = 1; - if (_unknownFields != null) { - hash ^= _unknownFields.GetHashCode(); - } - return hash; - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public override string ToString() { - return pb::JsonFormatter.ToDiagnosticString(this); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void WriteTo(pb::CodedOutputStream output) { - #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE - output.WriteRawMessage(this); - #else - if (_unknownFields != null) { - _unknownFields.WriteTo(output); - } - #endif - } - - #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - void pb::IBufferMessage.InternalWriteTo(ref pb::WriteContext output) { - if (_unknownFields != null) { - _unknownFields.WriteTo(ref output); - } - } - #endif - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public int CalculateSize() { - int size = 0; - if (_unknownFields != null) { - size += _unknownFields.CalculateSize(); - } - return size; - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void MergeFrom(WebsocketSendResponse other) { - if (other == null) { - return; - } - _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void MergeFrom(pb::CodedInputStream input) { - #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE - input.ReadRawMessage(this); - #else - uint tag; - while ((tag = input.ReadTag()) != 0) { - switch(tag) { - default: - _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input); - break; - } - } - #endif - } - - #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - void pb::IBufferMessage.InternalMergeFrom(ref pb::ParseContext input) { - uint tag; - while ((tag = input.ReadTag()) != 0) { - switch(tag) { - default: - _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, ref input); - break; - } - } - } - #endif - - } - - public sealed partial class WebsocketCloseRequest : pb::IMessage - #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE - , pb::IBufferMessage - #endif - { - private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new WebsocketCloseRequest()); - private pb::UnknownFieldSet _unknownFields; - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public static pb::MessageParser Parser { get { return _parser; } } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public static pbr::MessageDescriptor Descriptor { - get { return global::Nitric.Proto.Websocket.v1.WebsocketReflection.Descriptor.MessageTypes[2]; } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - pbr::MessageDescriptor pb::IMessage.Descriptor { - get { return Descriptor; } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public WebsocketCloseRequest() { - OnConstruction(); - } - - partial void OnConstruction(); - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public WebsocketCloseRequest(WebsocketCloseRequest other) : this() { - socket_ = other.socket_; - connectionId_ = other.connectionId_; - _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public WebsocketCloseRequest Clone() { - return new WebsocketCloseRequest(this); - } - - /// Field number for the "socket" field. - public const int SocketFieldNumber = 1; - private string socket_ = ""; - /// - /// The nitric name of the socket to send on - /// - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public string Socket { - get { return socket_; } - set { - socket_ = pb::ProtoPreconditions.CheckNotNull(value, "value"); - } - } - - /// Field number for the "connection_id" field. - public const int ConnectionIdFieldNumber = 2; - private string connectionId_ = ""; - /// - /// The connection ID of the client to send to - /// - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public string ConnectionId { - get { return connectionId_; } - set { - connectionId_ = pb::ProtoPreconditions.CheckNotNull(value, "value"); - } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public override bool Equals(object other) { - return Equals(other as WebsocketCloseRequest); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public bool Equals(WebsocketCloseRequest other) { - if (ReferenceEquals(other, null)) { - return false; - } - if (ReferenceEquals(other, this)) { - return true; - } - if (Socket != other.Socket) return false; - if (ConnectionId != other.ConnectionId) return false; - return Equals(_unknownFields, other._unknownFields); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public override int GetHashCode() { - int hash = 1; - if (Socket.Length != 0) hash ^= Socket.GetHashCode(); - if (ConnectionId.Length != 0) hash ^= ConnectionId.GetHashCode(); - if (_unknownFields != null) { - hash ^= _unknownFields.GetHashCode(); - } - return hash; - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public override string ToString() { - return pb::JsonFormatter.ToDiagnosticString(this); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void WriteTo(pb::CodedOutputStream output) { - #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE - output.WriteRawMessage(this); - #else - if (Socket.Length != 0) { - output.WriteRawTag(10); - output.WriteString(Socket); - } - if (ConnectionId.Length != 0) { - output.WriteRawTag(18); - output.WriteString(ConnectionId); - } - if (_unknownFields != null) { - _unknownFields.WriteTo(output); - } - #endif - } - - #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - void pb::IBufferMessage.InternalWriteTo(ref pb::WriteContext output) { - if (Socket.Length != 0) { - output.WriteRawTag(10); - output.WriteString(Socket); - } - if (ConnectionId.Length != 0) { - output.WriteRawTag(18); - output.WriteString(ConnectionId); - } - if (_unknownFields != null) { - _unknownFields.WriteTo(ref output); - } - } - #endif - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public int CalculateSize() { - int size = 0; - if (Socket.Length != 0) { - size += 1 + pb::CodedOutputStream.ComputeStringSize(Socket); - } - if (ConnectionId.Length != 0) { - size += 1 + pb::CodedOutputStream.ComputeStringSize(ConnectionId); - } - if (_unknownFields != null) { - size += _unknownFields.CalculateSize(); - } - return size; - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void MergeFrom(WebsocketCloseRequest other) { - if (other == null) { - return; - } - if (other.Socket.Length != 0) { - Socket = other.Socket; - } - if (other.ConnectionId.Length != 0) { - ConnectionId = other.ConnectionId; - } - _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void MergeFrom(pb::CodedInputStream input) { - #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE - input.ReadRawMessage(this); - #else - uint tag; - while ((tag = input.ReadTag()) != 0) { - switch(tag) { - default: - _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input); - break; - case 10: { - Socket = input.ReadString(); - break; - } - case 18: { - ConnectionId = input.ReadString(); - break; - } - } - } - #endif - } - - #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - void pb::IBufferMessage.InternalMergeFrom(ref pb::ParseContext input) { - uint tag; - while ((tag = input.ReadTag()) != 0) { - switch(tag) { - default: - _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, ref input); - break; - case 10: { - Socket = input.ReadString(); - break; - } - case 18: { - ConnectionId = input.ReadString(); - break; - } - } - } - } - #endif - - } - - public sealed partial class WebsocketCloseResponse : pb::IMessage - #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE - , pb::IBufferMessage - #endif - { - private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new WebsocketCloseResponse()); - private pb::UnknownFieldSet _unknownFields; - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public static pb::MessageParser Parser { get { return _parser; } } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public static pbr::MessageDescriptor Descriptor { - get { return global::Nitric.Proto.Websocket.v1.WebsocketReflection.Descriptor.MessageTypes[3]; } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - pbr::MessageDescriptor pb::IMessage.Descriptor { - get { return Descriptor; } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public WebsocketCloseResponse() { - OnConstruction(); - } - - partial void OnConstruction(); - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public WebsocketCloseResponse(WebsocketCloseResponse other) : this() { - _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public WebsocketCloseResponse Clone() { - return new WebsocketCloseResponse(this); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public override bool Equals(object other) { - return Equals(other as WebsocketCloseResponse); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public bool Equals(WebsocketCloseResponse other) { - if (ReferenceEquals(other, null)) { - return false; - } - if (ReferenceEquals(other, this)) { - return true; - } - return Equals(_unknownFields, other._unknownFields); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public override int GetHashCode() { - int hash = 1; - if (_unknownFields != null) { - hash ^= _unknownFields.GetHashCode(); - } - return hash; - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public override string ToString() { - return pb::JsonFormatter.ToDiagnosticString(this); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void WriteTo(pb::CodedOutputStream output) { - #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE - output.WriteRawMessage(this); - #else - if (_unknownFields != null) { - _unknownFields.WriteTo(output); - } - #endif - } - - #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - void pb::IBufferMessage.InternalWriteTo(ref pb::WriteContext output) { - if (_unknownFields != null) { - _unknownFields.WriteTo(ref output); - } - } - #endif - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public int CalculateSize() { - int size = 0; - if (_unknownFields != null) { - size += _unknownFields.CalculateSize(); - } - return size; - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void MergeFrom(WebsocketCloseResponse other) { - if (other == null) { - return; - } - _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void MergeFrom(pb::CodedInputStream input) { - #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE - input.ReadRawMessage(this); - #else - uint tag; - while ((tag = input.ReadTag()) != 0) { - switch(tag) { - default: - _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input); - break; - } - } - #endif - } - - #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - void pb::IBufferMessage.InternalMergeFrom(ref pb::ParseContext input) { - uint tag; - while ((tag = input.ReadTag()) != 0) { - switch(tag) { - default: - _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, ref input); - break; - } - } - } - #endif - - } - - #endregion - -} - -#endregion Designer generated code diff --git a/src/Nitric.Sdk/Proto/proto/websocket/v1/WebsocketGrpc.cs b/src/Nitric.Sdk/Proto/proto/websocket/v1/WebsocketGrpc.cs deleted file mode 100644 index 22c08dc..0000000 --- a/src/Nitric.Sdk/Proto/proto/websocket/v1/WebsocketGrpc.cs +++ /dev/null @@ -1,242 +0,0 @@ -// -// Generated by the protocol buffer compiler. DO NOT EDIT! -// source: proto/websocket/v1/websocket.proto -// -#pragma warning disable 0414, 1591 -#region Designer generated code - -using grpc = global::Grpc.Core; - -namespace Nitric.Proto.Websocket.v1 { - public static partial class WebsocketService - { - static readonly string __ServiceName = "nitric.websocket.v1.WebsocketService"; - - static void __Helper_SerializeMessage(global::Google.Protobuf.IMessage message, grpc::SerializationContext context) - { - #if !GRPC_DISABLE_PROTOBUF_BUFFER_SERIALIZATION - if (message is global::Google.Protobuf.IBufferMessage) - { - context.SetPayloadLength(message.CalculateSize()); - global::Google.Protobuf.MessageExtensions.WriteTo(message, context.GetBufferWriter()); - context.Complete(); - return; - } - #endif - context.Complete(global::Google.Protobuf.MessageExtensions.ToByteArray(message)); - } - - static class __Helper_MessageCache - { - public static readonly bool IsBufferMessage = global::System.Reflection.IntrospectionExtensions.GetTypeInfo(typeof(global::Google.Protobuf.IBufferMessage)).IsAssignableFrom(typeof(T)); - } - - static T __Helper_DeserializeMessage(grpc::DeserializationContext context, global::Google.Protobuf.MessageParser parser) where T : global::Google.Protobuf.IMessage - { - #if !GRPC_DISABLE_PROTOBUF_BUFFER_SERIALIZATION - if (__Helper_MessageCache.IsBufferMessage) - { - return parser.ParseFrom(context.PayloadAsReadOnlySequence()); - } - #endif - return parser.ParseFrom(context.PayloadAsNewBuffer()); - } - - static readonly grpc::Marshaller __Marshaller_nitric_websocket_v1_WebsocketSendRequest = grpc::Marshallers.Create(__Helper_SerializeMessage, context => __Helper_DeserializeMessage(context, global::Nitric.Proto.Websocket.v1.WebsocketSendRequest.Parser)); - static readonly grpc::Marshaller __Marshaller_nitric_websocket_v1_WebsocketSendResponse = grpc::Marshallers.Create(__Helper_SerializeMessage, context => __Helper_DeserializeMessage(context, global::Nitric.Proto.Websocket.v1.WebsocketSendResponse.Parser)); - static readonly grpc::Marshaller __Marshaller_nitric_websocket_v1_WebsocketCloseRequest = grpc::Marshallers.Create(__Helper_SerializeMessage, context => __Helper_DeserializeMessage(context, global::Nitric.Proto.Websocket.v1.WebsocketCloseRequest.Parser)); - static readonly grpc::Marshaller __Marshaller_nitric_websocket_v1_WebsocketCloseResponse = grpc::Marshallers.Create(__Helper_SerializeMessage, context => __Helper_DeserializeMessage(context, global::Nitric.Proto.Websocket.v1.WebsocketCloseResponse.Parser)); - - static readonly grpc::Method __Method_Send = new grpc::Method( - grpc::MethodType.Unary, - __ServiceName, - "Send", - __Marshaller_nitric_websocket_v1_WebsocketSendRequest, - __Marshaller_nitric_websocket_v1_WebsocketSendResponse); - - static readonly grpc::Method __Method_Close = new grpc::Method( - grpc::MethodType.Unary, - __ServiceName, - "Close", - __Marshaller_nitric_websocket_v1_WebsocketCloseRequest, - __Marshaller_nitric_websocket_v1_WebsocketCloseResponse); - - /// Service descriptor - public static global::Google.Protobuf.Reflection.ServiceDescriptor Descriptor - { - get { return global::Nitric.Proto.Websocket.v1.WebsocketReflection.Descriptor.Services[0]; } - } - - /// Base class for server-side implementations of WebsocketService - [grpc::BindServiceMethod(typeof(WebsocketService), "BindService")] - public abstract partial class WebsocketServiceBase - { - /// - /// Send a messages to a websocket - /// - /// The request received from the client. - /// The context of the server-side call handler being invoked. - /// The response to send back to the client (wrapped by a task). - public virtual global::System.Threading.Tasks.Task Send(global::Nitric.Proto.Websocket.v1.WebsocketSendRequest request, grpc::ServerCallContext context) - { - throw new grpc::RpcException(new grpc::Status(grpc::StatusCode.Unimplemented, "")); - } - - /// - /// Close a websocket connection - /// This can be used to force a client to disconnect - /// - /// The request received from the client. - /// The context of the server-side call handler being invoked. - /// The response to send back to the client (wrapped by a task). - public virtual global::System.Threading.Tasks.Task Close(global::Nitric.Proto.Websocket.v1.WebsocketCloseRequest request, grpc::ServerCallContext context) - { - throw new grpc::RpcException(new grpc::Status(grpc::StatusCode.Unimplemented, "")); - } - - } - - /// Client for WebsocketService - public partial class WebsocketServiceClient : grpc::ClientBase - { - /// Creates a new client for WebsocketService - /// The channel to use to make remote calls. - public WebsocketServiceClient(grpc::ChannelBase channel) : base(channel) - { - } - /// Creates a new client for WebsocketService that uses a custom CallInvoker. - /// The callInvoker to use to make remote calls. - public WebsocketServiceClient(grpc::CallInvoker callInvoker) : base(callInvoker) - { - } - /// Protected parameterless constructor to allow creation of test doubles. - protected WebsocketServiceClient() : base() - { - } - /// Protected constructor to allow creation of configured clients. - /// The client configuration. - protected WebsocketServiceClient(ClientBaseConfiguration configuration) : base(configuration) - { - } - - /// - /// Send a messages to a websocket - /// - /// The request to send to the server. - /// The initial metadata to send with the call. This parameter is optional. - /// An optional deadline for the call. The call will be cancelled if deadline is hit. - /// An optional token for canceling the call. - /// The response received from the server. - public virtual global::Nitric.Proto.Websocket.v1.WebsocketSendResponse Send(global::Nitric.Proto.Websocket.v1.WebsocketSendRequest request, grpc::Metadata headers = null, global::System.DateTime? deadline = null, global::System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken)) - { - return Send(request, new grpc::CallOptions(headers, deadline, cancellationToken)); - } - /// - /// Send a messages to a websocket - /// - /// The request to send to the server. - /// The options for the call. - /// The response received from the server. - public virtual global::Nitric.Proto.Websocket.v1.WebsocketSendResponse Send(global::Nitric.Proto.Websocket.v1.WebsocketSendRequest request, grpc::CallOptions options) - { - return CallInvoker.BlockingUnaryCall(__Method_Send, null, options, request); - } - /// - /// Send a messages to a websocket - /// - /// The request to send to the server. - /// The initial metadata to send with the call. This parameter is optional. - /// An optional deadline for the call. The call will be cancelled if deadline is hit. - /// An optional token for canceling the call. - /// The call object. - public virtual grpc::AsyncUnaryCall SendAsync(global::Nitric.Proto.Websocket.v1.WebsocketSendRequest request, grpc::Metadata headers = null, global::System.DateTime? deadline = null, global::System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken)) - { - return SendAsync(request, new grpc::CallOptions(headers, deadline, cancellationToken)); - } - /// - /// Send a messages to a websocket - /// - /// The request to send to the server. - /// The options for the call. - /// The call object. - public virtual grpc::AsyncUnaryCall SendAsync(global::Nitric.Proto.Websocket.v1.WebsocketSendRequest request, grpc::CallOptions options) - { - return CallInvoker.AsyncUnaryCall(__Method_Send, null, options, request); - } - /// - /// Close a websocket connection - /// This can be used to force a client to disconnect - /// - /// The request to send to the server. - /// The initial metadata to send with the call. This parameter is optional. - /// An optional deadline for the call. The call will be cancelled if deadline is hit. - /// An optional token for canceling the call. - /// The response received from the server. - public virtual global::Nitric.Proto.Websocket.v1.WebsocketCloseResponse Close(global::Nitric.Proto.Websocket.v1.WebsocketCloseRequest request, grpc::Metadata headers = null, global::System.DateTime? deadline = null, global::System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken)) - { - return Close(request, new grpc::CallOptions(headers, deadline, cancellationToken)); - } - /// - /// Close a websocket connection - /// This can be used to force a client to disconnect - /// - /// The request to send to the server. - /// The options for the call. - /// The response received from the server. - public virtual global::Nitric.Proto.Websocket.v1.WebsocketCloseResponse Close(global::Nitric.Proto.Websocket.v1.WebsocketCloseRequest request, grpc::CallOptions options) - { - return CallInvoker.BlockingUnaryCall(__Method_Close, null, options, request); - } - /// - /// Close a websocket connection - /// This can be used to force a client to disconnect - /// - /// The request to send to the server. - /// The initial metadata to send with the call. This parameter is optional. - /// An optional deadline for the call. The call will be cancelled if deadline is hit. - /// An optional token for canceling the call. - /// The call object. - public virtual grpc::AsyncUnaryCall CloseAsync(global::Nitric.Proto.Websocket.v1.WebsocketCloseRequest request, grpc::Metadata headers = null, global::System.DateTime? deadline = null, global::System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken)) - { - return CloseAsync(request, new grpc::CallOptions(headers, deadline, cancellationToken)); - } - /// - /// Close a websocket connection - /// This can be used to force a client to disconnect - /// - /// The request to send to the server. - /// The options for the call. - /// The call object. - public virtual grpc::AsyncUnaryCall CloseAsync(global::Nitric.Proto.Websocket.v1.WebsocketCloseRequest request, grpc::CallOptions options) - { - return CallInvoker.AsyncUnaryCall(__Method_Close, null, options, request); - } - /// Creates a new instance of client from given ClientBaseConfiguration. - protected override WebsocketServiceClient NewInstance(ClientBaseConfiguration configuration) - { - return new WebsocketServiceClient(configuration); - } - } - - /// Creates service definition that can be registered with a server - /// An object implementing the server-side handling logic. - public static grpc::ServerServiceDefinition BindService(WebsocketServiceBase serviceImpl) - { - return grpc::ServerServiceDefinition.CreateBuilder() - .AddMethod(__Method_Send, serviceImpl.Send) - .AddMethod(__Method_Close, serviceImpl.Close).Build(); - } - - /// Register service method with a service binder with or without implementation. Useful when customizing the service binding logic. - /// Note: this method is part of an experimental API that can change or be removed without any prior notice. - /// Service methods will be bound by calling AddMethod on this object. - /// An object implementing the server-side handling logic. - public static void BindService(grpc::ServiceBinderBase serviceBinder, WebsocketServiceBase serviceImpl) - { - serviceBinder.AddMethod(__Method_Send, serviceImpl == null ? null : new grpc::UnaryServerMethod(serviceImpl.Send)); - serviceBinder.AddMethod(__Method_Close, serviceImpl == null ? null : new grpc::UnaryServerMethod(serviceImpl.Close)); - } - - } -} -#endregion diff --git a/src/Nitric.Sdk/Proto/validate/Validate.cs b/src/Nitric.Sdk/Proto/validate/Validate.cs deleted file mode 100644 index a4d1d00..0000000 --- a/src/Nitric.Sdk/Proto/validate/Validate.cs +++ /dev/null @@ -1,13116 +0,0 @@ -// -// Generated by the protocol buffer compiler. DO NOT EDIT! -// source: validate/validate.proto -// -#pragma warning disable 1591, 0612, 3021 -#region Designer generated code - -using pb = global::Google.Protobuf; -using pbc = global::Google.Protobuf.Collections; -using pbr = global::Google.Protobuf.Reflection; -using scg = global::System.Collections.Generic; -namespace Validate { - - /// Holder for reflection information generated from validate/validate.proto - public static partial class ValidateReflection { - - #region Descriptor - /// File descriptor for validate/validate.proto - public static pbr::FileDescriptor Descriptor { - get { return descriptor; } - } - private static pbr::FileDescriptor descriptor; - - static ValidateReflection() { - byte[] descriptorData = global::System.Convert.FromBase64String( - string.Concat( - "Chd2YWxpZGF0ZS92YWxpZGF0ZS5wcm90bxIIdmFsaWRhdGUaIGdvb2dsZS9w", - "cm90b2J1Zi9kZXNjcmlwdG9yLnByb3RvGh5nb29nbGUvcHJvdG9idWYvZHVy", - "YXRpb24ucHJvdG8aH2dvb2dsZS9wcm90b2J1Zi90aW1lc3RhbXAucHJvdG8i", - "mAcKCkZpZWxkUnVsZXMSJwoHbWVzc2FnZRgRIAEoCzIWLnZhbGlkYXRlLk1l", - "c3NhZ2VSdWxlcxIlCgVmbG9hdBgBIAEoCzIULnZhbGlkYXRlLkZsb2F0UnVs", - "ZXNIABInCgZkb3VibGUYAiABKAsyFS52YWxpZGF0ZS5Eb3VibGVSdWxlc0gA", - "EiUKBWludDMyGAMgASgLMhQudmFsaWRhdGUuSW50MzJSdWxlc0gAEiUKBWlu", - "dDY0GAQgASgLMhQudmFsaWRhdGUuSW50NjRSdWxlc0gAEicKBnVpbnQzMhgF", - "IAEoCzIVLnZhbGlkYXRlLlVJbnQzMlJ1bGVzSAASJwoGdWludDY0GAYgASgL", - "MhUudmFsaWRhdGUuVUludDY0UnVsZXNIABInCgZzaW50MzIYByABKAsyFS52", - "YWxpZGF0ZS5TSW50MzJSdWxlc0gAEicKBnNpbnQ2NBgIIAEoCzIVLnZhbGlk", - "YXRlLlNJbnQ2NFJ1bGVzSAASKQoHZml4ZWQzMhgJIAEoCzIWLnZhbGlkYXRl", - "LkZpeGVkMzJSdWxlc0gAEikKB2ZpeGVkNjQYCiABKAsyFi52YWxpZGF0ZS5G", - "aXhlZDY0UnVsZXNIABIrCghzZml4ZWQzMhgLIAEoCzIXLnZhbGlkYXRlLlNG", - "aXhlZDMyUnVsZXNIABIrCghzZml4ZWQ2NBgMIAEoCzIXLnZhbGlkYXRlLlNG", - "aXhlZDY0UnVsZXNIABIjCgRib29sGA0gASgLMhMudmFsaWRhdGUuQm9vbFJ1", - "bGVzSAASJwoGc3RyaW5nGA4gASgLMhUudmFsaWRhdGUuU3RyaW5nUnVsZXNI", - "ABIlCgVieXRlcxgPIAEoCzIULnZhbGlkYXRlLkJ5dGVzUnVsZXNIABIjCgRl", - "bnVtGBAgASgLMhMudmFsaWRhdGUuRW51bVJ1bGVzSAASKwoIcmVwZWF0ZWQY", - "EiABKAsyFy52YWxpZGF0ZS5SZXBlYXRlZFJ1bGVzSAASIQoDbWFwGBMgASgL", - "MhIudmFsaWRhdGUuTWFwUnVsZXNIABIhCgNhbnkYFCABKAsyEi52YWxpZGF0", - "ZS5BbnlSdWxlc0gAEisKCGR1cmF0aW9uGBUgASgLMhcudmFsaWRhdGUuRHVy", - "YXRpb25SdWxlc0gAEi0KCXRpbWVzdGFtcBgWIAEoCzIYLnZhbGlkYXRlLlRp", - "bWVzdGFtcFJ1bGVzSABCBgoEdHlwZSJ/CgpGbG9hdFJ1bGVzEg0KBWNvbnN0", - "GAEgASgCEgoKAmx0GAIgASgCEgsKA2x0ZRgDIAEoAhIKCgJndBgEIAEoAhIL", - "CgNndGUYBSABKAISCgoCaW4YBiADKAISDgoGbm90X2luGAcgAygCEhQKDGln", - "bm9yZV9lbXB0eRgIIAEoCCKAAQoLRG91YmxlUnVsZXMSDQoFY29uc3QYASAB", - "KAESCgoCbHQYAiABKAESCwoDbHRlGAMgASgBEgoKAmd0GAQgASgBEgsKA2d0", - "ZRgFIAEoARIKCgJpbhgGIAMoARIOCgZub3RfaW4YByADKAESFAoMaWdub3Jl", - "X2VtcHR5GAggASgIIn8KCkludDMyUnVsZXMSDQoFY29uc3QYASABKAUSCgoC", - "bHQYAiABKAUSCwoDbHRlGAMgASgFEgoKAmd0GAQgASgFEgsKA2d0ZRgFIAEo", - "BRIKCgJpbhgGIAMoBRIOCgZub3RfaW4YByADKAUSFAoMaWdub3JlX2VtcHR5", - "GAggASgIIn8KCkludDY0UnVsZXMSDQoFY29uc3QYASABKAMSCgoCbHQYAiAB", - "KAMSCwoDbHRlGAMgASgDEgoKAmd0GAQgASgDEgsKA2d0ZRgFIAEoAxIKCgJp", - "bhgGIAMoAxIOCgZub3RfaW4YByADKAMSFAoMaWdub3JlX2VtcHR5GAggASgI", - "IoABCgtVSW50MzJSdWxlcxINCgVjb25zdBgBIAEoDRIKCgJsdBgCIAEoDRIL", - "CgNsdGUYAyABKA0SCgoCZ3QYBCABKA0SCwoDZ3RlGAUgASgNEgoKAmluGAYg", - "AygNEg4KBm5vdF9pbhgHIAMoDRIUCgxpZ25vcmVfZW1wdHkYCCABKAgigAEK", - "C1VJbnQ2NFJ1bGVzEg0KBWNvbnN0GAEgASgEEgoKAmx0GAIgASgEEgsKA2x0", - "ZRgDIAEoBBIKCgJndBgEIAEoBBILCgNndGUYBSABKAQSCgoCaW4YBiADKAQS", - "DgoGbm90X2luGAcgAygEEhQKDGlnbm9yZV9lbXB0eRgIIAEoCCKAAQoLU0lu", - "dDMyUnVsZXMSDQoFY29uc3QYASABKBESCgoCbHQYAiABKBESCwoDbHRlGAMg", - "ASgREgoKAmd0GAQgASgREgsKA2d0ZRgFIAEoERIKCgJpbhgGIAMoERIOCgZu", - "b3RfaW4YByADKBESFAoMaWdub3JlX2VtcHR5GAggASgIIoABCgtTSW50NjRS", - "dWxlcxINCgVjb25zdBgBIAEoEhIKCgJsdBgCIAEoEhILCgNsdGUYAyABKBIS", - "CgoCZ3QYBCABKBISCwoDZ3RlGAUgASgSEgoKAmluGAYgAygSEg4KBm5vdF9p", - "bhgHIAMoEhIUCgxpZ25vcmVfZW1wdHkYCCABKAgigQEKDEZpeGVkMzJSdWxl", - "cxINCgVjb25zdBgBIAEoBxIKCgJsdBgCIAEoBxILCgNsdGUYAyABKAcSCgoC", - "Z3QYBCABKAcSCwoDZ3RlGAUgASgHEgoKAmluGAYgAygHEg4KBm5vdF9pbhgH", - "IAMoBxIUCgxpZ25vcmVfZW1wdHkYCCABKAgigQEKDEZpeGVkNjRSdWxlcxIN", - "CgVjb25zdBgBIAEoBhIKCgJsdBgCIAEoBhILCgNsdGUYAyABKAYSCgoCZ3QY", - "BCABKAYSCwoDZ3RlGAUgASgGEgoKAmluGAYgAygGEg4KBm5vdF9pbhgHIAMo", - "BhIUCgxpZ25vcmVfZW1wdHkYCCABKAgiggEKDVNGaXhlZDMyUnVsZXMSDQoF", - "Y29uc3QYASABKA8SCgoCbHQYAiABKA8SCwoDbHRlGAMgASgPEgoKAmd0GAQg", - "ASgPEgsKA2d0ZRgFIAEoDxIKCgJpbhgGIAMoDxIOCgZub3RfaW4YByADKA8S", - "FAoMaWdub3JlX2VtcHR5GAggASgIIoIBCg1TRml4ZWQ2NFJ1bGVzEg0KBWNv", - "bnN0GAEgASgQEgoKAmx0GAIgASgQEgsKA2x0ZRgDIAEoEBIKCgJndBgEIAEo", - "EBILCgNndGUYBSABKBASCgoCaW4YBiADKBASDgoGbm90X2luGAcgAygQEhQK", - "DGlnbm9yZV9lbXB0eRgIIAEoCCIaCglCb29sUnVsZXMSDQoFY29uc3QYASAB", - "KAgi/QMKC1N0cmluZ1J1bGVzEg0KBWNvbnN0GAEgASgJEgsKA2xlbhgTIAEo", - "BBIPCgdtaW5fbGVuGAIgASgEEg8KB21heF9sZW4YAyABKAQSEQoJbGVuX2J5", - "dGVzGBQgASgEEhEKCW1pbl9ieXRlcxgEIAEoBBIRCgltYXhfYnl0ZXMYBSAB", - "KAQSDwoHcGF0dGVybhgGIAEoCRIOCgZwcmVmaXgYByABKAkSDgoGc3VmZml4", - "GAggASgJEhAKCGNvbnRhaW5zGAkgASgJEhQKDG5vdF9jb250YWlucxgXIAEo", - "CRIKCgJpbhgKIAMoCRIOCgZub3RfaW4YCyADKAkSDwoFZW1haWwYDCABKAhI", - "ABISCghob3N0bmFtZRgNIAEoCEgAEgwKAmlwGA4gASgISAASDgoEaXB2NBgP", - "IAEoCEgAEg4KBGlwdjYYECABKAhIABINCgN1cmkYESABKAhIABIRCgd1cmlf", - "cmVmGBIgASgISAASEQoHYWRkcmVzcxgVIAEoCEgAEg4KBHV1aWQYFiABKAhI", - "ABIwChB3ZWxsX2tub3duX3JlZ2V4GBggASgOMhQudmFsaWRhdGUuS25vd25S", - "ZWdleEgAEhQKBnN0cmljdBgZIAEoCDoEdHJ1ZRIUCgxpZ25vcmVfZW1wdHkY", - "GiABKAhCDAoKd2VsbF9rbm93biL7AQoKQnl0ZXNSdWxlcxINCgVjb25zdBgB", - "IAEoDBILCgNsZW4YDSABKAQSDwoHbWluX2xlbhgCIAEoBBIPCgdtYXhfbGVu", - "GAMgASgEEg8KB3BhdHRlcm4YBCABKAkSDgoGcHJlZml4GAUgASgMEg4KBnN1", - "ZmZpeBgGIAEoDBIQCghjb250YWlucxgHIAEoDBIKCgJpbhgIIAMoDBIOCgZu", - "b3RfaW4YCSADKAwSDAoCaXAYCiABKAhIABIOCgRpcHY0GAsgASgISAASDgoE", - "aXB2NhgMIAEoCEgAEhQKDGlnbm9yZV9lbXB0eRgOIAEoCEIMCgp3ZWxsX2tu", - "b3duIkwKCUVudW1SdWxlcxINCgVjb25zdBgBIAEoBRIUCgxkZWZpbmVkX29u", - "bHkYAiABKAgSCgoCaW4YAyADKAUSDgoGbm90X2luGAQgAygFIi4KDE1lc3Nh", - "Z2VSdWxlcxIMCgRza2lwGAEgASgIEhAKCHJlcXVpcmVkGAIgASgIIoABCg1S", - "ZXBlYXRlZFJ1bGVzEhEKCW1pbl9pdGVtcxgBIAEoBBIRCgltYXhfaXRlbXMY", - "AiABKAQSDgoGdW5pcXVlGAMgASgIEiMKBWl0ZW1zGAQgASgLMhQudmFsaWRh", - "dGUuRmllbGRSdWxlcxIUCgxpZ25vcmVfZW1wdHkYBSABKAgiowEKCE1hcFJ1", - "bGVzEhEKCW1pbl9wYWlycxgBIAEoBBIRCgltYXhfcGFpcnMYAiABKAQSEQoJ", - "bm9fc3BhcnNlGAMgASgIEiIKBGtleXMYBCABKAsyFC52YWxpZGF0ZS5GaWVs", - "ZFJ1bGVzEiQKBnZhbHVlcxgFIAEoCzIULnZhbGlkYXRlLkZpZWxkUnVsZXMS", - "FAoMaWdub3JlX2VtcHR5GAYgASgIIjgKCEFueVJ1bGVzEhAKCHJlcXVpcmVk", - "GAEgASgIEgoKAmluGAIgAygJEg4KBm5vdF9pbhgDIAMoCSK7AgoNRHVyYXRp", - "b25SdWxlcxIQCghyZXF1aXJlZBgBIAEoCBIoCgVjb25zdBgCIAEoCzIZLmdv", - "b2dsZS5wcm90b2J1Zi5EdXJhdGlvbhIlCgJsdBgDIAEoCzIZLmdvb2dsZS5w", - "cm90b2J1Zi5EdXJhdGlvbhImCgNsdGUYBCABKAsyGS5nb29nbGUucHJvdG9i", - "dWYuRHVyYXRpb24SJQoCZ3QYBSABKAsyGS5nb29nbGUucHJvdG9idWYuRHVy", - "YXRpb24SJgoDZ3RlGAYgASgLMhkuZ29vZ2xlLnByb3RvYnVmLkR1cmF0aW9u", - "EiUKAmluGAcgAygLMhkuZ29vZ2xlLnByb3RvYnVmLkR1cmF0aW9uEikKBm5v", - "dF9pbhgIIAMoCzIZLmdvb2dsZS5wcm90b2J1Zi5EdXJhdGlvbiK6AgoOVGlt", - "ZXN0YW1wUnVsZXMSEAoIcmVxdWlyZWQYASABKAgSKQoFY29uc3QYAiABKAsy", - "Gi5nb29nbGUucHJvdG9idWYuVGltZXN0YW1wEiYKAmx0GAMgASgLMhouZ29v", - "Z2xlLnByb3RvYnVmLlRpbWVzdGFtcBInCgNsdGUYBCABKAsyGi5nb29nbGUu", - "cHJvdG9idWYuVGltZXN0YW1wEiYKAmd0GAUgASgLMhouZ29vZ2xlLnByb3Rv", - "YnVmLlRpbWVzdGFtcBInCgNndGUYBiABKAsyGi5nb29nbGUucHJvdG9idWYu", - "VGltZXN0YW1wEg4KBmx0X25vdxgHIAEoCBIOCgZndF9ub3cYCCABKAgSKQoG", - "d2l0aGluGAkgASgLMhkuZ29vZ2xlLnByb3RvYnVmLkR1cmF0aW9uKkYKCktu", - "b3duUmVnZXgSCwoHVU5LTk9XThAAEhQKEEhUVFBfSEVBREVSX05BTUUQARIV", - "ChFIVFRQX0hFQURFUl9WQUxVRRACOjIKCGRpc2FibGVkEh8uZ29vZ2xlLnBy", - "b3RvYnVmLk1lc3NhZ2VPcHRpb25zGK8IIAEoCDoxCgdpZ25vcmVkEh8uZ29v", - "Z2xlLnByb3RvYnVmLk1lc3NhZ2VPcHRpb25zGLAIIAEoCDowCghyZXF1aXJl", - "ZBIdLmdvb2dsZS5wcm90b2J1Zi5PbmVvZk9wdGlvbnMYrwggASgIOkMKBXJ1", - "bGVzEh0uZ29vZ2xlLnByb3RvYnVmLkZpZWxkT3B0aW9ucxivCCABKAsyFC52", - "YWxpZGF0ZS5GaWVsZFJ1bGVzQlAKGmlvLmVudm95cHJveHkucGd2LnZhbGlk", - "YXRlWjJnaXRodWIuY29tL2Vudm95cHJveHkvcHJvdG9jLWdlbi12YWxpZGF0", - "ZS92YWxpZGF0ZQ==")); - descriptor = pbr::FileDescriptor.FromGeneratedCode(descriptorData, - new pbr::FileDescriptor[] { global::Google.Protobuf.Reflection.DescriptorReflection.Descriptor, global::Google.Protobuf.WellKnownTypes.DurationReflection.Descriptor, global::Google.Protobuf.WellKnownTypes.TimestampReflection.Descriptor, }, - new pbr::GeneratedClrTypeInfo(new[] {typeof(global::Validate.KnownRegex), }, new pb::Extension[] { ValidateExtensions.Disabled, ValidateExtensions.Ignored, ValidateExtensions.Required, ValidateExtensions.Rules }, new pbr::GeneratedClrTypeInfo[] { - new pbr::GeneratedClrTypeInfo(typeof(global::Validate.FieldRules), global::Validate.FieldRules.Parser, new[]{ "Message", "Float", "Double", "Int32", "Int64", "Uint32", "Uint64", "Sint32", "Sint64", "Fixed32", "Fixed64", "Sfixed32", "Sfixed64", "Bool", "String", "Bytes", "Enum", "Repeated", "Map", "Any", "Duration", "Timestamp" }, new[]{ "Type" }, null, null, null), - new pbr::GeneratedClrTypeInfo(typeof(global::Validate.FloatRules), global::Validate.FloatRules.Parser, new[]{ "Const", "Lt", "Lte", "Gt", "Gte", "In", "NotIn", "IgnoreEmpty" }, null, null, null, null), - new pbr::GeneratedClrTypeInfo(typeof(global::Validate.DoubleRules), global::Validate.DoubleRules.Parser, new[]{ "Const", "Lt", "Lte", "Gt", "Gte", "In", "NotIn", "IgnoreEmpty" }, null, null, null, null), - new pbr::GeneratedClrTypeInfo(typeof(global::Validate.Int32Rules), global::Validate.Int32Rules.Parser, new[]{ "Const", "Lt", "Lte", "Gt", "Gte", "In", "NotIn", "IgnoreEmpty" }, null, null, null, null), - new pbr::GeneratedClrTypeInfo(typeof(global::Validate.Int64Rules), global::Validate.Int64Rules.Parser, new[]{ "Const", "Lt", "Lte", "Gt", "Gte", "In", "NotIn", "IgnoreEmpty" }, null, null, null, null), - new pbr::GeneratedClrTypeInfo(typeof(global::Validate.UInt32Rules), global::Validate.UInt32Rules.Parser, new[]{ "Const", "Lt", "Lte", "Gt", "Gte", "In", "NotIn", "IgnoreEmpty" }, null, null, null, null), - new pbr::GeneratedClrTypeInfo(typeof(global::Validate.UInt64Rules), global::Validate.UInt64Rules.Parser, new[]{ "Const", "Lt", "Lte", "Gt", "Gte", "In", "NotIn", "IgnoreEmpty" }, null, null, null, null), - new pbr::GeneratedClrTypeInfo(typeof(global::Validate.SInt32Rules), global::Validate.SInt32Rules.Parser, new[]{ "Const", "Lt", "Lte", "Gt", "Gte", "In", "NotIn", "IgnoreEmpty" }, null, null, null, null), - new pbr::GeneratedClrTypeInfo(typeof(global::Validate.SInt64Rules), global::Validate.SInt64Rules.Parser, new[]{ "Const", "Lt", "Lte", "Gt", "Gte", "In", "NotIn", "IgnoreEmpty" }, null, null, null, null), - new pbr::GeneratedClrTypeInfo(typeof(global::Validate.Fixed32Rules), global::Validate.Fixed32Rules.Parser, new[]{ "Const", "Lt", "Lte", "Gt", "Gte", "In", "NotIn", "IgnoreEmpty" }, null, null, null, null), - new pbr::GeneratedClrTypeInfo(typeof(global::Validate.Fixed64Rules), global::Validate.Fixed64Rules.Parser, new[]{ "Const", "Lt", "Lte", "Gt", "Gte", "In", "NotIn", "IgnoreEmpty" }, null, null, null, null), - new pbr::GeneratedClrTypeInfo(typeof(global::Validate.SFixed32Rules), global::Validate.SFixed32Rules.Parser, new[]{ "Const", "Lt", "Lte", "Gt", "Gte", "In", "NotIn", "IgnoreEmpty" }, null, null, null, null), - new pbr::GeneratedClrTypeInfo(typeof(global::Validate.SFixed64Rules), global::Validate.SFixed64Rules.Parser, new[]{ "Const", "Lt", "Lte", "Gt", "Gte", "In", "NotIn", "IgnoreEmpty" }, null, null, null, null), - new pbr::GeneratedClrTypeInfo(typeof(global::Validate.BoolRules), global::Validate.BoolRules.Parser, new[]{ "Const" }, null, null, null, null), - new pbr::GeneratedClrTypeInfo(typeof(global::Validate.StringRules), global::Validate.StringRules.Parser, new[]{ "Const", "Len", "MinLen", "MaxLen", "LenBytes", "MinBytes", "MaxBytes", "Pattern", "Prefix", "Suffix", "Contains", "NotContains", "In", "NotIn", "Email", "Hostname", "Ip", "Ipv4", "Ipv6", "Uri", "UriRef", "Address", "Uuid", "WellKnownRegex", "Strict", "IgnoreEmpty" }, new[]{ "WellKnown" }, null, null, null), - new pbr::GeneratedClrTypeInfo(typeof(global::Validate.BytesRules), global::Validate.BytesRules.Parser, new[]{ "Const", "Len", "MinLen", "MaxLen", "Pattern", "Prefix", "Suffix", "Contains", "In", "NotIn", "Ip", "Ipv4", "Ipv6", "IgnoreEmpty" }, new[]{ "WellKnown" }, null, null, null), - new pbr::GeneratedClrTypeInfo(typeof(global::Validate.EnumRules), global::Validate.EnumRules.Parser, new[]{ "Const", "DefinedOnly", "In", "NotIn" }, null, null, null, null), - new pbr::GeneratedClrTypeInfo(typeof(global::Validate.MessageRules), global::Validate.MessageRules.Parser, new[]{ "Skip", "Required" }, null, null, null, null), - new pbr::GeneratedClrTypeInfo(typeof(global::Validate.RepeatedRules), global::Validate.RepeatedRules.Parser, new[]{ "MinItems", "MaxItems", "Unique", "Items", "IgnoreEmpty" }, null, null, null, null), - new pbr::GeneratedClrTypeInfo(typeof(global::Validate.MapRules), global::Validate.MapRules.Parser, new[]{ "MinPairs", "MaxPairs", "NoSparse", "Keys", "Values", "IgnoreEmpty" }, null, null, null, null), - new pbr::GeneratedClrTypeInfo(typeof(global::Validate.AnyRules), global::Validate.AnyRules.Parser, new[]{ "Required", "In", "NotIn" }, null, null, null, null), - new pbr::GeneratedClrTypeInfo(typeof(global::Validate.DurationRules), global::Validate.DurationRules.Parser, new[]{ "Required", "Const", "Lt", "Lte", "Gt", "Gte", "In", "NotIn" }, null, null, null, null), - new pbr::GeneratedClrTypeInfo(typeof(global::Validate.TimestampRules), global::Validate.TimestampRules.Parser, new[]{ "Required", "Const", "Lt", "Lte", "Gt", "Gte", "LtNow", "GtNow", "Within" }, null, null, null, null) - })); - } - #endregion - - } - /// Holder for extension identifiers generated from the top level of validate/validate.proto - public static partial class ValidateExtensions { - /// - /// Disabled nullifies any validation rules for this message, including any - /// message fields associated with it that do support validation. - /// - public static readonly pb::Extension Disabled = - new pb::Extension(1071, pb::FieldCodec.ForBool(8568, false)); - /// - /// Ignore skips generation of validation methods for this message. - /// - public static readonly pb::Extension Ignored = - new pb::Extension(1072, pb::FieldCodec.ForBool(8576, false)); - /// - /// Required ensures that exactly one the field options in a oneof is set; - /// validation fails if no fields in the oneof are set. - /// - public static readonly pb::Extension Required = - new pb::Extension(1071, pb::FieldCodec.ForBool(8568, false)); - /// - /// Rules specify the validations to be performed on this field. By default, - /// no validation is performed against a field. - /// - public static readonly pb::Extension Rules = - new pb::Extension(1071, pb::FieldCodec.ForMessage(8570, global::Validate.FieldRules.Parser)); - } - - #region Enums - /// - /// WellKnownRegex contain some well-known patterns. - /// - public enum KnownRegex { - [pbr::OriginalName("UNKNOWN")] Unknown = 0, - /// - /// HTTP header name as defined by RFC 7230. - /// - [pbr::OriginalName("HTTP_HEADER_NAME")] HttpHeaderName = 1, - /// - /// HTTP header value as defined by RFC 7230. - /// - [pbr::OriginalName("HTTP_HEADER_VALUE")] HttpHeaderValue = 2, - } - - #endregion - - #region Messages - /// - /// FieldRules encapsulates the rules for each type of field. Depending on the - /// field, the correct set should be used to ensure proper validations. - /// - public sealed partial class FieldRules : pb::IMessage - #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE - , pb::IBufferMessage - #endif - { - private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new FieldRules()); - private pb::UnknownFieldSet _unknownFields; - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public static pb::MessageParser Parser { get { return _parser; } } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public static pbr::MessageDescriptor Descriptor { - get { return global::Validate.ValidateReflection.Descriptor.MessageTypes[0]; } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - pbr::MessageDescriptor pb::IMessage.Descriptor { - get { return Descriptor; } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public FieldRules() { - OnConstruction(); - } - - partial void OnConstruction(); - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public FieldRules(FieldRules other) : this() { - message_ = other.message_ != null ? other.message_.Clone() : null; - switch (other.TypeCase) { - case TypeOneofCase.Float: - Float = other.Float.Clone(); - break; - case TypeOneofCase.Double: - Double = other.Double.Clone(); - break; - case TypeOneofCase.Int32: - Int32 = other.Int32.Clone(); - break; - case TypeOneofCase.Int64: - Int64 = other.Int64.Clone(); - break; - case TypeOneofCase.Uint32: - Uint32 = other.Uint32.Clone(); - break; - case TypeOneofCase.Uint64: - Uint64 = other.Uint64.Clone(); - break; - case TypeOneofCase.Sint32: - Sint32 = other.Sint32.Clone(); - break; - case TypeOneofCase.Sint64: - Sint64 = other.Sint64.Clone(); - break; - case TypeOneofCase.Fixed32: - Fixed32 = other.Fixed32.Clone(); - break; - case TypeOneofCase.Fixed64: - Fixed64 = other.Fixed64.Clone(); - break; - case TypeOneofCase.Sfixed32: - Sfixed32 = other.Sfixed32.Clone(); - break; - case TypeOneofCase.Sfixed64: - Sfixed64 = other.Sfixed64.Clone(); - break; - case TypeOneofCase.Bool: - Bool = other.Bool.Clone(); - break; - case TypeOneofCase.String: - String = other.String.Clone(); - break; - case TypeOneofCase.Bytes: - Bytes = other.Bytes.Clone(); - break; - case TypeOneofCase.Enum: - Enum = other.Enum.Clone(); - break; - case TypeOneofCase.Repeated: - Repeated = other.Repeated.Clone(); - break; - case TypeOneofCase.Map: - Map = other.Map.Clone(); - break; - case TypeOneofCase.Any: - Any = other.Any.Clone(); - break; - case TypeOneofCase.Duration: - Duration = other.Duration.Clone(); - break; - case TypeOneofCase.Timestamp: - Timestamp = other.Timestamp.Clone(); - break; - } - - _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public FieldRules Clone() { - return new FieldRules(this); - } - - /// Field number for the "message" field. - public const int MessageFieldNumber = 17; - private global::Validate.MessageRules message_; - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public global::Validate.MessageRules Message { - get { return message_; } - set { - message_ = value; - } - } - - /// Field number for the "float" field. - public const int FloatFieldNumber = 1; - /// - /// Scalar Field Types - /// - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public global::Validate.FloatRules Float { - get { return typeCase_ == TypeOneofCase.Float ? (global::Validate.FloatRules) type_ : null; } - set { - type_ = value; - typeCase_ = value == null ? TypeOneofCase.None : TypeOneofCase.Float; - } - } - - /// Field number for the "double" field. - public const int DoubleFieldNumber = 2; - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public global::Validate.DoubleRules Double { - get { return typeCase_ == TypeOneofCase.Double ? (global::Validate.DoubleRules) type_ : null; } - set { - type_ = value; - typeCase_ = value == null ? TypeOneofCase.None : TypeOneofCase.Double; - } - } - - /// Field number for the "int32" field. - public const int Int32FieldNumber = 3; - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public global::Validate.Int32Rules Int32 { - get { return typeCase_ == TypeOneofCase.Int32 ? (global::Validate.Int32Rules) type_ : null; } - set { - type_ = value; - typeCase_ = value == null ? TypeOneofCase.None : TypeOneofCase.Int32; - } - } - - /// Field number for the "int64" field. - public const int Int64FieldNumber = 4; - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public global::Validate.Int64Rules Int64 { - get { return typeCase_ == TypeOneofCase.Int64 ? (global::Validate.Int64Rules) type_ : null; } - set { - type_ = value; - typeCase_ = value == null ? TypeOneofCase.None : TypeOneofCase.Int64; - } - } - - /// Field number for the "uint32" field. - public const int Uint32FieldNumber = 5; - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public global::Validate.UInt32Rules Uint32 { - get { return typeCase_ == TypeOneofCase.Uint32 ? (global::Validate.UInt32Rules) type_ : null; } - set { - type_ = value; - typeCase_ = value == null ? TypeOneofCase.None : TypeOneofCase.Uint32; - } - } - - /// Field number for the "uint64" field. - public const int Uint64FieldNumber = 6; - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public global::Validate.UInt64Rules Uint64 { - get { return typeCase_ == TypeOneofCase.Uint64 ? (global::Validate.UInt64Rules) type_ : null; } - set { - type_ = value; - typeCase_ = value == null ? TypeOneofCase.None : TypeOneofCase.Uint64; - } - } - - /// Field number for the "sint32" field. - public const int Sint32FieldNumber = 7; - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public global::Validate.SInt32Rules Sint32 { - get { return typeCase_ == TypeOneofCase.Sint32 ? (global::Validate.SInt32Rules) type_ : null; } - set { - type_ = value; - typeCase_ = value == null ? TypeOneofCase.None : TypeOneofCase.Sint32; - } - } - - /// Field number for the "sint64" field. - public const int Sint64FieldNumber = 8; - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public global::Validate.SInt64Rules Sint64 { - get { return typeCase_ == TypeOneofCase.Sint64 ? (global::Validate.SInt64Rules) type_ : null; } - set { - type_ = value; - typeCase_ = value == null ? TypeOneofCase.None : TypeOneofCase.Sint64; - } - } - - /// Field number for the "fixed32" field. - public const int Fixed32FieldNumber = 9; - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public global::Validate.Fixed32Rules Fixed32 { - get { return typeCase_ == TypeOneofCase.Fixed32 ? (global::Validate.Fixed32Rules) type_ : null; } - set { - type_ = value; - typeCase_ = value == null ? TypeOneofCase.None : TypeOneofCase.Fixed32; - } - } - - /// Field number for the "fixed64" field. - public const int Fixed64FieldNumber = 10; - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public global::Validate.Fixed64Rules Fixed64 { - get { return typeCase_ == TypeOneofCase.Fixed64 ? (global::Validate.Fixed64Rules) type_ : null; } - set { - type_ = value; - typeCase_ = value == null ? TypeOneofCase.None : TypeOneofCase.Fixed64; - } - } - - /// Field number for the "sfixed32" field. - public const int Sfixed32FieldNumber = 11; - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public global::Validate.SFixed32Rules Sfixed32 { - get { return typeCase_ == TypeOneofCase.Sfixed32 ? (global::Validate.SFixed32Rules) type_ : null; } - set { - type_ = value; - typeCase_ = value == null ? TypeOneofCase.None : TypeOneofCase.Sfixed32; - } - } - - /// Field number for the "sfixed64" field. - public const int Sfixed64FieldNumber = 12; - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public global::Validate.SFixed64Rules Sfixed64 { - get { return typeCase_ == TypeOneofCase.Sfixed64 ? (global::Validate.SFixed64Rules) type_ : null; } - set { - type_ = value; - typeCase_ = value == null ? TypeOneofCase.None : TypeOneofCase.Sfixed64; - } - } - - /// Field number for the "bool" field. - public const int BoolFieldNumber = 13; - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public global::Validate.BoolRules Bool { - get { return typeCase_ == TypeOneofCase.Bool ? (global::Validate.BoolRules) type_ : null; } - set { - type_ = value; - typeCase_ = value == null ? TypeOneofCase.None : TypeOneofCase.Bool; - } - } - - /// Field number for the "string" field. - public const int StringFieldNumber = 14; - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public global::Validate.StringRules String { - get { return typeCase_ == TypeOneofCase.String ? (global::Validate.StringRules) type_ : null; } - set { - type_ = value; - typeCase_ = value == null ? TypeOneofCase.None : TypeOneofCase.String; - } - } - - /// Field number for the "bytes" field. - public const int BytesFieldNumber = 15; - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public global::Validate.BytesRules Bytes { - get { return typeCase_ == TypeOneofCase.Bytes ? (global::Validate.BytesRules) type_ : null; } - set { - type_ = value; - typeCase_ = value == null ? TypeOneofCase.None : TypeOneofCase.Bytes; - } - } - - /// Field number for the "enum" field. - public const int EnumFieldNumber = 16; - /// - /// Complex Field Types - /// - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public global::Validate.EnumRules Enum { - get { return typeCase_ == TypeOneofCase.Enum ? (global::Validate.EnumRules) type_ : null; } - set { - type_ = value; - typeCase_ = value == null ? TypeOneofCase.None : TypeOneofCase.Enum; - } - } - - /// Field number for the "repeated" field. - public const int RepeatedFieldNumber = 18; - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public global::Validate.RepeatedRules Repeated { - get { return typeCase_ == TypeOneofCase.Repeated ? (global::Validate.RepeatedRules) type_ : null; } - set { - type_ = value; - typeCase_ = value == null ? TypeOneofCase.None : TypeOneofCase.Repeated; - } - } - - /// Field number for the "map" field. - public const int MapFieldNumber = 19; - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public global::Validate.MapRules Map { - get { return typeCase_ == TypeOneofCase.Map ? (global::Validate.MapRules) type_ : null; } - set { - type_ = value; - typeCase_ = value == null ? TypeOneofCase.None : TypeOneofCase.Map; - } - } - - /// Field number for the "any" field. - public const int AnyFieldNumber = 20; - /// - /// Well-Known Field Types - /// - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public global::Validate.AnyRules Any { - get { return typeCase_ == TypeOneofCase.Any ? (global::Validate.AnyRules) type_ : null; } - set { - type_ = value; - typeCase_ = value == null ? TypeOneofCase.None : TypeOneofCase.Any; - } - } - - /// Field number for the "duration" field. - public const int DurationFieldNumber = 21; - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public global::Validate.DurationRules Duration { - get { return typeCase_ == TypeOneofCase.Duration ? (global::Validate.DurationRules) type_ : null; } - set { - type_ = value; - typeCase_ = value == null ? TypeOneofCase.None : TypeOneofCase.Duration; - } - } - - /// Field number for the "timestamp" field. - public const int TimestampFieldNumber = 22; - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public global::Validate.TimestampRules Timestamp { - get { return typeCase_ == TypeOneofCase.Timestamp ? (global::Validate.TimestampRules) type_ : null; } - set { - type_ = value; - typeCase_ = value == null ? TypeOneofCase.None : TypeOneofCase.Timestamp; - } - } - - private object type_; - /// Enum of possible cases for the "type" oneof. - public enum TypeOneofCase { - None = 0, - Float = 1, - Double = 2, - Int32 = 3, - Int64 = 4, - Uint32 = 5, - Uint64 = 6, - Sint32 = 7, - Sint64 = 8, - Fixed32 = 9, - Fixed64 = 10, - Sfixed32 = 11, - Sfixed64 = 12, - Bool = 13, - String = 14, - Bytes = 15, - Enum = 16, - Repeated = 18, - Map = 19, - Any = 20, - Duration = 21, - Timestamp = 22, - } - private TypeOneofCase typeCase_ = TypeOneofCase.None; - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public TypeOneofCase TypeCase { - get { return typeCase_; } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void ClearType() { - typeCase_ = TypeOneofCase.None; - type_ = null; - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public override bool Equals(object other) { - return Equals(other as FieldRules); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public bool Equals(FieldRules other) { - if (ReferenceEquals(other, null)) { - return false; - } - if (ReferenceEquals(other, this)) { - return true; - } - if (!object.Equals(Message, other.Message)) return false; - if (!object.Equals(Float, other.Float)) return false; - if (!object.Equals(Double, other.Double)) return false; - if (!object.Equals(Int32, other.Int32)) return false; - if (!object.Equals(Int64, other.Int64)) return false; - if (!object.Equals(Uint32, other.Uint32)) return false; - if (!object.Equals(Uint64, other.Uint64)) return false; - if (!object.Equals(Sint32, other.Sint32)) return false; - if (!object.Equals(Sint64, other.Sint64)) return false; - if (!object.Equals(Fixed32, other.Fixed32)) return false; - if (!object.Equals(Fixed64, other.Fixed64)) return false; - if (!object.Equals(Sfixed32, other.Sfixed32)) return false; - if (!object.Equals(Sfixed64, other.Sfixed64)) return false; - if (!object.Equals(Bool, other.Bool)) return false; - if (!object.Equals(String, other.String)) return false; - if (!object.Equals(Bytes, other.Bytes)) return false; - if (!object.Equals(Enum, other.Enum)) return false; - if (!object.Equals(Repeated, other.Repeated)) return false; - if (!object.Equals(Map, other.Map)) return false; - if (!object.Equals(Any, other.Any)) return false; - if (!object.Equals(Duration, other.Duration)) return false; - if (!object.Equals(Timestamp, other.Timestamp)) return false; - if (TypeCase != other.TypeCase) return false; - return Equals(_unknownFields, other._unknownFields); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public override int GetHashCode() { - int hash = 1; - if (message_ != null) hash ^= Message.GetHashCode(); - if (typeCase_ == TypeOneofCase.Float) hash ^= Float.GetHashCode(); - if (typeCase_ == TypeOneofCase.Double) hash ^= Double.GetHashCode(); - if (typeCase_ == TypeOneofCase.Int32) hash ^= Int32.GetHashCode(); - if (typeCase_ == TypeOneofCase.Int64) hash ^= Int64.GetHashCode(); - if (typeCase_ == TypeOneofCase.Uint32) hash ^= Uint32.GetHashCode(); - if (typeCase_ == TypeOneofCase.Uint64) hash ^= Uint64.GetHashCode(); - if (typeCase_ == TypeOneofCase.Sint32) hash ^= Sint32.GetHashCode(); - if (typeCase_ == TypeOneofCase.Sint64) hash ^= Sint64.GetHashCode(); - if (typeCase_ == TypeOneofCase.Fixed32) hash ^= Fixed32.GetHashCode(); - if (typeCase_ == TypeOneofCase.Fixed64) hash ^= Fixed64.GetHashCode(); - if (typeCase_ == TypeOneofCase.Sfixed32) hash ^= Sfixed32.GetHashCode(); - if (typeCase_ == TypeOneofCase.Sfixed64) hash ^= Sfixed64.GetHashCode(); - if (typeCase_ == TypeOneofCase.Bool) hash ^= Bool.GetHashCode(); - if (typeCase_ == TypeOneofCase.String) hash ^= String.GetHashCode(); - if (typeCase_ == TypeOneofCase.Bytes) hash ^= Bytes.GetHashCode(); - if (typeCase_ == TypeOneofCase.Enum) hash ^= Enum.GetHashCode(); - if (typeCase_ == TypeOneofCase.Repeated) hash ^= Repeated.GetHashCode(); - if (typeCase_ == TypeOneofCase.Map) hash ^= Map.GetHashCode(); - if (typeCase_ == TypeOneofCase.Any) hash ^= Any.GetHashCode(); - if (typeCase_ == TypeOneofCase.Duration) hash ^= Duration.GetHashCode(); - if (typeCase_ == TypeOneofCase.Timestamp) hash ^= Timestamp.GetHashCode(); - hash ^= (int) typeCase_; - if (_unknownFields != null) { - hash ^= _unknownFields.GetHashCode(); - } - return hash; - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public override string ToString() { - return pb::JsonFormatter.ToDiagnosticString(this); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void WriteTo(pb::CodedOutputStream output) { - #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE - output.WriteRawMessage(this); - #else - if (typeCase_ == TypeOneofCase.Float) { - output.WriteRawTag(10); - output.WriteMessage(Float); - } - if (typeCase_ == TypeOneofCase.Double) { - output.WriteRawTag(18); - output.WriteMessage(Double); - } - if (typeCase_ == TypeOneofCase.Int32) { - output.WriteRawTag(26); - output.WriteMessage(Int32); - } - if (typeCase_ == TypeOneofCase.Int64) { - output.WriteRawTag(34); - output.WriteMessage(Int64); - } - if (typeCase_ == TypeOneofCase.Uint32) { - output.WriteRawTag(42); - output.WriteMessage(Uint32); - } - if (typeCase_ == TypeOneofCase.Uint64) { - output.WriteRawTag(50); - output.WriteMessage(Uint64); - } - if (typeCase_ == TypeOneofCase.Sint32) { - output.WriteRawTag(58); - output.WriteMessage(Sint32); - } - if (typeCase_ == TypeOneofCase.Sint64) { - output.WriteRawTag(66); - output.WriteMessage(Sint64); - } - if (typeCase_ == TypeOneofCase.Fixed32) { - output.WriteRawTag(74); - output.WriteMessage(Fixed32); - } - if (typeCase_ == TypeOneofCase.Fixed64) { - output.WriteRawTag(82); - output.WriteMessage(Fixed64); - } - if (typeCase_ == TypeOneofCase.Sfixed32) { - output.WriteRawTag(90); - output.WriteMessage(Sfixed32); - } - if (typeCase_ == TypeOneofCase.Sfixed64) { - output.WriteRawTag(98); - output.WriteMessage(Sfixed64); - } - if (typeCase_ == TypeOneofCase.Bool) { - output.WriteRawTag(106); - output.WriteMessage(Bool); - } - if (typeCase_ == TypeOneofCase.String) { - output.WriteRawTag(114); - output.WriteMessage(String); - } - if (typeCase_ == TypeOneofCase.Bytes) { - output.WriteRawTag(122); - output.WriteMessage(Bytes); - } - if (typeCase_ == TypeOneofCase.Enum) { - output.WriteRawTag(130, 1); - output.WriteMessage(Enum); - } - if (message_ != null) { - output.WriteRawTag(138, 1); - output.WriteMessage(Message); - } - if (typeCase_ == TypeOneofCase.Repeated) { - output.WriteRawTag(146, 1); - output.WriteMessage(Repeated); - } - if (typeCase_ == TypeOneofCase.Map) { - output.WriteRawTag(154, 1); - output.WriteMessage(Map); - } - if (typeCase_ == TypeOneofCase.Any) { - output.WriteRawTag(162, 1); - output.WriteMessage(Any); - } - if (typeCase_ == TypeOneofCase.Duration) { - output.WriteRawTag(170, 1); - output.WriteMessage(Duration); - } - if (typeCase_ == TypeOneofCase.Timestamp) { - output.WriteRawTag(178, 1); - output.WriteMessage(Timestamp); - } - if (_unknownFields != null) { - _unknownFields.WriteTo(output); - } - #endif - } - - #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - void pb::IBufferMessage.InternalWriteTo(ref pb::WriteContext output) { - if (typeCase_ == TypeOneofCase.Float) { - output.WriteRawTag(10); - output.WriteMessage(Float); - } - if (typeCase_ == TypeOneofCase.Double) { - output.WriteRawTag(18); - output.WriteMessage(Double); - } - if (typeCase_ == TypeOneofCase.Int32) { - output.WriteRawTag(26); - output.WriteMessage(Int32); - } - if (typeCase_ == TypeOneofCase.Int64) { - output.WriteRawTag(34); - output.WriteMessage(Int64); - } - if (typeCase_ == TypeOneofCase.Uint32) { - output.WriteRawTag(42); - output.WriteMessage(Uint32); - } - if (typeCase_ == TypeOneofCase.Uint64) { - output.WriteRawTag(50); - output.WriteMessage(Uint64); - } - if (typeCase_ == TypeOneofCase.Sint32) { - output.WriteRawTag(58); - output.WriteMessage(Sint32); - } - if (typeCase_ == TypeOneofCase.Sint64) { - output.WriteRawTag(66); - output.WriteMessage(Sint64); - } - if (typeCase_ == TypeOneofCase.Fixed32) { - output.WriteRawTag(74); - output.WriteMessage(Fixed32); - } - if (typeCase_ == TypeOneofCase.Fixed64) { - output.WriteRawTag(82); - output.WriteMessage(Fixed64); - } - if (typeCase_ == TypeOneofCase.Sfixed32) { - output.WriteRawTag(90); - output.WriteMessage(Sfixed32); - } - if (typeCase_ == TypeOneofCase.Sfixed64) { - output.WriteRawTag(98); - output.WriteMessage(Sfixed64); - } - if (typeCase_ == TypeOneofCase.Bool) { - output.WriteRawTag(106); - output.WriteMessage(Bool); - } - if (typeCase_ == TypeOneofCase.String) { - output.WriteRawTag(114); - output.WriteMessage(String); - } - if (typeCase_ == TypeOneofCase.Bytes) { - output.WriteRawTag(122); - output.WriteMessage(Bytes); - } - if (typeCase_ == TypeOneofCase.Enum) { - output.WriteRawTag(130, 1); - output.WriteMessage(Enum); - } - if (message_ != null) { - output.WriteRawTag(138, 1); - output.WriteMessage(Message); - } - if (typeCase_ == TypeOneofCase.Repeated) { - output.WriteRawTag(146, 1); - output.WriteMessage(Repeated); - } - if (typeCase_ == TypeOneofCase.Map) { - output.WriteRawTag(154, 1); - output.WriteMessage(Map); - } - if (typeCase_ == TypeOneofCase.Any) { - output.WriteRawTag(162, 1); - output.WriteMessage(Any); - } - if (typeCase_ == TypeOneofCase.Duration) { - output.WriteRawTag(170, 1); - output.WriteMessage(Duration); - } - if (typeCase_ == TypeOneofCase.Timestamp) { - output.WriteRawTag(178, 1); - output.WriteMessage(Timestamp); - } - if (_unknownFields != null) { - _unknownFields.WriteTo(ref output); - } - } - #endif - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public int CalculateSize() { - int size = 0; - if (message_ != null) { - size += 2 + pb::CodedOutputStream.ComputeMessageSize(Message); - } - if (typeCase_ == TypeOneofCase.Float) { - size += 1 + pb::CodedOutputStream.ComputeMessageSize(Float); - } - if (typeCase_ == TypeOneofCase.Double) { - size += 1 + pb::CodedOutputStream.ComputeMessageSize(Double); - } - if (typeCase_ == TypeOneofCase.Int32) { - size += 1 + pb::CodedOutputStream.ComputeMessageSize(Int32); - } - if (typeCase_ == TypeOneofCase.Int64) { - size += 1 + pb::CodedOutputStream.ComputeMessageSize(Int64); - } - if (typeCase_ == TypeOneofCase.Uint32) { - size += 1 + pb::CodedOutputStream.ComputeMessageSize(Uint32); - } - if (typeCase_ == TypeOneofCase.Uint64) { - size += 1 + pb::CodedOutputStream.ComputeMessageSize(Uint64); - } - if (typeCase_ == TypeOneofCase.Sint32) { - size += 1 + pb::CodedOutputStream.ComputeMessageSize(Sint32); - } - if (typeCase_ == TypeOneofCase.Sint64) { - size += 1 + pb::CodedOutputStream.ComputeMessageSize(Sint64); - } - if (typeCase_ == TypeOneofCase.Fixed32) { - size += 1 + pb::CodedOutputStream.ComputeMessageSize(Fixed32); - } - if (typeCase_ == TypeOneofCase.Fixed64) { - size += 1 + pb::CodedOutputStream.ComputeMessageSize(Fixed64); - } - if (typeCase_ == TypeOneofCase.Sfixed32) { - size += 1 + pb::CodedOutputStream.ComputeMessageSize(Sfixed32); - } - if (typeCase_ == TypeOneofCase.Sfixed64) { - size += 1 + pb::CodedOutputStream.ComputeMessageSize(Sfixed64); - } - if (typeCase_ == TypeOneofCase.Bool) { - size += 1 + pb::CodedOutputStream.ComputeMessageSize(Bool); - } - if (typeCase_ == TypeOneofCase.String) { - size += 1 + pb::CodedOutputStream.ComputeMessageSize(String); - } - if (typeCase_ == TypeOneofCase.Bytes) { - size += 1 + pb::CodedOutputStream.ComputeMessageSize(Bytes); - } - if (typeCase_ == TypeOneofCase.Enum) { - size += 2 + pb::CodedOutputStream.ComputeMessageSize(Enum); - } - if (typeCase_ == TypeOneofCase.Repeated) { - size += 2 + pb::CodedOutputStream.ComputeMessageSize(Repeated); - } - if (typeCase_ == TypeOneofCase.Map) { - size += 2 + pb::CodedOutputStream.ComputeMessageSize(Map); - } - if (typeCase_ == TypeOneofCase.Any) { - size += 2 + pb::CodedOutputStream.ComputeMessageSize(Any); - } - if (typeCase_ == TypeOneofCase.Duration) { - size += 2 + pb::CodedOutputStream.ComputeMessageSize(Duration); - } - if (typeCase_ == TypeOneofCase.Timestamp) { - size += 2 + pb::CodedOutputStream.ComputeMessageSize(Timestamp); - } - if (_unknownFields != null) { - size += _unknownFields.CalculateSize(); - } - return size; - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void MergeFrom(FieldRules other) { - if (other == null) { - return; - } - if (other.message_ != null) { - if (message_ == null) { - Message = new global::Validate.MessageRules(); - } - Message.MergeFrom(other.Message); - } - switch (other.TypeCase) { - case TypeOneofCase.Float: - if (Float == null) { - Float = new global::Validate.FloatRules(); - } - Float.MergeFrom(other.Float); - break; - case TypeOneofCase.Double: - if (Double == null) { - Double = new global::Validate.DoubleRules(); - } - Double.MergeFrom(other.Double); - break; - case TypeOneofCase.Int32: - if (Int32 == null) { - Int32 = new global::Validate.Int32Rules(); - } - Int32.MergeFrom(other.Int32); - break; - case TypeOneofCase.Int64: - if (Int64 == null) { - Int64 = new global::Validate.Int64Rules(); - } - Int64.MergeFrom(other.Int64); - break; - case TypeOneofCase.Uint32: - if (Uint32 == null) { - Uint32 = new global::Validate.UInt32Rules(); - } - Uint32.MergeFrom(other.Uint32); - break; - case TypeOneofCase.Uint64: - if (Uint64 == null) { - Uint64 = new global::Validate.UInt64Rules(); - } - Uint64.MergeFrom(other.Uint64); - break; - case TypeOneofCase.Sint32: - if (Sint32 == null) { - Sint32 = new global::Validate.SInt32Rules(); - } - Sint32.MergeFrom(other.Sint32); - break; - case TypeOneofCase.Sint64: - if (Sint64 == null) { - Sint64 = new global::Validate.SInt64Rules(); - } - Sint64.MergeFrom(other.Sint64); - break; - case TypeOneofCase.Fixed32: - if (Fixed32 == null) { - Fixed32 = new global::Validate.Fixed32Rules(); - } - Fixed32.MergeFrom(other.Fixed32); - break; - case TypeOneofCase.Fixed64: - if (Fixed64 == null) { - Fixed64 = new global::Validate.Fixed64Rules(); - } - Fixed64.MergeFrom(other.Fixed64); - break; - case TypeOneofCase.Sfixed32: - if (Sfixed32 == null) { - Sfixed32 = new global::Validate.SFixed32Rules(); - } - Sfixed32.MergeFrom(other.Sfixed32); - break; - case TypeOneofCase.Sfixed64: - if (Sfixed64 == null) { - Sfixed64 = new global::Validate.SFixed64Rules(); - } - Sfixed64.MergeFrom(other.Sfixed64); - break; - case TypeOneofCase.Bool: - if (Bool == null) { - Bool = new global::Validate.BoolRules(); - } - Bool.MergeFrom(other.Bool); - break; - case TypeOneofCase.String: - if (String == null) { - String = new global::Validate.StringRules(); - } - String.MergeFrom(other.String); - break; - case TypeOneofCase.Bytes: - if (Bytes == null) { - Bytes = new global::Validate.BytesRules(); - } - Bytes.MergeFrom(other.Bytes); - break; - case TypeOneofCase.Enum: - if (Enum == null) { - Enum = new global::Validate.EnumRules(); - } - Enum.MergeFrom(other.Enum); - break; - case TypeOneofCase.Repeated: - if (Repeated == null) { - Repeated = new global::Validate.RepeatedRules(); - } - Repeated.MergeFrom(other.Repeated); - break; - case TypeOneofCase.Map: - if (Map == null) { - Map = new global::Validate.MapRules(); - } - Map.MergeFrom(other.Map); - break; - case TypeOneofCase.Any: - if (Any == null) { - Any = new global::Validate.AnyRules(); - } - Any.MergeFrom(other.Any); - break; - case TypeOneofCase.Duration: - if (Duration == null) { - Duration = new global::Validate.DurationRules(); - } - Duration.MergeFrom(other.Duration); - break; - case TypeOneofCase.Timestamp: - if (Timestamp == null) { - Timestamp = new global::Validate.TimestampRules(); - } - Timestamp.MergeFrom(other.Timestamp); - break; - } - - _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void MergeFrom(pb::CodedInputStream input) { - #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE - input.ReadRawMessage(this); - #else - uint tag; - while ((tag = input.ReadTag()) != 0) { - switch(tag) { - default: - _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input); - break; - case 10: { - global::Validate.FloatRules subBuilder = new global::Validate.FloatRules(); - if (typeCase_ == TypeOneofCase.Float) { - subBuilder.MergeFrom(Float); - } - input.ReadMessage(subBuilder); - Float = subBuilder; - break; - } - case 18: { - global::Validate.DoubleRules subBuilder = new global::Validate.DoubleRules(); - if (typeCase_ == TypeOneofCase.Double) { - subBuilder.MergeFrom(Double); - } - input.ReadMessage(subBuilder); - Double = subBuilder; - break; - } - case 26: { - global::Validate.Int32Rules subBuilder = new global::Validate.Int32Rules(); - if (typeCase_ == TypeOneofCase.Int32) { - subBuilder.MergeFrom(Int32); - } - input.ReadMessage(subBuilder); - Int32 = subBuilder; - break; - } - case 34: { - global::Validate.Int64Rules subBuilder = new global::Validate.Int64Rules(); - if (typeCase_ == TypeOneofCase.Int64) { - subBuilder.MergeFrom(Int64); - } - input.ReadMessage(subBuilder); - Int64 = subBuilder; - break; - } - case 42: { - global::Validate.UInt32Rules subBuilder = new global::Validate.UInt32Rules(); - if (typeCase_ == TypeOneofCase.Uint32) { - subBuilder.MergeFrom(Uint32); - } - input.ReadMessage(subBuilder); - Uint32 = subBuilder; - break; - } - case 50: { - global::Validate.UInt64Rules subBuilder = new global::Validate.UInt64Rules(); - if (typeCase_ == TypeOneofCase.Uint64) { - subBuilder.MergeFrom(Uint64); - } - input.ReadMessage(subBuilder); - Uint64 = subBuilder; - break; - } - case 58: { - global::Validate.SInt32Rules subBuilder = new global::Validate.SInt32Rules(); - if (typeCase_ == TypeOneofCase.Sint32) { - subBuilder.MergeFrom(Sint32); - } - input.ReadMessage(subBuilder); - Sint32 = subBuilder; - break; - } - case 66: { - global::Validate.SInt64Rules subBuilder = new global::Validate.SInt64Rules(); - if (typeCase_ == TypeOneofCase.Sint64) { - subBuilder.MergeFrom(Sint64); - } - input.ReadMessage(subBuilder); - Sint64 = subBuilder; - break; - } - case 74: { - global::Validate.Fixed32Rules subBuilder = new global::Validate.Fixed32Rules(); - if (typeCase_ == TypeOneofCase.Fixed32) { - subBuilder.MergeFrom(Fixed32); - } - input.ReadMessage(subBuilder); - Fixed32 = subBuilder; - break; - } - case 82: { - global::Validate.Fixed64Rules subBuilder = new global::Validate.Fixed64Rules(); - if (typeCase_ == TypeOneofCase.Fixed64) { - subBuilder.MergeFrom(Fixed64); - } - input.ReadMessage(subBuilder); - Fixed64 = subBuilder; - break; - } - case 90: { - global::Validate.SFixed32Rules subBuilder = new global::Validate.SFixed32Rules(); - if (typeCase_ == TypeOneofCase.Sfixed32) { - subBuilder.MergeFrom(Sfixed32); - } - input.ReadMessage(subBuilder); - Sfixed32 = subBuilder; - break; - } - case 98: { - global::Validate.SFixed64Rules subBuilder = new global::Validate.SFixed64Rules(); - if (typeCase_ == TypeOneofCase.Sfixed64) { - subBuilder.MergeFrom(Sfixed64); - } - input.ReadMessage(subBuilder); - Sfixed64 = subBuilder; - break; - } - case 106: { - global::Validate.BoolRules subBuilder = new global::Validate.BoolRules(); - if (typeCase_ == TypeOneofCase.Bool) { - subBuilder.MergeFrom(Bool); - } - input.ReadMessage(subBuilder); - Bool = subBuilder; - break; - } - case 114: { - global::Validate.StringRules subBuilder = new global::Validate.StringRules(); - if (typeCase_ == TypeOneofCase.String) { - subBuilder.MergeFrom(String); - } - input.ReadMessage(subBuilder); - String = subBuilder; - break; - } - case 122: { - global::Validate.BytesRules subBuilder = new global::Validate.BytesRules(); - if (typeCase_ == TypeOneofCase.Bytes) { - subBuilder.MergeFrom(Bytes); - } - input.ReadMessage(subBuilder); - Bytes = subBuilder; - break; - } - case 130: { - global::Validate.EnumRules subBuilder = new global::Validate.EnumRules(); - if (typeCase_ == TypeOneofCase.Enum) { - subBuilder.MergeFrom(Enum); - } - input.ReadMessage(subBuilder); - Enum = subBuilder; - break; - } - case 138: { - if (message_ == null) { - Message = new global::Validate.MessageRules(); - } - input.ReadMessage(Message); - break; - } - case 146: { - global::Validate.RepeatedRules subBuilder = new global::Validate.RepeatedRules(); - if (typeCase_ == TypeOneofCase.Repeated) { - subBuilder.MergeFrom(Repeated); - } - input.ReadMessage(subBuilder); - Repeated = subBuilder; - break; - } - case 154: { - global::Validate.MapRules subBuilder = new global::Validate.MapRules(); - if (typeCase_ == TypeOneofCase.Map) { - subBuilder.MergeFrom(Map); - } - input.ReadMessage(subBuilder); - Map = subBuilder; - break; - } - case 162: { - global::Validate.AnyRules subBuilder = new global::Validate.AnyRules(); - if (typeCase_ == TypeOneofCase.Any) { - subBuilder.MergeFrom(Any); - } - input.ReadMessage(subBuilder); - Any = subBuilder; - break; - } - case 170: { - global::Validate.DurationRules subBuilder = new global::Validate.DurationRules(); - if (typeCase_ == TypeOneofCase.Duration) { - subBuilder.MergeFrom(Duration); - } - input.ReadMessage(subBuilder); - Duration = subBuilder; - break; - } - case 178: { - global::Validate.TimestampRules subBuilder = new global::Validate.TimestampRules(); - if (typeCase_ == TypeOneofCase.Timestamp) { - subBuilder.MergeFrom(Timestamp); - } - input.ReadMessage(subBuilder); - Timestamp = subBuilder; - break; - } - } - } - #endif - } - - #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - void pb::IBufferMessage.InternalMergeFrom(ref pb::ParseContext input) { - uint tag; - while ((tag = input.ReadTag()) != 0) { - switch(tag) { - default: - _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, ref input); - break; - case 10: { - global::Validate.FloatRules subBuilder = new global::Validate.FloatRules(); - if (typeCase_ == TypeOneofCase.Float) { - subBuilder.MergeFrom(Float); - } - input.ReadMessage(subBuilder); - Float = subBuilder; - break; - } - case 18: { - global::Validate.DoubleRules subBuilder = new global::Validate.DoubleRules(); - if (typeCase_ == TypeOneofCase.Double) { - subBuilder.MergeFrom(Double); - } - input.ReadMessage(subBuilder); - Double = subBuilder; - break; - } - case 26: { - global::Validate.Int32Rules subBuilder = new global::Validate.Int32Rules(); - if (typeCase_ == TypeOneofCase.Int32) { - subBuilder.MergeFrom(Int32); - } - input.ReadMessage(subBuilder); - Int32 = subBuilder; - break; - } - case 34: { - global::Validate.Int64Rules subBuilder = new global::Validate.Int64Rules(); - if (typeCase_ == TypeOneofCase.Int64) { - subBuilder.MergeFrom(Int64); - } - input.ReadMessage(subBuilder); - Int64 = subBuilder; - break; - } - case 42: { - global::Validate.UInt32Rules subBuilder = new global::Validate.UInt32Rules(); - if (typeCase_ == TypeOneofCase.Uint32) { - subBuilder.MergeFrom(Uint32); - } - input.ReadMessage(subBuilder); - Uint32 = subBuilder; - break; - } - case 50: { - global::Validate.UInt64Rules subBuilder = new global::Validate.UInt64Rules(); - if (typeCase_ == TypeOneofCase.Uint64) { - subBuilder.MergeFrom(Uint64); - } - input.ReadMessage(subBuilder); - Uint64 = subBuilder; - break; - } - case 58: { - global::Validate.SInt32Rules subBuilder = new global::Validate.SInt32Rules(); - if (typeCase_ == TypeOneofCase.Sint32) { - subBuilder.MergeFrom(Sint32); - } - input.ReadMessage(subBuilder); - Sint32 = subBuilder; - break; - } - case 66: { - global::Validate.SInt64Rules subBuilder = new global::Validate.SInt64Rules(); - if (typeCase_ == TypeOneofCase.Sint64) { - subBuilder.MergeFrom(Sint64); - } - input.ReadMessage(subBuilder); - Sint64 = subBuilder; - break; - } - case 74: { - global::Validate.Fixed32Rules subBuilder = new global::Validate.Fixed32Rules(); - if (typeCase_ == TypeOneofCase.Fixed32) { - subBuilder.MergeFrom(Fixed32); - } - input.ReadMessage(subBuilder); - Fixed32 = subBuilder; - break; - } - case 82: { - global::Validate.Fixed64Rules subBuilder = new global::Validate.Fixed64Rules(); - if (typeCase_ == TypeOneofCase.Fixed64) { - subBuilder.MergeFrom(Fixed64); - } - input.ReadMessage(subBuilder); - Fixed64 = subBuilder; - break; - } - case 90: { - global::Validate.SFixed32Rules subBuilder = new global::Validate.SFixed32Rules(); - if (typeCase_ == TypeOneofCase.Sfixed32) { - subBuilder.MergeFrom(Sfixed32); - } - input.ReadMessage(subBuilder); - Sfixed32 = subBuilder; - break; - } - case 98: { - global::Validate.SFixed64Rules subBuilder = new global::Validate.SFixed64Rules(); - if (typeCase_ == TypeOneofCase.Sfixed64) { - subBuilder.MergeFrom(Sfixed64); - } - input.ReadMessage(subBuilder); - Sfixed64 = subBuilder; - break; - } - case 106: { - global::Validate.BoolRules subBuilder = new global::Validate.BoolRules(); - if (typeCase_ == TypeOneofCase.Bool) { - subBuilder.MergeFrom(Bool); - } - input.ReadMessage(subBuilder); - Bool = subBuilder; - break; - } - case 114: { - global::Validate.StringRules subBuilder = new global::Validate.StringRules(); - if (typeCase_ == TypeOneofCase.String) { - subBuilder.MergeFrom(String); - } - input.ReadMessage(subBuilder); - String = subBuilder; - break; - } - case 122: { - global::Validate.BytesRules subBuilder = new global::Validate.BytesRules(); - if (typeCase_ == TypeOneofCase.Bytes) { - subBuilder.MergeFrom(Bytes); - } - input.ReadMessage(subBuilder); - Bytes = subBuilder; - break; - } - case 130: { - global::Validate.EnumRules subBuilder = new global::Validate.EnumRules(); - if (typeCase_ == TypeOneofCase.Enum) { - subBuilder.MergeFrom(Enum); - } - input.ReadMessage(subBuilder); - Enum = subBuilder; - break; - } - case 138: { - if (message_ == null) { - Message = new global::Validate.MessageRules(); - } - input.ReadMessage(Message); - break; - } - case 146: { - global::Validate.RepeatedRules subBuilder = new global::Validate.RepeatedRules(); - if (typeCase_ == TypeOneofCase.Repeated) { - subBuilder.MergeFrom(Repeated); - } - input.ReadMessage(subBuilder); - Repeated = subBuilder; - break; - } - case 154: { - global::Validate.MapRules subBuilder = new global::Validate.MapRules(); - if (typeCase_ == TypeOneofCase.Map) { - subBuilder.MergeFrom(Map); - } - input.ReadMessage(subBuilder); - Map = subBuilder; - break; - } - case 162: { - global::Validate.AnyRules subBuilder = new global::Validate.AnyRules(); - if (typeCase_ == TypeOneofCase.Any) { - subBuilder.MergeFrom(Any); - } - input.ReadMessage(subBuilder); - Any = subBuilder; - break; - } - case 170: { - global::Validate.DurationRules subBuilder = new global::Validate.DurationRules(); - if (typeCase_ == TypeOneofCase.Duration) { - subBuilder.MergeFrom(Duration); - } - input.ReadMessage(subBuilder); - Duration = subBuilder; - break; - } - case 178: { - global::Validate.TimestampRules subBuilder = new global::Validate.TimestampRules(); - if (typeCase_ == TypeOneofCase.Timestamp) { - subBuilder.MergeFrom(Timestamp); - } - input.ReadMessage(subBuilder); - Timestamp = subBuilder; - break; - } - } - } - } - #endif - - } - - /// - /// FloatRules describes the constraints applied to `float` values - /// - public sealed partial class FloatRules : pb::IMessage - #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE - , pb::IBufferMessage - #endif - { - private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new FloatRules()); - private pb::UnknownFieldSet _unknownFields; - private int _hasBits0; - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public static pb::MessageParser Parser { get { return _parser; } } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public static pbr::MessageDescriptor Descriptor { - get { return global::Validate.ValidateReflection.Descriptor.MessageTypes[1]; } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - pbr::MessageDescriptor pb::IMessage.Descriptor { - get { return Descriptor; } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public FloatRules() { - OnConstruction(); - } - - partial void OnConstruction(); - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public FloatRules(FloatRules other) : this() { - _hasBits0 = other._hasBits0; - const_ = other.const_; - lt_ = other.lt_; - lte_ = other.lte_; - gt_ = other.gt_; - gte_ = other.gte_; - in_ = other.in_.Clone(); - notIn_ = other.notIn_.Clone(); - ignoreEmpty_ = other.ignoreEmpty_; - _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public FloatRules Clone() { - return new FloatRules(this); - } - - /// Field number for the "const" field. - public const int ConstFieldNumber = 1; - private readonly static float ConstDefaultValue = 0F; - - private float const_; - /// - /// Const specifies that this field must be exactly the specified value - /// - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public float Const { - get { if ((_hasBits0 & 1) != 0) { return const_; } else { return ConstDefaultValue; } } - set { - _hasBits0 |= 1; - const_ = value; - } - } - /// Gets whether the "const" field is set - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public bool HasConst { - get { return (_hasBits0 & 1) != 0; } - } - /// Clears the value of the "const" field - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void ClearConst() { - _hasBits0 &= ~1; - } - - /// Field number for the "lt" field. - public const int LtFieldNumber = 2; - private readonly static float LtDefaultValue = 0F; - - private float lt_; - /// - /// Lt specifies that this field must be less than the specified value, - /// exclusive - /// - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public float Lt { - get { if ((_hasBits0 & 2) != 0) { return lt_; } else { return LtDefaultValue; } } - set { - _hasBits0 |= 2; - lt_ = value; - } - } - /// Gets whether the "lt" field is set - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public bool HasLt { - get { return (_hasBits0 & 2) != 0; } - } - /// Clears the value of the "lt" field - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void ClearLt() { - _hasBits0 &= ~2; - } - - /// Field number for the "lte" field. - public const int LteFieldNumber = 3; - private readonly static float LteDefaultValue = 0F; - - private float lte_; - /// - /// Lte specifies that this field must be less than or equal to the - /// specified value, inclusive - /// - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public float Lte { - get { if ((_hasBits0 & 4) != 0) { return lte_; } else { return LteDefaultValue; } } - set { - _hasBits0 |= 4; - lte_ = value; - } - } - /// Gets whether the "lte" field is set - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public bool HasLte { - get { return (_hasBits0 & 4) != 0; } - } - /// Clears the value of the "lte" field - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void ClearLte() { - _hasBits0 &= ~4; - } - - /// Field number for the "gt" field. - public const int GtFieldNumber = 4; - private readonly static float GtDefaultValue = 0F; - - private float gt_; - /// - /// Gt specifies that this field must be greater than the specified value, - /// exclusive. If the value of Gt is larger than a specified Lt or Lte, the - /// range is reversed. - /// - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public float Gt { - get { if ((_hasBits0 & 8) != 0) { return gt_; } else { return GtDefaultValue; } } - set { - _hasBits0 |= 8; - gt_ = value; - } - } - /// Gets whether the "gt" field is set - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public bool HasGt { - get { return (_hasBits0 & 8) != 0; } - } - /// Clears the value of the "gt" field - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void ClearGt() { - _hasBits0 &= ~8; - } - - /// Field number for the "gte" field. - public const int GteFieldNumber = 5; - private readonly static float GteDefaultValue = 0F; - - private float gte_; - /// - /// Gte specifies that this field must be greater than or equal to the - /// specified value, inclusive. If the value of Gte is larger than a - /// specified Lt or Lte, the range is reversed. - /// - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public float Gte { - get { if ((_hasBits0 & 16) != 0) { return gte_; } else { return GteDefaultValue; } } - set { - _hasBits0 |= 16; - gte_ = value; - } - } - /// Gets whether the "gte" field is set - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public bool HasGte { - get { return (_hasBits0 & 16) != 0; } - } - /// Clears the value of the "gte" field - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void ClearGte() { - _hasBits0 &= ~16; - } - - /// Field number for the "in" field. - public const int InFieldNumber = 6; - private static readonly pb::FieldCodec _repeated_in_codec - = pb::FieldCodec.ForFloat(53); - private readonly pbc::RepeatedField in_ = new pbc::RepeatedField(); - /// - /// In specifies that this field must be equal to one of the specified - /// values - /// - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public pbc::RepeatedField In { - get { return in_; } - } - - /// Field number for the "not_in" field. - public const int NotInFieldNumber = 7; - private static readonly pb::FieldCodec _repeated_notIn_codec - = pb::FieldCodec.ForFloat(61); - private readonly pbc::RepeatedField notIn_ = new pbc::RepeatedField(); - /// - /// NotIn specifies that this field cannot be equal to one of the specified - /// values - /// - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public pbc::RepeatedField NotIn { - get { return notIn_; } - } - - /// Field number for the "ignore_empty" field. - public const int IgnoreEmptyFieldNumber = 8; - private readonly static bool IgnoreEmptyDefaultValue = false; - - private bool ignoreEmpty_; - /// - /// IgnoreEmpty specifies that the validation rules of this field should be - /// evaluated only if the field is not empty - /// - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public bool IgnoreEmpty { - get { if ((_hasBits0 & 32) != 0) { return ignoreEmpty_; } else { return IgnoreEmptyDefaultValue; } } - set { - _hasBits0 |= 32; - ignoreEmpty_ = value; - } - } - /// Gets whether the "ignore_empty" field is set - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public bool HasIgnoreEmpty { - get { return (_hasBits0 & 32) != 0; } - } - /// Clears the value of the "ignore_empty" field - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void ClearIgnoreEmpty() { - _hasBits0 &= ~32; - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public override bool Equals(object other) { - return Equals(other as FloatRules); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public bool Equals(FloatRules other) { - if (ReferenceEquals(other, null)) { - return false; - } - if (ReferenceEquals(other, this)) { - return true; - } - if (!pbc::ProtobufEqualityComparers.BitwiseSingleEqualityComparer.Equals(Const, other.Const)) return false; - if (!pbc::ProtobufEqualityComparers.BitwiseSingleEqualityComparer.Equals(Lt, other.Lt)) return false; - if (!pbc::ProtobufEqualityComparers.BitwiseSingleEqualityComparer.Equals(Lte, other.Lte)) return false; - if (!pbc::ProtobufEqualityComparers.BitwiseSingleEqualityComparer.Equals(Gt, other.Gt)) return false; - if (!pbc::ProtobufEqualityComparers.BitwiseSingleEqualityComparer.Equals(Gte, other.Gte)) return false; - if(!in_.Equals(other.in_)) return false; - if(!notIn_.Equals(other.notIn_)) return false; - if (IgnoreEmpty != other.IgnoreEmpty) return false; - return Equals(_unknownFields, other._unknownFields); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public override int GetHashCode() { - int hash = 1; - if (HasConst) hash ^= pbc::ProtobufEqualityComparers.BitwiseSingleEqualityComparer.GetHashCode(Const); - if (HasLt) hash ^= pbc::ProtobufEqualityComparers.BitwiseSingleEqualityComparer.GetHashCode(Lt); - if (HasLte) hash ^= pbc::ProtobufEqualityComparers.BitwiseSingleEqualityComparer.GetHashCode(Lte); - if (HasGt) hash ^= pbc::ProtobufEqualityComparers.BitwiseSingleEqualityComparer.GetHashCode(Gt); - if (HasGte) hash ^= pbc::ProtobufEqualityComparers.BitwiseSingleEqualityComparer.GetHashCode(Gte); - hash ^= in_.GetHashCode(); - hash ^= notIn_.GetHashCode(); - if (HasIgnoreEmpty) hash ^= IgnoreEmpty.GetHashCode(); - if (_unknownFields != null) { - hash ^= _unknownFields.GetHashCode(); - } - return hash; - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public override string ToString() { - return pb::JsonFormatter.ToDiagnosticString(this); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void WriteTo(pb::CodedOutputStream output) { - #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE - output.WriteRawMessage(this); - #else - if (HasConst) { - output.WriteRawTag(13); - output.WriteFloat(Const); - } - if (HasLt) { - output.WriteRawTag(21); - output.WriteFloat(Lt); - } - if (HasLte) { - output.WriteRawTag(29); - output.WriteFloat(Lte); - } - if (HasGt) { - output.WriteRawTag(37); - output.WriteFloat(Gt); - } - if (HasGte) { - output.WriteRawTag(45); - output.WriteFloat(Gte); - } - in_.WriteTo(output, _repeated_in_codec); - notIn_.WriteTo(output, _repeated_notIn_codec); - if (HasIgnoreEmpty) { - output.WriteRawTag(64); - output.WriteBool(IgnoreEmpty); - } - if (_unknownFields != null) { - _unknownFields.WriteTo(output); - } - #endif - } - - #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - void pb::IBufferMessage.InternalWriteTo(ref pb::WriteContext output) { - if (HasConst) { - output.WriteRawTag(13); - output.WriteFloat(Const); - } - if (HasLt) { - output.WriteRawTag(21); - output.WriteFloat(Lt); - } - if (HasLte) { - output.WriteRawTag(29); - output.WriteFloat(Lte); - } - if (HasGt) { - output.WriteRawTag(37); - output.WriteFloat(Gt); - } - if (HasGte) { - output.WriteRawTag(45); - output.WriteFloat(Gte); - } - in_.WriteTo(ref output, _repeated_in_codec); - notIn_.WriteTo(ref output, _repeated_notIn_codec); - if (HasIgnoreEmpty) { - output.WriteRawTag(64); - output.WriteBool(IgnoreEmpty); - } - if (_unknownFields != null) { - _unknownFields.WriteTo(ref output); - } - } - #endif - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public int CalculateSize() { - int size = 0; - if (HasConst) { - size += 1 + 4; - } - if (HasLt) { - size += 1 + 4; - } - if (HasLte) { - size += 1 + 4; - } - if (HasGt) { - size += 1 + 4; - } - if (HasGte) { - size += 1 + 4; - } - size += in_.CalculateSize(_repeated_in_codec); - size += notIn_.CalculateSize(_repeated_notIn_codec); - if (HasIgnoreEmpty) { - size += 1 + 1; - } - if (_unknownFields != null) { - size += _unknownFields.CalculateSize(); - } - return size; - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void MergeFrom(FloatRules other) { - if (other == null) { - return; - } - if (other.HasConst) { - Const = other.Const; - } - if (other.HasLt) { - Lt = other.Lt; - } - if (other.HasLte) { - Lte = other.Lte; - } - if (other.HasGt) { - Gt = other.Gt; - } - if (other.HasGte) { - Gte = other.Gte; - } - in_.Add(other.in_); - notIn_.Add(other.notIn_); - if (other.HasIgnoreEmpty) { - IgnoreEmpty = other.IgnoreEmpty; - } - _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void MergeFrom(pb::CodedInputStream input) { - #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE - input.ReadRawMessage(this); - #else - uint tag; - while ((tag = input.ReadTag()) != 0) { - switch(tag) { - default: - _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input); - break; - case 13: { - Const = input.ReadFloat(); - break; - } - case 21: { - Lt = input.ReadFloat(); - break; - } - case 29: { - Lte = input.ReadFloat(); - break; - } - case 37: { - Gt = input.ReadFloat(); - break; - } - case 45: { - Gte = input.ReadFloat(); - break; - } - case 50: - case 53: { - in_.AddEntriesFrom(input, _repeated_in_codec); - break; - } - case 58: - case 61: { - notIn_.AddEntriesFrom(input, _repeated_notIn_codec); - break; - } - case 64: { - IgnoreEmpty = input.ReadBool(); - break; - } - } - } - #endif - } - - #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - void pb::IBufferMessage.InternalMergeFrom(ref pb::ParseContext input) { - uint tag; - while ((tag = input.ReadTag()) != 0) { - switch(tag) { - default: - _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, ref input); - break; - case 13: { - Const = input.ReadFloat(); - break; - } - case 21: { - Lt = input.ReadFloat(); - break; - } - case 29: { - Lte = input.ReadFloat(); - break; - } - case 37: { - Gt = input.ReadFloat(); - break; - } - case 45: { - Gte = input.ReadFloat(); - break; - } - case 50: - case 53: { - in_.AddEntriesFrom(ref input, _repeated_in_codec); - break; - } - case 58: - case 61: { - notIn_.AddEntriesFrom(ref input, _repeated_notIn_codec); - break; - } - case 64: { - IgnoreEmpty = input.ReadBool(); - break; - } - } - } - } - #endif - - } - - /// - /// DoubleRules describes the constraints applied to `double` values - /// - public sealed partial class DoubleRules : pb::IMessage - #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE - , pb::IBufferMessage - #endif - { - private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new DoubleRules()); - private pb::UnknownFieldSet _unknownFields; - private int _hasBits0; - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public static pb::MessageParser Parser { get { return _parser; } } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public static pbr::MessageDescriptor Descriptor { - get { return global::Validate.ValidateReflection.Descriptor.MessageTypes[2]; } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - pbr::MessageDescriptor pb::IMessage.Descriptor { - get { return Descriptor; } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public DoubleRules() { - OnConstruction(); - } - - partial void OnConstruction(); - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public DoubleRules(DoubleRules other) : this() { - _hasBits0 = other._hasBits0; - const_ = other.const_; - lt_ = other.lt_; - lte_ = other.lte_; - gt_ = other.gt_; - gte_ = other.gte_; - in_ = other.in_.Clone(); - notIn_ = other.notIn_.Clone(); - ignoreEmpty_ = other.ignoreEmpty_; - _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public DoubleRules Clone() { - return new DoubleRules(this); - } - - /// Field number for the "const" field. - public const int ConstFieldNumber = 1; - private readonly static double ConstDefaultValue = 0D; - - private double const_; - /// - /// Const specifies that this field must be exactly the specified value - /// - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public double Const { - get { if ((_hasBits0 & 1) != 0) { return const_; } else { return ConstDefaultValue; } } - set { - _hasBits0 |= 1; - const_ = value; - } - } - /// Gets whether the "const" field is set - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public bool HasConst { - get { return (_hasBits0 & 1) != 0; } - } - /// Clears the value of the "const" field - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void ClearConst() { - _hasBits0 &= ~1; - } - - /// Field number for the "lt" field. - public const int LtFieldNumber = 2; - private readonly static double LtDefaultValue = 0D; - - private double lt_; - /// - /// Lt specifies that this field must be less than the specified value, - /// exclusive - /// - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public double Lt { - get { if ((_hasBits0 & 2) != 0) { return lt_; } else { return LtDefaultValue; } } - set { - _hasBits0 |= 2; - lt_ = value; - } - } - /// Gets whether the "lt" field is set - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public bool HasLt { - get { return (_hasBits0 & 2) != 0; } - } - /// Clears the value of the "lt" field - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void ClearLt() { - _hasBits0 &= ~2; - } - - /// Field number for the "lte" field. - public const int LteFieldNumber = 3; - private readonly static double LteDefaultValue = 0D; - - private double lte_; - /// - /// Lte specifies that this field must be less than or equal to the - /// specified value, inclusive - /// - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public double Lte { - get { if ((_hasBits0 & 4) != 0) { return lte_; } else { return LteDefaultValue; } } - set { - _hasBits0 |= 4; - lte_ = value; - } - } - /// Gets whether the "lte" field is set - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public bool HasLte { - get { return (_hasBits0 & 4) != 0; } - } - /// Clears the value of the "lte" field - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void ClearLte() { - _hasBits0 &= ~4; - } - - /// Field number for the "gt" field. - public const int GtFieldNumber = 4; - private readonly static double GtDefaultValue = 0D; - - private double gt_; - /// - /// Gt specifies that this field must be greater than the specified value, - /// exclusive. If the value of Gt is larger than a specified Lt or Lte, the - /// range is reversed. - /// - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public double Gt { - get { if ((_hasBits0 & 8) != 0) { return gt_; } else { return GtDefaultValue; } } - set { - _hasBits0 |= 8; - gt_ = value; - } - } - /// Gets whether the "gt" field is set - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public bool HasGt { - get { return (_hasBits0 & 8) != 0; } - } - /// Clears the value of the "gt" field - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void ClearGt() { - _hasBits0 &= ~8; - } - - /// Field number for the "gte" field. - public const int GteFieldNumber = 5; - private readonly static double GteDefaultValue = 0D; - - private double gte_; - /// - /// Gte specifies that this field must be greater than or equal to the - /// specified value, inclusive. If the value of Gte is larger than a - /// specified Lt or Lte, the range is reversed. - /// - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public double Gte { - get { if ((_hasBits0 & 16) != 0) { return gte_; } else { return GteDefaultValue; } } - set { - _hasBits0 |= 16; - gte_ = value; - } - } - /// Gets whether the "gte" field is set - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public bool HasGte { - get { return (_hasBits0 & 16) != 0; } - } - /// Clears the value of the "gte" field - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void ClearGte() { - _hasBits0 &= ~16; - } - - /// Field number for the "in" field. - public const int InFieldNumber = 6; - private static readonly pb::FieldCodec _repeated_in_codec - = pb::FieldCodec.ForDouble(49); - private readonly pbc::RepeatedField in_ = new pbc::RepeatedField(); - /// - /// In specifies that this field must be equal to one of the specified - /// values - /// - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public pbc::RepeatedField In { - get { return in_; } - } - - /// Field number for the "not_in" field. - public const int NotInFieldNumber = 7; - private static readonly pb::FieldCodec _repeated_notIn_codec - = pb::FieldCodec.ForDouble(57); - private readonly pbc::RepeatedField notIn_ = new pbc::RepeatedField(); - /// - /// NotIn specifies that this field cannot be equal to one of the specified - /// values - /// - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public pbc::RepeatedField NotIn { - get { return notIn_; } - } - - /// Field number for the "ignore_empty" field. - public const int IgnoreEmptyFieldNumber = 8; - private readonly static bool IgnoreEmptyDefaultValue = false; - - private bool ignoreEmpty_; - /// - /// IgnoreEmpty specifies that the validation rules of this field should be - /// evaluated only if the field is not empty - /// - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public bool IgnoreEmpty { - get { if ((_hasBits0 & 32) != 0) { return ignoreEmpty_; } else { return IgnoreEmptyDefaultValue; } } - set { - _hasBits0 |= 32; - ignoreEmpty_ = value; - } - } - /// Gets whether the "ignore_empty" field is set - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public bool HasIgnoreEmpty { - get { return (_hasBits0 & 32) != 0; } - } - /// Clears the value of the "ignore_empty" field - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void ClearIgnoreEmpty() { - _hasBits0 &= ~32; - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public override bool Equals(object other) { - return Equals(other as DoubleRules); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public bool Equals(DoubleRules other) { - if (ReferenceEquals(other, null)) { - return false; - } - if (ReferenceEquals(other, this)) { - return true; - } - if (!pbc::ProtobufEqualityComparers.BitwiseDoubleEqualityComparer.Equals(Const, other.Const)) return false; - if (!pbc::ProtobufEqualityComparers.BitwiseDoubleEqualityComparer.Equals(Lt, other.Lt)) return false; - if (!pbc::ProtobufEqualityComparers.BitwiseDoubleEqualityComparer.Equals(Lte, other.Lte)) return false; - if (!pbc::ProtobufEqualityComparers.BitwiseDoubleEqualityComparer.Equals(Gt, other.Gt)) return false; - if (!pbc::ProtobufEqualityComparers.BitwiseDoubleEqualityComparer.Equals(Gte, other.Gte)) return false; - if(!in_.Equals(other.in_)) return false; - if(!notIn_.Equals(other.notIn_)) return false; - if (IgnoreEmpty != other.IgnoreEmpty) return false; - return Equals(_unknownFields, other._unknownFields); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public override int GetHashCode() { - int hash = 1; - if (HasConst) hash ^= pbc::ProtobufEqualityComparers.BitwiseDoubleEqualityComparer.GetHashCode(Const); - if (HasLt) hash ^= pbc::ProtobufEqualityComparers.BitwiseDoubleEqualityComparer.GetHashCode(Lt); - if (HasLte) hash ^= pbc::ProtobufEqualityComparers.BitwiseDoubleEqualityComparer.GetHashCode(Lte); - if (HasGt) hash ^= pbc::ProtobufEqualityComparers.BitwiseDoubleEqualityComparer.GetHashCode(Gt); - if (HasGte) hash ^= pbc::ProtobufEqualityComparers.BitwiseDoubleEqualityComparer.GetHashCode(Gte); - hash ^= in_.GetHashCode(); - hash ^= notIn_.GetHashCode(); - if (HasIgnoreEmpty) hash ^= IgnoreEmpty.GetHashCode(); - if (_unknownFields != null) { - hash ^= _unknownFields.GetHashCode(); - } - return hash; - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public override string ToString() { - return pb::JsonFormatter.ToDiagnosticString(this); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void WriteTo(pb::CodedOutputStream output) { - #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE - output.WriteRawMessage(this); - #else - if (HasConst) { - output.WriteRawTag(9); - output.WriteDouble(Const); - } - if (HasLt) { - output.WriteRawTag(17); - output.WriteDouble(Lt); - } - if (HasLte) { - output.WriteRawTag(25); - output.WriteDouble(Lte); - } - if (HasGt) { - output.WriteRawTag(33); - output.WriteDouble(Gt); - } - if (HasGte) { - output.WriteRawTag(41); - output.WriteDouble(Gte); - } - in_.WriteTo(output, _repeated_in_codec); - notIn_.WriteTo(output, _repeated_notIn_codec); - if (HasIgnoreEmpty) { - output.WriteRawTag(64); - output.WriteBool(IgnoreEmpty); - } - if (_unknownFields != null) { - _unknownFields.WriteTo(output); - } - #endif - } - - #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - void pb::IBufferMessage.InternalWriteTo(ref pb::WriteContext output) { - if (HasConst) { - output.WriteRawTag(9); - output.WriteDouble(Const); - } - if (HasLt) { - output.WriteRawTag(17); - output.WriteDouble(Lt); - } - if (HasLte) { - output.WriteRawTag(25); - output.WriteDouble(Lte); - } - if (HasGt) { - output.WriteRawTag(33); - output.WriteDouble(Gt); - } - if (HasGte) { - output.WriteRawTag(41); - output.WriteDouble(Gte); - } - in_.WriteTo(ref output, _repeated_in_codec); - notIn_.WriteTo(ref output, _repeated_notIn_codec); - if (HasIgnoreEmpty) { - output.WriteRawTag(64); - output.WriteBool(IgnoreEmpty); - } - if (_unknownFields != null) { - _unknownFields.WriteTo(ref output); - } - } - #endif - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public int CalculateSize() { - int size = 0; - if (HasConst) { - size += 1 + 8; - } - if (HasLt) { - size += 1 + 8; - } - if (HasLte) { - size += 1 + 8; - } - if (HasGt) { - size += 1 + 8; - } - if (HasGte) { - size += 1 + 8; - } - size += in_.CalculateSize(_repeated_in_codec); - size += notIn_.CalculateSize(_repeated_notIn_codec); - if (HasIgnoreEmpty) { - size += 1 + 1; - } - if (_unknownFields != null) { - size += _unknownFields.CalculateSize(); - } - return size; - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void MergeFrom(DoubleRules other) { - if (other == null) { - return; - } - if (other.HasConst) { - Const = other.Const; - } - if (other.HasLt) { - Lt = other.Lt; - } - if (other.HasLte) { - Lte = other.Lte; - } - if (other.HasGt) { - Gt = other.Gt; - } - if (other.HasGte) { - Gte = other.Gte; - } - in_.Add(other.in_); - notIn_.Add(other.notIn_); - if (other.HasIgnoreEmpty) { - IgnoreEmpty = other.IgnoreEmpty; - } - _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void MergeFrom(pb::CodedInputStream input) { - #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE - input.ReadRawMessage(this); - #else - uint tag; - while ((tag = input.ReadTag()) != 0) { - switch(tag) { - default: - _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input); - break; - case 9: { - Const = input.ReadDouble(); - break; - } - case 17: { - Lt = input.ReadDouble(); - break; - } - case 25: { - Lte = input.ReadDouble(); - break; - } - case 33: { - Gt = input.ReadDouble(); - break; - } - case 41: { - Gte = input.ReadDouble(); - break; - } - case 50: - case 49: { - in_.AddEntriesFrom(input, _repeated_in_codec); - break; - } - case 58: - case 57: { - notIn_.AddEntriesFrom(input, _repeated_notIn_codec); - break; - } - case 64: { - IgnoreEmpty = input.ReadBool(); - break; - } - } - } - #endif - } - - #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - void pb::IBufferMessage.InternalMergeFrom(ref pb::ParseContext input) { - uint tag; - while ((tag = input.ReadTag()) != 0) { - switch(tag) { - default: - _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, ref input); - break; - case 9: { - Const = input.ReadDouble(); - break; - } - case 17: { - Lt = input.ReadDouble(); - break; - } - case 25: { - Lte = input.ReadDouble(); - break; - } - case 33: { - Gt = input.ReadDouble(); - break; - } - case 41: { - Gte = input.ReadDouble(); - break; - } - case 50: - case 49: { - in_.AddEntriesFrom(ref input, _repeated_in_codec); - break; - } - case 58: - case 57: { - notIn_.AddEntriesFrom(ref input, _repeated_notIn_codec); - break; - } - case 64: { - IgnoreEmpty = input.ReadBool(); - break; - } - } - } - } - #endif - - } - - /// - /// Int32Rules describes the constraints applied to `int32` values - /// - public sealed partial class Int32Rules : pb::IMessage - #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE - , pb::IBufferMessage - #endif - { - private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new Int32Rules()); - private pb::UnknownFieldSet _unknownFields; - private int _hasBits0; - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public static pb::MessageParser Parser { get { return _parser; } } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public static pbr::MessageDescriptor Descriptor { - get { return global::Validate.ValidateReflection.Descriptor.MessageTypes[3]; } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - pbr::MessageDescriptor pb::IMessage.Descriptor { - get { return Descriptor; } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public Int32Rules() { - OnConstruction(); - } - - partial void OnConstruction(); - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public Int32Rules(Int32Rules other) : this() { - _hasBits0 = other._hasBits0; - const_ = other.const_; - lt_ = other.lt_; - lte_ = other.lte_; - gt_ = other.gt_; - gte_ = other.gte_; - in_ = other.in_.Clone(); - notIn_ = other.notIn_.Clone(); - ignoreEmpty_ = other.ignoreEmpty_; - _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public Int32Rules Clone() { - return new Int32Rules(this); - } - - /// Field number for the "const" field. - public const int ConstFieldNumber = 1; - private readonly static int ConstDefaultValue = 0; - - private int const_; - /// - /// Const specifies that this field must be exactly the specified value - /// - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public int Const { - get { if ((_hasBits0 & 1) != 0) { return const_; } else { return ConstDefaultValue; } } - set { - _hasBits0 |= 1; - const_ = value; - } - } - /// Gets whether the "const" field is set - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public bool HasConst { - get { return (_hasBits0 & 1) != 0; } - } - /// Clears the value of the "const" field - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void ClearConst() { - _hasBits0 &= ~1; - } - - /// Field number for the "lt" field. - public const int LtFieldNumber = 2; - private readonly static int LtDefaultValue = 0; - - private int lt_; - /// - /// Lt specifies that this field must be less than the specified value, - /// exclusive - /// - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public int Lt { - get { if ((_hasBits0 & 2) != 0) { return lt_; } else { return LtDefaultValue; } } - set { - _hasBits0 |= 2; - lt_ = value; - } - } - /// Gets whether the "lt" field is set - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public bool HasLt { - get { return (_hasBits0 & 2) != 0; } - } - /// Clears the value of the "lt" field - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void ClearLt() { - _hasBits0 &= ~2; - } - - /// Field number for the "lte" field. - public const int LteFieldNumber = 3; - private readonly static int LteDefaultValue = 0; - - private int lte_; - /// - /// Lte specifies that this field must be less than or equal to the - /// specified value, inclusive - /// - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public int Lte { - get { if ((_hasBits0 & 4) != 0) { return lte_; } else { return LteDefaultValue; } } - set { - _hasBits0 |= 4; - lte_ = value; - } - } - /// Gets whether the "lte" field is set - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public bool HasLte { - get { return (_hasBits0 & 4) != 0; } - } - /// Clears the value of the "lte" field - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void ClearLte() { - _hasBits0 &= ~4; - } - - /// Field number for the "gt" field. - public const int GtFieldNumber = 4; - private readonly static int GtDefaultValue = 0; - - private int gt_; - /// - /// Gt specifies that this field must be greater than the specified value, - /// exclusive. If the value of Gt is larger than a specified Lt or Lte, the - /// range is reversed. - /// - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public int Gt { - get { if ((_hasBits0 & 8) != 0) { return gt_; } else { return GtDefaultValue; } } - set { - _hasBits0 |= 8; - gt_ = value; - } - } - /// Gets whether the "gt" field is set - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public bool HasGt { - get { return (_hasBits0 & 8) != 0; } - } - /// Clears the value of the "gt" field - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void ClearGt() { - _hasBits0 &= ~8; - } - - /// Field number for the "gte" field. - public const int GteFieldNumber = 5; - private readonly static int GteDefaultValue = 0; - - private int gte_; - /// - /// Gte specifies that this field must be greater than or equal to the - /// specified value, inclusive. If the value of Gte is larger than a - /// specified Lt or Lte, the range is reversed. - /// - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public int Gte { - get { if ((_hasBits0 & 16) != 0) { return gte_; } else { return GteDefaultValue; } } - set { - _hasBits0 |= 16; - gte_ = value; - } - } - /// Gets whether the "gte" field is set - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public bool HasGte { - get { return (_hasBits0 & 16) != 0; } - } - /// Clears the value of the "gte" field - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void ClearGte() { - _hasBits0 &= ~16; - } - - /// Field number for the "in" field. - public const int InFieldNumber = 6; - private static readonly pb::FieldCodec _repeated_in_codec - = pb::FieldCodec.ForInt32(48); - private readonly pbc::RepeatedField in_ = new pbc::RepeatedField(); - /// - /// In specifies that this field must be equal to one of the specified - /// values - /// - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public pbc::RepeatedField In { - get { return in_; } - } - - /// Field number for the "not_in" field. - public const int NotInFieldNumber = 7; - private static readonly pb::FieldCodec _repeated_notIn_codec - = pb::FieldCodec.ForInt32(56); - private readonly pbc::RepeatedField notIn_ = new pbc::RepeatedField(); - /// - /// NotIn specifies that this field cannot be equal to one of the specified - /// values - /// - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public pbc::RepeatedField NotIn { - get { return notIn_; } - } - - /// Field number for the "ignore_empty" field. - public const int IgnoreEmptyFieldNumber = 8; - private readonly static bool IgnoreEmptyDefaultValue = false; - - private bool ignoreEmpty_; - /// - /// IgnoreEmpty specifies that the validation rules of this field should be - /// evaluated only if the field is not empty - /// - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public bool IgnoreEmpty { - get { if ((_hasBits0 & 32) != 0) { return ignoreEmpty_; } else { return IgnoreEmptyDefaultValue; } } - set { - _hasBits0 |= 32; - ignoreEmpty_ = value; - } - } - /// Gets whether the "ignore_empty" field is set - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public bool HasIgnoreEmpty { - get { return (_hasBits0 & 32) != 0; } - } - /// Clears the value of the "ignore_empty" field - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void ClearIgnoreEmpty() { - _hasBits0 &= ~32; - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public override bool Equals(object other) { - return Equals(other as Int32Rules); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public bool Equals(Int32Rules other) { - if (ReferenceEquals(other, null)) { - return false; - } - if (ReferenceEquals(other, this)) { - return true; - } - if (Const != other.Const) return false; - if (Lt != other.Lt) return false; - if (Lte != other.Lte) return false; - if (Gt != other.Gt) return false; - if (Gte != other.Gte) return false; - if(!in_.Equals(other.in_)) return false; - if(!notIn_.Equals(other.notIn_)) return false; - if (IgnoreEmpty != other.IgnoreEmpty) return false; - return Equals(_unknownFields, other._unknownFields); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public override int GetHashCode() { - int hash = 1; - if (HasConst) hash ^= Const.GetHashCode(); - if (HasLt) hash ^= Lt.GetHashCode(); - if (HasLte) hash ^= Lte.GetHashCode(); - if (HasGt) hash ^= Gt.GetHashCode(); - if (HasGte) hash ^= Gte.GetHashCode(); - hash ^= in_.GetHashCode(); - hash ^= notIn_.GetHashCode(); - if (HasIgnoreEmpty) hash ^= IgnoreEmpty.GetHashCode(); - if (_unknownFields != null) { - hash ^= _unknownFields.GetHashCode(); - } - return hash; - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public override string ToString() { - return pb::JsonFormatter.ToDiagnosticString(this); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void WriteTo(pb::CodedOutputStream output) { - #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE - output.WriteRawMessage(this); - #else - if (HasConst) { - output.WriteRawTag(8); - output.WriteInt32(Const); - } - if (HasLt) { - output.WriteRawTag(16); - output.WriteInt32(Lt); - } - if (HasLte) { - output.WriteRawTag(24); - output.WriteInt32(Lte); - } - if (HasGt) { - output.WriteRawTag(32); - output.WriteInt32(Gt); - } - if (HasGte) { - output.WriteRawTag(40); - output.WriteInt32(Gte); - } - in_.WriteTo(output, _repeated_in_codec); - notIn_.WriteTo(output, _repeated_notIn_codec); - if (HasIgnoreEmpty) { - output.WriteRawTag(64); - output.WriteBool(IgnoreEmpty); - } - if (_unknownFields != null) { - _unknownFields.WriteTo(output); - } - #endif - } - - #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - void pb::IBufferMessage.InternalWriteTo(ref pb::WriteContext output) { - if (HasConst) { - output.WriteRawTag(8); - output.WriteInt32(Const); - } - if (HasLt) { - output.WriteRawTag(16); - output.WriteInt32(Lt); - } - if (HasLte) { - output.WriteRawTag(24); - output.WriteInt32(Lte); - } - if (HasGt) { - output.WriteRawTag(32); - output.WriteInt32(Gt); - } - if (HasGte) { - output.WriteRawTag(40); - output.WriteInt32(Gte); - } - in_.WriteTo(ref output, _repeated_in_codec); - notIn_.WriteTo(ref output, _repeated_notIn_codec); - if (HasIgnoreEmpty) { - output.WriteRawTag(64); - output.WriteBool(IgnoreEmpty); - } - if (_unknownFields != null) { - _unknownFields.WriteTo(ref output); - } - } - #endif - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public int CalculateSize() { - int size = 0; - if (HasConst) { - size += 1 + pb::CodedOutputStream.ComputeInt32Size(Const); - } - if (HasLt) { - size += 1 + pb::CodedOutputStream.ComputeInt32Size(Lt); - } - if (HasLte) { - size += 1 + pb::CodedOutputStream.ComputeInt32Size(Lte); - } - if (HasGt) { - size += 1 + pb::CodedOutputStream.ComputeInt32Size(Gt); - } - if (HasGte) { - size += 1 + pb::CodedOutputStream.ComputeInt32Size(Gte); - } - size += in_.CalculateSize(_repeated_in_codec); - size += notIn_.CalculateSize(_repeated_notIn_codec); - if (HasIgnoreEmpty) { - size += 1 + 1; - } - if (_unknownFields != null) { - size += _unknownFields.CalculateSize(); - } - return size; - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void MergeFrom(Int32Rules other) { - if (other == null) { - return; - } - if (other.HasConst) { - Const = other.Const; - } - if (other.HasLt) { - Lt = other.Lt; - } - if (other.HasLte) { - Lte = other.Lte; - } - if (other.HasGt) { - Gt = other.Gt; - } - if (other.HasGte) { - Gte = other.Gte; - } - in_.Add(other.in_); - notIn_.Add(other.notIn_); - if (other.HasIgnoreEmpty) { - IgnoreEmpty = other.IgnoreEmpty; - } - _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void MergeFrom(pb::CodedInputStream input) { - #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE - input.ReadRawMessage(this); - #else - uint tag; - while ((tag = input.ReadTag()) != 0) { - switch(tag) { - default: - _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input); - break; - case 8: { - Const = input.ReadInt32(); - break; - } - case 16: { - Lt = input.ReadInt32(); - break; - } - case 24: { - Lte = input.ReadInt32(); - break; - } - case 32: { - Gt = input.ReadInt32(); - break; - } - case 40: { - Gte = input.ReadInt32(); - break; - } - case 50: - case 48: { - in_.AddEntriesFrom(input, _repeated_in_codec); - break; - } - case 58: - case 56: { - notIn_.AddEntriesFrom(input, _repeated_notIn_codec); - break; - } - case 64: { - IgnoreEmpty = input.ReadBool(); - break; - } - } - } - #endif - } - - #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - void pb::IBufferMessage.InternalMergeFrom(ref pb::ParseContext input) { - uint tag; - while ((tag = input.ReadTag()) != 0) { - switch(tag) { - default: - _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, ref input); - break; - case 8: { - Const = input.ReadInt32(); - break; - } - case 16: { - Lt = input.ReadInt32(); - break; - } - case 24: { - Lte = input.ReadInt32(); - break; - } - case 32: { - Gt = input.ReadInt32(); - break; - } - case 40: { - Gte = input.ReadInt32(); - break; - } - case 50: - case 48: { - in_.AddEntriesFrom(ref input, _repeated_in_codec); - break; - } - case 58: - case 56: { - notIn_.AddEntriesFrom(ref input, _repeated_notIn_codec); - break; - } - case 64: { - IgnoreEmpty = input.ReadBool(); - break; - } - } - } - } - #endif - - } - - /// - /// Int64Rules describes the constraints applied to `int64` values - /// - public sealed partial class Int64Rules : pb::IMessage - #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE - , pb::IBufferMessage - #endif - { - private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new Int64Rules()); - private pb::UnknownFieldSet _unknownFields; - private int _hasBits0; - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public static pb::MessageParser Parser { get { return _parser; } } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public static pbr::MessageDescriptor Descriptor { - get { return global::Validate.ValidateReflection.Descriptor.MessageTypes[4]; } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - pbr::MessageDescriptor pb::IMessage.Descriptor { - get { return Descriptor; } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public Int64Rules() { - OnConstruction(); - } - - partial void OnConstruction(); - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public Int64Rules(Int64Rules other) : this() { - _hasBits0 = other._hasBits0; - const_ = other.const_; - lt_ = other.lt_; - lte_ = other.lte_; - gt_ = other.gt_; - gte_ = other.gte_; - in_ = other.in_.Clone(); - notIn_ = other.notIn_.Clone(); - ignoreEmpty_ = other.ignoreEmpty_; - _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public Int64Rules Clone() { - return new Int64Rules(this); - } - - /// Field number for the "const" field. - public const int ConstFieldNumber = 1; - private readonly static long ConstDefaultValue = 0L; - - private long const_; - /// - /// Const specifies that this field must be exactly the specified value - /// - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public long Const { - get { if ((_hasBits0 & 1) != 0) { return const_; } else { return ConstDefaultValue; } } - set { - _hasBits0 |= 1; - const_ = value; - } - } - /// Gets whether the "const" field is set - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public bool HasConst { - get { return (_hasBits0 & 1) != 0; } - } - /// Clears the value of the "const" field - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void ClearConst() { - _hasBits0 &= ~1; - } - - /// Field number for the "lt" field. - public const int LtFieldNumber = 2; - private readonly static long LtDefaultValue = 0L; - - private long lt_; - /// - /// Lt specifies that this field must be less than the specified value, - /// exclusive - /// - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public long Lt { - get { if ((_hasBits0 & 2) != 0) { return lt_; } else { return LtDefaultValue; } } - set { - _hasBits0 |= 2; - lt_ = value; - } - } - /// Gets whether the "lt" field is set - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public bool HasLt { - get { return (_hasBits0 & 2) != 0; } - } - /// Clears the value of the "lt" field - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void ClearLt() { - _hasBits0 &= ~2; - } - - /// Field number for the "lte" field. - public const int LteFieldNumber = 3; - private readonly static long LteDefaultValue = 0L; - - private long lte_; - /// - /// Lte specifies that this field must be less than or equal to the - /// specified value, inclusive - /// - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public long Lte { - get { if ((_hasBits0 & 4) != 0) { return lte_; } else { return LteDefaultValue; } } - set { - _hasBits0 |= 4; - lte_ = value; - } - } - /// Gets whether the "lte" field is set - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public bool HasLte { - get { return (_hasBits0 & 4) != 0; } - } - /// Clears the value of the "lte" field - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void ClearLte() { - _hasBits0 &= ~4; - } - - /// Field number for the "gt" field. - public const int GtFieldNumber = 4; - private readonly static long GtDefaultValue = 0L; - - private long gt_; - /// - /// Gt specifies that this field must be greater than the specified value, - /// exclusive. If the value of Gt is larger than a specified Lt or Lte, the - /// range is reversed. - /// - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public long Gt { - get { if ((_hasBits0 & 8) != 0) { return gt_; } else { return GtDefaultValue; } } - set { - _hasBits0 |= 8; - gt_ = value; - } - } - /// Gets whether the "gt" field is set - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public bool HasGt { - get { return (_hasBits0 & 8) != 0; } - } - /// Clears the value of the "gt" field - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void ClearGt() { - _hasBits0 &= ~8; - } - - /// Field number for the "gte" field. - public const int GteFieldNumber = 5; - private readonly static long GteDefaultValue = 0L; - - private long gte_; - /// - /// Gte specifies that this field must be greater than or equal to the - /// specified value, inclusive. If the value of Gte is larger than a - /// specified Lt or Lte, the range is reversed. - /// - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public long Gte { - get { if ((_hasBits0 & 16) != 0) { return gte_; } else { return GteDefaultValue; } } - set { - _hasBits0 |= 16; - gte_ = value; - } - } - /// Gets whether the "gte" field is set - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public bool HasGte { - get { return (_hasBits0 & 16) != 0; } - } - /// Clears the value of the "gte" field - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void ClearGte() { - _hasBits0 &= ~16; - } - - /// Field number for the "in" field. - public const int InFieldNumber = 6; - private static readonly pb::FieldCodec _repeated_in_codec - = pb::FieldCodec.ForInt64(48); - private readonly pbc::RepeatedField in_ = new pbc::RepeatedField(); - /// - /// In specifies that this field must be equal to one of the specified - /// values - /// - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public pbc::RepeatedField In { - get { return in_; } - } - - /// Field number for the "not_in" field. - public const int NotInFieldNumber = 7; - private static readonly pb::FieldCodec _repeated_notIn_codec - = pb::FieldCodec.ForInt64(56); - private readonly pbc::RepeatedField notIn_ = new pbc::RepeatedField(); - /// - /// NotIn specifies that this field cannot be equal to one of the specified - /// values - /// - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public pbc::RepeatedField NotIn { - get { return notIn_; } - } - - /// Field number for the "ignore_empty" field. - public const int IgnoreEmptyFieldNumber = 8; - private readonly static bool IgnoreEmptyDefaultValue = false; - - private bool ignoreEmpty_; - /// - /// IgnoreEmpty specifies that the validation rules of this field should be - /// evaluated only if the field is not empty - /// - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public bool IgnoreEmpty { - get { if ((_hasBits0 & 32) != 0) { return ignoreEmpty_; } else { return IgnoreEmptyDefaultValue; } } - set { - _hasBits0 |= 32; - ignoreEmpty_ = value; - } - } - /// Gets whether the "ignore_empty" field is set - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public bool HasIgnoreEmpty { - get { return (_hasBits0 & 32) != 0; } - } - /// Clears the value of the "ignore_empty" field - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void ClearIgnoreEmpty() { - _hasBits0 &= ~32; - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public override bool Equals(object other) { - return Equals(other as Int64Rules); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public bool Equals(Int64Rules other) { - if (ReferenceEquals(other, null)) { - return false; - } - if (ReferenceEquals(other, this)) { - return true; - } - if (Const != other.Const) return false; - if (Lt != other.Lt) return false; - if (Lte != other.Lte) return false; - if (Gt != other.Gt) return false; - if (Gte != other.Gte) return false; - if(!in_.Equals(other.in_)) return false; - if(!notIn_.Equals(other.notIn_)) return false; - if (IgnoreEmpty != other.IgnoreEmpty) return false; - return Equals(_unknownFields, other._unknownFields); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public override int GetHashCode() { - int hash = 1; - if (HasConst) hash ^= Const.GetHashCode(); - if (HasLt) hash ^= Lt.GetHashCode(); - if (HasLte) hash ^= Lte.GetHashCode(); - if (HasGt) hash ^= Gt.GetHashCode(); - if (HasGte) hash ^= Gte.GetHashCode(); - hash ^= in_.GetHashCode(); - hash ^= notIn_.GetHashCode(); - if (HasIgnoreEmpty) hash ^= IgnoreEmpty.GetHashCode(); - if (_unknownFields != null) { - hash ^= _unknownFields.GetHashCode(); - } - return hash; - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public override string ToString() { - return pb::JsonFormatter.ToDiagnosticString(this); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void WriteTo(pb::CodedOutputStream output) { - #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE - output.WriteRawMessage(this); - #else - if (HasConst) { - output.WriteRawTag(8); - output.WriteInt64(Const); - } - if (HasLt) { - output.WriteRawTag(16); - output.WriteInt64(Lt); - } - if (HasLte) { - output.WriteRawTag(24); - output.WriteInt64(Lte); - } - if (HasGt) { - output.WriteRawTag(32); - output.WriteInt64(Gt); - } - if (HasGte) { - output.WriteRawTag(40); - output.WriteInt64(Gte); - } - in_.WriteTo(output, _repeated_in_codec); - notIn_.WriteTo(output, _repeated_notIn_codec); - if (HasIgnoreEmpty) { - output.WriteRawTag(64); - output.WriteBool(IgnoreEmpty); - } - if (_unknownFields != null) { - _unknownFields.WriteTo(output); - } - #endif - } - - #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - void pb::IBufferMessage.InternalWriteTo(ref pb::WriteContext output) { - if (HasConst) { - output.WriteRawTag(8); - output.WriteInt64(Const); - } - if (HasLt) { - output.WriteRawTag(16); - output.WriteInt64(Lt); - } - if (HasLte) { - output.WriteRawTag(24); - output.WriteInt64(Lte); - } - if (HasGt) { - output.WriteRawTag(32); - output.WriteInt64(Gt); - } - if (HasGte) { - output.WriteRawTag(40); - output.WriteInt64(Gte); - } - in_.WriteTo(ref output, _repeated_in_codec); - notIn_.WriteTo(ref output, _repeated_notIn_codec); - if (HasIgnoreEmpty) { - output.WriteRawTag(64); - output.WriteBool(IgnoreEmpty); - } - if (_unknownFields != null) { - _unknownFields.WriteTo(ref output); - } - } - #endif - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public int CalculateSize() { - int size = 0; - if (HasConst) { - size += 1 + pb::CodedOutputStream.ComputeInt64Size(Const); - } - if (HasLt) { - size += 1 + pb::CodedOutputStream.ComputeInt64Size(Lt); - } - if (HasLte) { - size += 1 + pb::CodedOutputStream.ComputeInt64Size(Lte); - } - if (HasGt) { - size += 1 + pb::CodedOutputStream.ComputeInt64Size(Gt); - } - if (HasGte) { - size += 1 + pb::CodedOutputStream.ComputeInt64Size(Gte); - } - size += in_.CalculateSize(_repeated_in_codec); - size += notIn_.CalculateSize(_repeated_notIn_codec); - if (HasIgnoreEmpty) { - size += 1 + 1; - } - if (_unknownFields != null) { - size += _unknownFields.CalculateSize(); - } - return size; - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void MergeFrom(Int64Rules other) { - if (other == null) { - return; - } - if (other.HasConst) { - Const = other.Const; - } - if (other.HasLt) { - Lt = other.Lt; - } - if (other.HasLte) { - Lte = other.Lte; - } - if (other.HasGt) { - Gt = other.Gt; - } - if (other.HasGte) { - Gte = other.Gte; - } - in_.Add(other.in_); - notIn_.Add(other.notIn_); - if (other.HasIgnoreEmpty) { - IgnoreEmpty = other.IgnoreEmpty; - } - _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void MergeFrom(pb::CodedInputStream input) { - #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE - input.ReadRawMessage(this); - #else - uint tag; - while ((tag = input.ReadTag()) != 0) { - switch(tag) { - default: - _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input); - break; - case 8: { - Const = input.ReadInt64(); - break; - } - case 16: { - Lt = input.ReadInt64(); - break; - } - case 24: { - Lte = input.ReadInt64(); - break; - } - case 32: { - Gt = input.ReadInt64(); - break; - } - case 40: { - Gte = input.ReadInt64(); - break; - } - case 50: - case 48: { - in_.AddEntriesFrom(input, _repeated_in_codec); - break; - } - case 58: - case 56: { - notIn_.AddEntriesFrom(input, _repeated_notIn_codec); - break; - } - case 64: { - IgnoreEmpty = input.ReadBool(); - break; - } - } - } - #endif - } - - #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - void pb::IBufferMessage.InternalMergeFrom(ref pb::ParseContext input) { - uint tag; - while ((tag = input.ReadTag()) != 0) { - switch(tag) { - default: - _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, ref input); - break; - case 8: { - Const = input.ReadInt64(); - break; - } - case 16: { - Lt = input.ReadInt64(); - break; - } - case 24: { - Lte = input.ReadInt64(); - break; - } - case 32: { - Gt = input.ReadInt64(); - break; - } - case 40: { - Gte = input.ReadInt64(); - break; - } - case 50: - case 48: { - in_.AddEntriesFrom(ref input, _repeated_in_codec); - break; - } - case 58: - case 56: { - notIn_.AddEntriesFrom(ref input, _repeated_notIn_codec); - break; - } - case 64: { - IgnoreEmpty = input.ReadBool(); - break; - } - } - } - } - #endif - - } - - /// - /// UInt32Rules describes the constraints applied to `uint32` values - /// - public sealed partial class UInt32Rules : pb::IMessage - #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE - , pb::IBufferMessage - #endif - { - private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new UInt32Rules()); - private pb::UnknownFieldSet _unknownFields; - private int _hasBits0; - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public static pb::MessageParser Parser { get { return _parser; } } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public static pbr::MessageDescriptor Descriptor { - get { return global::Validate.ValidateReflection.Descriptor.MessageTypes[5]; } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - pbr::MessageDescriptor pb::IMessage.Descriptor { - get { return Descriptor; } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public UInt32Rules() { - OnConstruction(); - } - - partial void OnConstruction(); - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public UInt32Rules(UInt32Rules other) : this() { - _hasBits0 = other._hasBits0; - const_ = other.const_; - lt_ = other.lt_; - lte_ = other.lte_; - gt_ = other.gt_; - gte_ = other.gte_; - in_ = other.in_.Clone(); - notIn_ = other.notIn_.Clone(); - ignoreEmpty_ = other.ignoreEmpty_; - _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public UInt32Rules Clone() { - return new UInt32Rules(this); - } - - /// Field number for the "const" field. - public const int ConstFieldNumber = 1; - private readonly static uint ConstDefaultValue = 0; - - private uint const_; - /// - /// Const specifies that this field must be exactly the specified value - /// - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public uint Const { - get { if ((_hasBits0 & 1) != 0) { return const_; } else { return ConstDefaultValue; } } - set { - _hasBits0 |= 1; - const_ = value; - } - } - /// Gets whether the "const" field is set - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public bool HasConst { - get { return (_hasBits0 & 1) != 0; } - } - /// Clears the value of the "const" field - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void ClearConst() { - _hasBits0 &= ~1; - } - - /// Field number for the "lt" field. - public const int LtFieldNumber = 2; - private readonly static uint LtDefaultValue = 0; - - private uint lt_; - /// - /// Lt specifies that this field must be less than the specified value, - /// exclusive - /// - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public uint Lt { - get { if ((_hasBits0 & 2) != 0) { return lt_; } else { return LtDefaultValue; } } - set { - _hasBits0 |= 2; - lt_ = value; - } - } - /// Gets whether the "lt" field is set - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public bool HasLt { - get { return (_hasBits0 & 2) != 0; } - } - /// Clears the value of the "lt" field - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void ClearLt() { - _hasBits0 &= ~2; - } - - /// Field number for the "lte" field. - public const int LteFieldNumber = 3; - private readonly static uint LteDefaultValue = 0; - - private uint lte_; - /// - /// Lte specifies that this field must be less than or equal to the - /// specified value, inclusive - /// - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public uint Lte { - get { if ((_hasBits0 & 4) != 0) { return lte_; } else { return LteDefaultValue; } } - set { - _hasBits0 |= 4; - lte_ = value; - } - } - /// Gets whether the "lte" field is set - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public bool HasLte { - get { return (_hasBits0 & 4) != 0; } - } - /// Clears the value of the "lte" field - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void ClearLte() { - _hasBits0 &= ~4; - } - - /// Field number for the "gt" field. - public const int GtFieldNumber = 4; - private readonly static uint GtDefaultValue = 0; - - private uint gt_; - /// - /// Gt specifies that this field must be greater than the specified value, - /// exclusive. If the value of Gt is larger than a specified Lt or Lte, the - /// range is reversed. - /// - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public uint Gt { - get { if ((_hasBits0 & 8) != 0) { return gt_; } else { return GtDefaultValue; } } - set { - _hasBits0 |= 8; - gt_ = value; - } - } - /// Gets whether the "gt" field is set - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public bool HasGt { - get { return (_hasBits0 & 8) != 0; } - } - /// Clears the value of the "gt" field - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void ClearGt() { - _hasBits0 &= ~8; - } - - /// Field number for the "gte" field. - public const int GteFieldNumber = 5; - private readonly static uint GteDefaultValue = 0; - - private uint gte_; - /// - /// Gte specifies that this field must be greater than or equal to the - /// specified value, inclusive. If the value of Gte is larger than a - /// specified Lt or Lte, the range is reversed. - /// - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public uint Gte { - get { if ((_hasBits0 & 16) != 0) { return gte_; } else { return GteDefaultValue; } } - set { - _hasBits0 |= 16; - gte_ = value; - } - } - /// Gets whether the "gte" field is set - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public bool HasGte { - get { return (_hasBits0 & 16) != 0; } - } - /// Clears the value of the "gte" field - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void ClearGte() { - _hasBits0 &= ~16; - } - - /// Field number for the "in" field. - public const int InFieldNumber = 6; - private static readonly pb::FieldCodec _repeated_in_codec - = pb::FieldCodec.ForUInt32(48); - private readonly pbc::RepeatedField in_ = new pbc::RepeatedField(); - /// - /// In specifies that this field must be equal to one of the specified - /// values - /// - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public pbc::RepeatedField In { - get { return in_; } - } - - /// Field number for the "not_in" field. - public const int NotInFieldNumber = 7; - private static readonly pb::FieldCodec _repeated_notIn_codec - = pb::FieldCodec.ForUInt32(56); - private readonly pbc::RepeatedField notIn_ = new pbc::RepeatedField(); - /// - /// NotIn specifies that this field cannot be equal to one of the specified - /// values - /// - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public pbc::RepeatedField NotIn { - get { return notIn_; } - } - - /// Field number for the "ignore_empty" field. - public const int IgnoreEmptyFieldNumber = 8; - private readonly static bool IgnoreEmptyDefaultValue = false; - - private bool ignoreEmpty_; - /// - /// IgnoreEmpty specifies that the validation rules of this field should be - /// evaluated only if the field is not empty - /// - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public bool IgnoreEmpty { - get { if ((_hasBits0 & 32) != 0) { return ignoreEmpty_; } else { return IgnoreEmptyDefaultValue; } } - set { - _hasBits0 |= 32; - ignoreEmpty_ = value; - } - } - /// Gets whether the "ignore_empty" field is set - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public bool HasIgnoreEmpty { - get { return (_hasBits0 & 32) != 0; } - } - /// Clears the value of the "ignore_empty" field - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void ClearIgnoreEmpty() { - _hasBits0 &= ~32; - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public override bool Equals(object other) { - return Equals(other as UInt32Rules); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public bool Equals(UInt32Rules other) { - if (ReferenceEquals(other, null)) { - return false; - } - if (ReferenceEquals(other, this)) { - return true; - } - if (Const != other.Const) return false; - if (Lt != other.Lt) return false; - if (Lte != other.Lte) return false; - if (Gt != other.Gt) return false; - if (Gte != other.Gte) return false; - if(!in_.Equals(other.in_)) return false; - if(!notIn_.Equals(other.notIn_)) return false; - if (IgnoreEmpty != other.IgnoreEmpty) return false; - return Equals(_unknownFields, other._unknownFields); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public override int GetHashCode() { - int hash = 1; - if (HasConst) hash ^= Const.GetHashCode(); - if (HasLt) hash ^= Lt.GetHashCode(); - if (HasLte) hash ^= Lte.GetHashCode(); - if (HasGt) hash ^= Gt.GetHashCode(); - if (HasGte) hash ^= Gte.GetHashCode(); - hash ^= in_.GetHashCode(); - hash ^= notIn_.GetHashCode(); - if (HasIgnoreEmpty) hash ^= IgnoreEmpty.GetHashCode(); - if (_unknownFields != null) { - hash ^= _unknownFields.GetHashCode(); - } - return hash; - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public override string ToString() { - return pb::JsonFormatter.ToDiagnosticString(this); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void WriteTo(pb::CodedOutputStream output) { - #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE - output.WriteRawMessage(this); - #else - if (HasConst) { - output.WriteRawTag(8); - output.WriteUInt32(Const); - } - if (HasLt) { - output.WriteRawTag(16); - output.WriteUInt32(Lt); - } - if (HasLte) { - output.WriteRawTag(24); - output.WriteUInt32(Lte); - } - if (HasGt) { - output.WriteRawTag(32); - output.WriteUInt32(Gt); - } - if (HasGte) { - output.WriteRawTag(40); - output.WriteUInt32(Gte); - } - in_.WriteTo(output, _repeated_in_codec); - notIn_.WriteTo(output, _repeated_notIn_codec); - if (HasIgnoreEmpty) { - output.WriteRawTag(64); - output.WriteBool(IgnoreEmpty); - } - if (_unknownFields != null) { - _unknownFields.WriteTo(output); - } - #endif - } - - #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - void pb::IBufferMessage.InternalWriteTo(ref pb::WriteContext output) { - if (HasConst) { - output.WriteRawTag(8); - output.WriteUInt32(Const); - } - if (HasLt) { - output.WriteRawTag(16); - output.WriteUInt32(Lt); - } - if (HasLte) { - output.WriteRawTag(24); - output.WriteUInt32(Lte); - } - if (HasGt) { - output.WriteRawTag(32); - output.WriteUInt32(Gt); - } - if (HasGte) { - output.WriteRawTag(40); - output.WriteUInt32(Gte); - } - in_.WriteTo(ref output, _repeated_in_codec); - notIn_.WriteTo(ref output, _repeated_notIn_codec); - if (HasIgnoreEmpty) { - output.WriteRawTag(64); - output.WriteBool(IgnoreEmpty); - } - if (_unknownFields != null) { - _unknownFields.WriteTo(ref output); - } - } - #endif - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public int CalculateSize() { - int size = 0; - if (HasConst) { - size += 1 + pb::CodedOutputStream.ComputeUInt32Size(Const); - } - if (HasLt) { - size += 1 + pb::CodedOutputStream.ComputeUInt32Size(Lt); - } - if (HasLte) { - size += 1 + pb::CodedOutputStream.ComputeUInt32Size(Lte); - } - if (HasGt) { - size += 1 + pb::CodedOutputStream.ComputeUInt32Size(Gt); - } - if (HasGte) { - size += 1 + pb::CodedOutputStream.ComputeUInt32Size(Gte); - } - size += in_.CalculateSize(_repeated_in_codec); - size += notIn_.CalculateSize(_repeated_notIn_codec); - if (HasIgnoreEmpty) { - size += 1 + 1; - } - if (_unknownFields != null) { - size += _unknownFields.CalculateSize(); - } - return size; - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void MergeFrom(UInt32Rules other) { - if (other == null) { - return; - } - if (other.HasConst) { - Const = other.Const; - } - if (other.HasLt) { - Lt = other.Lt; - } - if (other.HasLte) { - Lte = other.Lte; - } - if (other.HasGt) { - Gt = other.Gt; - } - if (other.HasGte) { - Gte = other.Gte; - } - in_.Add(other.in_); - notIn_.Add(other.notIn_); - if (other.HasIgnoreEmpty) { - IgnoreEmpty = other.IgnoreEmpty; - } - _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void MergeFrom(pb::CodedInputStream input) { - #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE - input.ReadRawMessage(this); - #else - uint tag; - while ((tag = input.ReadTag()) != 0) { - switch(tag) { - default: - _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input); - break; - case 8: { - Const = input.ReadUInt32(); - break; - } - case 16: { - Lt = input.ReadUInt32(); - break; - } - case 24: { - Lte = input.ReadUInt32(); - break; - } - case 32: { - Gt = input.ReadUInt32(); - break; - } - case 40: { - Gte = input.ReadUInt32(); - break; - } - case 50: - case 48: { - in_.AddEntriesFrom(input, _repeated_in_codec); - break; - } - case 58: - case 56: { - notIn_.AddEntriesFrom(input, _repeated_notIn_codec); - break; - } - case 64: { - IgnoreEmpty = input.ReadBool(); - break; - } - } - } - #endif - } - - #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - void pb::IBufferMessage.InternalMergeFrom(ref pb::ParseContext input) { - uint tag; - while ((tag = input.ReadTag()) != 0) { - switch(tag) { - default: - _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, ref input); - break; - case 8: { - Const = input.ReadUInt32(); - break; - } - case 16: { - Lt = input.ReadUInt32(); - break; - } - case 24: { - Lte = input.ReadUInt32(); - break; - } - case 32: { - Gt = input.ReadUInt32(); - break; - } - case 40: { - Gte = input.ReadUInt32(); - break; - } - case 50: - case 48: { - in_.AddEntriesFrom(ref input, _repeated_in_codec); - break; - } - case 58: - case 56: { - notIn_.AddEntriesFrom(ref input, _repeated_notIn_codec); - break; - } - case 64: { - IgnoreEmpty = input.ReadBool(); - break; - } - } - } - } - #endif - - } - - /// - /// UInt64Rules describes the constraints applied to `uint64` values - /// - public sealed partial class UInt64Rules : pb::IMessage - #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE - , pb::IBufferMessage - #endif - { - private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new UInt64Rules()); - private pb::UnknownFieldSet _unknownFields; - private int _hasBits0; - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public static pb::MessageParser Parser { get { return _parser; } } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public static pbr::MessageDescriptor Descriptor { - get { return global::Validate.ValidateReflection.Descriptor.MessageTypes[6]; } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - pbr::MessageDescriptor pb::IMessage.Descriptor { - get { return Descriptor; } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public UInt64Rules() { - OnConstruction(); - } - - partial void OnConstruction(); - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public UInt64Rules(UInt64Rules other) : this() { - _hasBits0 = other._hasBits0; - const_ = other.const_; - lt_ = other.lt_; - lte_ = other.lte_; - gt_ = other.gt_; - gte_ = other.gte_; - in_ = other.in_.Clone(); - notIn_ = other.notIn_.Clone(); - ignoreEmpty_ = other.ignoreEmpty_; - _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public UInt64Rules Clone() { - return new UInt64Rules(this); - } - - /// Field number for the "const" field. - public const int ConstFieldNumber = 1; - private readonly static ulong ConstDefaultValue = 0UL; - - private ulong const_; - /// - /// Const specifies that this field must be exactly the specified value - /// - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public ulong Const { - get { if ((_hasBits0 & 1) != 0) { return const_; } else { return ConstDefaultValue; } } - set { - _hasBits0 |= 1; - const_ = value; - } - } - /// Gets whether the "const" field is set - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public bool HasConst { - get { return (_hasBits0 & 1) != 0; } - } - /// Clears the value of the "const" field - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void ClearConst() { - _hasBits0 &= ~1; - } - - /// Field number for the "lt" field. - public const int LtFieldNumber = 2; - private readonly static ulong LtDefaultValue = 0UL; - - private ulong lt_; - /// - /// Lt specifies that this field must be less than the specified value, - /// exclusive - /// - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public ulong Lt { - get { if ((_hasBits0 & 2) != 0) { return lt_; } else { return LtDefaultValue; } } - set { - _hasBits0 |= 2; - lt_ = value; - } - } - /// Gets whether the "lt" field is set - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public bool HasLt { - get { return (_hasBits0 & 2) != 0; } - } - /// Clears the value of the "lt" field - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void ClearLt() { - _hasBits0 &= ~2; - } - - /// Field number for the "lte" field. - public const int LteFieldNumber = 3; - private readonly static ulong LteDefaultValue = 0UL; - - private ulong lte_; - /// - /// Lte specifies that this field must be less than or equal to the - /// specified value, inclusive - /// - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public ulong Lte { - get { if ((_hasBits0 & 4) != 0) { return lte_; } else { return LteDefaultValue; } } - set { - _hasBits0 |= 4; - lte_ = value; - } - } - /// Gets whether the "lte" field is set - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public bool HasLte { - get { return (_hasBits0 & 4) != 0; } - } - /// Clears the value of the "lte" field - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void ClearLte() { - _hasBits0 &= ~4; - } - - /// Field number for the "gt" field. - public const int GtFieldNumber = 4; - private readonly static ulong GtDefaultValue = 0UL; - - private ulong gt_; - /// - /// Gt specifies that this field must be greater than the specified value, - /// exclusive. If the value of Gt is larger than a specified Lt or Lte, the - /// range is reversed. - /// - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public ulong Gt { - get { if ((_hasBits0 & 8) != 0) { return gt_; } else { return GtDefaultValue; } } - set { - _hasBits0 |= 8; - gt_ = value; - } - } - /// Gets whether the "gt" field is set - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public bool HasGt { - get { return (_hasBits0 & 8) != 0; } - } - /// Clears the value of the "gt" field - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void ClearGt() { - _hasBits0 &= ~8; - } - - /// Field number for the "gte" field. - public const int GteFieldNumber = 5; - private readonly static ulong GteDefaultValue = 0UL; - - private ulong gte_; - /// - /// Gte specifies that this field must be greater than or equal to the - /// specified value, inclusive. If the value of Gte is larger than a - /// specified Lt or Lte, the range is reversed. - /// - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public ulong Gte { - get { if ((_hasBits0 & 16) != 0) { return gte_; } else { return GteDefaultValue; } } - set { - _hasBits0 |= 16; - gte_ = value; - } - } - /// Gets whether the "gte" field is set - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public bool HasGte { - get { return (_hasBits0 & 16) != 0; } - } - /// Clears the value of the "gte" field - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void ClearGte() { - _hasBits0 &= ~16; - } - - /// Field number for the "in" field. - public const int InFieldNumber = 6; - private static readonly pb::FieldCodec _repeated_in_codec - = pb::FieldCodec.ForUInt64(48); - private readonly pbc::RepeatedField in_ = new pbc::RepeatedField(); - /// - /// In specifies that this field must be equal to one of the specified - /// values - /// - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public pbc::RepeatedField In { - get { return in_; } - } - - /// Field number for the "not_in" field. - public const int NotInFieldNumber = 7; - private static readonly pb::FieldCodec _repeated_notIn_codec - = pb::FieldCodec.ForUInt64(56); - private readonly pbc::RepeatedField notIn_ = new pbc::RepeatedField(); - /// - /// NotIn specifies that this field cannot be equal to one of the specified - /// values - /// - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public pbc::RepeatedField NotIn { - get { return notIn_; } - } - - /// Field number for the "ignore_empty" field. - public const int IgnoreEmptyFieldNumber = 8; - private readonly static bool IgnoreEmptyDefaultValue = false; - - private bool ignoreEmpty_; - /// - /// IgnoreEmpty specifies that the validation rules of this field should be - /// evaluated only if the field is not empty - /// - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public bool IgnoreEmpty { - get { if ((_hasBits0 & 32) != 0) { return ignoreEmpty_; } else { return IgnoreEmptyDefaultValue; } } - set { - _hasBits0 |= 32; - ignoreEmpty_ = value; - } - } - /// Gets whether the "ignore_empty" field is set - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public bool HasIgnoreEmpty { - get { return (_hasBits0 & 32) != 0; } - } - /// Clears the value of the "ignore_empty" field - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void ClearIgnoreEmpty() { - _hasBits0 &= ~32; - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public override bool Equals(object other) { - return Equals(other as UInt64Rules); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public bool Equals(UInt64Rules other) { - if (ReferenceEquals(other, null)) { - return false; - } - if (ReferenceEquals(other, this)) { - return true; - } - if (Const != other.Const) return false; - if (Lt != other.Lt) return false; - if (Lte != other.Lte) return false; - if (Gt != other.Gt) return false; - if (Gte != other.Gte) return false; - if(!in_.Equals(other.in_)) return false; - if(!notIn_.Equals(other.notIn_)) return false; - if (IgnoreEmpty != other.IgnoreEmpty) return false; - return Equals(_unknownFields, other._unknownFields); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public override int GetHashCode() { - int hash = 1; - if (HasConst) hash ^= Const.GetHashCode(); - if (HasLt) hash ^= Lt.GetHashCode(); - if (HasLte) hash ^= Lte.GetHashCode(); - if (HasGt) hash ^= Gt.GetHashCode(); - if (HasGte) hash ^= Gte.GetHashCode(); - hash ^= in_.GetHashCode(); - hash ^= notIn_.GetHashCode(); - if (HasIgnoreEmpty) hash ^= IgnoreEmpty.GetHashCode(); - if (_unknownFields != null) { - hash ^= _unknownFields.GetHashCode(); - } - return hash; - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public override string ToString() { - return pb::JsonFormatter.ToDiagnosticString(this); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void WriteTo(pb::CodedOutputStream output) { - #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE - output.WriteRawMessage(this); - #else - if (HasConst) { - output.WriteRawTag(8); - output.WriteUInt64(Const); - } - if (HasLt) { - output.WriteRawTag(16); - output.WriteUInt64(Lt); - } - if (HasLte) { - output.WriteRawTag(24); - output.WriteUInt64(Lte); - } - if (HasGt) { - output.WriteRawTag(32); - output.WriteUInt64(Gt); - } - if (HasGte) { - output.WriteRawTag(40); - output.WriteUInt64(Gte); - } - in_.WriteTo(output, _repeated_in_codec); - notIn_.WriteTo(output, _repeated_notIn_codec); - if (HasIgnoreEmpty) { - output.WriteRawTag(64); - output.WriteBool(IgnoreEmpty); - } - if (_unknownFields != null) { - _unknownFields.WriteTo(output); - } - #endif - } - - #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - void pb::IBufferMessage.InternalWriteTo(ref pb::WriteContext output) { - if (HasConst) { - output.WriteRawTag(8); - output.WriteUInt64(Const); - } - if (HasLt) { - output.WriteRawTag(16); - output.WriteUInt64(Lt); - } - if (HasLte) { - output.WriteRawTag(24); - output.WriteUInt64(Lte); - } - if (HasGt) { - output.WriteRawTag(32); - output.WriteUInt64(Gt); - } - if (HasGte) { - output.WriteRawTag(40); - output.WriteUInt64(Gte); - } - in_.WriteTo(ref output, _repeated_in_codec); - notIn_.WriteTo(ref output, _repeated_notIn_codec); - if (HasIgnoreEmpty) { - output.WriteRawTag(64); - output.WriteBool(IgnoreEmpty); - } - if (_unknownFields != null) { - _unknownFields.WriteTo(ref output); - } - } - #endif - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public int CalculateSize() { - int size = 0; - if (HasConst) { - size += 1 + pb::CodedOutputStream.ComputeUInt64Size(Const); - } - if (HasLt) { - size += 1 + pb::CodedOutputStream.ComputeUInt64Size(Lt); - } - if (HasLte) { - size += 1 + pb::CodedOutputStream.ComputeUInt64Size(Lte); - } - if (HasGt) { - size += 1 + pb::CodedOutputStream.ComputeUInt64Size(Gt); - } - if (HasGte) { - size += 1 + pb::CodedOutputStream.ComputeUInt64Size(Gte); - } - size += in_.CalculateSize(_repeated_in_codec); - size += notIn_.CalculateSize(_repeated_notIn_codec); - if (HasIgnoreEmpty) { - size += 1 + 1; - } - if (_unknownFields != null) { - size += _unknownFields.CalculateSize(); - } - return size; - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void MergeFrom(UInt64Rules other) { - if (other == null) { - return; - } - if (other.HasConst) { - Const = other.Const; - } - if (other.HasLt) { - Lt = other.Lt; - } - if (other.HasLte) { - Lte = other.Lte; - } - if (other.HasGt) { - Gt = other.Gt; - } - if (other.HasGte) { - Gte = other.Gte; - } - in_.Add(other.in_); - notIn_.Add(other.notIn_); - if (other.HasIgnoreEmpty) { - IgnoreEmpty = other.IgnoreEmpty; - } - _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void MergeFrom(pb::CodedInputStream input) { - #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE - input.ReadRawMessage(this); - #else - uint tag; - while ((tag = input.ReadTag()) != 0) { - switch(tag) { - default: - _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input); - break; - case 8: { - Const = input.ReadUInt64(); - break; - } - case 16: { - Lt = input.ReadUInt64(); - break; - } - case 24: { - Lte = input.ReadUInt64(); - break; - } - case 32: { - Gt = input.ReadUInt64(); - break; - } - case 40: { - Gte = input.ReadUInt64(); - break; - } - case 50: - case 48: { - in_.AddEntriesFrom(input, _repeated_in_codec); - break; - } - case 58: - case 56: { - notIn_.AddEntriesFrom(input, _repeated_notIn_codec); - break; - } - case 64: { - IgnoreEmpty = input.ReadBool(); - break; - } - } - } - #endif - } - - #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - void pb::IBufferMessage.InternalMergeFrom(ref pb::ParseContext input) { - uint tag; - while ((tag = input.ReadTag()) != 0) { - switch(tag) { - default: - _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, ref input); - break; - case 8: { - Const = input.ReadUInt64(); - break; - } - case 16: { - Lt = input.ReadUInt64(); - break; - } - case 24: { - Lte = input.ReadUInt64(); - break; - } - case 32: { - Gt = input.ReadUInt64(); - break; - } - case 40: { - Gte = input.ReadUInt64(); - break; - } - case 50: - case 48: { - in_.AddEntriesFrom(ref input, _repeated_in_codec); - break; - } - case 58: - case 56: { - notIn_.AddEntriesFrom(ref input, _repeated_notIn_codec); - break; - } - case 64: { - IgnoreEmpty = input.ReadBool(); - break; - } - } - } - } - #endif - - } - - /// - /// SInt32Rules describes the constraints applied to `sint32` values - /// - public sealed partial class SInt32Rules : pb::IMessage - #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE - , pb::IBufferMessage - #endif - { - private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new SInt32Rules()); - private pb::UnknownFieldSet _unknownFields; - private int _hasBits0; - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public static pb::MessageParser Parser { get { return _parser; } } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public static pbr::MessageDescriptor Descriptor { - get { return global::Validate.ValidateReflection.Descriptor.MessageTypes[7]; } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - pbr::MessageDescriptor pb::IMessage.Descriptor { - get { return Descriptor; } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public SInt32Rules() { - OnConstruction(); - } - - partial void OnConstruction(); - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public SInt32Rules(SInt32Rules other) : this() { - _hasBits0 = other._hasBits0; - const_ = other.const_; - lt_ = other.lt_; - lte_ = other.lte_; - gt_ = other.gt_; - gte_ = other.gte_; - in_ = other.in_.Clone(); - notIn_ = other.notIn_.Clone(); - ignoreEmpty_ = other.ignoreEmpty_; - _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public SInt32Rules Clone() { - return new SInt32Rules(this); - } - - /// Field number for the "const" field. - public const int ConstFieldNumber = 1; - private readonly static int ConstDefaultValue = 0; - - private int const_; - /// - /// Const specifies that this field must be exactly the specified value - /// - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public int Const { - get { if ((_hasBits0 & 1) != 0) { return const_; } else { return ConstDefaultValue; } } - set { - _hasBits0 |= 1; - const_ = value; - } - } - /// Gets whether the "const" field is set - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public bool HasConst { - get { return (_hasBits0 & 1) != 0; } - } - /// Clears the value of the "const" field - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void ClearConst() { - _hasBits0 &= ~1; - } - - /// Field number for the "lt" field. - public const int LtFieldNumber = 2; - private readonly static int LtDefaultValue = 0; - - private int lt_; - /// - /// Lt specifies that this field must be less than the specified value, - /// exclusive - /// - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public int Lt { - get { if ((_hasBits0 & 2) != 0) { return lt_; } else { return LtDefaultValue; } } - set { - _hasBits0 |= 2; - lt_ = value; - } - } - /// Gets whether the "lt" field is set - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public bool HasLt { - get { return (_hasBits0 & 2) != 0; } - } - /// Clears the value of the "lt" field - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void ClearLt() { - _hasBits0 &= ~2; - } - - /// Field number for the "lte" field. - public const int LteFieldNumber = 3; - private readonly static int LteDefaultValue = 0; - - private int lte_; - /// - /// Lte specifies that this field must be less than or equal to the - /// specified value, inclusive - /// - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public int Lte { - get { if ((_hasBits0 & 4) != 0) { return lte_; } else { return LteDefaultValue; } } - set { - _hasBits0 |= 4; - lte_ = value; - } - } - /// Gets whether the "lte" field is set - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public bool HasLte { - get { return (_hasBits0 & 4) != 0; } - } - /// Clears the value of the "lte" field - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void ClearLte() { - _hasBits0 &= ~4; - } - - /// Field number for the "gt" field. - public const int GtFieldNumber = 4; - private readonly static int GtDefaultValue = 0; - - private int gt_; - /// - /// Gt specifies that this field must be greater than the specified value, - /// exclusive. If the value of Gt is larger than a specified Lt or Lte, the - /// range is reversed. - /// - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public int Gt { - get { if ((_hasBits0 & 8) != 0) { return gt_; } else { return GtDefaultValue; } } - set { - _hasBits0 |= 8; - gt_ = value; - } - } - /// Gets whether the "gt" field is set - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public bool HasGt { - get { return (_hasBits0 & 8) != 0; } - } - /// Clears the value of the "gt" field - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void ClearGt() { - _hasBits0 &= ~8; - } - - /// Field number for the "gte" field. - public const int GteFieldNumber = 5; - private readonly static int GteDefaultValue = 0; - - private int gte_; - /// - /// Gte specifies that this field must be greater than or equal to the - /// specified value, inclusive. If the value of Gte is larger than a - /// specified Lt or Lte, the range is reversed. - /// - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public int Gte { - get { if ((_hasBits0 & 16) != 0) { return gte_; } else { return GteDefaultValue; } } - set { - _hasBits0 |= 16; - gte_ = value; - } - } - /// Gets whether the "gte" field is set - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public bool HasGte { - get { return (_hasBits0 & 16) != 0; } - } - /// Clears the value of the "gte" field - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void ClearGte() { - _hasBits0 &= ~16; - } - - /// Field number for the "in" field. - public const int InFieldNumber = 6; - private static readonly pb::FieldCodec _repeated_in_codec - = pb::FieldCodec.ForSInt32(48); - private readonly pbc::RepeatedField in_ = new pbc::RepeatedField(); - /// - /// In specifies that this field must be equal to one of the specified - /// values - /// - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public pbc::RepeatedField In { - get { return in_; } - } - - /// Field number for the "not_in" field. - public const int NotInFieldNumber = 7; - private static readonly pb::FieldCodec _repeated_notIn_codec - = pb::FieldCodec.ForSInt32(56); - private readonly pbc::RepeatedField notIn_ = new pbc::RepeatedField(); - /// - /// NotIn specifies that this field cannot be equal to one of the specified - /// values - /// - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public pbc::RepeatedField NotIn { - get { return notIn_; } - } - - /// Field number for the "ignore_empty" field. - public const int IgnoreEmptyFieldNumber = 8; - private readonly static bool IgnoreEmptyDefaultValue = false; - - private bool ignoreEmpty_; - /// - /// IgnoreEmpty specifies that the validation rules of this field should be - /// evaluated only if the field is not empty - /// - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public bool IgnoreEmpty { - get { if ((_hasBits0 & 32) != 0) { return ignoreEmpty_; } else { return IgnoreEmptyDefaultValue; } } - set { - _hasBits0 |= 32; - ignoreEmpty_ = value; - } - } - /// Gets whether the "ignore_empty" field is set - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public bool HasIgnoreEmpty { - get { return (_hasBits0 & 32) != 0; } - } - /// Clears the value of the "ignore_empty" field - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void ClearIgnoreEmpty() { - _hasBits0 &= ~32; - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public override bool Equals(object other) { - return Equals(other as SInt32Rules); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public bool Equals(SInt32Rules other) { - if (ReferenceEquals(other, null)) { - return false; - } - if (ReferenceEquals(other, this)) { - return true; - } - if (Const != other.Const) return false; - if (Lt != other.Lt) return false; - if (Lte != other.Lte) return false; - if (Gt != other.Gt) return false; - if (Gte != other.Gte) return false; - if(!in_.Equals(other.in_)) return false; - if(!notIn_.Equals(other.notIn_)) return false; - if (IgnoreEmpty != other.IgnoreEmpty) return false; - return Equals(_unknownFields, other._unknownFields); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public override int GetHashCode() { - int hash = 1; - if (HasConst) hash ^= Const.GetHashCode(); - if (HasLt) hash ^= Lt.GetHashCode(); - if (HasLte) hash ^= Lte.GetHashCode(); - if (HasGt) hash ^= Gt.GetHashCode(); - if (HasGte) hash ^= Gte.GetHashCode(); - hash ^= in_.GetHashCode(); - hash ^= notIn_.GetHashCode(); - if (HasIgnoreEmpty) hash ^= IgnoreEmpty.GetHashCode(); - if (_unknownFields != null) { - hash ^= _unknownFields.GetHashCode(); - } - return hash; - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public override string ToString() { - return pb::JsonFormatter.ToDiagnosticString(this); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void WriteTo(pb::CodedOutputStream output) { - #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE - output.WriteRawMessage(this); - #else - if (HasConst) { - output.WriteRawTag(8); - output.WriteSInt32(Const); - } - if (HasLt) { - output.WriteRawTag(16); - output.WriteSInt32(Lt); - } - if (HasLte) { - output.WriteRawTag(24); - output.WriteSInt32(Lte); - } - if (HasGt) { - output.WriteRawTag(32); - output.WriteSInt32(Gt); - } - if (HasGte) { - output.WriteRawTag(40); - output.WriteSInt32(Gte); - } - in_.WriteTo(output, _repeated_in_codec); - notIn_.WriteTo(output, _repeated_notIn_codec); - if (HasIgnoreEmpty) { - output.WriteRawTag(64); - output.WriteBool(IgnoreEmpty); - } - if (_unknownFields != null) { - _unknownFields.WriteTo(output); - } - #endif - } - - #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - void pb::IBufferMessage.InternalWriteTo(ref pb::WriteContext output) { - if (HasConst) { - output.WriteRawTag(8); - output.WriteSInt32(Const); - } - if (HasLt) { - output.WriteRawTag(16); - output.WriteSInt32(Lt); - } - if (HasLte) { - output.WriteRawTag(24); - output.WriteSInt32(Lte); - } - if (HasGt) { - output.WriteRawTag(32); - output.WriteSInt32(Gt); - } - if (HasGte) { - output.WriteRawTag(40); - output.WriteSInt32(Gte); - } - in_.WriteTo(ref output, _repeated_in_codec); - notIn_.WriteTo(ref output, _repeated_notIn_codec); - if (HasIgnoreEmpty) { - output.WriteRawTag(64); - output.WriteBool(IgnoreEmpty); - } - if (_unknownFields != null) { - _unknownFields.WriteTo(ref output); - } - } - #endif - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public int CalculateSize() { - int size = 0; - if (HasConst) { - size += 1 + pb::CodedOutputStream.ComputeSInt32Size(Const); - } - if (HasLt) { - size += 1 + pb::CodedOutputStream.ComputeSInt32Size(Lt); - } - if (HasLte) { - size += 1 + pb::CodedOutputStream.ComputeSInt32Size(Lte); - } - if (HasGt) { - size += 1 + pb::CodedOutputStream.ComputeSInt32Size(Gt); - } - if (HasGte) { - size += 1 + pb::CodedOutputStream.ComputeSInt32Size(Gte); - } - size += in_.CalculateSize(_repeated_in_codec); - size += notIn_.CalculateSize(_repeated_notIn_codec); - if (HasIgnoreEmpty) { - size += 1 + 1; - } - if (_unknownFields != null) { - size += _unknownFields.CalculateSize(); - } - return size; - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void MergeFrom(SInt32Rules other) { - if (other == null) { - return; - } - if (other.HasConst) { - Const = other.Const; - } - if (other.HasLt) { - Lt = other.Lt; - } - if (other.HasLte) { - Lte = other.Lte; - } - if (other.HasGt) { - Gt = other.Gt; - } - if (other.HasGte) { - Gte = other.Gte; - } - in_.Add(other.in_); - notIn_.Add(other.notIn_); - if (other.HasIgnoreEmpty) { - IgnoreEmpty = other.IgnoreEmpty; - } - _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void MergeFrom(pb::CodedInputStream input) { - #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE - input.ReadRawMessage(this); - #else - uint tag; - while ((tag = input.ReadTag()) != 0) { - switch(tag) { - default: - _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input); - break; - case 8: { - Const = input.ReadSInt32(); - break; - } - case 16: { - Lt = input.ReadSInt32(); - break; - } - case 24: { - Lte = input.ReadSInt32(); - break; - } - case 32: { - Gt = input.ReadSInt32(); - break; - } - case 40: { - Gte = input.ReadSInt32(); - break; - } - case 50: - case 48: { - in_.AddEntriesFrom(input, _repeated_in_codec); - break; - } - case 58: - case 56: { - notIn_.AddEntriesFrom(input, _repeated_notIn_codec); - break; - } - case 64: { - IgnoreEmpty = input.ReadBool(); - break; - } - } - } - #endif - } - - #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - void pb::IBufferMessage.InternalMergeFrom(ref pb::ParseContext input) { - uint tag; - while ((tag = input.ReadTag()) != 0) { - switch(tag) { - default: - _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, ref input); - break; - case 8: { - Const = input.ReadSInt32(); - break; - } - case 16: { - Lt = input.ReadSInt32(); - break; - } - case 24: { - Lte = input.ReadSInt32(); - break; - } - case 32: { - Gt = input.ReadSInt32(); - break; - } - case 40: { - Gte = input.ReadSInt32(); - break; - } - case 50: - case 48: { - in_.AddEntriesFrom(ref input, _repeated_in_codec); - break; - } - case 58: - case 56: { - notIn_.AddEntriesFrom(ref input, _repeated_notIn_codec); - break; - } - case 64: { - IgnoreEmpty = input.ReadBool(); - break; - } - } - } - } - #endif - - } - - /// - /// SInt64Rules describes the constraints applied to `sint64` values - /// - public sealed partial class SInt64Rules : pb::IMessage - #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE - , pb::IBufferMessage - #endif - { - private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new SInt64Rules()); - private pb::UnknownFieldSet _unknownFields; - private int _hasBits0; - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public static pb::MessageParser Parser { get { return _parser; } } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public static pbr::MessageDescriptor Descriptor { - get { return global::Validate.ValidateReflection.Descriptor.MessageTypes[8]; } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - pbr::MessageDescriptor pb::IMessage.Descriptor { - get { return Descriptor; } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public SInt64Rules() { - OnConstruction(); - } - - partial void OnConstruction(); - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public SInt64Rules(SInt64Rules other) : this() { - _hasBits0 = other._hasBits0; - const_ = other.const_; - lt_ = other.lt_; - lte_ = other.lte_; - gt_ = other.gt_; - gte_ = other.gte_; - in_ = other.in_.Clone(); - notIn_ = other.notIn_.Clone(); - ignoreEmpty_ = other.ignoreEmpty_; - _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public SInt64Rules Clone() { - return new SInt64Rules(this); - } - - /// Field number for the "const" field. - public const int ConstFieldNumber = 1; - private readonly static long ConstDefaultValue = 0L; - - private long const_; - /// - /// Const specifies that this field must be exactly the specified value - /// - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public long Const { - get { if ((_hasBits0 & 1) != 0) { return const_; } else { return ConstDefaultValue; } } - set { - _hasBits0 |= 1; - const_ = value; - } - } - /// Gets whether the "const" field is set - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public bool HasConst { - get { return (_hasBits0 & 1) != 0; } - } - /// Clears the value of the "const" field - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void ClearConst() { - _hasBits0 &= ~1; - } - - /// Field number for the "lt" field. - public const int LtFieldNumber = 2; - private readonly static long LtDefaultValue = 0L; - - private long lt_; - /// - /// Lt specifies that this field must be less than the specified value, - /// exclusive - /// - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public long Lt { - get { if ((_hasBits0 & 2) != 0) { return lt_; } else { return LtDefaultValue; } } - set { - _hasBits0 |= 2; - lt_ = value; - } - } - /// Gets whether the "lt" field is set - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public bool HasLt { - get { return (_hasBits0 & 2) != 0; } - } - /// Clears the value of the "lt" field - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void ClearLt() { - _hasBits0 &= ~2; - } - - /// Field number for the "lte" field. - public const int LteFieldNumber = 3; - private readonly static long LteDefaultValue = 0L; - - private long lte_; - /// - /// Lte specifies that this field must be less than or equal to the - /// specified value, inclusive - /// - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public long Lte { - get { if ((_hasBits0 & 4) != 0) { return lte_; } else { return LteDefaultValue; } } - set { - _hasBits0 |= 4; - lte_ = value; - } - } - /// Gets whether the "lte" field is set - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public bool HasLte { - get { return (_hasBits0 & 4) != 0; } - } - /// Clears the value of the "lte" field - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void ClearLte() { - _hasBits0 &= ~4; - } - - /// Field number for the "gt" field. - public const int GtFieldNumber = 4; - private readonly static long GtDefaultValue = 0L; - - private long gt_; - /// - /// Gt specifies that this field must be greater than the specified value, - /// exclusive. If the value of Gt is larger than a specified Lt or Lte, the - /// range is reversed. - /// - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public long Gt { - get { if ((_hasBits0 & 8) != 0) { return gt_; } else { return GtDefaultValue; } } - set { - _hasBits0 |= 8; - gt_ = value; - } - } - /// Gets whether the "gt" field is set - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public bool HasGt { - get { return (_hasBits0 & 8) != 0; } - } - /// Clears the value of the "gt" field - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void ClearGt() { - _hasBits0 &= ~8; - } - - /// Field number for the "gte" field. - public const int GteFieldNumber = 5; - private readonly static long GteDefaultValue = 0L; - - private long gte_; - /// - /// Gte specifies that this field must be greater than or equal to the - /// specified value, inclusive. If the value of Gte is larger than a - /// specified Lt or Lte, the range is reversed. - /// - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public long Gte { - get { if ((_hasBits0 & 16) != 0) { return gte_; } else { return GteDefaultValue; } } - set { - _hasBits0 |= 16; - gte_ = value; - } - } - /// Gets whether the "gte" field is set - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public bool HasGte { - get { return (_hasBits0 & 16) != 0; } - } - /// Clears the value of the "gte" field - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void ClearGte() { - _hasBits0 &= ~16; - } - - /// Field number for the "in" field. - public const int InFieldNumber = 6; - private static readonly pb::FieldCodec _repeated_in_codec - = pb::FieldCodec.ForSInt64(48); - private readonly pbc::RepeatedField in_ = new pbc::RepeatedField(); - /// - /// In specifies that this field must be equal to one of the specified - /// values - /// - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public pbc::RepeatedField In { - get { return in_; } - } - - /// Field number for the "not_in" field. - public const int NotInFieldNumber = 7; - private static readonly pb::FieldCodec _repeated_notIn_codec - = pb::FieldCodec.ForSInt64(56); - private readonly pbc::RepeatedField notIn_ = new pbc::RepeatedField(); - /// - /// NotIn specifies that this field cannot be equal to one of the specified - /// values - /// - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public pbc::RepeatedField NotIn { - get { return notIn_; } - } - - /// Field number for the "ignore_empty" field. - public const int IgnoreEmptyFieldNumber = 8; - private readonly static bool IgnoreEmptyDefaultValue = false; - - private bool ignoreEmpty_; - /// - /// IgnoreEmpty specifies that the validation rules of this field should be - /// evaluated only if the field is not empty - /// - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public bool IgnoreEmpty { - get { if ((_hasBits0 & 32) != 0) { return ignoreEmpty_; } else { return IgnoreEmptyDefaultValue; } } - set { - _hasBits0 |= 32; - ignoreEmpty_ = value; - } - } - /// Gets whether the "ignore_empty" field is set - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public bool HasIgnoreEmpty { - get { return (_hasBits0 & 32) != 0; } - } - /// Clears the value of the "ignore_empty" field - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void ClearIgnoreEmpty() { - _hasBits0 &= ~32; - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public override bool Equals(object other) { - return Equals(other as SInt64Rules); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public bool Equals(SInt64Rules other) { - if (ReferenceEquals(other, null)) { - return false; - } - if (ReferenceEquals(other, this)) { - return true; - } - if (Const != other.Const) return false; - if (Lt != other.Lt) return false; - if (Lte != other.Lte) return false; - if (Gt != other.Gt) return false; - if (Gte != other.Gte) return false; - if(!in_.Equals(other.in_)) return false; - if(!notIn_.Equals(other.notIn_)) return false; - if (IgnoreEmpty != other.IgnoreEmpty) return false; - return Equals(_unknownFields, other._unknownFields); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public override int GetHashCode() { - int hash = 1; - if (HasConst) hash ^= Const.GetHashCode(); - if (HasLt) hash ^= Lt.GetHashCode(); - if (HasLte) hash ^= Lte.GetHashCode(); - if (HasGt) hash ^= Gt.GetHashCode(); - if (HasGte) hash ^= Gte.GetHashCode(); - hash ^= in_.GetHashCode(); - hash ^= notIn_.GetHashCode(); - if (HasIgnoreEmpty) hash ^= IgnoreEmpty.GetHashCode(); - if (_unknownFields != null) { - hash ^= _unknownFields.GetHashCode(); - } - return hash; - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public override string ToString() { - return pb::JsonFormatter.ToDiagnosticString(this); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void WriteTo(pb::CodedOutputStream output) { - #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE - output.WriteRawMessage(this); - #else - if (HasConst) { - output.WriteRawTag(8); - output.WriteSInt64(Const); - } - if (HasLt) { - output.WriteRawTag(16); - output.WriteSInt64(Lt); - } - if (HasLte) { - output.WriteRawTag(24); - output.WriteSInt64(Lte); - } - if (HasGt) { - output.WriteRawTag(32); - output.WriteSInt64(Gt); - } - if (HasGte) { - output.WriteRawTag(40); - output.WriteSInt64(Gte); - } - in_.WriteTo(output, _repeated_in_codec); - notIn_.WriteTo(output, _repeated_notIn_codec); - if (HasIgnoreEmpty) { - output.WriteRawTag(64); - output.WriteBool(IgnoreEmpty); - } - if (_unknownFields != null) { - _unknownFields.WriteTo(output); - } - #endif - } - - #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - void pb::IBufferMessage.InternalWriteTo(ref pb::WriteContext output) { - if (HasConst) { - output.WriteRawTag(8); - output.WriteSInt64(Const); - } - if (HasLt) { - output.WriteRawTag(16); - output.WriteSInt64(Lt); - } - if (HasLte) { - output.WriteRawTag(24); - output.WriteSInt64(Lte); - } - if (HasGt) { - output.WriteRawTag(32); - output.WriteSInt64(Gt); - } - if (HasGte) { - output.WriteRawTag(40); - output.WriteSInt64(Gte); - } - in_.WriteTo(ref output, _repeated_in_codec); - notIn_.WriteTo(ref output, _repeated_notIn_codec); - if (HasIgnoreEmpty) { - output.WriteRawTag(64); - output.WriteBool(IgnoreEmpty); - } - if (_unknownFields != null) { - _unknownFields.WriteTo(ref output); - } - } - #endif - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public int CalculateSize() { - int size = 0; - if (HasConst) { - size += 1 + pb::CodedOutputStream.ComputeSInt64Size(Const); - } - if (HasLt) { - size += 1 + pb::CodedOutputStream.ComputeSInt64Size(Lt); - } - if (HasLte) { - size += 1 + pb::CodedOutputStream.ComputeSInt64Size(Lte); - } - if (HasGt) { - size += 1 + pb::CodedOutputStream.ComputeSInt64Size(Gt); - } - if (HasGte) { - size += 1 + pb::CodedOutputStream.ComputeSInt64Size(Gte); - } - size += in_.CalculateSize(_repeated_in_codec); - size += notIn_.CalculateSize(_repeated_notIn_codec); - if (HasIgnoreEmpty) { - size += 1 + 1; - } - if (_unknownFields != null) { - size += _unknownFields.CalculateSize(); - } - return size; - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void MergeFrom(SInt64Rules other) { - if (other == null) { - return; - } - if (other.HasConst) { - Const = other.Const; - } - if (other.HasLt) { - Lt = other.Lt; - } - if (other.HasLte) { - Lte = other.Lte; - } - if (other.HasGt) { - Gt = other.Gt; - } - if (other.HasGte) { - Gte = other.Gte; - } - in_.Add(other.in_); - notIn_.Add(other.notIn_); - if (other.HasIgnoreEmpty) { - IgnoreEmpty = other.IgnoreEmpty; - } - _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void MergeFrom(pb::CodedInputStream input) { - #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE - input.ReadRawMessage(this); - #else - uint tag; - while ((tag = input.ReadTag()) != 0) { - switch(tag) { - default: - _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input); - break; - case 8: { - Const = input.ReadSInt64(); - break; - } - case 16: { - Lt = input.ReadSInt64(); - break; - } - case 24: { - Lte = input.ReadSInt64(); - break; - } - case 32: { - Gt = input.ReadSInt64(); - break; - } - case 40: { - Gte = input.ReadSInt64(); - break; - } - case 50: - case 48: { - in_.AddEntriesFrom(input, _repeated_in_codec); - break; - } - case 58: - case 56: { - notIn_.AddEntriesFrom(input, _repeated_notIn_codec); - break; - } - case 64: { - IgnoreEmpty = input.ReadBool(); - break; - } - } - } - #endif - } - - #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - void pb::IBufferMessage.InternalMergeFrom(ref pb::ParseContext input) { - uint tag; - while ((tag = input.ReadTag()) != 0) { - switch(tag) { - default: - _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, ref input); - break; - case 8: { - Const = input.ReadSInt64(); - break; - } - case 16: { - Lt = input.ReadSInt64(); - break; - } - case 24: { - Lte = input.ReadSInt64(); - break; - } - case 32: { - Gt = input.ReadSInt64(); - break; - } - case 40: { - Gte = input.ReadSInt64(); - break; - } - case 50: - case 48: { - in_.AddEntriesFrom(ref input, _repeated_in_codec); - break; - } - case 58: - case 56: { - notIn_.AddEntriesFrom(ref input, _repeated_notIn_codec); - break; - } - case 64: { - IgnoreEmpty = input.ReadBool(); - break; - } - } - } - } - #endif - - } - - /// - /// Fixed32Rules describes the constraints applied to `fixed32` values - /// - public sealed partial class Fixed32Rules : pb::IMessage - #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE - , pb::IBufferMessage - #endif - { - private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new Fixed32Rules()); - private pb::UnknownFieldSet _unknownFields; - private int _hasBits0; - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public static pb::MessageParser Parser { get { return _parser; } } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public static pbr::MessageDescriptor Descriptor { - get { return global::Validate.ValidateReflection.Descriptor.MessageTypes[9]; } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - pbr::MessageDescriptor pb::IMessage.Descriptor { - get { return Descriptor; } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public Fixed32Rules() { - OnConstruction(); - } - - partial void OnConstruction(); - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public Fixed32Rules(Fixed32Rules other) : this() { - _hasBits0 = other._hasBits0; - const_ = other.const_; - lt_ = other.lt_; - lte_ = other.lte_; - gt_ = other.gt_; - gte_ = other.gte_; - in_ = other.in_.Clone(); - notIn_ = other.notIn_.Clone(); - ignoreEmpty_ = other.ignoreEmpty_; - _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public Fixed32Rules Clone() { - return new Fixed32Rules(this); - } - - /// Field number for the "const" field. - public const int ConstFieldNumber = 1; - private readonly static uint ConstDefaultValue = 0; - - private uint const_; - /// - /// Const specifies that this field must be exactly the specified value - /// - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public uint Const { - get { if ((_hasBits0 & 1) != 0) { return const_; } else { return ConstDefaultValue; } } - set { - _hasBits0 |= 1; - const_ = value; - } - } - /// Gets whether the "const" field is set - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public bool HasConst { - get { return (_hasBits0 & 1) != 0; } - } - /// Clears the value of the "const" field - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void ClearConst() { - _hasBits0 &= ~1; - } - - /// Field number for the "lt" field. - public const int LtFieldNumber = 2; - private readonly static uint LtDefaultValue = 0; - - private uint lt_; - /// - /// Lt specifies that this field must be less than the specified value, - /// exclusive - /// - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public uint Lt { - get { if ((_hasBits0 & 2) != 0) { return lt_; } else { return LtDefaultValue; } } - set { - _hasBits0 |= 2; - lt_ = value; - } - } - /// Gets whether the "lt" field is set - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public bool HasLt { - get { return (_hasBits0 & 2) != 0; } - } - /// Clears the value of the "lt" field - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void ClearLt() { - _hasBits0 &= ~2; - } - - /// Field number for the "lte" field. - public const int LteFieldNumber = 3; - private readonly static uint LteDefaultValue = 0; - - private uint lte_; - /// - /// Lte specifies that this field must be less than or equal to the - /// specified value, inclusive - /// - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public uint Lte { - get { if ((_hasBits0 & 4) != 0) { return lte_; } else { return LteDefaultValue; } } - set { - _hasBits0 |= 4; - lte_ = value; - } - } - /// Gets whether the "lte" field is set - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public bool HasLte { - get { return (_hasBits0 & 4) != 0; } - } - /// Clears the value of the "lte" field - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void ClearLte() { - _hasBits0 &= ~4; - } - - /// Field number for the "gt" field. - public const int GtFieldNumber = 4; - private readonly static uint GtDefaultValue = 0; - - private uint gt_; - /// - /// Gt specifies that this field must be greater than the specified value, - /// exclusive. If the value of Gt is larger than a specified Lt or Lte, the - /// range is reversed. - /// - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public uint Gt { - get { if ((_hasBits0 & 8) != 0) { return gt_; } else { return GtDefaultValue; } } - set { - _hasBits0 |= 8; - gt_ = value; - } - } - /// Gets whether the "gt" field is set - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public bool HasGt { - get { return (_hasBits0 & 8) != 0; } - } - /// Clears the value of the "gt" field - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void ClearGt() { - _hasBits0 &= ~8; - } - - /// Field number for the "gte" field. - public const int GteFieldNumber = 5; - private readonly static uint GteDefaultValue = 0; - - private uint gte_; - /// - /// Gte specifies that this field must be greater than or equal to the - /// specified value, inclusive. If the value of Gte is larger than a - /// specified Lt or Lte, the range is reversed. - /// - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public uint Gte { - get { if ((_hasBits0 & 16) != 0) { return gte_; } else { return GteDefaultValue; } } - set { - _hasBits0 |= 16; - gte_ = value; - } - } - /// Gets whether the "gte" field is set - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public bool HasGte { - get { return (_hasBits0 & 16) != 0; } - } - /// Clears the value of the "gte" field - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void ClearGte() { - _hasBits0 &= ~16; - } - - /// Field number for the "in" field. - public const int InFieldNumber = 6; - private static readonly pb::FieldCodec _repeated_in_codec - = pb::FieldCodec.ForFixed32(53); - private readonly pbc::RepeatedField in_ = new pbc::RepeatedField(); - /// - /// In specifies that this field must be equal to one of the specified - /// values - /// - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public pbc::RepeatedField In { - get { return in_; } - } - - /// Field number for the "not_in" field. - public const int NotInFieldNumber = 7; - private static readonly pb::FieldCodec _repeated_notIn_codec - = pb::FieldCodec.ForFixed32(61); - private readonly pbc::RepeatedField notIn_ = new pbc::RepeatedField(); - /// - /// NotIn specifies that this field cannot be equal to one of the specified - /// values - /// - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public pbc::RepeatedField NotIn { - get { return notIn_; } - } - - /// Field number for the "ignore_empty" field. - public const int IgnoreEmptyFieldNumber = 8; - private readonly static bool IgnoreEmptyDefaultValue = false; - - private bool ignoreEmpty_; - /// - /// IgnoreEmpty specifies that the validation rules of this field should be - /// evaluated only if the field is not empty - /// - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public bool IgnoreEmpty { - get { if ((_hasBits0 & 32) != 0) { return ignoreEmpty_; } else { return IgnoreEmptyDefaultValue; } } - set { - _hasBits0 |= 32; - ignoreEmpty_ = value; - } - } - /// Gets whether the "ignore_empty" field is set - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public bool HasIgnoreEmpty { - get { return (_hasBits0 & 32) != 0; } - } - /// Clears the value of the "ignore_empty" field - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void ClearIgnoreEmpty() { - _hasBits0 &= ~32; - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public override bool Equals(object other) { - return Equals(other as Fixed32Rules); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public bool Equals(Fixed32Rules other) { - if (ReferenceEquals(other, null)) { - return false; - } - if (ReferenceEquals(other, this)) { - return true; - } - if (Const != other.Const) return false; - if (Lt != other.Lt) return false; - if (Lte != other.Lte) return false; - if (Gt != other.Gt) return false; - if (Gte != other.Gte) return false; - if(!in_.Equals(other.in_)) return false; - if(!notIn_.Equals(other.notIn_)) return false; - if (IgnoreEmpty != other.IgnoreEmpty) return false; - return Equals(_unknownFields, other._unknownFields); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public override int GetHashCode() { - int hash = 1; - if (HasConst) hash ^= Const.GetHashCode(); - if (HasLt) hash ^= Lt.GetHashCode(); - if (HasLte) hash ^= Lte.GetHashCode(); - if (HasGt) hash ^= Gt.GetHashCode(); - if (HasGte) hash ^= Gte.GetHashCode(); - hash ^= in_.GetHashCode(); - hash ^= notIn_.GetHashCode(); - if (HasIgnoreEmpty) hash ^= IgnoreEmpty.GetHashCode(); - if (_unknownFields != null) { - hash ^= _unknownFields.GetHashCode(); - } - return hash; - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public override string ToString() { - return pb::JsonFormatter.ToDiagnosticString(this); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void WriteTo(pb::CodedOutputStream output) { - #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE - output.WriteRawMessage(this); - #else - if (HasConst) { - output.WriteRawTag(13); - output.WriteFixed32(Const); - } - if (HasLt) { - output.WriteRawTag(21); - output.WriteFixed32(Lt); - } - if (HasLte) { - output.WriteRawTag(29); - output.WriteFixed32(Lte); - } - if (HasGt) { - output.WriteRawTag(37); - output.WriteFixed32(Gt); - } - if (HasGte) { - output.WriteRawTag(45); - output.WriteFixed32(Gte); - } - in_.WriteTo(output, _repeated_in_codec); - notIn_.WriteTo(output, _repeated_notIn_codec); - if (HasIgnoreEmpty) { - output.WriteRawTag(64); - output.WriteBool(IgnoreEmpty); - } - if (_unknownFields != null) { - _unknownFields.WriteTo(output); - } - #endif - } - - #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - void pb::IBufferMessage.InternalWriteTo(ref pb::WriteContext output) { - if (HasConst) { - output.WriteRawTag(13); - output.WriteFixed32(Const); - } - if (HasLt) { - output.WriteRawTag(21); - output.WriteFixed32(Lt); - } - if (HasLte) { - output.WriteRawTag(29); - output.WriteFixed32(Lte); - } - if (HasGt) { - output.WriteRawTag(37); - output.WriteFixed32(Gt); - } - if (HasGte) { - output.WriteRawTag(45); - output.WriteFixed32(Gte); - } - in_.WriteTo(ref output, _repeated_in_codec); - notIn_.WriteTo(ref output, _repeated_notIn_codec); - if (HasIgnoreEmpty) { - output.WriteRawTag(64); - output.WriteBool(IgnoreEmpty); - } - if (_unknownFields != null) { - _unknownFields.WriteTo(ref output); - } - } - #endif - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public int CalculateSize() { - int size = 0; - if (HasConst) { - size += 1 + 4; - } - if (HasLt) { - size += 1 + 4; - } - if (HasLte) { - size += 1 + 4; - } - if (HasGt) { - size += 1 + 4; - } - if (HasGte) { - size += 1 + 4; - } - size += in_.CalculateSize(_repeated_in_codec); - size += notIn_.CalculateSize(_repeated_notIn_codec); - if (HasIgnoreEmpty) { - size += 1 + 1; - } - if (_unknownFields != null) { - size += _unknownFields.CalculateSize(); - } - return size; - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void MergeFrom(Fixed32Rules other) { - if (other == null) { - return; - } - if (other.HasConst) { - Const = other.Const; - } - if (other.HasLt) { - Lt = other.Lt; - } - if (other.HasLte) { - Lte = other.Lte; - } - if (other.HasGt) { - Gt = other.Gt; - } - if (other.HasGte) { - Gte = other.Gte; - } - in_.Add(other.in_); - notIn_.Add(other.notIn_); - if (other.HasIgnoreEmpty) { - IgnoreEmpty = other.IgnoreEmpty; - } - _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void MergeFrom(pb::CodedInputStream input) { - #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE - input.ReadRawMessage(this); - #else - uint tag; - while ((tag = input.ReadTag()) != 0) { - switch(tag) { - default: - _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input); - break; - case 13: { - Const = input.ReadFixed32(); - break; - } - case 21: { - Lt = input.ReadFixed32(); - break; - } - case 29: { - Lte = input.ReadFixed32(); - break; - } - case 37: { - Gt = input.ReadFixed32(); - break; - } - case 45: { - Gte = input.ReadFixed32(); - break; - } - case 50: - case 53: { - in_.AddEntriesFrom(input, _repeated_in_codec); - break; - } - case 58: - case 61: { - notIn_.AddEntriesFrom(input, _repeated_notIn_codec); - break; - } - case 64: { - IgnoreEmpty = input.ReadBool(); - break; - } - } - } - #endif - } - - #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - void pb::IBufferMessage.InternalMergeFrom(ref pb::ParseContext input) { - uint tag; - while ((tag = input.ReadTag()) != 0) { - switch(tag) { - default: - _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, ref input); - break; - case 13: { - Const = input.ReadFixed32(); - break; - } - case 21: { - Lt = input.ReadFixed32(); - break; - } - case 29: { - Lte = input.ReadFixed32(); - break; - } - case 37: { - Gt = input.ReadFixed32(); - break; - } - case 45: { - Gte = input.ReadFixed32(); - break; - } - case 50: - case 53: { - in_.AddEntriesFrom(ref input, _repeated_in_codec); - break; - } - case 58: - case 61: { - notIn_.AddEntriesFrom(ref input, _repeated_notIn_codec); - break; - } - case 64: { - IgnoreEmpty = input.ReadBool(); - break; - } - } - } - } - #endif - - } - - /// - /// Fixed64Rules describes the constraints applied to `fixed64` values - /// - public sealed partial class Fixed64Rules : pb::IMessage - #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE - , pb::IBufferMessage - #endif - { - private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new Fixed64Rules()); - private pb::UnknownFieldSet _unknownFields; - private int _hasBits0; - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public static pb::MessageParser Parser { get { return _parser; } } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public static pbr::MessageDescriptor Descriptor { - get { return global::Validate.ValidateReflection.Descriptor.MessageTypes[10]; } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - pbr::MessageDescriptor pb::IMessage.Descriptor { - get { return Descriptor; } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public Fixed64Rules() { - OnConstruction(); - } - - partial void OnConstruction(); - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public Fixed64Rules(Fixed64Rules other) : this() { - _hasBits0 = other._hasBits0; - const_ = other.const_; - lt_ = other.lt_; - lte_ = other.lte_; - gt_ = other.gt_; - gte_ = other.gte_; - in_ = other.in_.Clone(); - notIn_ = other.notIn_.Clone(); - ignoreEmpty_ = other.ignoreEmpty_; - _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public Fixed64Rules Clone() { - return new Fixed64Rules(this); - } - - /// Field number for the "const" field. - public const int ConstFieldNumber = 1; - private readonly static ulong ConstDefaultValue = 0UL; - - private ulong const_; - /// - /// Const specifies that this field must be exactly the specified value - /// - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public ulong Const { - get { if ((_hasBits0 & 1) != 0) { return const_; } else { return ConstDefaultValue; } } - set { - _hasBits0 |= 1; - const_ = value; - } - } - /// Gets whether the "const" field is set - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public bool HasConst { - get { return (_hasBits0 & 1) != 0; } - } - /// Clears the value of the "const" field - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void ClearConst() { - _hasBits0 &= ~1; - } - - /// Field number for the "lt" field. - public const int LtFieldNumber = 2; - private readonly static ulong LtDefaultValue = 0UL; - - private ulong lt_; - /// - /// Lt specifies that this field must be less than the specified value, - /// exclusive - /// - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public ulong Lt { - get { if ((_hasBits0 & 2) != 0) { return lt_; } else { return LtDefaultValue; } } - set { - _hasBits0 |= 2; - lt_ = value; - } - } - /// Gets whether the "lt" field is set - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public bool HasLt { - get { return (_hasBits0 & 2) != 0; } - } - /// Clears the value of the "lt" field - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void ClearLt() { - _hasBits0 &= ~2; - } - - /// Field number for the "lte" field. - public const int LteFieldNumber = 3; - private readonly static ulong LteDefaultValue = 0UL; - - private ulong lte_; - /// - /// Lte specifies that this field must be less than or equal to the - /// specified value, inclusive - /// - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public ulong Lte { - get { if ((_hasBits0 & 4) != 0) { return lte_; } else { return LteDefaultValue; } } - set { - _hasBits0 |= 4; - lte_ = value; - } - } - /// Gets whether the "lte" field is set - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public bool HasLte { - get { return (_hasBits0 & 4) != 0; } - } - /// Clears the value of the "lte" field - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void ClearLte() { - _hasBits0 &= ~4; - } - - /// Field number for the "gt" field. - public const int GtFieldNumber = 4; - private readonly static ulong GtDefaultValue = 0UL; - - private ulong gt_; - /// - /// Gt specifies that this field must be greater than the specified value, - /// exclusive. If the value of Gt is larger than a specified Lt or Lte, the - /// range is reversed. - /// - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public ulong Gt { - get { if ((_hasBits0 & 8) != 0) { return gt_; } else { return GtDefaultValue; } } - set { - _hasBits0 |= 8; - gt_ = value; - } - } - /// Gets whether the "gt" field is set - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public bool HasGt { - get { return (_hasBits0 & 8) != 0; } - } - /// Clears the value of the "gt" field - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void ClearGt() { - _hasBits0 &= ~8; - } - - /// Field number for the "gte" field. - public const int GteFieldNumber = 5; - private readonly static ulong GteDefaultValue = 0UL; - - private ulong gte_; - /// - /// Gte specifies that this field must be greater than or equal to the - /// specified value, inclusive. If the value of Gte is larger than a - /// specified Lt or Lte, the range is reversed. - /// - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public ulong Gte { - get { if ((_hasBits0 & 16) != 0) { return gte_; } else { return GteDefaultValue; } } - set { - _hasBits0 |= 16; - gte_ = value; - } - } - /// Gets whether the "gte" field is set - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public bool HasGte { - get { return (_hasBits0 & 16) != 0; } - } - /// Clears the value of the "gte" field - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void ClearGte() { - _hasBits0 &= ~16; - } - - /// Field number for the "in" field. - public const int InFieldNumber = 6; - private static readonly pb::FieldCodec _repeated_in_codec - = pb::FieldCodec.ForFixed64(49); - private readonly pbc::RepeatedField in_ = new pbc::RepeatedField(); - /// - /// In specifies that this field must be equal to one of the specified - /// values - /// - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public pbc::RepeatedField In { - get { return in_; } - } - - /// Field number for the "not_in" field. - public const int NotInFieldNumber = 7; - private static readonly pb::FieldCodec _repeated_notIn_codec - = pb::FieldCodec.ForFixed64(57); - private readonly pbc::RepeatedField notIn_ = new pbc::RepeatedField(); - /// - /// NotIn specifies that this field cannot be equal to one of the specified - /// values - /// - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public pbc::RepeatedField NotIn { - get { return notIn_; } - } - - /// Field number for the "ignore_empty" field. - public const int IgnoreEmptyFieldNumber = 8; - private readonly static bool IgnoreEmptyDefaultValue = false; - - private bool ignoreEmpty_; - /// - /// IgnoreEmpty specifies that the validation rules of this field should be - /// evaluated only if the field is not empty - /// - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public bool IgnoreEmpty { - get { if ((_hasBits0 & 32) != 0) { return ignoreEmpty_; } else { return IgnoreEmptyDefaultValue; } } - set { - _hasBits0 |= 32; - ignoreEmpty_ = value; - } - } - /// Gets whether the "ignore_empty" field is set - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public bool HasIgnoreEmpty { - get { return (_hasBits0 & 32) != 0; } - } - /// Clears the value of the "ignore_empty" field - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void ClearIgnoreEmpty() { - _hasBits0 &= ~32; - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public override bool Equals(object other) { - return Equals(other as Fixed64Rules); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public bool Equals(Fixed64Rules other) { - if (ReferenceEquals(other, null)) { - return false; - } - if (ReferenceEquals(other, this)) { - return true; - } - if (Const != other.Const) return false; - if (Lt != other.Lt) return false; - if (Lte != other.Lte) return false; - if (Gt != other.Gt) return false; - if (Gte != other.Gte) return false; - if(!in_.Equals(other.in_)) return false; - if(!notIn_.Equals(other.notIn_)) return false; - if (IgnoreEmpty != other.IgnoreEmpty) return false; - return Equals(_unknownFields, other._unknownFields); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public override int GetHashCode() { - int hash = 1; - if (HasConst) hash ^= Const.GetHashCode(); - if (HasLt) hash ^= Lt.GetHashCode(); - if (HasLte) hash ^= Lte.GetHashCode(); - if (HasGt) hash ^= Gt.GetHashCode(); - if (HasGte) hash ^= Gte.GetHashCode(); - hash ^= in_.GetHashCode(); - hash ^= notIn_.GetHashCode(); - if (HasIgnoreEmpty) hash ^= IgnoreEmpty.GetHashCode(); - if (_unknownFields != null) { - hash ^= _unknownFields.GetHashCode(); - } - return hash; - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public override string ToString() { - return pb::JsonFormatter.ToDiagnosticString(this); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void WriteTo(pb::CodedOutputStream output) { - #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE - output.WriteRawMessage(this); - #else - if (HasConst) { - output.WriteRawTag(9); - output.WriteFixed64(Const); - } - if (HasLt) { - output.WriteRawTag(17); - output.WriteFixed64(Lt); - } - if (HasLte) { - output.WriteRawTag(25); - output.WriteFixed64(Lte); - } - if (HasGt) { - output.WriteRawTag(33); - output.WriteFixed64(Gt); - } - if (HasGte) { - output.WriteRawTag(41); - output.WriteFixed64(Gte); - } - in_.WriteTo(output, _repeated_in_codec); - notIn_.WriteTo(output, _repeated_notIn_codec); - if (HasIgnoreEmpty) { - output.WriteRawTag(64); - output.WriteBool(IgnoreEmpty); - } - if (_unknownFields != null) { - _unknownFields.WriteTo(output); - } - #endif - } - - #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - void pb::IBufferMessage.InternalWriteTo(ref pb::WriteContext output) { - if (HasConst) { - output.WriteRawTag(9); - output.WriteFixed64(Const); - } - if (HasLt) { - output.WriteRawTag(17); - output.WriteFixed64(Lt); - } - if (HasLte) { - output.WriteRawTag(25); - output.WriteFixed64(Lte); - } - if (HasGt) { - output.WriteRawTag(33); - output.WriteFixed64(Gt); - } - if (HasGte) { - output.WriteRawTag(41); - output.WriteFixed64(Gte); - } - in_.WriteTo(ref output, _repeated_in_codec); - notIn_.WriteTo(ref output, _repeated_notIn_codec); - if (HasIgnoreEmpty) { - output.WriteRawTag(64); - output.WriteBool(IgnoreEmpty); - } - if (_unknownFields != null) { - _unknownFields.WriteTo(ref output); - } - } - #endif - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public int CalculateSize() { - int size = 0; - if (HasConst) { - size += 1 + 8; - } - if (HasLt) { - size += 1 + 8; - } - if (HasLte) { - size += 1 + 8; - } - if (HasGt) { - size += 1 + 8; - } - if (HasGte) { - size += 1 + 8; - } - size += in_.CalculateSize(_repeated_in_codec); - size += notIn_.CalculateSize(_repeated_notIn_codec); - if (HasIgnoreEmpty) { - size += 1 + 1; - } - if (_unknownFields != null) { - size += _unknownFields.CalculateSize(); - } - return size; - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void MergeFrom(Fixed64Rules other) { - if (other == null) { - return; - } - if (other.HasConst) { - Const = other.Const; - } - if (other.HasLt) { - Lt = other.Lt; - } - if (other.HasLte) { - Lte = other.Lte; - } - if (other.HasGt) { - Gt = other.Gt; - } - if (other.HasGte) { - Gte = other.Gte; - } - in_.Add(other.in_); - notIn_.Add(other.notIn_); - if (other.HasIgnoreEmpty) { - IgnoreEmpty = other.IgnoreEmpty; - } - _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void MergeFrom(pb::CodedInputStream input) { - #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE - input.ReadRawMessage(this); - #else - uint tag; - while ((tag = input.ReadTag()) != 0) { - switch(tag) { - default: - _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input); - break; - case 9: { - Const = input.ReadFixed64(); - break; - } - case 17: { - Lt = input.ReadFixed64(); - break; - } - case 25: { - Lte = input.ReadFixed64(); - break; - } - case 33: { - Gt = input.ReadFixed64(); - break; - } - case 41: { - Gte = input.ReadFixed64(); - break; - } - case 50: - case 49: { - in_.AddEntriesFrom(input, _repeated_in_codec); - break; - } - case 58: - case 57: { - notIn_.AddEntriesFrom(input, _repeated_notIn_codec); - break; - } - case 64: { - IgnoreEmpty = input.ReadBool(); - break; - } - } - } - #endif - } - - #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - void pb::IBufferMessage.InternalMergeFrom(ref pb::ParseContext input) { - uint tag; - while ((tag = input.ReadTag()) != 0) { - switch(tag) { - default: - _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, ref input); - break; - case 9: { - Const = input.ReadFixed64(); - break; - } - case 17: { - Lt = input.ReadFixed64(); - break; - } - case 25: { - Lte = input.ReadFixed64(); - break; - } - case 33: { - Gt = input.ReadFixed64(); - break; - } - case 41: { - Gte = input.ReadFixed64(); - break; - } - case 50: - case 49: { - in_.AddEntriesFrom(ref input, _repeated_in_codec); - break; - } - case 58: - case 57: { - notIn_.AddEntriesFrom(ref input, _repeated_notIn_codec); - break; - } - case 64: { - IgnoreEmpty = input.ReadBool(); - break; - } - } - } - } - #endif - - } - - /// - /// SFixed32Rules describes the constraints applied to `sfixed32` values - /// - public sealed partial class SFixed32Rules : pb::IMessage - #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE - , pb::IBufferMessage - #endif - { - private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new SFixed32Rules()); - private pb::UnknownFieldSet _unknownFields; - private int _hasBits0; - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public static pb::MessageParser Parser { get { return _parser; } } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public static pbr::MessageDescriptor Descriptor { - get { return global::Validate.ValidateReflection.Descriptor.MessageTypes[11]; } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - pbr::MessageDescriptor pb::IMessage.Descriptor { - get { return Descriptor; } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public SFixed32Rules() { - OnConstruction(); - } - - partial void OnConstruction(); - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public SFixed32Rules(SFixed32Rules other) : this() { - _hasBits0 = other._hasBits0; - const_ = other.const_; - lt_ = other.lt_; - lte_ = other.lte_; - gt_ = other.gt_; - gte_ = other.gte_; - in_ = other.in_.Clone(); - notIn_ = other.notIn_.Clone(); - ignoreEmpty_ = other.ignoreEmpty_; - _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public SFixed32Rules Clone() { - return new SFixed32Rules(this); - } - - /// Field number for the "const" field. - public const int ConstFieldNumber = 1; - private readonly static int ConstDefaultValue = 0; - - private int const_; - /// - /// Const specifies that this field must be exactly the specified value - /// - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public int Const { - get { if ((_hasBits0 & 1) != 0) { return const_; } else { return ConstDefaultValue; } } - set { - _hasBits0 |= 1; - const_ = value; - } - } - /// Gets whether the "const" field is set - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public bool HasConst { - get { return (_hasBits0 & 1) != 0; } - } - /// Clears the value of the "const" field - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void ClearConst() { - _hasBits0 &= ~1; - } - - /// Field number for the "lt" field. - public const int LtFieldNumber = 2; - private readonly static int LtDefaultValue = 0; - - private int lt_; - /// - /// Lt specifies that this field must be less than the specified value, - /// exclusive - /// - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public int Lt { - get { if ((_hasBits0 & 2) != 0) { return lt_; } else { return LtDefaultValue; } } - set { - _hasBits0 |= 2; - lt_ = value; - } - } - /// Gets whether the "lt" field is set - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public bool HasLt { - get { return (_hasBits0 & 2) != 0; } - } - /// Clears the value of the "lt" field - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void ClearLt() { - _hasBits0 &= ~2; - } - - /// Field number for the "lte" field. - public const int LteFieldNumber = 3; - private readonly static int LteDefaultValue = 0; - - private int lte_; - /// - /// Lte specifies that this field must be less than or equal to the - /// specified value, inclusive - /// - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public int Lte { - get { if ((_hasBits0 & 4) != 0) { return lte_; } else { return LteDefaultValue; } } - set { - _hasBits0 |= 4; - lte_ = value; - } - } - /// Gets whether the "lte" field is set - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public bool HasLte { - get { return (_hasBits0 & 4) != 0; } - } - /// Clears the value of the "lte" field - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void ClearLte() { - _hasBits0 &= ~4; - } - - /// Field number for the "gt" field. - public const int GtFieldNumber = 4; - private readonly static int GtDefaultValue = 0; - - private int gt_; - /// - /// Gt specifies that this field must be greater than the specified value, - /// exclusive. If the value of Gt is larger than a specified Lt or Lte, the - /// range is reversed. - /// - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public int Gt { - get { if ((_hasBits0 & 8) != 0) { return gt_; } else { return GtDefaultValue; } } - set { - _hasBits0 |= 8; - gt_ = value; - } - } - /// Gets whether the "gt" field is set - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public bool HasGt { - get { return (_hasBits0 & 8) != 0; } - } - /// Clears the value of the "gt" field - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void ClearGt() { - _hasBits0 &= ~8; - } - - /// Field number for the "gte" field. - public const int GteFieldNumber = 5; - private readonly static int GteDefaultValue = 0; - - private int gte_; - /// - /// Gte specifies that this field must be greater than or equal to the - /// specified value, inclusive. If the value of Gte is larger than a - /// specified Lt or Lte, the range is reversed. - /// - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public int Gte { - get { if ((_hasBits0 & 16) != 0) { return gte_; } else { return GteDefaultValue; } } - set { - _hasBits0 |= 16; - gte_ = value; - } - } - /// Gets whether the "gte" field is set - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public bool HasGte { - get { return (_hasBits0 & 16) != 0; } - } - /// Clears the value of the "gte" field - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void ClearGte() { - _hasBits0 &= ~16; - } - - /// Field number for the "in" field. - public const int InFieldNumber = 6; - private static readonly pb::FieldCodec _repeated_in_codec - = pb::FieldCodec.ForSFixed32(53); - private readonly pbc::RepeatedField in_ = new pbc::RepeatedField(); - /// - /// In specifies that this field must be equal to one of the specified - /// values - /// - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public pbc::RepeatedField In { - get { return in_; } - } - - /// Field number for the "not_in" field. - public const int NotInFieldNumber = 7; - private static readonly pb::FieldCodec _repeated_notIn_codec - = pb::FieldCodec.ForSFixed32(61); - private readonly pbc::RepeatedField notIn_ = new pbc::RepeatedField(); - /// - /// NotIn specifies that this field cannot be equal to one of the specified - /// values - /// - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public pbc::RepeatedField NotIn { - get { return notIn_; } - } - - /// Field number for the "ignore_empty" field. - public const int IgnoreEmptyFieldNumber = 8; - private readonly static bool IgnoreEmptyDefaultValue = false; - - private bool ignoreEmpty_; - /// - /// IgnoreEmpty specifies that the validation rules of this field should be - /// evaluated only if the field is not empty - /// - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public bool IgnoreEmpty { - get { if ((_hasBits0 & 32) != 0) { return ignoreEmpty_; } else { return IgnoreEmptyDefaultValue; } } - set { - _hasBits0 |= 32; - ignoreEmpty_ = value; - } - } - /// Gets whether the "ignore_empty" field is set - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public bool HasIgnoreEmpty { - get { return (_hasBits0 & 32) != 0; } - } - /// Clears the value of the "ignore_empty" field - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void ClearIgnoreEmpty() { - _hasBits0 &= ~32; - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public override bool Equals(object other) { - return Equals(other as SFixed32Rules); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public bool Equals(SFixed32Rules other) { - if (ReferenceEquals(other, null)) { - return false; - } - if (ReferenceEquals(other, this)) { - return true; - } - if (Const != other.Const) return false; - if (Lt != other.Lt) return false; - if (Lte != other.Lte) return false; - if (Gt != other.Gt) return false; - if (Gte != other.Gte) return false; - if(!in_.Equals(other.in_)) return false; - if(!notIn_.Equals(other.notIn_)) return false; - if (IgnoreEmpty != other.IgnoreEmpty) return false; - return Equals(_unknownFields, other._unknownFields); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public override int GetHashCode() { - int hash = 1; - if (HasConst) hash ^= Const.GetHashCode(); - if (HasLt) hash ^= Lt.GetHashCode(); - if (HasLte) hash ^= Lte.GetHashCode(); - if (HasGt) hash ^= Gt.GetHashCode(); - if (HasGte) hash ^= Gte.GetHashCode(); - hash ^= in_.GetHashCode(); - hash ^= notIn_.GetHashCode(); - if (HasIgnoreEmpty) hash ^= IgnoreEmpty.GetHashCode(); - if (_unknownFields != null) { - hash ^= _unknownFields.GetHashCode(); - } - return hash; - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public override string ToString() { - return pb::JsonFormatter.ToDiagnosticString(this); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void WriteTo(pb::CodedOutputStream output) { - #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE - output.WriteRawMessage(this); - #else - if (HasConst) { - output.WriteRawTag(13); - output.WriteSFixed32(Const); - } - if (HasLt) { - output.WriteRawTag(21); - output.WriteSFixed32(Lt); - } - if (HasLte) { - output.WriteRawTag(29); - output.WriteSFixed32(Lte); - } - if (HasGt) { - output.WriteRawTag(37); - output.WriteSFixed32(Gt); - } - if (HasGte) { - output.WriteRawTag(45); - output.WriteSFixed32(Gte); - } - in_.WriteTo(output, _repeated_in_codec); - notIn_.WriteTo(output, _repeated_notIn_codec); - if (HasIgnoreEmpty) { - output.WriteRawTag(64); - output.WriteBool(IgnoreEmpty); - } - if (_unknownFields != null) { - _unknownFields.WriteTo(output); - } - #endif - } - - #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - void pb::IBufferMessage.InternalWriteTo(ref pb::WriteContext output) { - if (HasConst) { - output.WriteRawTag(13); - output.WriteSFixed32(Const); - } - if (HasLt) { - output.WriteRawTag(21); - output.WriteSFixed32(Lt); - } - if (HasLte) { - output.WriteRawTag(29); - output.WriteSFixed32(Lte); - } - if (HasGt) { - output.WriteRawTag(37); - output.WriteSFixed32(Gt); - } - if (HasGte) { - output.WriteRawTag(45); - output.WriteSFixed32(Gte); - } - in_.WriteTo(ref output, _repeated_in_codec); - notIn_.WriteTo(ref output, _repeated_notIn_codec); - if (HasIgnoreEmpty) { - output.WriteRawTag(64); - output.WriteBool(IgnoreEmpty); - } - if (_unknownFields != null) { - _unknownFields.WriteTo(ref output); - } - } - #endif - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public int CalculateSize() { - int size = 0; - if (HasConst) { - size += 1 + 4; - } - if (HasLt) { - size += 1 + 4; - } - if (HasLte) { - size += 1 + 4; - } - if (HasGt) { - size += 1 + 4; - } - if (HasGte) { - size += 1 + 4; - } - size += in_.CalculateSize(_repeated_in_codec); - size += notIn_.CalculateSize(_repeated_notIn_codec); - if (HasIgnoreEmpty) { - size += 1 + 1; - } - if (_unknownFields != null) { - size += _unknownFields.CalculateSize(); - } - return size; - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void MergeFrom(SFixed32Rules other) { - if (other == null) { - return; - } - if (other.HasConst) { - Const = other.Const; - } - if (other.HasLt) { - Lt = other.Lt; - } - if (other.HasLte) { - Lte = other.Lte; - } - if (other.HasGt) { - Gt = other.Gt; - } - if (other.HasGte) { - Gte = other.Gte; - } - in_.Add(other.in_); - notIn_.Add(other.notIn_); - if (other.HasIgnoreEmpty) { - IgnoreEmpty = other.IgnoreEmpty; - } - _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void MergeFrom(pb::CodedInputStream input) { - #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE - input.ReadRawMessage(this); - #else - uint tag; - while ((tag = input.ReadTag()) != 0) { - switch(tag) { - default: - _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input); - break; - case 13: { - Const = input.ReadSFixed32(); - break; - } - case 21: { - Lt = input.ReadSFixed32(); - break; - } - case 29: { - Lte = input.ReadSFixed32(); - break; - } - case 37: { - Gt = input.ReadSFixed32(); - break; - } - case 45: { - Gte = input.ReadSFixed32(); - break; - } - case 50: - case 53: { - in_.AddEntriesFrom(input, _repeated_in_codec); - break; - } - case 58: - case 61: { - notIn_.AddEntriesFrom(input, _repeated_notIn_codec); - break; - } - case 64: { - IgnoreEmpty = input.ReadBool(); - break; - } - } - } - #endif - } - - #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - void pb::IBufferMessage.InternalMergeFrom(ref pb::ParseContext input) { - uint tag; - while ((tag = input.ReadTag()) != 0) { - switch(tag) { - default: - _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, ref input); - break; - case 13: { - Const = input.ReadSFixed32(); - break; - } - case 21: { - Lt = input.ReadSFixed32(); - break; - } - case 29: { - Lte = input.ReadSFixed32(); - break; - } - case 37: { - Gt = input.ReadSFixed32(); - break; - } - case 45: { - Gte = input.ReadSFixed32(); - break; - } - case 50: - case 53: { - in_.AddEntriesFrom(ref input, _repeated_in_codec); - break; - } - case 58: - case 61: { - notIn_.AddEntriesFrom(ref input, _repeated_notIn_codec); - break; - } - case 64: { - IgnoreEmpty = input.ReadBool(); - break; - } - } - } - } - #endif - - } - - /// - /// SFixed64Rules describes the constraints applied to `sfixed64` values - /// - public sealed partial class SFixed64Rules : pb::IMessage - #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE - , pb::IBufferMessage - #endif - { - private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new SFixed64Rules()); - private pb::UnknownFieldSet _unknownFields; - private int _hasBits0; - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public static pb::MessageParser Parser { get { return _parser; } } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public static pbr::MessageDescriptor Descriptor { - get { return global::Validate.ValidateReflection.Descriptor.MessageTypes[12]; } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - pbr::MessageDescriptor pb::IMessage.Descriptor { - get { return Descriptor; } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public SFixed64Rules() { - OnConstruction(); - } - - partial void OnConstruction(); - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public SFixed64Rules(SFixed64Rules other) : this() { - _hasBits0 = other._hasBits0; - const_ = other.const_; - lt_ = other.lt_; - lte_ = other.lte_; - gt_ = other.gt_; - gte_ = other.gte_; - in_ = other.in_.Clone(); - notIn_ = other.notIn_.Clone(); - ignoreEmpty_ = other.ignoreEmpty_; - _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public SFixed64Rules Clone() { - return new SFixed64Rules(this); - } - - /// Field number for the "const" field. - public const int ConstFieldNumber = 1; - private readonly static long ConstDefaultValue = 0L; - - private long const_; - /// - /// Const specifies that this field must be exactly the specified value - /// - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public long Const { - get { if ((_hasBits0 & 1) != 0) { return const_; } else { return ConstDefaultValue; } } - set { - _hasBits0 |= 1; - const_ = value; - } - } - /// Gets whether the "const" field is set - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public bool HasConst { - get { return (_hasBits0 & 1) != 0; } - } - /// Clears the value of the "const" field - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void ClearConst() { - _hasBits0 &= ~1; - } - - /// Field number for the "lt" field. - public const int LtFieldNumber = 2; - private readonly static long LtDefaultValue = 0L; - - private long lt_; - /// - /// Lt specifies that this field must be less than the specified value, - /// exclusive - /// - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public long Lt { - get { if ((_hasBits0 & 2) != 0) { return lt_; } else { return LtDefaultValue; } } - set { - _hasBits0 |= 2; - lt_ = value; - } - } - /// Gets whether the "lt" field is set - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public bool HasLt { - get { return (_hasBits0 & 2) != 0; } - } - /// Clears the value of the "lt" field - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void ClearLt() { - _hasBits0 &= ~2; - } - - /// Field number for the "lte" field. - public const int LteFieldNumber = 3; - private readonly static long LteDefaultValue = 0L; - - private long lte_; - /// - /// Lte specifies that this field must be less than or equal to the - /// specified value, inclusive - /// - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public long Lte { - get { if ((_hasBits0 & 4) != 0) { return lte_; } else { return LteDefaultValue; } } - set { - _hasBits0 |= 4; - lte_ = value; - } - } - /// Gets whether the "lte" field is set - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public bool HasLte { - get { return (_hasBits0 & 4) != 0; } - } - /// Clears the value of the "lte" field - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void ClearLte() { - _hasBits0 &= ~4; - } - - /// Field number for the "gt" field. - public const int GtFieldNumber = 4; - private readonly static long GtDefaultValue = 0L; - - private long gt_; - /// - /// Gt specifies that this field must be greater than the specified value, - /// exclusive. If the value of Gt is larger than a specified Lt or Lte, the - /// range is reversed. - /// - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public long Gt { - get { if ((_hasBits0 & 8) != 0) { return gt_; } else { return GtDefaultValue; } } - set { - _hasBits0 |= 8; - gt_ = value; - } - } - /// Gets whether the "gt" field is set - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public bool HasGt { - get { return (_hasBits0 & 8) != 0; } - } - /// Clears the value of the "gt" field - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void ClearGt() { - _hasBits0 &= ~8; - } - - /// Field number for the "gte" field. - public const int GteFieldNumber = 5; - private readonly static long GteDefaultValue = 0L; - - private long gte_; - /// - /// Gte specifies that this field must be greater than or equal to the - /// specified value, inclusive. If the value of Gte is larger than a - /// specified Lt or Lte, the range is reversed. - /// - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public long Gte { - get { if ((_hasBits0 & 16) != 0) { return gte_; } else { return GteDefaultValue; } } - set { - _hasBits0 |= 16; - gte_ = value; - } - } - /// Gets whether the "gte" field is set - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public bool HasGte { - get { return (_hasBits0 & 16) != 0; } - } - /// Clears the value of the "gte" field - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void ClearGte() { - _hasBits0 &= ~16; - } - - /// Field number for the "in" field. - public const int InFieldNumber = 6; - private static readonly pb::FieldCodec _repeated_in_codec - = pb::FieldCodec.ForSFixed64(49); - private readonly pbc::RepeatedField in_ = new pbc::RepeatedField(); - /// - /// In specifies that this field must be equal to one of the specified - /// values - /// - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public pbc::RepeatedField In { - get { return in_; } - } - - /// Field number for the "not_in" field. - public const int NotInFieldNumber = 7; - private static readonly pb::FieldCodec _repeated_notIn_codec - = pb::FieldCodec.ForSFixed64(57); - private readonly pbc::RepeatedField notIn_ = new pbc::RepeatedField(); - /// - /// NotIn specifies that this field cannot be equal to one of the specified - /// values - /// - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public pbc::RepeatedField NotIn { - get { return notIn_; } - } - - /// Field number for the "ignore_empty" field. - public const int IgnoreEmptyFieldNumber = 8; - private readonly static bool IgnoreEmptyDefaultValue = false; - - private bool ignoreEmpty_; - /// - /// IgnoreEmpty specifies that the validation rules of this field should be - /// evaluated only if the field is not empty - /// - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public bool IgnoreEmpty { - get { if ((_hasBits0 & 32) != 0) { return ignoreEmpty_; } else { return IgnoreEmptyDefaultValue; } } - set { - _hasBits0 |= 32; - ignoreEmpty_ = value; - } - } - /// Gets whether the "ignore_empty" field is set - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public bool HasIgnoreEmpty { - get { return (_hasBits0 & 32) != 0; } - } - /// Clears the value of the "ignore_empty" field - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void ClearIgnoreEmpty() { - _hasBits0 &= ~32; - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public override bool Equals(object other) { - return Equals(other as SFixed64Rules); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public bool Equals(SFixed64Rules other) { - if (ReferenceEquals(other, null)) { - return false; - } - if (ReferenceEquals(other, this)) { - return true; - } - if (Const != other.Const) return false; - if (Lt != other.Lt) return false; - if (Lte != other.Lte) return false; - if (Gt != other.Gt) return false; - if (Gte != other.Gte) return false; - if(!in_.Equals(other.in_)) return false; - if(!notIn_.Equals(other.notIn_)) return false; - if (IgnoreEmpty != other.IgnoreEmpty) return false; - return Equals(_unknownFields, other._unknownFields); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public override int GetHashCode() { - int hash = 1; - if (HasConst) hash ^= Const.GetHashCode(); - if (HasLt) hash ^= Lt.GetHashCode(); - if (HasLte) hash ^= Lte.GetHashCode(); - if (HasGt) hash ^= Gt.GetHashCode(); - if (HasGte) hash ^= Gte.GetHashCode(); - hash ^= in_.GetHashCode(); - hash ^= notIn_.GetHashCode(); - if (HasIgnoreEmpty) hash ^= IgnoreEmpty.GetHashCode(); - if (_unknownFields != null) { - hash ^= _unknownFields.GetHashCode(); - } - return hash; - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public override string ToString() { - return pb::JsonFormatter.ToDiagnosticString(this); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void WriteTo(pb::CodedOutputStream output) { - #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE - output.WriteRawMessage(this); - #else - if (HasConst) { - output.WriteRawTag(9); - output.WriteSFixed64(Const); - } - if (HasLt) { - output.WriteRawTag(17); - output.WriteSFixed64(Lt); - } - if (HasLte) { - output.WriteRawTag(25); - output.WriteSFixed64(Lte); - } - if (HasGt) { - output.WriteRawTag(33); - output.WriteSFixed64(Gt); - } - if (HasGte) { - output.WriteRawTag(41); - output.WriteSFixed64(Gte); - } - in_.WriteTo(output, _repeated_in_codec); - notIn_.WriteTo(output, _repeated_notIn_codec); - if (HasIgnoreEmpty) { - output.WriteRawTag(64); - output.WriteBool(IgnoreEmpty); - } - if (_unknownFields != null) { - _unknownFields.WriteTo(output); - } - #endif - } - - #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - void pb::IBufferMessage.InternalWriteTo(ref pb::WriteContext output) { - if (HasConst) { - output.WriteRawTag(9); - output.WriteSFixed64(Const); - } - if (HasLt) { - output.WriteRawTag(17); - output.WriteSFixed64(Lt); - } - if (HasLte) { - output.WriteRawTag(25); - output.WriteSFixed64(Lte); - } - if (HasGt) { - output.WriteRawTag(33); - output.WriteSFixed64(Gt); - } - if (HasGte) { - output.WriteRawTag(41); - output.WriteSFixed64(Gte); - } - in_.WriteTo(ref output, _repeated_in_codec); - notIn_.WriteTo(ref output, _repeated_notIn_codec); - if (HasIgnoreEmpty) { - output.WriteRawTag(64); - output.WriteBool(IgnoreEmpty); - } - if (_unknownFields != null) { - _unknownFields.WriteTo(ref output); - } - } - #endif - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public int CalculateSize() { - int size = 0; - if (HasConst) { - size += 1 + 8; - } - if (HasLt) { - size += 1 + 8; - } - if (HasLte) { - size += 1 + 8; - } - if (HasGt) { - size += 1 + 8; - } - if (HasGte) { - size += 1 + 8; - } - size += in_.CalculateSize(_repeated_in_codec); - size += notIn_.CalculateSize(_repeated_notIn_codec); - if (HasIgnoreEmpty) { - size += 1 + 1; - } - if (_unknownFields != null) { - size += _unknownFields.CalculateSize(); - } - return size; - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void MergeFrom(SFixed64Rules other) { - if (other == null) { - return; - } - if (other.HasConst) { - Const = other.Const; - } - if (other.HasLt) { - Lt = other.Lt; - } - if (other.HasLte) { - Lte = other.Lte; - } - if (other.HasGt) { - Gt = other.Gt; - } - if (other.HasGte) { - Gte = other.Gte; - } - in_.Add(other.in_); - notIn_.Add(other.notIn_); - if (other.HasIgnoreEmpty) { - IgnoreEmpty = other.IgnoreEmpty; - } - _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void MergeFrom(pb::CodedInputStream input) { - #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE - input.ReadRawMessage(this); - #else - uint tag; - while ((tag = input.ReadTag()) != 0) { - switch(tag) { - default: - _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input); - break; - case 9: { - Const = input.ReadSFixed64(); - break; - } - case 17: { - Lt = input.ReadSFixed64(); - break; - } - case 25: { - Lte = input.ReadSFixed64(); - break; - } - case 33: { - Gt = input.ReadSFixed64(); - break; - } - case 41: { - Gte = input.ReadSFixed64(); - break; - } - case 50: - case 49: { - in_.AddEntriesFrom(input, _repeated_in_codec); - break; - } - case 58: - case 57: { - notIn_.AddEntriesFrom(input, _repeated_notIn_codec); - break; - } - case 64: { - IgnoreEmpty = input.ReadBool(); - break; - } - } - } - #endif - } - - #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - void pb::IBufferMessage.InternalMergeFrom(ref pb::ParseContext input) { - uint tag; - while ((tag = input.ReadTag()) != 0) { - switch(tag) { - default: - _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, ref input); - break; - case 9: { - Const = input.ReadSFixed64(); - break; - } - case 17: { - Lt = input.ReadSFixed64(); - break; - } - case 25: { - Lte = input.ReadSFixed64(); - break; - } - case 33: { - Gt = input.ReadSFixed64(); - break; - } - case 41: { - Gte = input.ReadSFixed64(); - break; - } - case 50: - case 49: { - in_.AddEntriesFrom(ref input, _repeated_in_codec); - break; - } - case 58: - case 57: { - notIn_.AddEntriesFrom(ref input, _repeated_notIn_codec); - break; - } - case 64: { - IgnoreEmpty = input.ReadBool(); - break; - } - } - } - } - #endif - - } - - /// - /// BoolRules describes the constraints applied to `bool` values - /// - public sealed partial class BoolRules : pb::IMessage - #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE - , pb::IBufferMessage - #endif - { - private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new BoolRules()); - private pb::UnknownFieldSet _unknownFields; - private int _hasBits0; - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public static pb::MessageParser Parser { get { return _parser; } } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public static pbr::MessageDescriptor Descriptor { - get { return global::Validate.ValidateReflection.Descriptor.MessageTypes[13]; } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - pbr::MessageDescriptor pb::IMessage.Descriptor { - get { return Descriptor; } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public BoolRules() { - OnConstruction(); - } - - partial void OnConstruction(); - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public BoolRules(BoolRules other) : this() { - _hasBits0 = other._hasBits0; - const_ = other.const_; - _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public BoolRules Clone() { - return new BoolRules(this); - } - - /// Field number for the "const" field. - public const int ConstFieldNumber = 1; - private readonly static bool ConstDefaultValue = false; - - private bool const_; - /// - /// Const specifies that this field must be exactly the specified value - /// - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public bool Const { - get { if ((_hasBits0 & 1) != 0) { return const_; } else { return ConstDefaultValue; } } - set { - _hasBits0 |= 1; - const_ = value; - } - } - /// Gets whether the "const" field is set - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public bool HasConst { - get { return (_hasBits0 & 1) != 0; } - } - /// Clears the value of the "const" field - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void ClearConst() { - _hasBits0 &= ~1; - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public override bool Equals(object other) { - return Equals(other as BoolRules); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public bool Equals(BoolRules other) { - if (ReferenceEquals(other, null)) { - return false; - } - if (ReferenceEquals(other, this)) { - return true; - } - if (Const != other.Const) return false; - return Equals(_unknownFields, other._unknownFields); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public override int GetHashCode() { - int hash = 1; - if (HasConst) hash ^= Const.GetHashCode(); - if (_unknownFields != null) { - hash ^= _unknownFields.GetHashCode(); - } - return hash; - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public override string ToString() { - return pb::JsonFormatter.ToDiagnosticString(this); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void WriteTo(pb::CodedOutputStream output) { - #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE - output.WriteRawMessage(this); - #else - if (HasConst) { - output.WriteRawTag(8); - output.WriteBool(Const); - } - if (_unknownFields != null) { - _unknownFields.WriteTo(output); - } - #endif - } - - #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - void pb::IBufferMessage.InternalWriteTo(ref pb::WriteContext output) { - if (HasConst) { - output.WriteRawTag(8); - output.WriteBool(Const); - } - if (_unknownFields != null) { - _unknownFields.WriteTo(ref output); - } - } - #endif - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public int CalculateSize() { - int size = 0; - if (HasConst) { - size += 1 + 1; - } - if (_unknownFields != null) { - size += _unknownFields.CalculateSize(); - } - return size; - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void MergeFrom(BoolRules other) { - if (other == null) { - return; - } - if (other.HasConst) { - Const = other.Const; - } - _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void MergeFrom(pb::CodedInputStream input) { - #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE - input.ReadRawMessage(this); - #else - uint tag; - while ((tag = input.ReadTag()) != 0) { - switch(tag) { - default: - _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input); - break; - case 8: { - Const = input.ReadBool(); - break; - } - } - } - #endif - } - - #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - void pb::IBufferMessage.InternalMergeFrom(ref pb::ParseContext input) { - uint tag; - while ((tag = input.ReadTag()) != 0) { - switch(tag) { - default: - _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, ref input); - break; - case 8: { - Const = input.ReadBool(); - break; - } - } - } - } - #endif - - } - - /// - /// StringRules describe the constraints applied to `string` values - /// - public sealed partial class StringRules : pb::IMessage - #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE - , pb::IBufferMessage - #endif - { - private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new StringRules()); - private pb::UnknownFieldSet _unknownFields; - private int _hasBits0; - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public static pb::MessageParser Parser { get { return _parser; } } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public static pbr::MessageDescriptor Descriptor { - get { return global::Validate.ValidateReflection.Descriptor.MessageTypes[14]; } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - pbr::MessageDescriptor pb::IMessage.Descriptor { - get { return Descriptor; } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public StringRules() { - OnConstruction(); - } - - partial void OnConstruction(); - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public StringRules(StringRules other) : this() { - _hasBits0 = other._hasBits0; - const_ = other.const_; - len_ = other.len_; - minLen_ = other.minLen_; - maxLen_ = other.maxLen_; - lenBytes_ = other.lenBytes_; - minBytes_ = other.minBytes_; - maxBytes_ = other.maxBytes_; - pattern_ = other.pattern_; - prefix_ = other.prefix_; - suffix_ = other.suffix_; - contains_ = other.contains_; - notContains_ = other.notContains_; - in_ = other.in_.Clone(); - notIn_ = other.notIn_.Clone(); - strict_ = other.strict_; - ignoreEmpty_ = other.ignoreEmpty_; - switch (other.WellKnownCase) { - case WellKnownOneofCase.Email: - Email = other.Email; - break; - case WellKnownOneofCase.Hostname: - Hostname = other.Hostname; - break; - case WellKnownOneofCase.Ip: - Ip = other.Ip; - break; - case WellKnownOneofCase.Ipv4: - Ipv4 = other.Ipv4; - break; - case WellKnownOneofCase.Ipv6: - Ipv6 = other.Ipv6; - break; - case WellKnownOneofCase.Uri: - Uri = other.Uri; - break; - case WellKnownOneofCase.UriRef: - UriRef = other.UriRef; - break; - case WellKnownOneofCase.Address: - Address = other.Address; - break; - case WellKnownOneofCase.Uuid: - Uuid = other.Uuid; - break; - case WellKnownOneofCase.WellKnownRegex: - WellKnownRegex = other.WellKnownRegex; - break; - } - - _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public StringRules Clone() { - return new StringRules(this); - } - - /// Field number for the "const" field. - public const int ConstFieldNumber = 1; - private readonly static string ConstDefaultValue = ""; - - private string const_; - /// - /// Const specifies that this field must be exactly the specified value - /// - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public string Const { - get { return const_ ?? ConstDefaultValue; } - set { - const_ = pb::ProtoPreconditions.CheckNotNull(value, "value"); - } - } - /// Gets whether the "const" field is set - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public bool HasConst { - get { return const_ != null; } - } - /// Clears the value of the "const" field - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void ClearConst() { - const_ = null; - } - - /// Field number for the "len" field. - public const int LenFieldNumber = 19; - private readonly static ulong LenDefaultValue = 0UL; - - private ulong len_; - /// - /// Len specifies that this field must be the specified number of - /// characters (Unicode code points). Note that the number of - /// characters may differ from the number of bytes in the string. - /// - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public ulong Len { - get { if ((_hasBits0 & 16) != 0) { return len_; } else { return LenDefaultValue; } } - set { - _hasBits0 |= 16; - len_ = value; - } - } - /// Gets whether the "len" field is set - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public bool HasLen { - get { return (_hasBits0 & 16) != 0; } - } - /// Clears the value of the "len" field - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void ClearLen() { - _hasBits0 &= ~16; - } - - /// Field number for the "min_len" field. - public const int MinLenFieldNumber = 2; - private readonly static ulong MinLenDefaultValue = 0UL; - - private ulong minLen_; - /// - /// MinLen specifies that this field must be the specified number of - /// characters (Unicode code points) at a minimum. Note that the number of - /// characters may differ from the number of bytes in the string. - /// - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public ulong MinLen { - get { if ((_hasBits0 & 1) != 0) { return minLen_; } else { return MinLenDefaultValue; } } - set { - _hasBits0 |= 1; - minLen_ = value; - } - } - /// Gets whether the "min_len" field is set - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public bool HasMinLen { - get { return (_hasBits0 & 1) != 0; } - } - /// Clears the value of the "min_len" field - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void ClearMinLen() { - _hasBits0 &= ~1; - } - - /// Field number for the "max_len" field. - public const int MaxLenFieldNumber = 3; - private readonly static ulong MaxLenDefaultValue = 0UL; - - private ulong maxLen_; - /// - /// MaxLen specifies that this field must be the specified number of - /// characters (Unicode code points) at a maximum. Note that the number of - /// characters may differ from the number of bytes in the string. - /// - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public ulong MaxLen { - get { if ((_hasBits0 & 2) != 0) { return maxLen_; } else { return MaxLenDefaultValue; } } - set { - _hasBits0 |= 2; - maxLen_ = value; - } - } - /// Gets whether the "max_len" field is set - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public bool HasMaxLen { - get { return (_hasBits0 & 2) != 0; } - } - /// Clears the value of the "max_len" field - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void ClearMaxLen() { - _hasBits0 &= ~2; - } - - /// Field number for the "len_bytes" field. - public const int LenBytesFieldNumber = 20; - private readonly static ulong LenBytesDefaultValue = 0UL; - - private ulong lenBytes_; - /// - /// LenBytes specifies that this field must be the specified number of bytes - /// at a minimum - /// - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public ulong LenBytes { - get { if ((_hasBits0 & 32) != 0) { return lenBytes_; } else { return LenBytesDefaultValue; } } - set { - _hasBits0 |= 32; - lenBytes_ = value; - } - } - /// Gets whether the "len_bytes" field is set - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public bool HasLenBytes { - get { return (_hasBits0 & 32) != 0; } - } - /// Clears the value of the "len_bytes" field - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void ClearLenBytes() { - _hasBits0 &= ~32; - } - - /// Field number for the "min_bytes" field. - public const int MinBytesFieldNumber = 4; - private readonly static ulong MinBytesDefaultValue = 0UL; - - private ulong minBytes_; - /// - /// MinBytes specifies that this field must be the specified number of bytes - /// at a minimum - /// - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public ulong MinBytes { - get { if ((_hasBits0 & 4) != 0) { return minBytes_; } else { return MinBytesDefaultValue; } } - set { - _hasBits0 |= 4; - minBytes_ = value; - } - } - /// Gets whether the "min_bytes" field is set - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public bool HasMinBytes { - get { return (_hasBits0 & 4) != 0; } - } - /// Clears the value of the "min_bytes" field - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void ClearMinBytes() { - _hasBits0 &= ~4; - } - - /// Field number for the "max_bytes" field. - public const int MaxBytesFieldNumber = 5; - private readonly static ulong MaxBytesDefaultValue = 0UL; - - private ulong maxBytes_; - /// - /// MaxBytes specifies that this field must be the specified number of bytes - /// at a maximum - /// - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public ulong MaxBytes { - get { if ((_hasBits0 & 8) != 0) { return maxBytes_; } else { return MaxBytesDefaultValue; } } - set { - _hasBits0 |= 8; - maxBytes_ = value; - } - } - /// Gets whether the "max_bytes" field is set - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public bool HasMaxBytes { - get { return (_hasBits0 & 8) != 0; } - } - /// Clears the value of the "max_bytes" field - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void ClearMaxBytes() { - _hasBits0 &= ~8; - } - - /// Field number for the "pattern" field. - public const int PatternFieldNumber = 6; - private readonly static string PatternDefaultValue = ""; - - private string pattern_; - /// - /// Pattern specifes that this field must match against the specified - /// regular expression (RE2 syntax). The included expression should elide - /// any delimiters. - /// - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public string Pattern { - get { return pattern_ ?? PatternDefaultValue; } - set { - pattern_ = pb::ProtoPreconditions.CheckNotNull(value, "value"); - } - } - /// Gets whether the "pattern" field is set - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public bool HasPattern { - get { return pattern_ != null; } - } - /// Clears the value of the "pattern" field - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void ClearPattern() { - pattern_ = null; - } - - /// Field number for the "prefix" field. - public const int PrefixFieldNumber = 7; - private readonly static string PrefixDefaultValue = ""; - - private string prefix_; - /// - /// Prefix specifies that this field must have the specified substring at - /// the beginning of the string. - /// - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public string Prefix { - get { return prefix_ ?? PrefixDefaultValue; } - set { - prefix_ = pb::ProtoPreconditions.CheckNotNull(value, "value"); - } - } - /// Gets whether the "prefix" field is set - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public bool HasPrefix { - get { return prefix_ != null; } - } - /// Clears the value of the "prefix" field - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void ClearPrefix() { - prefix_ = null; - } - - /// Field number for the "suffix" field. - public const int SuffixFieldNumber = 8; - private readonly static string SuffixDefaultValue = ""; - - private string suffix_; - /// - /// Suffix specifies that this field must have the specified substring at - /// the end of the string. - /// - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public string Suffix { - get { return suffix_ ?? SuffixDefaultValue; } - set { - suffix_ = pb::ProtoPreconditions.CheckNotNull(value, "value"); - } - } - /// Gets whether the "suffix" field is set - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public bool HasSuffix { - get { return suffix_ != null; } - } - /// Clears the value of the "suffix" field - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void ClearSuffix() { - suffix_ = null; - } - - /// Field number for the "contains" field. - public const int ContainsFieldNumber = 9; - private readonly static string ContainsDefaultValue = ""; - - private string contains_; - /// - /// Contains specifies that this field must have the specified substring - /// anywhere in the string. - /// - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public string Contains { - get { return contains_ ?? ContainsDefaultValue; } - set { - contains_ = pb::ProtoPreconditions.CheckNotNull(value, "value"); - } - } - /// Gets whether the "contains" field is set - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public bool HasContains { - get { return contains_ != null; } - } - /// Clears the value of the "contains" field - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void ClearContains() { - contains_ = null; - } - - /// Field number for the "not_contains" field. - public const int NotContainsFieldNumber = 23; - private readonly static string NotContainsDefaultValue = ""; - - private string notContains_; - /// - /// NotContains specifies that this field cannot have the specified substring - /// anywhere in the string. - /// - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public string NotContains { - get { return notContains_ ?? NotContainsDefaultValue; } - set { - notContains_ = pb::ProtoPreconditions.CheckNotNull(value, "value"); - } - } - /// Gets whether the "not_contains" field is set - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public bool HasNotContains { - get { return notContains_ != null; } - } - /// Clears the value of the "not_contains" field - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void ClearNotContains() { - notContains_ = null; - } - - /// Field number for the "in" field. - public const int InFieldNumber = 10; - private static readonly pb::FieldCodec _repeated_in_codec - = pb::FieldCodec.ForString(82); - private readonly pbc::RepeatedField in_ = new pbc::RepeatedField(); - /// - /// In specifies that this field must be equal to one of the specified - /// values - /// - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public pbc::RepeatedField In { - get { return in_; } - } - - /// Field number for the "not_in" field. - public const int NotInFieldNumber = 11; - private static readonly pb::FieldCodec _repeated_notIn_codec - = pb::FieldCodec.ForString(90); - private readonly pbc::RepeatedField notIn_ = new pbc::RepeatedField(); - /// - /// NotIn specifies that this field cannot be equal to one of the specified - /// values - /// - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public pbc::RepeatedField NotIn { - get { return notIn_; } - } - - /// Field number for the "email" field. - public const int EmailFieldNumber = 12; - /// - /// Email specifies that the field must be a valid email address as - /// defined by RFC 5322 - /// - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public bool Email { - get { return HasEmail ? (bool) wellKnown_ : false; } - set { - wellKnown_ = value; - wellKnownCase_ = WellKnownOneofCase.Email; - } - } - /// Gets whether the "email" field is set - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public bool HasEmail { - get { return wellKnownCase_ == WellKnownOneofCase.Email; } - } - /// Clears the value of the oneof if it's currently set to "email" - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void ClearEmail() { - if (HasEmail) { - ClearWellKnown(); - } - } - - /// Field number for the "hostname" field. - public const int HostnameFieldNumber = 13; - /// - /// Hostname specifies that the field must be a valid hostname as - /// defined by RFC 1034. This constraint does not support - /// internationalized domain names (IDNs). - /// - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public bool Hostname { - get { return HasHostname ? (bool) wellKnown_ : false; } - set { - wellKnown_ = value; - wellKnownCase_ = WellKnownOneofCase.Hostname; - } - } - /// Gets whether the "hostname" field is set - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public bool HasHostname { - get { return wellKnownCase_ == WellKnownOneofCase.Hostname; } - } - /// Clears the value of the oneof if it's currently set to "hostname" - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void ClearHostname() { - if (HasHostname) { - ClearWellKnown(); - } - } - - /// Field number for the "ip" field. - public const int IpFieldNumber = 14; - /// - /// Ip specifies that the field must be a valid IP (v4 or v6) address. - /// Valid IPv6 addresses should not include surrounding square brackets. - /// - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public bool Ip { - get { return HasIp ? (bool) wellKnown_ : false; } - set { - wellKnown_ = value; - wellKnownCase_ = WellKnownOneofCase.Ip; - } - } - /// Gets whether the "ip" field is set - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public bool HasIp { - get { return wellKnownCase_ == WellKnownOneofCase.Ip; } - } - /// Clears the value of the oneof if it's currently set to "ip" - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void ClearIp() { - if (HasIp) { - ClearWellKnown(); - } - } - - /// Field number for the "ipv4" field. - public const int Ipv4FieldNumber = 15; - /// - /// Ipv4 specifies that the field must be a valid IPv4 address. - /// - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public bool Ipv4 { - get { return HasIpv4 ? (bool) wellKnown_ : false; } - set { - wellKnown_ = value; - wellKnownCase_ = WellKnownOneofCase.Ipv4; - } - } - /// Gets whether the "ipv4" field is set - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public bool HasIpv4 { - get { return wellKnownCase_ == WellKnownOneofCase.Ipv4; } - } - /// Clears the value of the oneof if it's currently set to "ipv4" - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void ClearIpv4() { - if (HasIpv4) { - ClearWellKnown(); - } - } - - /// Field number for the "ipv6" field. - public const int Ipv6FieldNumber = 16; - /// - /// Ipv6 specifies that the field must be a valid IPv6 address. Valid - /// IPv6 addresses should not include surrounding square brackets. - /// - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public bool Ipv6 { - get { return HasIpv6 ? (bool) wellKnown_ : false; } - set { - wellKnown_ = value; - wellKnownCase_ = WellKnownOneofCase.Ipv6; - } - } - /// Gets whether the "ipv6" field is set - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public bool HasIpv6 { - get { return wellKnownCase_ == WellKnownOneofCase.Ipv6; } - } - /// Clears the value of the oneof if it's currently set to "ipv6" - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void ClearIpv6() { - if (HasIpv6) { - ClearWellKnown(); - } - } - - /// Field number for the "uri" field. - public const int UriFieldNumber = 17; - /// - /// Uri specifies that the field must be a valid, absolute URI as defined - /// by RFC 3986 - /// - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public bool Uri { - get { return HasUri ? (bool) wellKnown_ : false; } - set { - wellKnown_ = value; - wellKnownCase_ = WellKnownOneofCase.Uri; - } - } - /// Gets whether the "uri" field is set - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public bool HasUri { - get { return wellKnownCase_ == WellKnownOneofCase.Uri; } - } - /// Clears the value of the oneof if it's currently set to "uri" - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void ClearUri() { - if (HasUri) { - ClearWellKnown(); - } - } - - /// Field number for the "uri_ref" field. - public const int UriRefFieldNumber = 18; - /// - /// UriRef specifies that the field must be a valid URI as defined by RFC - /// 3986 and may be relative or absolute. - /// - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public bool UriRef { - get { return HasUriRef ? (bool) wellKnown_ : false; } - set { - wellKnown_ = value; - wellKnownCase_ = WellKnownOneofCase.UriRef; - } - } - /// Gets whether the "uri_ref" field is set - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public bool HasUriRef { - get { return wellKnownCase_ == WellKnownOneofCase.UriRef; } - } - /// Clears the value of the oneof if it's currently set to "uri_ref" - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void ClearUriRef() { - if (HasUriRef) { - ClearWellKnown(); - } - } - - /// Field number for the "address" field. - public const int AddressFieldNumber = 21; - /// - /// Address specifies that the field must be either a valid hostname as - /// defined by RFC 1034 (which does not support internationalized domain - /// names or IDNs), or it can be a valid IP (v4 or v6). - /// - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public bool Address { - get { return HasAddress ? (bool) wellKnown_ : false; } - set { - wellKnown_ = value; - wellKnownCase_ = WellKnownOneofCase.Address; - } - } - /// Gets whether the "address" field is set - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public bool HasAddress { - get { return wellKnownCase_ == WellKnownOneofCase.Address; } - } - /// Clears the value of the oneof if it's currently set to "address" - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void ClearAddress() { - if (HasAddress) { - ClearWellKnown(); - } - } - - /// Field number for the "uuid" field. - public const int UuidFieldNumber = 22; - /// - /// Uuid specifies that the field must be a valid UUID as defined by - /// RFC 4122 - /// - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public bool Uuid { - get { return HasUuid ? (bool) wellKnown_ : false; } - set { - wellKnown_ = value; - wellKnownCase_ = WellKnownOneofCase.Uuid; - } - } - /// Gets whether the "uuid" field is set - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public bool HasUuid { - get { return wellKnownCase_ == WellKnownOneofCase.Uuid; } - } - /// Clears the value of the oneof if it's currently set to "uuid" - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void ClearUuid() { - if (HasUuid) { - ClearWellKnown(); - } - } - - /// Field number for the "well_known_regex" field. - public const int WellKnownRegexFieldNumber = 24; - /// - /// WellKnownRegex specifies a common well known pattern defined as a regex. - /// - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public global::Validate.KnownRegex WellKnownRegex { - get { return HasWellKnownRegex ? (global::Validate.KnownRegex) wellKnown_ : global::Validate.KnownRegex.Unknown; } - set { - wellKnown_ = value; - wellKnownCase_ = WellKnownOneofCase.WellKnownRegex; - } - } - /// Gets whether the "well_known_regex" field is set - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public bool HasWellKnownRegex { - get { return wellKnownCase_ == WellKnownOneofCase.WellKnownRegex; } - } - /// Clears the value of the oneof if it's currently set to "well_known_regex" - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void ClearWellKnownRegex() { - if (HasWellKnownRegex) { - ClearWellKnown(); - } - } - - /// Field number for the "strict" field. - public const int StrictFieldNumber = 25; - private readonly static bool StrictDefaultValue = true; - - private bool strict_; - /// - /// This applies to regexes HTTP_HEADER_NAME and HTTP_HEADER_VALUE to enable - /// strict header validation. - /// By default, this is true, and HTTP header validations are RFC-compliant. - /// Setting to false will enable a looser validations that only disallows - /// \r\n\0 characters, which can be used to bypass header matching rules. - /// - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public bool Strict { - get { if ((_hasBits0 & 64) != 0) { return strict_; } else { return StrictDefaultValue; } } - set { - _hasBits0 |= 64; - strict_ = value; - } - } - /// Gets whether the "strict" field is set - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public bool HasStrict { - get { return (_hasBits0 & 64) != 0; } - } - /// Clears the value of the "strict" field - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void ClearStrict() { - _hasBits0 &= ~64; - } - - /// Field number for the "ignore_empty" field. - public const int IgnoreEmptyFieldNumber = 26; - private readonly static bool IgnoreEmptyDefaultValue = false; - - private bool ignoreEmpty_; - /// - /// IgnoreEmpty specifies that the validation rules of this field should be - /// evaluated only if the field is not empty - /// - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public bool IgnoreEmpty { - get { if ((_hasBits0 & 128) != 0) { return ignoreEmpty_; } else { return IgnoreEmptyDefaultValue; } } - set { - _hasBits0 |= 128; - ignoreEmpty_ = value; - } - } - /// Gets whether the "ignore_empty" field is set - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public bool HasIgnoreEmpty { - get { return (_hasBits0 & 128) != 0; } - } - /// Clears the value of the "ignore_empty" field - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void ClearIgnoreEmpty() { - _hasBits0 &= ~128; - } - - private object wellKnown_; - /// Enum of possible cases for the "well_known" oneof. - public enum WellKnownOneofCase { - None = 0, - Email = 12, - Hostname = 13, - Ip = 14, - Ipv4 = 15, - Ipv6 = 16, - Uri = 17, - UriRef = 18, - Address = 21, - Uuid = 22, - WellKnownRegex = 24, - } - private WellKnownOneofCase wellKnownCase_ = WellKnownOneofCase.None; - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public WellKnownOneofCase WellKnownCase { - get { return wellKnownCase_; } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void ClearWellKnown() { - wellKnownCase_ = WellKnownOneofCase.None; - wellKnown_ = null; - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public override bool Equals(object other) { - return Equals(other as StringRules); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public bool Equals(StringRules other) { - if (ReferenceEquals(other, null)) { - return false; - } - if (ReferenceEquals(other, this)) { - return true; - } - if (Const != other.Const) return false; - if (Len != other.Len) return false; - if (MinLen != other.MinLen) return false; - if (MaxLen != other.MaxLen) return false; - if (LenBytes != other.LenBytes) return false; - if (MinBytes != other.MinBytes) return false; - if (MaxBytes != other.MaxBytes) return false; - if (Pattern != other.Pattern) return false; - if (Prefix != other.Prefix) return false; - if (Suffix != other.Suffix) return false; - if (Contains != other.Contains) return false; - if (NotContains != other.NotContains) return false; - if(!in_.Equals(other.in_)) return false; - if(!notIn_.Equals(other.notIn_)) return false; - if (Email != other.Email) return false; - if (Hostname != other.Hostname) return false; - if (Ip != other.Ip) return false; - if (Ipv4 != other.Ipv4) return false; - if (Ipv6 != other.Ipv6) return false; - if (Uri != other.Uri) return false; - if (UriRef != other.UriRef) return false; - if (Address != other.Address) return false; - if (Uuid != other.Uuid) return false; - if (WellKnownRegex != other.WellKnownRegex) return false; - if (Strict != other.Strict) return false; - if (IgnoreEmpty != other.IgnoreEmpty) return false; - if (WellKnownCase != other.WellKnownCase) return false; - return Equals(_unknownFields, other._unknownFields); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public override int GetHashCode() { - int hash = 1; - if (HasConst) hash ^= Const.GetHashCode(); - if (HasLen) hash ^= Len.GetHashCode(); - if (HasMinLen) hash ^= MinLen.GetHashCode(); - if (HasMaxLen) hash ^= MaxLen.GetHashCode(); - if (HasLenBytes) hash ^= LenBytes.GetHashCode(); - if (HasMinBytes) hash ^= MinBytes.GetHashCode(); - if (HasMaxBytes) hash ^= MaxBytes.GetHashCode(); - if (HasPattern) hash ^= Pattern.GetHashCode(); - if (HasPrefix) hash ^= Prefix.GetHashCode(); - if (HasSuffix) hash ^= Suffix.GetHashCode(); - if (HasContains) hash ^= Contains.GetHashCode(); - if (HasNotContains) hash ^= NotContains.GetHashCode(); - hash ^= in_.GetHashCode(); - hash ^= notIn_.GetHashCode(); - if (HasEmail) hash ^= Email.GetHashCode(); - if (HasHostname) hash ^= Hostname.GetHashCode(); - if (HasIp) hash ^= Ip.GetHashCode(); - if (HasIpv4) hash ^= Ipv4.GetHashCode(); - if (HasIpv6) hash ^= Ipv6.GetHashCode(); - if (HasUri) hash ^= Uri.GetHashCode(); - if (HasUriRef) hash ^= UriRef.GetHashCode(); - if (HasAddress) hash ^= Address.GetHashCode(); - if (HasUuid) hash ^= Uuid.GetHashCode(); - if (HasWellKnownRegex) hash ^= WellKnownRegex.GetHashCode(); - if (HasStrict) hash ^= Strict.GetHashCode(); - if (HasIgnoreEmpty) hash ^= IgnoreEmpty.GetHashCode(); - hash ^= (int) wellKnownCase_; - if (_unknownFields != null) { - hash ^= _unknownFields.GetHashCode(); - } - return hash; - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public override string ToString() { - return pb::JsonFormatter.ToDiagnosticString(this); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void WriteTo(pb::CodedOutputStream output) { - #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE - output.WriteRawMessage(this); - #else - if (HasConst) { - output.WriteRawTag(10); - output.WriteString(Const); - } - if (HasMinLen) { - output.WriteRawTag(16); - output.WriteUInt64(MinLen); - } - if (HasMaxLen) { - output.WriteRawTag(24); - output.WriteUInt64(MaxLen); - } - if (HasMinBytes) { - output.WriteRawTag(32); - output.WriteUInt64(MinBytes); - } - if (HasMaxBytes) { - output.WriteRawTag(40); - output.WriteUInt64(MaxBytes); - } - if (HasPattern) { - output.WriteRawTag(50); - output.WriteString(Pattern); - } - if (HasPrefix) { - output.WriteRawTag(58); - output.WriteString(Prefix); - } - if (HasSuffix) { - output.WriteRawTag(66); - output.WriteString(Suffix); - } - if (HasContains) { - output.WriteRawTag(74); - output.WriteString(Contains); - } - in_.WriteTo(output, _repeated_in_codec); - notIn_.WriteTo(output, _repeated_notIn_codec); - if (HasEmail) { - output.WriteRawTag(96); - output.WriteBool(Email); - } - if (HasHostname) { - output.WriteRawTag(104); - output.WriteBool(Hostname); - } - if (HasIp) { - output.WriteRawTag(112); - output.WriteBool(Ip); - } - if (HasIpv4) { - output.WriteRawTag(120); - output.WriteBool(Ipv4); - } - if (HasIpv6) { - output.WriteRawTag(128, 1); - output.WriteBool(Ipv6); - } - if (HasUri) { - output.WriteRawTag(136, 1); - output.WriteBool(Uri); - } - if (HasUriRef) { - output.WriteRawTag(144, 1); - output.WriteBool(UriRef); - } - if (HasLen) { - output.WriteRawTag(152, 1); - output.WriteUInt64(Len); - } - if (HasLenBytes) { - output.WriteRawTag(160, 1); - output.WriteUInt64(LenBytes); - } - if (HasAddress) { - output.WriteRawTag(168, 1); - output.WriteBool(Address); - } - if (HasUuid) { - output.WriteRawTag(176, 1); - output.WriteBool(Uuid); - } - if (HasNotContains) { - output.WriteRawTag(186, 1); - output.WriteString(NotContains); - } - if (HasWellKnownRegex) { - output.WriteRawTag(192, 1); - output.WriteEnum((int) WellKnownRegex); - } - if (HasStrict) { - output.WriteRawTag(200, 1); - output.WriteBool(Strict); - } - if (HasIgnoreEmpty) { - output.WriteRawTag(208, 1); - output.WriteBool(IgnoreEmpty); - } - if (_unknownFields != null) { - _unknownFields.WriteTo(output); - } - #endif - } - - #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - void pb::IBufferMessage.InternalWriteTo(ref pb::WriteContext output) { - if (HasConst) { - output.WriteRawTag(10); - output.WriteString(Const); - } - if (HasMinLen) { - output.WriteRawTag(16); - output.WriteUInt64(MinLen); - } - if (HasMaxLen) { - output.WriteRawTag(24); - output.WriteUInt64(MaxLen); - } - if (HasMinBytes) { - output.WriteRawTag(32); - output.WriteUInt64(MinBytes); - } - if (HasMaxBytes) { - output.WriteRawTag(40); - output.WriteUInt64(MaxBytes); - } - if (HasPattern) { - output.WriteRawTag(50); - output.WriteString(Pattern); - } - if (HasPrefix) { - output.WriteRawTag(58); - output.WriteString(Prefix); - } - if (HasSuffix) { - output.WriteRawTag(66); - output.WriteString(Suffix); - } - if (HasContains) { - output.WriteRawTag(74); - output.WriteString(Contains); - } - in_.WriteTo(ref output, _repeated_in_codec); - notIn_.WriteTo(ref output, _repeated_notIn_codec); - if (HasEmail) { - output.WriteRawTag(96); - output.WriteBool(Email); - } - if (HasHostname) { - output.WriteRawTag(104); - output.WriteBool(Hostname); - } - if (HasIp) { - output.WriteRawTag(112); - output.WriteBool(Ip); - } - if (HasIpv4) { - output.WriteRawTag(120); - output.WriteBool(Ipv4); - } - if (HasIpv6) { - output.WriteRawTag(128, 1); - output.WriteBool(Ipv6); - } - if (HasUri) { - output.WriteRawTag(136, 1); - output.WriteBool(Uri); - } - if (HasUriRef) { - output.WriteRawTag(144, 1); - output.WriteBool(UriRef); - } - if (HasLen) { - output.WriteRawTag(152, 1); - output.WriteUInt64(Len); - } - if (HasLenBytes) { - output.WriteRawTag(160, 1); - output.WriteUInt64(LenBytes); - } - if (HasAddress) { - output.WriteRawTag(168, 1); - output.WriteBool(Address); - } - if (HasUuid) { - output.WriteRawTag(176, 1); - output.WriteBool(Uuid); - } - if (HasNotContains) { - output.WriteRawTag(186, 1); - output.WriteString(NotContains); - } - if (HasWellKnownRegex) { - output.WriteRawTag(192, 1); - output.WriteEnum((int) WellKnownRegex); - } - if (HasStrict) { - output.WriteRawTag(200, 1); - output.WriteBool(Strict); - } - if (HasIgnoreEmpty) { - output.WriteRawTag(208, 1); - output.WriteBool(IgnoreEmpty); - } - if (_unknownFields != null) { - _unknownFields.WriteTo(ref output); - } - } - #endif - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public int CalculateSize() { - int size = 0; - if (HasConst) { - size += 1 + pb::CodedOutputStream.ComputeStringSize(Const); - } - if (HasLen) { - size += 2 + pb::CodedOutputStream.ComputeUInt64Size(Len); - } - if (HasMinLen) { - size += 1 + pb::CodedOutputStream.ComputeUInt64Size(MinLen); - } - if (HasMaxLen) { - size += 1 + pb::CodedOutputStream.ComputeUInt64Size(MaxLen); - } - if (HasLenBytes) { - size += 2 + pb::CodedOutputStream.ComputeUInt64Size(LenBytes); - } - if (HasMinBytes) { - size += 1 + pb::CodedOutputStream.ComputeUInt64Size(MinBytes); - } - if (HasMaxBytes) { - size += 1 + pb::CodedOutputStream.ComputeUInt64Size(MaxBytes); - } - if (HasPattern) { - size += 1 + pb::CodedOutputStream.ComputeStringSize(Pattern); - } - if (HasPrefix) { - size += 1 + pb::CodedOutputStream.ComputeStringSize(Prefix); - } - if (HasSuffix) { - size += 1 + pb::CodedOutputStream.ComputeStringSize(Suffix); - } - if (HasContains) { - size += 1 + pb::CodedOutputStream.ComputeStringSize(Contains); - } - if (HasNotContains) { - size += 2 + pb::CodedOutputStream.ComputeStringSize(NotContains); - } - size += in_.CalculateSize(_repeated_in_codec); - size += notIn_.CalculateSize(_repeated_notIn_codec); - if (HasEmail) { - size += 1 + 1; - } - if (HasHostname) { - size += 1 + 1; - } - if (HasIp) { - size += 1 + 1; - } - if (HasIpv4) { - size += 1 + 1; - } - if (HasIpv6) { - size += 2 + 1; - } - if (HasUri) { - size += 2 + 1; - } - if (HasUriRef) { - size += 2 + 1; - } - if (HasAddress) { - size += 2 + 1; - } - if (HasUuid) { - size += 2 + 1; - } - if (HasWellKnownRegex) { - size += 2 + pb::CodedOutputStream.ComputeEnumSize((int) WellKnownRegex); - } - if (HasStrict) { - size += 2 + 1; - } - if (HasIgnoreEmpty) { - size += 2 + 1; - } - if (_unknownFields != null) { - size += _unknownFields.CalculateSize(); - } - return size; - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void MergeFrom(StringRules other) { - if (other == null) { - return; - } - if (other.HasConst) { - Const = other.Const; - } - if (other.HasLen) { - Len = other.Len; - } - if (other.HasMinLen) { - MinLen = other.MinLen; - } - if (other.HasMaxLen) { - MaxLen = other.MaxLen; - } - if (other.HasLenBytes) { - LenBytes = other.LenBytes; - } - if (other.HasMinBytes) { - MinBytes = other.MinBytes; - } - if (other.HasMaxBytes) { - MaxBytes = other.MaxBytes; - } - if (other.HasPattern) { - Pattern = other.Pattern; - } - if (other.HasPrefix) { - Prefix = other.Prefix; - } - if (other.HasSuffix) { - Suffix = other.Suffix; - } - if (other.HasContains) { - Contains = other.Contains; - } - if (other.HasNotContains) { - NotContains = other.NotContains; - } - in_.Add(other.in_); - notIn_.Add(other.notIn_); - if (other.HasStrict) { - Strict = other.Strict; - } - if (other.HasIgnoreEmpty) { - IgnoreEmpty = other.IgnoreEmpty; - } - switch (other.WellKnownCase) { - case WellKnownOneofCase.Email: - Email = other.Email; - break; - case WellKnownOneofCase.Hostname: - Hostname = other.Hostname; - break; - case WellKnownOneofCase.Ip: - Ip = other.Ip; - break; - case WellKnownOneofCase.Ipv4: - Ipv4 = other.Ipv4; - break; - case WellKnownOneofCase.Ipv6: - Ipv6 = other.Ipv6; - break; - case WellKnownOneofCase.Uri: - Uri = other.Uri; - break; - case WellKnownOneofCase.UriRef: - UriRef = other.UriRef; - break; - case WellKnownOneofCase.Address: - Address = other.Address; - break; - case WellKnownOneofCase.Uuid: - Uuid = other.Uuid; - break; - case WellKnownOneofCase.WellKnownRegex: - WellKnownRegex = other.WellKnownRegex; - break; - } - - _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void MergeFrom(pb::CodedInputStream input) { - #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE - input.ReadRawMessage(this); - #else - uint tag; - while ((tag = input.ReadTag()) != 0) { - switch(tag) { - default: - _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input); - break; - case 10: { - Const = input.ReadString(); - break; - } - case 16: { - MinLen = input.ReadUInt64(); - break; - } - case 24: { - MaxLen = input.ReadUInt64(); - break; - } - case 32: { - MinBytes = input.ReadUInt64(); - break; - } - case 40: { - MaxBytes = input.ReadUInt64(); - break; - } - case 50: { - Pattern = input.ReadString(); - break; - } - case 58: { - Prefix = input.ReadString(); - break; - } - case 66: { - Suffix = input.ReadString(); - break; - } - case 74: { - Contains = input.ReadString(); - break; - } - case 82: { - in_.AddEntriesFrom(input, _repeated_in_codec); - break; - } - case 90: { - notIn_.AddEntriesFrom(input, _repeated_notIn_codec); - break; - } - case 96: { - Email = input.ReadBool(); - break; - } - case 104: { - Hostname = input.ReadBool(); - break; - } - case 112: { - Ip = input.ReadBool(); - break; - } - case 120: { - Ipv4 = input.ReadBool(); - break; - } - case 128: { - Ipv6 = input.ReadBool(); - break; - } - case 136: { - Uri = input.ReadBool(); - break; - } - case 144: { - UriRef = input.ReadBool(); - break; - } - case 152: { - Len = input.ReadUInt64(); - break; - } - case 160: { - LenBytes = input.ReadUInt64(); - break; - } - case 168: { - Address = input.ReadBool(); - break; - } - case 176: { - Uuid = input.ReadBool(); - break; - } - case 186: { - NotContains = input.ReadString(); - break; - } - case 192: { - wellKnown_ = input.ReadEnum(); - wellKnownCase_ = WellKnownOneofCase.WellKnownRegex; - break; - } - case 200: { - Strict = input.ReadBool(); - break; - } - case 208: { - IgnoreEmpty = input.ReadBool(); - break; - } - } - } - #endif - } - - #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - void pb::IBufferMessage.InternalMergeFrom(ref pb::ParseContext input) { - uint tag; - while ((tag = input.ReadTag()) != 0) { - switch(tag) { - default: - _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, ref input); - break; - case 10: { - Const = input.ReadString(); - break; - } - case 16: { - MinLen = input.ReadUInt64(); - break; - } - case 24: { - MaxLen = input.ReadUInt64(); - break; - } - case 32: { - MinBytes = input.ReadUInt64(); - break; - } - case 40: { - MaxBytes = input.ReadUInt64(); - break; - } - case 50: { - Pattern = input.ReadString(); - break; - } - case 58: { - Prefix = input.ReadString(); - break; - } - case 66: { - Suffix = input.ReadString(); - break; - } - case 74: { - Contains = input.ReadString(); - break; - } - case 82: { - in_.AddEntriesFrom(ref input, _repeated_in_codec); - break; - } - case 90: { - notIn_.AddEntriesFrom(ref input, _repeated_notIn_codec); - break; - } - case 96: { - Email = input.ReadBool(); - break; - } - case 104: { - Hostname = input.ReadBool(); - break; - } - case 112: { - Ip = input.ReadBool(); - break; - } - case 120: { - Ipv4 = input.ReadBool(); - break; - } - case 128: { - Ipv6 = input.ReadBool(); - break; - } - case 136: { - Uri = input.ReadBool(); - break; - } - case 144: { - UriRef = input.ReadBool(); - break; - } - case 152: { - Len = input.ReadUInt64(); - break; - } - case 160: { - LenBytes = input.ReadUInt64(); - break; - } - case 168: { - Address = input.ReadBool(); - break; - } - case 176: { - Uuid = input.ReadBool(); - break; - } - case 186: { - NotContains = input.ReadString(); - break; - } - case 192: { - wellKnown_ = input.ReadEnum(); - wellKnownCase_ = WellKnownOneofCase.WellKnownRegex; - break; - } - case 200: { - Strict = input.ReadBool(); - break; - } - case 208: { - IgnoreEmpty = input.ReadBool(); - break; - } - } - } - } - #endif - - } - - /// - /// BytesRules describe the constraints applied to `bytes` values - /// - public sealed partial class BytesRules : pb::IMessage - #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE - , pb::IBufferMessage - #endif - { - private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new BytesRules()); - private pb::UnknownFieldSet _unknownFields; - private int _hasBits0; - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public static pb::MessageParser Parser { get { return _parser; } } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public static pbr::MessageDescriptor Descriptor { - get { return global::Validate.ValidateReflection.Descriptor.MessageTypes[15]; } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - pbr::MessageDescriptor pb::IMessage.Descriptor { - get { return Descriptor; } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public BytesRules() { - OnConstruction(); - } - - partial void OnConstruction(); - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public BytesRules(BytesRules other) : this() { - _hasBits0 = other._hasBits0; - const_ = other.const_; - len_ = other.len_; - minLen_ = other.minLen_; - maxLen_ = other.maxLen_; - pattern_ = other.pattern_; - prefix_ = other.prefix_; - suffix_ = other.suffix_; - contains_ = other.contains_; - in_ = other.in_.Clone(); - notIn_ = other.notIn_.Clone(); - ignoreEmpty_ = other.ignoreEmpty_; - switch (other.WellKnownCase) { - case WellKnownOneofCase.Ip: - Ip = other.Ip; - break; - case WellKnownOneofCase.Ipv4: - Ipv4 = other.Ipv4; - break; - case WellKnownOneofCase.Ipv6: - Ipv6 = other.Ipv6; - break; - } - - _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public BytesRules Clone() { - return new BytesRules(this); - } - - /// Field number for the "const" field. - public const int ConstFieldNumber = 1; - private readonly static pb::ByteString ConstDefaultValue = pb::ByteString.Empty; - - private pb::ByteString const_; - /// - /// Const specifies that this field must be exactly the specified value - /// - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public pb::ByteString Const { - get { return const_ ?? ConstDefaultValue; } - set { - const_ = pb::ProtoPreconditions.CheckNotNull(value, "value"); - } - } - /// Gets whether the "const" field is set - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public bool HasConst { - get { return const_ != null; } - } - /// Clears the value of the "const" field - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void ClearConst() { - const_ = null; - } - - /// Field number for the "len" field. - public const int LenFieldNumber = 13; - private readonly static ulong LenDefaultValue = 0UL; - - private ulong len_; - /// - /// Len specifies that this field must be the specified number of bytes - /// - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public ulong Len { - get { if ((_hasBits0 & 4) != 0) { return len_; } else { return LenDefaultValue; } } - set { - _hasBits0 |= 4; - len_ = value; - } - } - /// Gets whether the "len" field is set - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public bool HasLen { - get { return (_hasBits0 & 4) != 0; } - } - /// Clears the value of the "len" field - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void ClearLen() { - _hasBits0 &= ~4; - } - - /// Field number for the "min_len" field. - public const int MinLenFieldNumber = 2; - private readonly static ulong MinLenDefaultValue = 0UL; - - private ulong minLen_; - /// - /// MinLen specifies that this field must be the specified number of bytes - /// at a minimum - /// - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public ulong MinLen { - get { if ((_hasBits0 & 1) != 0) { return minLen_; } else { return MinLenDefaultValue; } } - set { - _hasBits0 |= 1; - minLen_ = value; - } - } - /// Gets whether the "min_len" field is set - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public bool HasMinLen { - get { return (_hasBits0 & 1) != 0; } - } - /// Clears the value of the "min_len" field - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void ClearMinLen() { - _hasBits0 &= ~1; - } - - /// Field number for the "max_len" field. - public const int MaxLenFieldNumber = 3; - private readonly static ulong MaxLenDefaultValue = 0UL; - - private ulong maxLen_; - /// - /// MaxLen specifies that this field must be the specified number of bytes - /// at a maximum - /// - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public ulong MaxLen { - get { if ((_hasBits0 & 2) != 0) { return maxLen_; } else { return MaxLenDefaultValue; } } - set { - _hasBits0 |= 2; - maxLen_ = value; - } - } - /// Gets whether the "max_len" field is set - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public bool HasMaxLen { - get { return (_hasBits0 & 2) != 0; } - } - /// Clears the value of the "max_len" field - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void ClearMaxLen() { - _hasBits0 &= ~2; - } - - /// Field number for the "pattern" field. - public const int PatternFieldNumber = 4; - private readonly static string PatternDefaultValue = ""; - - private string pattern_; - /// - /// Pattern specifes that this field must match against the specified - /// regular expression (RE2 syntax). The included expression should elide - /// any delimiters. - /// - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public string Pattern { - get { return pattern_ ?? PatternDefaultValue; } - set { - pattern_ = pb::ProtoPreconditions.CheckNotNull(value, "value"); - } - } - /// Gets whether the "pattern" field is set - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public bool HasPattern { - get { return pattern_ != null; } - } - /// Clears the value of the "pattern" field - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void ClearPattern() { - pattern_ = null; - } - - /// Field number for the "prefix" field. - public const int PrefixFieldNumber = 5; - private readonly static pb::ByteString PrefixDefaultValue = pb::ByteString.Empty; - - private pb::ByteString prefix_; - /// - /// Prefix specifies that this field must have the specified bytes at the - /// beginning of the string. - /// - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public pb::ByteString Prefix { - get { return prefix_ ?? PrefixDefaultValue; } - set { - prefix_ = pb::ProtoPreconditions.CheckNotNull(value, "value"); - } - } - /// Gets whether the "prefix" field is set - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public bool HasPrefix { - get { return prefix_ != null; } - } - /// Clears the value of the "prefix" field - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void ClearPrefix() { - prefix_ = null; - } - - /// Field number for the "suffix" field. - public const int SuffixFieldNumber = 6; - private readonly static pb::ByteString SuffixDefaultValue = pb::ByteString.Empty; - - private pb::ByteString suffix_; - /// - /// Suffix specifies that this field must have the specified bytes at the - /// end of the string. - /// - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public pb::ByteString Suffix { - get { return suffix_ ?? SuffixDefaultValue; } - set { - suffix_ = pb::ProtoPreconditions.CheckNotNull(value, "value"); - } - } - /// Gets whether the "suffix" field is set - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public bool HasSuffix { - get { return suffix_ != null; } - } - /// Clears the value of the "suffix" field - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void ClearSuffix() { - suffix_ = null; - } - - /// Field number for the "contains" field. - public const int ContainsFieldNumber = 7; - private readonly static pb::ByteString ContainsDefaultValue = pb::ByteString.Empty; - - private pb::ByteString contains_; - /// - /// Contains specifies that this field must have the specified bytes - /// anywhere in the string. - /// - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public pb::ByteString Contains { - get { return contains_ ?? ContainsDefaultValue; } - set { - contains_ = pb::ProtoPreconditions.CheckNotNull(value, "value"); - } - } - /// Gets whether the "contains" field is set - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public bool HasContains { - get { return contains_ != null; } - } - /// Clears the value of the "contains" field - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void ClearContains() { - contains_ = null; - } - - /// Field number for the "in" field. - public const int InFieldNumber = 8; - private static readonly pb::FieldCodec _repeated_in_codec - = pb::FieldCodec.ForBytes(66); - private readonly pbc::RepeatedField in_ = new pbc::RepeatedField(); - /// - /// In specifies that this field must be equal to one of the specified - /// values - /// - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public pbc::RepeatedField In { - get { return in_; } - } - - /// Field number for the "not_in" field. - public const int NotInFieldNumber = 9; - private static readonly pb::FieldCodec _repeated_notIn_codec - = pb::FieldCodec.ForBytes(74); - private readonly pbc::RepeatedField notIn_ = new pbc::RepeatedField(); - /// - /// NotIn specifies that this field cannot be equal to one of the specified - /// values - /// - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public pbc::RepeatedField NotIn { - get { return notIn_; } - } - - /// Field number for the "ip" field. - public const int IpFieldNumber = 10; - /// - /// Ip specifies that the field must be a valid IP (v4 or v6) address in - /// byte format - /// - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public bool Ip { - get { return HasIp ? (bool) wellKnown_ : false; } - set { - wellKnown_ = value; - wellKnownCase_ = WellKnownOneofCase.Ip; - } - } - /// Gets whether the "ip" field is set - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public bool HasIp { - get { return wellKnownCase_ == WellKnownOneofCase.Ip; } - } - /// Clears the value of the oneof if it's currently set to "ip" - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void ClearIp() { - if (HasIp) { - ClearWellKnown(); - } - } - - /// Field number for the "ipv4" field. - public const int Ipv4FieldNumber = 11; - /// - /// Ipv4 specifies that the field must be a valid IPv4 address in byte - /// format - /// - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public bool Ipv4 { - get { return HasIpv4 ? (bool) wellKnown_ : false; } - set { - wellKnown_ = value; - wellKnownCase_ = WellKnownOneofCase.Ipv4; - } - } - /// Gets whether the "ipv4" field is set - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public bool HasIpv4 { - get { return wellKnownCase_ == WellKnownOneofCase.Ipv4; } - } - /// Clears the value of the oneof if it's currently set to "ipv4" - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void ClearIpv4() { - if (HasIpv4) { - ClearWellKnown(); - } - } - - /// Field number for the "ipv6" field. - public const int Ipv6FieldNumber = 12; - /// - /// Ipv6 specifies that the field must be a valid IPv6 address in byte - /// format - /// - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public bool Ipv6 { - get { return HasIpv6 ? (bool) wellKnown_ : false; } - set { - wellKnown_ = value; - wellKnownCase_ = WellKnownOneofCase.Ipv6; - } - } - /// Gets whether the "ipv6" field is set - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public bool HasIpv6 { - get { return wellKnownCase_ == WellKnownOneofCase.Ipv6; } - } - /// Clears the value of the oneof if it's currently set to "ipv6" - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void ClearIpv6() { - if (HasIpv6) { - ClearWellKnown(); - } - } - - /// Field number for the "ignore_empty" field. - public const int IgnoreEmptyFieldNumber = 14; - private readonly static bool IgnoreEmptyDefaultValue = false; - - private bool ignoreEmpty_; - /// - /// IgnoreEmpty specifies that the validation rules of this field should be - /// evaluated only if the field is not empty - /// - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public bool IgnoreEmpty { - get { if ((_hasBits0 & 8) != 0) { return ignoreEmpty_; } else { return IgnoreEmptyDefaultValue; } } - set { - _hasBits0 |= 8; - ignoreEmpty_ = value; - } - } - /// Gets whether the "ignore_empty" field is set - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public bool HasIgnoreEmpty { - get { return (_hasBits0 & 8) != 0; } - } - /// Clears the value of the "ignore_empty" field - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void ClearIgnoreEmpty() { - _hasBits0 &= ~8; - } - - private object wellKnown_; - /// Enum of possible cases for the "well_known" oneof. - public enum WellKnownOneofCase { - None = 0, - Ip = 10, - Ipv4 = 11, - Ipv6 = 12, - } - private WellKnownOneofCase wellKnownCase_ = WellKnownOneofCase.None; - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public WellKnownOneofCase WellKnownCase { - get { return wellKnownCase_; } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void ClearWellKnown() { - wellKnownCase_ = WellKnownOneofCase.None; - wellKnown_ = null; - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public override bool Equals(object other) { - return Equals(other as BytesRules); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public bool Equals(BytesRules other) { - if (ReferenceEquals(other, null)) { - return false; - } - if (ReferenceEquals(other, this)) { - return true; - } - if (Const != other.Const) return false; - if (Len != other.Len) return false; - if (MinLen != other.MinLen) return false; - if (MaxLen != other.MaxLen) return false; - if (Pattern != other.Pattern) return false; - if (Prefix != other.Prefix) return false; - if (Suffix != other.Suffix) return false; - if (Contains != other.Contains) return false; - if(!in_.Equals(other.in_)) return false; - if(!notIn_.Equals(other.notIn_)) return false; - if (Ip != other.Ip) return false; - if (Ipv4 != other.Ipv4) return false; - if (Ipv6 != other.Ipv6) return false; - if (IgnoreEmpty != other.IgnoreEmpty) return false; - if (WellKnownCase != other.WellKnownCase) return false; - return Equals(_unknownFields, other._unknownFields); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public override int GetHashCode() { - int hash = 1; - if (HasConst) hash ^= Const.GetHashCode(); - if (HasLen) hash ^= Len.GetHashCode(); - if (HasMinLen) hash ^= MinLen.GetHashCode(); - if (HasMaxLen) hash ^= MaxLen.GetHashCode(); - if (HasPattern) hash ^= Pattern.GetHashCode(); - if (HasPrefix) hash ^= Prefix.GetHashCode(); - if (HasSuffix) hash ^= Suffix.GetHashCode(); - if (HasContains) hash ^= Contains.GetHashCode(); - hash ^= in_.GetHashCode(); - hash ^= notIn_.GetHashCode(); - if (HasIp) hash ^= Ip.GetHashCode(); - if (HasIpv4) hash ^= Ipv4.GetHashCode(); - if (HasIpv6) hash ^= Ipv6.GetHashCode(); - if (HasIgnoreEmpty) hash ^= IgnoreEmpty.GetHashCode(); - hash ^= (int) wellKnownCase_; - if (_unknownFields != null) { - hash ^= _unknownFields.GetHashCode(); - } - return hash; - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public override string ToString() { - return pb::JsonFormatter.ToDiagnosticString(this); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void WriteTo(pb::CodedOutputStream output) { - #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE - output.WriteRawMessage(this); - #else - if (HasConst) { - output.WriteRawTag(10); - output.WriteBytes(Const); - } - if (HasMinLen) { - output.WriteRawTag(16); - output.WriteUInt64(MinLen); - } - if (HasMaxLen) { - output.WriteRawTag(24); - output.WriteUInt64(MaxLen); - } - if (HasPattern) { - output.WriteRawTag(34); - output.WriteString(Pattern); - } - if (HasPrefix) { - output.WriteRawTag(42); - output.WriteBytes(Prefix); - } - if (HasSuffix) { - output.WriteRawTag(50); - output.WriteBytes(Suffix); - } - if (HasContains) { - output.WriteRawTag(58); - output.WriteBytes(Contains); - } - in_.WriteTo(output, _repeated_in_codec); - notIn_.WriteTo(output, _repeated_notIn_codec); - if (HasIp) { - output.WriteRawTag(80); - output.WriteBool(Ip); - } - if (HasIpv4) { - output.WriteRawTag(88); - output.WriteBool(Ipv4); - } - if (HasIpv6) { - output.WriteRawTag(96); - output.WriteBool(Ipv6); - } - if (HasLen) { - output.WriteRawTag(104); - output.WriteUInt64(Len); - } - if (HasIgnoreEmpty) { - output.WriteRawTag(112); - output.WriteBool(IgnoreEmpty); - } - if (_unknownFields != null) { - _unknownFields.WriteTo(output); - } - #endif - } - - #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - void pb::IBufferMessage.InternalWriteTo(ref pb::WriteContext output) { - if (HasConst) { - output.WriteRawTag(10); - output.WriteBytes(Const); - } - if (HasMinLen) { - output.WriteRawTag(16); - output.WriteUInt64(MinLen); - } - if (HasMaxLen) { - output.WriteRawTag(24); - output.WriteUInt64(MaxLen); - } - if (HasPattern) { - output.WriteRawTag(34); - output.WriteString(Pattern); - } - if (HasPrefix) { - output.WriteRawTag(42); - output.WriteBytes(Prefix); - } - if (HasSuffix) { - output.WriteRawTag(50); - output.WriteBytes(Suffix); - } - if (HasContains) { - output.WriteRawTag(58); - output.WriteBytes(Contains); - } - in_.WriteTo(ref output, _repeated_in_codec); - notIn_.WriteTo(ref output, _repeated_notIn_codec); - if (HasIp) { - output.WriteRawTag(80); - output.WriteBool(Ip); - } - if (HasIpv4) { - output.WriteRawTag(88); - output.WriteBool(Ipv4); - } - if (HasIpv6) { - output.WriteRawTag(96); - output.WriteBool(Ipv6); - } - if (HasLen) { - output.WriteRawTag(104); - output.WriteUInt64(Len); - } - if (HasIgnoreEmpty) { - output.WriteRawTag(112); - output.WriteBool(IgnoreEmpty); - } - if (_unknownFields != null) { - _unknownFields.WriteTo(ref output); - } - } - #endif - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public int CalculateSize() { - int size = 0; - if (HasConst) { - size += 1 + pb::CodedOutputStream.ComputeBytesSize(Const); - } - if (HasLen) { - size += 1 + pb::CodedOutputStream.ComputeUInt64Size(Len); - } - if (HasMinLen) { - size += 1 + pb::CodedOutputStream.ComputeUInt64Size(MinLen); - } - if (HasMaxLen) { - size += 1 + pb::CodedOutputStream.ComputeUInt64Size(MaxLen); - } - if (HasPattern) { - size += 1 + pb::CodedOutputStream.ComputeStringSize(Pattern); - } - if (HasPrefix) { - size += 1 + pb::CodedOutputStream.ComputeBytesSize(Prefix); - } - if (HasSuffix) { - size += 1 + pb::CodedOutputStream.ComputeBytesSize(Suffix); - } - if (HasContains) { - size += 1 + pb::CodedOutputStream.ComputeBytesSize(Contains); - } - size += in_.CalculateSize(_repeated_in_codec); - size += notIn_.CalculateSize(_repeated_notIn_codec); - if (HasIp) { - size += 1 + 1; - } - if (HasIpv4) { - size += 1 + 1; - } - if (HasIpv6) { - size += 1 + 1; - } - if (HasIgnoreEmpty) { - size += 1 + 1; - } - if (_unknownFields != null) { - size += _unknownFields.CalculateSize(); - } - return size; - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void MergeFrom(BytesRules other) { - if (other == null) { - return; - } - if (other.HasConst) { - Const = other.Const; - } - if (other.HasLen) { - Len = other.Len; - } - if (other.HasMinLen) { - MinLen = other.MinLen; - } - if (other.HasMaxLen) { - MaxLen = other.MaxLen; - } - if (other.HasPattern) { - Pattern = other.Pattern; - } - if (other.HasPrefix) { - Prefix = other.Prefix; - } - if (other.HasSuffix) { - Suffix = other.Suffix; - } - if (other.HasContains) { - Contains = other.Contains; - } - in_.Add(other.in_); - notIn_.Add(other.notIn_); - if (other.HasIgnoreEmpty) { - IgnoreEmpty = other.IgnoreEmpty; - } - switch (other.WellKnownCase) { - case WellKnownOneofCase.Ip: - Ip = other.Ip; - break; - case WellKnownOneofCase.Ipv4: - Ipv4 = other.Ipv4; - break; - case WellKnownOneofCase.Ipv6: - Ipv6 = other.Ipv6; - break; - } - - _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void MergeFrom(pb::CodedInputStream input) { - #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE - input.ReadRawMessage(this); - #else - uint tag; - while ((tag = input.ReadTag()) != 0) { - switch(tag) { - default: - _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input); - break; - case 10: { - Const = input.ReadBytes(); - break; - } - case 16: { - MinLen = input.ReadUInt64(); - break; - } - case 24: { - MaxLen = input.ReadUInt64(); - break; - } - case 34: { - Pattern = input.ReadString(); - break; - } - case 42: { - Prefix = input.ReadBytes(); - break; - } - case 50: { - Suffix = input.ReadBytes(); - break; - } - case 58: { - Contains = input.ReadBytes(); - break; - } - case 66: { - in_.AddEntriesFrom(input, _repeated_in_codec); - break; - } - case 74: { - notIn_.AddEntriesFrom(input, _repeated_notIn_codec); - break; - } - case 80: { - Ip = input.ReadBool(); - break; - } - case 88: { - Ipv4 = input.ReadBool(); - break; - } - case 96: { - Ipv6 = input.ReadBool(); - break; - } - case 104: { - Len = input.ReadUInt64(); - break; - } - case 112: { - IgnoreEmpty = input.ReadBool(); - break; - } - } - } - #endif - } - - #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - void pb::IBufferMessage.InternalMergeFrom(ref pb::ParseContext input) { - uint tag; - while ((tag = input.ReadTag()) != 0) { - switch(tag) { - default: - _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, ref input); - break; - case 10: { - Const = input.ReadBytes(); - break; - } - case 16: { - MinLen = input.ReadUInt64(); - break; - } - case 24: { - MaxLen = input.ReadUInt64(); - break; - } - case 34: { - Pattern = input.ReadString(); - break; - } - case 42: { - Prefix = input.ReadBytes(); - break; - } - case 50: { - Suffix = input.ReadBytes(); - break; - } - case 58: { - Contains = input.ReadBytes(); - break; - } - case 66: { - in_.AddEntriesFrom(ref input, _repeated_in_codec); - break; - } - case 74: { - notIn_.AddEntriesFrom(ref input, _repeated_notIn_codec); - break; - } - case 80: { - Ip = input.ReadBool(); - break; - } - case 88: { - Ipv4 = input.ReadBool(); - break; - } - case 96: { - Ipv6 = input.ReadBool(); - break; - } - case 104: { - Len = input.ReadUInt64(); - break; - } - case 112: { - IgnoreEmpty = input.ReadBool(); - break; - } - } - } - } - #endif - - } - - /// - /// EnumRules describe the constraints applied to enum values - /// - public sealed partial class EnumRules : pb::IMessage - #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE - , pb::IBufferMessage - #endif - { - private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new EnumRules()); - private pb::UnknownFieldSet _unknownFields; - private int _hasBits0; - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public static pb::MessageParser Parser { get { return _parser; } } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public static pbr::MessageDescriptor Descriptor { - get { return global::Validate.ValidateReflection.Descriptor.MessageTypes[16]; } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - pbr::MessageDescriptor pb::IMessage.Descriptor { - get { return Descriptor; } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public EnumRules() { - OnConstruction(); - } - - partial void OnConstruction(); - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public EnumRules(EnumRules other) : this() { - _hasBits0 = other._hasBits0; - const_ = other.const_; - definedOnly_ = other.definedOnly_; - in_ = other.in_.Clone(); - notIn_ = other.notIn_.Clone(); - _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public EnumRules Clone() { - return new EnumRules(this); - } - - /// Field number for the "const" field. - public const int ConstFieldNumber = 1; - private readonly static int ConstDefaultValue = 0; - - private int const_; - /// - /// Const specifies that this field must be exactly the specified value - /// - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public int Const { - get { if ((_hasBits0 & 1) != 0) { return const_; } else { return ConstDefaultValue; } } - set { - _hasBits0 |= 1; - const_ = value; - } - } - /// Gets whether the "const" field is set - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public bool HasConst { - get { return (_hasBits0 & 1) != 0; } - } - /// Clears the value of the "const" field - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void ClearConst() { - _hasBits0 &= ~1; - } - - /// Field number for the "defined_only" field. - public const int DefinedOnlyFieldNumber = 2; - private readonly static bool DefinedOnlyDefaultValue = false; - - private bool definedOnly_; - /// - /// DefinedOnly specifies that this field must be only one of the defined - /// values for this enum, failing on any undefined value. - /// - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public bool DefinedOnly { - get { if ((_hasBits0 & 2) != 0) { return definedOnly_; } else { return DefinedOnlyDefaultValue; } } - set { - _hasBits0 |= 2; - definedOnly_ = value; - } - } - /// Gets whether the "defined_only" field is set - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public bool HasDefinedOnly { - get { return (_hasBits0 & 2) != 0; } - } - /// Clears the value of the "defined_only" field - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void ClearDefinedOnly() { - _hasBits0 &= ~2; - } - - /// Field number for the "in" field. - public const int InFieldNumber = 3; - private static readonly pb::FieldCodec _repeated_in_codec - = pb::FieldCodec.ForInt32(24); - private readonly pbc::RepeatedField in_ = new pbc::RepeatedField(); - /// - /// In specifies that this field must be equal to one of the specified - /// values - /// - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public pbc::RepeatedField In { - get { return in_; } - } - - /// Field number for the "not_in" field. - public const int NotInFieldNumber = 4; - private static readonly pb::FieldCodec _repeated_notIn_codec - = pb::FieldCodec.ForInt32(32); - private readonly pbc::RepeatedField notIn_ = new pbc::RepeatedField(); - /// - /// NotIn specifies that this field cannot be equal to one of the specified - /// values - /// - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public pbc::RepeatedField NotIn { - get { return notIn_; } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public override bool Equals(object other) { - return Equals(other as EnumRules); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public bool Equals(EnumRules other) { - if (ReferenceEquals(other, null)) { - return false; - } - if (ReferenceEquals(other, this)) { - return true; - } - if (Const != other.Const) return false; - if (DefinedOnly != other.DefinedOnly) return false; - if(!in_.Equals(other.in_)) return false; - if(!notIn_.Equals(other.notIn_)) return false; - return Equals(_unknownFields, other._unknownFields); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public override int GetHashCode() { - int hash = 1; - if (HasConst) hash ^= Const.GetHashCode(); - if (HasDefinedOnly) hash ^= DefinedOnly.GetHashCode(); - hash ^= in_.GetHashCode(); - hash ^= notIn_.GetHashCode(); - if (_unknownFields != null) { - hash ^= _unknownFields.GetHashCode(); - } - return hash; - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public override string ToString() { - return pb::JsonFormatter.ToDiagnosticString(this); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void WriteTo(pb::CodedOutputStream output) { - #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE - output.WriteRawMessage(this); - #else - if (HasConst) { - output.WriteRawTag(8); - output.WriteInt32(Const); - } - if (HasDefinedOnly) { - output.WriteRawTag(16); - output.WriteBool(DefinedOnly); - } - in_.WriteTo(output, _repeated_in_codec); - notIn_.WriteTo(output, _repeated_notIn_codec); - if (_unknownFields != null) { - _unknownFields.WriteTo(output); - } - #endif - } - - #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - void pb::IBufferMessage.InternalWriteTo(ref pb::WriteContext output) { - if (HasConst) { - output.WriteRawTag(8); - output.WriteInt32(Const); - } - if (HasDefinedOnly) { - output.WriteRawTag(16); - output.WriteBool(DefinedOnly); - } - in_.WriteTo(ref output, _repeated_in_codec); - notIn_.WriteTo(ref output, _repeated_notIn_codec); - if (_unknownFields != null) { - _unknownFields.WriteTo(ref output); - } - } - #endif - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public int CalculateSize() { - int size = 0; - if (HasConst) { - size += 1 + pb::CodedOutputStream.ComputeInt32Size(Const); - } - if (HasDefinedOnly) { - size += 1 + 1; - } - size += in_.CalculateSize(_repeated_in_codec); - size += notIn_.CalculateSize(_repeated_notIn_codec); - if (_unknownFields != null) { - size += _unknownFields.CalculateSize(); - } - return size; - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void MergeFrom(EnumRules other) { - if (other == null) { - return; - } - if (other.HasConst) { - Const = other.Const; - } - if (other.HasDefinedOnly) { - DefinedOnly = other.DefinedOnly; - } - in_.Add(other.in_); - notIn_.Add(other.notIn_); - _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void MergeFrom(pb::CodedInputStream input) { - #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE - input.ReadRawMessage(this); - #else - uint tag; - while ((tag = input.ReadTag()) != 0) { - switch(tag) { - default: - _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input); - break; - case 8: { - Const = input.ReadInt32(); - break; - } - case 16: { - DefinedOnly = input.ReadBool(); - break; - } - case 26: - case 24: { - in_.AddEntriesFrom(input, _repeated_in_codec); - break; - } - case 34: - case 32: { - notIn_.AddEntriesFrom(input, _repeated_notIn_codec); - break; - } - } - } - #endif - } - - #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - void pb::IBufferMessage.InternalMergeFrom(ref pb::ParseContext input) { - uint tag; - while ((tag = input.ReadTag()) != 0) { - switch(tag) { - default: - _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, ref input); - break; - case 8: { - Const = input.ReadInt32(); - break; - } - case 16: { - DefinedOnly = input.ReadBool(); - break; - } - case 26: - case 24: { - in_.AddEntriesFrom(ref input, _repeated_in_codec); - break; - } - case 34: - case 32: { - notIn_.AddEntriesFrom(ref input, _repeated_notIn_codec); - break; - } - } - } - } - #endif - - } - - /// - /// MessageRules describe the constraints applied to embedded message values. - /// For message-type fields, validation is performed recursively. - /// - public sealed partial class MessageRules : pb::IMessage - #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE - , pb::IBufferMessage - #endif - { - private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new MessageRules()); - private pb::UnknownFieldSet _unknownFields; - private int _hasBits0; - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public static pb::MessageParser Parser { get { return _parser; } } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public static pbr::MessageDescriptor Descriptor { - get { return global::Validate.ValidateReflection.Descriptor.MessageTypes[17]; } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - pbr::MessageDescriptor pb::IMessage.Descriptor { - get { return Descriptor; } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public MessageRules() { - OnConstruction(); - } - - partial void OnConstruction(); - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public MessageRules(MessageRules other) : this() { - _hasBits0 = other._hasBits0; - skip_ = other.skip_; - required_ = other.required_; - _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public MessageRules Clone() { - return new MessageRules(this); - } - - /// Field number for the "skip" field. - public const int SkipFieldNumber = 1; - private readonly static bool SkipDefaultValue = false; - - private bool skip_; - /// - /// Skip specifies that the validation rules of this field should not be - /// evaluated - /// - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public bool Skip { - get { if ((_hasBits0 & 1) != 0) { return skip_; } else { return SkipDefaultValue; } } - set { - _hasBits0 |= 1; - skip_ = value; - } - } - /// Gets whether the "skip" field is set - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public bool HasSkip { - get { return (_hasBits0 & 1) != 0; } - } - /// Clears the value of the "skip" field - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void ClearSkip() { - _hasBits0 &= ~1; - } - - /// Field number for the "required" field. - public const int RequiredFieldNumber = 2; - private readonly static bool RequiredDefaultValue = false; - - private bool required_; - /// - /// Required specifies that this field must be set - /// - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public bool Required { - get { if ((_hasBits0 & 2) != 0) { return required_; } else { return RequiredDefaultValue; } } - set { - _hasBits0 |= 2; - required_ = value; - } - } - /// Gets whether the "required" field is set - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public bool HasRequired { - get { return (_hasBits0 & 2) != 0; } - } - /// Clears the value of the "required" field - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void ClearRequired() { - _hasBits0 &= ~2; - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public override bool Equals(object other) { - return Equals(other as MessageRules); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public bool Equals(MessageRules other) { - if (ReferenceEquals(other, null)) { - return false; - } - if (ReferenceEquals(other, this)) { - return true; - } - if (Skip != other.Skip) return false; - if (Required != other.Required) return false; - return Equals(_unknownFields, other._unknownFields); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public override int GetHashCode() { - int hash = 1; - if (HasSkip) hash ^= Skip.GetHashCode(); - if (HasRequired) hash ^= Required.GetHashCode(); - if (_unknownFields != null) { - hash ^= _unknownFields.GetHashCode(); - } - return hash; - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public override string ToString() { - return pb::JsonFormatter.ToDiagnosticString(this); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void WriteTo(pb::CodedOutputStream output) { - #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE - output.WriteRawMessage(this); - #else - if (HasSkip) { - output.WriteRawTag(8); - output.WriteBool(Skip); - } - if (HasRequired) { - output.WriteRawTag(16); - output.WriteBool(Required); - } - if (_unknownFields != null) { - _unknownFields.WriteTo(output); - } - #endif - } - - #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - void pb::IBufferMessage.InternalWriteTo(ref pb::WriteContext output) { - if (HasSkip) { - output.WriteRawTag(8); - output.WriteBool(Skip); - } - if (HasRequired) { - output.WriteRawTag(16); - output.WriteBool(Required); - } - if (_unknownFields != null) { - _unknownFields.WriteTo(ref output); - } - } - #endif - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public int CalculateSize() { - int size = 0; - if (HasSkip) { - size += 1 + 1; - } - if (HasRequired) { - size += 1 + 1; - } - if (_unknownFields != null) { - size += _unknownFields.CalculateSize(); - } - return size; - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void MergeFrom(MessageRules other) { - if (other == null) { - return; - } - if (other.HasSkip) { - Skip = other.Skip; - } - if (other.HasRequired) { - Required = other.Required; - } - _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void MergeFrom(pb::CodedInputStream input) { - #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE - input.ReadRawMessage(this); - #else - uint tag; - while ((tag = input.ReadTag()) != 0) { - switch(tag) { - default: - _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input); - break; - case 8: { - Skip = input.ReadBool(); - break; - } - case 16: { - Required = input.ReadBool(); - break; - } - } - } - #endif - } - - #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - void pb::IBufferMessage.InternalMergeFrom(ref pb::ParseContext input) { - uint tag; - while ((tag = input.ReadTag()) != 0) { - switch(tag) { - default: - _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, ref input); - break; - case 8: { - Skip = input.ReadBool(); - break; - } - case 16: { - Required = input.ReadBool(); - break; - } - } - } - } - #endif - - } - - /// - /// RepeatedRules describe the constraints applied to `repeated` values - /// - public sealed partial class RepeatedRules : pb::IMessage - #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE - , pb::IBufferMessage - #endif - { - private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new RepeatedRules()); - private pb::UnknownFieldSet _unknownFields; - private int _hasBits0; - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public static pb::MessageParser Parser { get { return _parser; } } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public static pbr::MessageDescriptor Descriptor { - get { return global::Validate.ValidateReflection.Descriptor.MessageTypes[18]; } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - pbr::MessageDescriptor pb::IMessage.Descriptor { - get { return Descriptor; } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public RepeatedRules() { - OnConstruction(); - } - - partial void OnConstruction(); - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public RepeatedRules(RepeatedRules other) : this() { - _hasBits0 = other._hasBits0; - minItems_ = other.minItems_; - maxItems_ = other.maxItems_; - unique_ = other.unique_; - items_ = other.items_ != null ? other.items_.Clone() : null; - ignoreEmpty_ = other.ignoreEmpty_; - _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public RepeatedRules Clone() { - return new RepeatedRules(this); - } - - /// Field number for the "min_items" field. - public const int MinItemsFieldNumber = 1; - private readonly static ulong MinItemsDefaultValue = 0UL; - - private ulong minItems_; - /// - /// MinItems specifies that this field must have the specified number of - /// items at a minimum - /// - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public ulong MinItems { - get { if ((_hasBits0 & 1) != 0) { return minItems_; } else { return MinItemsDefaultValue; } } - set { - _hasBits0 |= 1; - minItems_ = value; - } - } - /// Gets whether the "min_items" field is set - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public bool HasMinItems { - get { return (_hasBits0 & 1) != 0; } - } - /// Clears the value of the "min_items" field - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void ClearMinItems() { - _hasBits0 &= ~1; - } - - /// Field number for the "max_items" field. - public const int MaxItemsFieldNumber = 2; - private readonly static ulong MaxItemsDefaultValue = 0UL; - - private ulong maxItems_; - /// - /// MaxItems specifies that this field must have the specified number of - /// items at a maximum - /// - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public ulong MaxItems { - get { if ((_hasBits0 & 2) != 0) { return maxItems_; } else { return MaxItemsDefaultValue; } } - set { - _hasBits0 |= 2; - maxItems_ = value; - } - } - /// Gets whether the "max_items" field is set - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public bool HasMaxItems { - get { return (_hasBits0 & 2) != 0; } - } - /// Clears the value of the "max_items" field - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void ClearMaxItems() { - _hasBits0 &= ~2; - } - - /// Field number for the "unique" field. - public const int UniqueFieldNumber = 3; - private readonly static bool UniqueDefaultValue = false; - - private bool unique_; - /// - /// Unique specifies that all elements in this field must be unique. This - /// contraint is only applicable to scalar and enum types (messages are not - /// supported). - /// - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public bool Unique { - get { if ((_hasBits0 & 4) != 0) { return unique_; } else { return UniqueDefaultValue; } } - set { - _hasBits0 |= 4; - unique_ = value; - } - } - /// Gets whether the "unique" field is set - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public bool HasUnique { - get { return (_hasBits0 & 4) != 0; } - } - /// Clears the value of the "unique" field - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void ClearUnique() { - _hasBits0 &= ~4; - } - - /// Field number for the "items" field. - public const int ItemsFieldNumber = 4; - private global::Validate.FieldRules items_; - /// - /// Items specifies the contraints to be applied to each item in the field. - /// Repeated message fields will still execute validation against each item - /// unless skip is specified here. - /// - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public global::Validate.FieldRules Items { - get { return items_; } - set { - items_ = value; - } - } - - /// Field number for the "ignore_empty" field. - public const int IgnoreEmptyFieldNumber = 5; - private readonly static bool IgnoreEmptyDefaultValue = false; - - private bool ignoreEmpty_; - /// - /// IgnoreEmpty specifies that the validation rules of this field should be - /// evaluated only if the field is not empty - /// - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public bool IgnoreEmpty { - get { if ((_hasBits0 & 8) != 0) { return ignoreEmpty_; } else { return IgnoreEmptyDefaultValue; } } - set { - _hasBits0 |= 8; - ignoreEmpty_ = value; - } - } - /// Gets whether the "ignore_empty" field is set - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public bool HasIgnoreEmpty { - get { return (_hasBits0 & 8) != 0; } - } - /// Clears the value of the "ignore_empty" field - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void ClearIgnoreEmpty() { - _hasBits0 &= ~8; - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public override bool Equals(object other) { - return Equals(other as RepeatedRules); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public bool Equals(RepeatedRules other) { - if (ReferenceEquals(other, null)) { - return false; - } - if (ReferenceEquals(other, this)) { - return true; - } - if (MinItems != other.MinItems) return false; - if (MaxItems != other.MaxItems) return false; - if (Unique != other.Unique) return false; - if (!object.Equals(Items, other.Items)) return false; - if (IgnoreEmpty != other.IgnoreEmpty) return false; - return Equals(_unknownFields, other._unknownFields); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public override int GetHashCode() { - int hash = 1; - if (HasMinItems) hash ^= MinItems.GetHashCode(); - if (HasMaxItems) hash ^= MaxItems.GetHashCode(); - if (HasUnique) hash ^= Unique.GetHashCode(); - if (items_ != null) hash ^= Items.GetHashCode(); - if (HasIgnoreEmpty) hash ^= IgnoreEmpty.GetHashCode(); - if (_unknownFields != null) { - hash ^= _unknownFields.GetHashCode(); - } - return hash; - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public override string ToString() { - return pb::JsonFormatter.ToDiagnosticString(this); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void WriteTo(pb::CodedOutputStream output) { - #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE - output.WriteRawMessage(this); - #else - if (HasMinItems) { - output.WriteRawTag(8); - output.WriteUInt64(MinItems); - } - if (HasMaxItems) { - output.WriteRawTag(16); - output.WriteUInt64(MaxItems); - } - if (HasUnique) { - output.WriteRawTag(24); - output.WriteBool(Unique); - } - if (items_ != null) { - output.WriteRawTag(34); - output.WriteMessage(Items); - } - if (HasIgnoreEmpty) { - output.WriteRawTag(40); - output.WriteBool(IgnoreEmpty); - } - if (_unknownFields != null) { - _unknownFields.WriteTo(output); - } - #endif - } - - #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - void pb::IBufferMessage.InternalWriteTo(ref pb::WriteContext output) { - if (HasMinItems) { - output.WriteRawTag(8); - output.WriteUInt64(MinItems); - } - if (HasMaxItems) { - output.WriteRawTag(16); - output.WriteUInt64(MaxItems); - } - if (HasUnique) { - output.WriteRawTag(24); - output.WriteBool(Unique); - } - if (items_ != null) { - output.WriteRawTag(34); - output.WriteMessage(Items); - } - if (HasIgnoreEmpty) { - output.WriteRawTag(40); - output.WriteBool(IgnoreEmpty); - } - if (_unknownFields != null) { - _unknownFields.WriteTo(ref output); - } - } - #endif - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public int CalculateSize() { - int size = 0; - if (HasMinItems) { - size += 1 + pb::CodedOutputStream.ComputeUInt64Size(MinItems); - } - if (HasMaxItems) { - size += 1 + pb::CodedOutputStream.ComputeUInt64Size(MaxItems); - } - if (HasUnique) { - size += 1 + 1; - } - if (items_ != null) { - size += 1 + pb::CodedOutputStream.ComputeMessageSize(Items); - } - if (HasIgnoreEmpty) { - size += 1 + 1; - } - if (_unknownFields != null) { - size += _unknownFields.CalculateSize(); - } - return size; - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void MergeFrom(RepeatedRules other) { - if (other == null) { - return; - } - if (other.HasMinItems) { - MinItems = other.MinItems; - } - if (other.HasMaxItems) { - MaxItems = other.MaxItems; - } - if (other.HasUnique) { - Unique = other.Unique; - } - if (other.items_ != null) { - if (items_ == null) { - Items = new global::Validate.FieldRules(); - } - Items.MergeFrom(other.Items); - } - if (other.HasIgnoreEmpty) { - IgnoreEmpty = other.IgnoreEmpty; - } - _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void MergeFrom(pb::CodedInputStream input) { - #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE - input.ReadRawMessage(this); - #else - uint tag; - while ((tag = input.ReadTag()) != 0) { - switch(tag) { - default: - _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input); - break; - case 8: { - MinItems = input.ReadUInt64(); - break; - } - case 16: { - MaxItems = input.ReadUInt64(); - break; - } - case 24: { - Unique = input.ReadBool(); - break; - } - case 34: { - if (items_ == null) { - Items = new global::Validate.FieldRules(); - } - input.ReadMessage(Items); - break; - } - case 40: { - IgnoreEmpty = input.ReadBool(); - break; - } - } - } - #endif - } - - #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - void pb::IBufferMessage.InternalMergeFrom(ref pb::ParseContext input) { - uint tag; - while ((tag = input.ReadTag()) != 0) { - switch(tag) { - default: - _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, ref input); - break; - case 8: { - MinItems = input.ReadUInt64(); - break; - } - case 16: { - MaxItems = input.ReadUInt64(); - break; - } - case 24: { - Unique = input.ReadBool(); - break; - } - case 34: { - if (items_ == null) { - Items = new global::Validate.FieldRules(); - } - input.ReadMessage(Items); - break; - } - case 40: { - IgnoreEmpty = input.ReadBool(); - break; - } - } - } - } - #endif - - } - - /// - /// MapRules describe the constraints applied to `map` values - /// - public sealed partial class MapRules : pb::IMessage - #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE - , pb::IBufferMessage - #endif - { - private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new MapRules()); - private pb::UnknownFieldSet _unknownFields; - private int _hasBits0; - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public static pb::MessageParser Parser { get { return _parser; } } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public static pbr::MessageDescriptor Descriptor { - get { return global::Validate.ValidateReflection.Descriptor.MessageTypes[19]; } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - pbr::MessageDescriptor pb::IMessage.Descriptor { - get { return Descriptor; } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public MapRules() { - OnConstruction(); - } - - partial void OnConstruction(); - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public MapRules(MapRules other) : this() { - _hasBits0 = other._hasBits0; - minPairs_ = other.minPairs_; - maxPairs_ = other.maxPairs_; - noSparse_ = other.noSparse_; - keys_ = other.keys_ != null ? other.keys_.Clone() : null; - values_ = other.values_ != null ? other.values_.Clone() : null; - ignoreEmpty_ = other.ignoreEmpty_; - _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public MapRules Clone() { - return new MapRules(this); - } - - /// Field number for the "min_pairs" field. - public const int MinPairsFieldNumber = 1; - private readonly static ulong MinPairsDefaultValue = 0UL; - - private ulong minPairs_; - /// - /// MinPairs specifies that this field must have the specified number of - /// KVs at a minimum - /// - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public ulong MinPairs { - get { if ((_hasBits0 & 1) != 0) { return minPairs_; } else { return MinPairsDefaultValue; } } - set { - _hasBits0 |= 1; - minPairs_ = value; - } - } - /// Gets whether the "min_pairs" field is set - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public bool HasMinPairs { - get { return (_hasBits0 & 1) != 0; } - } - /// Clears the value of the "min_pairs" field - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void ClearMinPairs() { - _hasBits0 &= ~1; - } - - /// Field number for the "max_pairs" field. - public const int MaxPairsFieldNumber = 2; - private readonly static ulong MaxPairsDefaultValue = 0UL; - - private ulong maxPairs_; - /// - /// MaxPairs specifies that this field must have the specified number of - /// KVs at a maximum - /// - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public ulong MaxPairs { - get { if ((_hasBits0 & 2) != 0) { return maxPairs_; } else { return MaxPairsDefaultValue; } } - set { - _hasBits0 |= 2; - maxPairs_ = value; - } - } - /// Gets whether the "max_pairs" field is set - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public bool HasMaxPairs { - get { return (_hasBits0 & 2) != 0; } - } - /// Clears the value of the "max_pairs" field - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void ClearMaxPairs() { - _hasBits0 &= ~2; - } - - /// Field number for the "no_sparse" field. - public const int NoSparseFieldNumber = 3; - private readonly static bool NoSparseDefaultValue = false; - - private bool noSparse_; - /// - /// NoSparse specifies values in this field cannot be unset. This only - /// applies to map's with message value types. - /// - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public bool NoSparse { - get { if ((_hasBits0 & 4) != 0) { return noSparse_; } else { return NoSparseDefaultValue; } } - set { - _hasBits0 |= 4; - noSparse_ = value; - } - } - /// Gets whether the "no_sparse" field is set - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public bool HasNoSparse { - get { return (_hasBits0 & 4) != 0; } - } - /// Clears the value of the "no_sparse" field - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void ClearNoSparse() { - _hasBits0 &= ~4; - } - - /// Field number for the "keys" field. - public const int KeysFieldNumber = 4; - private global::Validate.FieldRules keys_; - /// - /// Keys specifies the constraints to be applied to each key in the field. - /// - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public global::Validate.FieldRules Keys { - get { return keys_; } - set { - keys_ = value; - } - } - - /// Field number for the "values" field. - public const int ValuesFieldNumber = 5; - private global::Validate.FieldRules values_; - /// - /// Values specifies the constraints to be applied to the value of each key - /// in the field. Message values will still have their validations evaluated - /// unless skip is specified here. - /// - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public global::Validate.FieldRules Values { - get { return values_; } - set { - values_ = value; - } - } - - /// Field number for the "ignore_empty" field. - public const int IgnoreEmptyFieldNumber = 6; - private readonly static bool IgnoreEmptyDefaultValue = false; - - private bool ignoreEmpty_; - /// - /// IgnoreEmpty specifies that the validation rules of this field should be - /// evaluated only if the field is not empty - /// - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public bool IgnoreEmpty { - get { if ((_hasBits0 & 8) != 0) { return ignoreEmpty_; } else { return IgnoreEmptyDefaultValue; } } - set { - _hasBits0 |= 8; - ignoreEmpty_ = value; - } - } - /// Gets whether the "ignore_empty" field is set - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public bool HasIgnoreEmpty { - get { return (_hasBits0 & 8) != 0; } - } - /// Clears the value of the "ignore_empty" field - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void ClearIgnoreEmpty() { - _hasBits0 &= ~8; - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public override bool Equals(object other) { - return Equals(other as MapRules); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public bool Equals(MapRules other) { - if (ReferenceEquals(other, null)) { - return false; - } - if (ReferenceEquals(other, this)) { - return true; - } - if (MinPairs != other.MinPairs) return false; - if (MaxPairs != other.MaxPairs) return false; - if (NoSparse != other.NoSparse) return false; - if (!object.Equals(Keys, other.Keys)) return false; - if (!object.Equals(Values, other.Values)) return false; - if (IgnoreEmpty != other.IgnoreEmpty) return false; - return Equals(_unknownFields, other._unknownFields); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public override int GetHashCode() { - int hash = 1; - if (HasMinPairs) hash ^= MinPairs.GetHashCode(); - if (HasMaxPairs) hash ^= MaxPairs.GetHashCode(); - if (HasNoSparse) hash ^= NoSparse.GetHashCode(); - if (keys_ != null) hash ^= Keys.GetHashCode(); - if (values_ != null) hash ^= Values.GetHashCode(); - if (HasIgnoreEmpty) hash ^= IgnoreEmpty.GetHashCode(); - if (_unknownFields != null) { - hash ^= _unknownFields.GetHashCode(); - } - return hash; - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public override string ToString() { - return pb::JsonFormatter.ToDiagnosticString(this); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void WriteTo(pb::CodedOutputStream output) { - #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE - output.WriteRawMessage(this); - #else - if (HasMinPairs) { - output.WriteRawTag(8); - output.WriteUInt64(MinPairs); - } - if (HasMaxPairs) { - output.WriteRawTag(16); - output.WriteUInt64(MaxPairs); - } - if (HasNoSparse) { - output.WriteRawTag(24); - output.WriteBool(NoSparse); - } - if (keys_ != null) { - output.WriteRawTag(34); - output.WriteMessage(Keys); - } - if (values_ != null) { - output.WriteRawTag(42); - output.WriteMessage(Values); - } - if (HasIgnoreEmpty) { - output.WriteRawTag(48); - output.WriteBool(IgnoreEmpty); - } - if (_unknownFields != null) { - _unknownFields.WriteTo(output); - } - #endif - } - - #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - void pb::IBufferMessage.InternalWriteTo(ref pb::WriteContext output) { - if (HasMinPairs) { - output.WriteRawTag(8); - output.WriteUInt64(MinPairs); - } - if (HasMaxPairs) { - output.WriteRawTag(16); - output.WriteUInt64(MaxPairs); - } - if (HasNoSparse) { - output.WriteRawTag(24); - output.WriteBool(NoSparse); - } - if (keys_ != null) { - output.WriteRawTag(34); - output.WriteMessage(Keys); - } - if (values_ != null) { - output.WriteRawTag(42); - output.WriteMessage(Values); - } - if (HasIgnoreEmpty) { - output.WriteRawTag(48); - output.WriteBool(IgnoreEmpty); - } - if (_unknownFields != null) { - _unknownFields.WriteTo(ref output); - } - } - #endif - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public int CalculateSize() { - int size = 0; - if (HasMinPairs) { - size += 1 + pb::CodedOutputStream.ComputeUInt64Size(MinPairs); - } - if (HasMaxPairs) { - size += 1 + pb::CodedOutputStream.ComputeUInt64Size(MaxPairs); - } - if (HasNoSparse) { - size += 1 + 1; - } - if (keys_ != null) { - size += 1 + pb::CodedOutputStream.ComputeMessageSize(Keys); - } - if (values_ != null) { - size += 1 + pb::CodedOutputStream.ComputeMessageSize(Values); - } - if (HasIgnoreEmpty) { - size += 1 + 1; - } - if (_unknownFields != null) { - size += _unknownFields.CalculateSize(); - } - return size; - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void MergeFrom(MapRules other) { - if (other == null) { - return; - } - if (other.HasMinPairs) { - MinPairs = other.MinPairs; - } - if (other.HasMaxPairs) { - MaxPairs = other.MaxPairs; - } - if (other.HasNoSparse) { - NoSparse = other.NoSparse; - } - if (other.keys_ != null) { - if (keys_ == null) { - Keys = new global::Validate.FieldRules(); - } - Keys.MergeFrom(other.Keys); - } - if (other.values_ != null) { - if (values_ == null) { - Values = new global::Validate.FieldRules(); - } - Values.MergeFrom(other.Values); - } - if (other.HasIgnoreEmpty) { - IgnoreEmpty = other.IgnoreEmpty; - } - _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void MergeFrom(pb::CodedInputStream input) { - #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE - input.ReadRawMessage(this); - #else - uint tag; - while ((tag = input.ReadTag()) != 0) { - switch(tag) { - default: - _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input); - break; - case 8: { - MinPairs = input.ReadUInt64(); - break; - } - case 16: { - MaxPairs = input.ReadUInt64(); - break; - } - case 24: { - NoSparse = input.ReadBool(); - break; - } - case 34: { - if (keys_ == null) { - Keys = new global::Validate.FieldRules(); - } - input.ReadMessage(Keys); - break; - } - case 42: { - if (values_ == null) { - Values = new global::Validate.FieldRules(); - } - input.ReadMessage(Values); - break; - } - case 48: { - IgnoreEmpty = input.ReadBool(); - break; - } - } - } - #endif - } - - #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - void pb::IBufferMessage.InternalMergeFrom(ref pb::ParseContext input) { - uint tag; - while ((tag = input.ReadTag()) != 0) { - switch(tag) { - default: - _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, ref input); - break; - case 8: { - MinPairs = input.ReadUInt64(); - break; - } - case 16: { - MaxPairs = input.ReadUInt64(); - break; - } - case 24: { - NoSparse = input.ReadBool(); - break; - } - case 34: { - if (keys_ == null) { - Keys = new global::Validate.FieldRules(); - } - input.ReadMessage(Keys); - break; - } - case 42: { - if (values_ == null) { - Values = new global::Validate.FieldRules(); - } - input.ReadMessage(Values); - break; - } - case 48: { - IgnoreEmpty = input.ReadBool(); - break; - } - } - } - } - #endif - - } - - /// - /// AnyRules describe constraints applied exclusively to the - /// `google.protobuf.Any` well-known type - /// - public sealed partial class AnyRules : pb::IMessage - #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE - , pb::IBufferMessage - #endif - { - private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new AnyRules()); - private pb::UnknownFieldSet _unknownFields; - private int _hasBits0; - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public static pb::MessageParser Parser { get { return _parser; } } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public static pbr::MessageDescriptor Descriptor { - get { return global::Validate.ValidateReflection.Descriptor.MessageTypes[20]; } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - pbr::MessageDescriptor pb::IMessage.Descriptor { - get { return Descriptor; } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public AnyRules() { - OnConstruction(); - } - - partial void OnConstruction(); - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public AnyRules(AnyRules other) : this() { - _hasBits0 = other._hasBits0; - required_ = other.required_; - in_ = other.in_.Clone(); - notIn_ = other.notIn_.Clone(); - _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public AnyRules Clone() { - return new AnyRules(this); - } - - /// Field number for the "required" field. - public const int RequiredFieldNumber = 1; - private readonly static bool RequiredDefaultValue = false; - - private bool required_; - /// - /// Required specifies that this field must be set - /// - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public bool Required { - get { if ((_hasBits0 & 1) != 0) { return required_; } else { return RequiredDefaultValue; } } - set { - _hasBits0 |= 1; - required_ = value; - } - } - /// Gets whether the "required" field is set - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public bool HasRequired { - get { return (_hasBits0 & 1) != 0; } - } - /// Clears the value of the "required" field - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void ClearRequired() { - _hasBits0 &= ~1; - } - - /// Field number for the "in" field. - public const int InFieldNumber = 2; - private static readonly pb::FieldCodec _repeated_in_codec - = pb::FieldCodec.ForString(18); - private readonly pbc::RepeatedField in_ = new pbc::RepeatedField(); - /// - /// In specifies that this field's `type_url` must be equal to one of the - /// specified values. - /// - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public pbc::RepeatedField In { - get { return in_; } - } - - /// Field number for the "not_in" field. - public const int NotInFieldNumber = 3; - private static readonly pb::FieldCodec _repeated_notIn_codec - = pb::FieldCodec.ForString(26); - private readonly pbc::RepeatedField notIn_ = new pbc::RepeatedField(); - /// - /// NotIn specifies that this field's `type_url` must not be equal to any of - /// the specified values. - /// - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public pbc::RepeatedField NotIn { - get { return notIn_; } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public override bool Equals(object other) { - return Equals(other as AnyRules); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public bool Equals(AnyRules other) { - if (ReferenceEquals(other, null)) { - return false; - } - if (ReferenceEquals(other, this)) { - return true; - } - if (Required != other.Required) return false; - if(!in_.Equals(other.in_)) return false; - if(!notIn_.Equals(other.notIn_)) return false; - return Equals(_unknownFields, other._unknownFields); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public override int GetHashCode() { - int hash = 1; - if (HasRequired) hash ^= Required.GetHashCode(); - hash ^= in_.GetHashCode(); - hash ^= notIn_.GetHashCode(); - if (_unknownFields != null) { - hash ^= _unknownFields.GetHashCode(); - } - return hash; - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public override string ToString() { - return pb::JsonFormatter.ToDiagnosticString(this); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void WriteTo(pb::CodedOutputStream output) { - #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE - output.WriteRawMessage(this); - #else - if (HasRequired) { - output.WriteRawTag(8); - output.WriteBool(Required); - } - in_.WriteTo(output, _repeated_in_codec); - notIn_.WriteTo(output, _repeated_notIn_codec); - if (_unknownFields != null) { - _unknownFields.WriteTo(output); - } - #endif - } - - #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - void pb::IBufferMessage.InternalWriteTo(ref pb::WriteContext output) { - if (HasRequired) { - output.WriteRawTag(8); - output.WriteBool(Required); - } - in_.WriteTo(ref output, _repeated_in_codec); - notIn_.WriteTo(ref output, _repeated_notIn_codec); - if (_unknownFields != null) { - _unknownFields.WriteTo(ref output); - } - } - #endif - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public int CalculateSize() { - int size = 0; - if (HasRequired) { - size += 1 + 1; - } - size += in_.CalculateSize(_repeated_in_codec); - size += notIn_.CalculateSize(_repeated_notIn_codec); - if (_unknownFields != null) { - size += _unknownFields.CalculateSize(); - } - return size; - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void MergeFrom(AnyRules other) { - if (other == null) { - return; - } - if (other.HasRequired) { - Required = other.Required; - } - in_.Add(other.in_); - notIn_.Add(other.notIn_); - _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void MergeFrom(pb::CodedInputStream input) { - #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE - input.ReadRawMessage(this); - #else - uint tag; - while ((tag = input.ReadTag()) != 0) { - switch(tag) { - default: - _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input); - break; - case 8: { - Required = input.ReadBool(); - break; - } - case 18: { - in_.AddEntriesFrom(input, _repeated_in_codec); - break; - } - case 26: { - notIn_.AddEntriesFrom(input, _repeated_notIn_codec); - break; - } - } - } - #endif - } - - #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - void pb::IBufferMessage.InternalMergeFrom(ref pb::ParseContext input) { - uint tag; - while ((tag = input.ReadTag()) != 0) { - switch(tag) { - default: - _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, ref input); - break; - case 8: { - Required = input.ReadBool(); - break; - } - case 18: { - in_.AddEntriesFrom(ref input, _repeated_in_codec); - break; - } - case 26: { - notIn_.AddEntriesFrom(ref input, _repeated_notIn_codec); - break; - } - } - } - } - #endif - - } - - /// - /// DurationRules describe the constraints applied exclusively to the - /// `google.protobuf.Duration` well-known type - /// - public sealed partial class DurationRules : pb::IMessage - #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE - , pb::IBufferMessage - #endif - { - private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new DurationRules()); - private pb::UnknownFieldSet _unknownFields; - private int _hasBits0; - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public static pb::MessageParser Parser { get { return _parser; } } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public static pbr::MessageDescriptor Descriptor { - get { return global::Validate.ValidateReflection.Descriptor.MessageTypes[21]; } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - pbr::MessageDescriptor pb::IMessage.Descriptor { - get { return Descriptor; } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public DurationRules() { - OnConstruction(); - } - - partial void OnConstruction(); - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public DurationRules(DurationRules other) : this() { - _hasBits0 = other._hasBits0; - required_ = other.required_; - const_ = other.const_ != null ? other.const_.Clone() : null; - lt_ = other.lt_ != null ? other.lt_.Clone() : null; - lte_ = other.lte_ != null ? other.lte_.Clone() : null; - gt_ = other.gt_ != null ? other.gt_.Clone() : null; - gte_ = other.gte_ != null ? other.gte_.Clone() : null; - in_ = other.in_.Clone(); - notIn_ = other.notIn_.Clone(); - _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public DurationRules Clone() { - return new DurationRules(this); - } - - /// Field number for the "required" field. - public const int RequiredFieldNumber = 1; - private readonly static bool RequiredDefaultValue = false; - - private bool required_; - /// - /// Required specifies that this field must be set - /// - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public bool Required { - get { if ((_hasBits0 & 1) != 0) { return required_; } else { return RequiredDefaultValue; } } - set { - _hasBits0 |= 1; - required_ = value; - } - } - /// Gets whether the "required" field is set - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public bool HasRequired { - get { return (_hasBits0 & 1) != 0; } - } - /// Clears the value of the "required" field - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void ClearRequired() { - _hasBits0 &= ~1; - } - - /// Field number for the "const" field. - public const int ConstFieldNumber = 2; - private global::Google.Protobuf.WellKnownTypes.Duration const_; - /// - /// Const specifies that this field must be exactly the specified value - /// - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public global::Google.Protobuf.WellKnownTypes.Duration Const { - get { return const_; } - set { - const_ = value; - } - } - - /// Field number for the "lt" field. - public const int LtFieldNumber = 3; - private global::Google.Protobuf.WellKnownTypes.Duration lt_; - /// - /// Lt specifies that this field must be less than the specified value, - /// exclusive - /// - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public global::Google.Protobuf.WellKnownTypes.Duration Lt { - get { return lt_; } - set { - lt_ = value; - } - } - - /// Field number for the "lte" field. - public const int LteFieldNumber = 4; - private global::Google.Protobuf.WellKnownTypes.Duration lte_; - /// - /// Lt specifies that this field must be less than the specified value, - /// inclusive - /// - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public global::Google.Protobuf.WellKnownTypes.Duration Lte { - get { return lte_; } - set { - lte_ = value; - } - } - - /// Field number for the "gt" field. - public const int GtFieldNumber = 5; - private global::Google.Protobuf.WellKnownTypes.Duration gt_; - /// - /// Gt specifies that this field must be greater than the specified value, - /// exclusive - /// - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public global::Google.Protobuf.WellKnownTypes.Duration Gt { - get { return gt_; } - set { - gt_ = value; - } - } - - /// Field number for the "gte" field. - public const int GteFieldNumber = 6; - private global::Google.Protobuf.WellKnownTypes.Duration gte_; - /// - /// Gte specifies that this field must be greater than the specified value, - /// inclusive - /// - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public global::Google.Protobuf.WellKnownTypes.Duration Gte { - get { return gte_; } - set { - gte_ = value; - } - } - - /// Field number for the "in" field. - public const int InFieldNumber = 7; - private static readonly pb::FieldCodec _repeated_in_codec - = pb::FieldCodec.ForMessage(58, global::Google.Protobuf.WellKnownTypes.Duration.Parser); - private readonly pbc::RepeatedField in_ = new pbc::RepeatedField(); - /// - /// In specifies that this field must be equal to one of the specified - /// values - /// - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public pbc::RepeatedField In { - get { return in_; } - } - - /// Field number for the "not_in" field. - public const int NotInFieldNumber = 8; - private static readonly pb::FieldCodec _repeated_notIn_codec - = pb::FieldCodec.ForMessage(66, global::Google.Protobuf.WellKnownTypes.Duration.Parser); - private readonly pbc::RepeatedField notIn_ = new pbc::RepeatedField(); - /// - /// NotIn specifies that this field cannot be equal to one of the specified - /// values - /// - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public pbc::RepeatedField NotIn { - get { return notIn_; } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public override bool Equals(object other) { - return Equals(other as DurationRules); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public bool Equals(DurationRules other) { - if (ReferenceEquals(other, null)) { - return false; - } - if (ReferenceEquals(other, this)) { - return true; - } - if (Required != other.Required) return false; - if (!object.Equals(Const, other.Const)) return false; - if (!object.Equals(Lt, other.Lt)) return false; - if (!object.Equals(Lte, other.Lte)) return false; - if (!object.Equals(Gt, other.Gt)) return false; - if (!object.Equals(Gte, other.Gte)) return false; - if(!in_.Equals(other.in_)) return false; - if(!notIn_.Equals(other.notIn_)) return false; - return Equals(_unknownFields, other._unknownFields); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public override int GetHashCode() { - int hash = 1; - if (HasRequired) hash ^= Required.GetHashCode(); - if (const_ != null) hash ^= Const.GetHashCode(); - if (lt_ != null) hash ^= Lt.GetHashCode(); - if (lte_ != null) hash ^= Lte.GetHashCode(); - if (gt_ != null) hash ^= Gt.GetHashCode(); - if (gte_ != null) hash ^= Gte.GetHashCode(); - hash ^= in_.GetHashCode(); - hash ^= notIn_.GetHashCode(); - if (_unknownFields != null) { - hash ^= _unknownFields.GetHashCode(); - } - return hash; - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public override string ToString() { - return pb::JsonFormatter.ToDiagnosticString(this); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void WriteTo(pb::CodedOutputStream output) { - #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE - output.WriteRawMessage(this); - #else - if (HasRequired) { - output.WriteRawTag(8); - output.WriteBool(Required); - } - if (const_ != null) { - output.WriteRawTag(18); - output.WriteMessage(Const); - } - if (lt_ != null) { - output.WriteRawTag(26); - output.WriteMessage(Lt); - } - if (lte_ != null) { - output.WriteRawTag(34); - output.WriteMessage(Lte); - } - if (gt_ != null) { - output.WriteRawTag(42); - output.WriteMessage(Gt); - } - if (gte_ != null) { - output.WriteRawTag(50); - output.WriteMessage(Gte); - } - in_.WriteTo(output, _repeated_in_codec); - notIn_.WriteTo(output, _repeated_notIn_codec); - if (_unknownFields != null) { - _unknownFields.WriteTo(output); - } - #endif - } - - #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - void pb::IBufferMessage.InternalWriteTo(ref pb::WriteContext output) { - if (HasRequired) { - output.WriteRawTag(8); - output.WriteBool(Required); - } - if (const_ != null) { - output.WriteRawTag(18); - output.WriteMessage(Const); - } - if (lt_ != null) { - output.WriteRawTag(26); - output.WriteMessage(Lt); - } - if (lte_ != null) { - output.WriteRawTag(34); - output.WriteMessage(Lte); - } - if (gt_ != null) { - output.WriteRawTag(42); - output.WriteMessage(Gt); - } - if (gte_ != null) { - output.WriteRawTag(50); - output.WriteMessage(Gte); - } - in_.WriteTo(ref output, _repeated_in_codec); - notIn_.WriteTo(ref output, _repeated_notIn_codec); - if (_unknownFields != null) { - _unknownFields.WriteTo(ref output); - } - } - #endif - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public int CalculateSize() { - int size = 0; - if (HasRequired) { - size += 1 + 1; - } - if (const_ != null) { - size += 1 + pb::CodedOutputStream.ComputeMessageSize(Const); - } - if (lt_ != null) { - size += 1 + pb::CodedOutputStream.ComputeMessageSize(Lt); - } - if (lte_ != null) { - size += 1 + pb::CodedOutputStream.ComputeMessageSize(Lte); - } - if (gt_ != null) { - size += 1 + pb::CodedOutputStream.ComputeMessageSize(Gt); - } - if (gte_ != null) { - size += 1 + pb::CodedOutputStream.ComputeMessageSize(Gte); - } - size += in_.CalculateSize(_repeated_in_codec); - size += notIn_.CalculateSize(_repeated_notIn_codec); - if (_unknownFields != null) { - size += _unknownFields.CalculateSize(); - } - return size; - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void MergeFrom(DurationRules other) { - if (other == null) { - return; - } - if (other.HasRequired) { - Required = other.Required; - } - if (other.const_ != null) { - if (const_ == null) { - Const = new global::Google.Protobuf.WellKnownTypes.Duration(); - } - Const.MergeFrom(other.Const); - } - if (other.lt_ != null) { - if (lt_ == null) { - Lt = new global::Google.Protobuf.WellKnownTypes.Duration(); - } - Lt.MergeFrom(other.Lt); - } - if (other.lte_ != null) { - if (lte_ == null) { - Lte = new global::Google.Protobuf.WellKnownTypes.Duration(); - } - Lte.MergeFrom(other.Lte); - } - if (other.gt_ != null) { - if (gt_ == null) { - Gt = new global::Google.Protobuf.WellKnownTypes.Duration(); - } - Gt.MergeFrom(other.Gt); - } - if (other.gte_ != null) { - if (gte_ == null) { - Gte = new global::Google.Protobuf.WellKnownTypes.Duration(); - } - Gte.MergeFrom(other.Gte); - } - in_.Add(other.in_); - notIn_.Add(other.notIn_); - _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void MergeFrom(pb::CodedInputStream input) { - #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE - input.ReadRawMessage(this); - #else - uint tag; - while ((tag = input.ReadTag()) != 0) { - switch(tag) { - default: - _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input); - break; - case 8: { - Required = input.ReadBool(); - break; - } - case 18: { - if (const_ == null) { - Const = new global::Google.Protobuf.WellKnownTypes.Duration(); - } - input.ReadMessage(Const); - break; - } - case 26: { - if (lt_ == null) { - Lt = new global::Google.Protobuf.WellKnownTypes.Duration(); - } - input.ReadMessage(Lt); - break; - } - case 34: { - if (lte_ == null) { - Lte = new global::Google.Protobuf.WellKnownTypes.Duration(); - } - input.ReadMessage(Lte); - break; - } - case 42: { - if (gt_ == null) { - Gt = new global::Google.Protobuf.WellKnownTypes.Duration(); - } - input.ReadMessage(Gt); - break; - } - case 50: { - if (gte_ == null) { - Gte = new global::Google.Protobuf.WellKnownTypes.Duration(); - } - input.ReadMessage(Gte); - break; - } - case 58: { - in_.AddEntriesFrom(input, _repeated_in_codec); - break; - } - case 66: { - notIn_.AddEntriesFrom(input, _repeated_notIn_codec); - break; - } - } - } - #endif - } - - #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - void pb::IBufferMessage.InternalMergeFrom(ref pb::ParseContext input) { - uint tag; - while ((tag = input.ReadTag()) != 0) { - switch(tag) { - default: - _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, ref input); - break; - case 8: { - Required = input.ReadBool(); - break; - } - case 18: { - if (const_ == null) { - Const = new global::Google.Protobuf.WellKnownTypes.Duration(); - } - input.ReadMessage(Const); - break; - } - case 26: { - if (lt_ == null) { - Lt = new global::Google.Protobuf.WellKnownTypes.Duration(); - } - input.ReadMessage(Lt); - break; - } - case 34: { - if (lte_ == null) { - Lte = new global::Google.Protobuf.WellKnownTypes.Duration(); - } - input.ReadMessage(Lte); - break; - } - case 42: { - if (gt_ == null) { - Gt = new global::Google.Protobuf.WellKnownTypes.Duration(); - } - input.ReadMessage(Gt); - break; - } - case 50: { - if (gte_ == null) { - Gte = new global::Google.Protobuf.WellKnownTypes.Duration(); - } - input.ReadMessage(Gte); - break; - } - case 58: { - in_.AddEntriesFrom(ref input, _repeated_in_codec); - break; - } - case 66: { - notIn_.AddEntriesFrom(ref input, _repeated_notIn_codec); - break; - } - } - } - } - #endif - - } - - /// - /// TimestampRules describe the constraints applied exclusively to the - /// `google.protobuf.Timestamp` well-known type - /// - public sealed partial class TimestampRules : pb::IMessage - #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE - , pb::IBufferMessage - #endif - { - private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new TimestampRules()); - private pb::UnknownFieldSet _unknownFields; - private int _hasBits0; - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public static pb::MessageParser Parser { get { return _parser; } } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public static pbr::MessageDescriptor Descriptor { - get { return global::Validate.ValidateReflection.Descriptor.MessageTypes[22]; } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - pbr::MessageDescriptor pb::IMessage.Descriptor { - get { return Descriptor; } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public TimestampRules() { - OnConstruction(); - } - - partial void OnConstruction(); - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public TimestampRules(TimestampRules other) : this() { - _hasBits0 = other._hasBits0; - required_ = other.required_; - const_ = other.const_ != null ? other.const_.Clone() : null; - lt_ = other.lt_ != null ? other.lt_.Clone() : null; - lte_ = other.lte_ != null ? other.lte_.Clone() : null; - gt_ = other.gt_ != null ? other.gt_.Clone() : null; - gte_ = other.gte_ != null ? other.gte_.Clone() : null; - ltNow_ = other.ltNow_; - gtNow_ = other.gtNow_; - within_ = other.within_ != null ? other.within_.Clone() : null; - _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public TimestampRules Clone() { - return new TimestampRules(this); - } - - /// Field number for the "required" field. - public const int RequiredFieldNumber = 1; - private readonly static bool RequiredDefaultValue = false; - - private bool required_; - /// - /// Required specifies that this field must be set - /// - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public bool Required { - get { if ((_hasBits0 & 1) != 0) { return required_; } else { return RequiredDefaultValue; } } - set { - _hasBits0 |= 1; - required_ = value; - } - } - /// Gets whether the "required" field is set - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public bool HasRequired { - get { return (_hasBits0 & 1) != 0; } - } - /// Clears the value of the "required" field - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void ClearRequired() { - _hasBits0 &= ~1; - } - - /// Field number for the "const" field. - public const int ConstFieldNumber = 2; - private global::Google.Protobuf.WellKnownTypes.Timestamp const_; - /// - /// Const specifies that this field must be exactly the specified value - /// - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public global::Google.Protobuf.WellKnownTypes.Timestamp Const { - get { return const_; } - set { - const_ = value; - } - } - - /// Field number for the "lt" field. - public const int LtFieldNumber = 3; - private global::Google.Protobuf.WellKnownTypes.Timestamp lt_; - /// - /// Lt specifies that this field must be less than the specified value, - /// exclusive - /// - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public global::Google.Protobuf.WellKnownTypes.Timestamp Lt { - get { return lt_; } - set { - lt_ = value; - } - } - - /// Field number for the "lte" field. - public const int LteFieldNumber = 4; - private global::Google.Protobuf.WellKnownTypes.Timestamp lte_; - /// - /// Lte specifies that this field must be less than the specified value, - /// inclusive - /// - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public global::Google.Protobuf.WellKnownTypes.Timestamp Lte { - get { return lte_; } - set { - lte_ = value; - } - } - - /// Field number for the "gt" field. - public const int GtFieldNumber = 5; - private global::Google.Protobuf.WellKnownTypes.Timestamp gt_; - /// - /// Gt specifies that this field must be greater than the specified value, - /// exclusive - /// - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public global::Google.Protobuf.WellKnownTypes.Timestamp Gt { - get { return gt_; } - set { - gt_ = value; - } - } - - /// Field number for the "gte" field. - public const int GteFieldNumber = 6; - private global::Google.Protobuf.WellKnownTypes.Timestamp gte_; - /// - /// Gte specifies that this field must be greater than the specified value, - /// inclusive - /// - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public global::Google.Protobuf.WellKnownTypes.Timestamp Gte { - get { return gte_; } - set { - gte_ = value; - } - } - - /// Field number for the "lt_now" field. - public const int LtNowFieldNumber = 7; - private readonly static bool LtNowDefaultValue = false; - - private bool ltNow_; - /// - /// LtNow specifies that this must be less than the current time. LtNow - /// can only be used with the Within rule. - /// - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public bool LtNow { - get { if ((_hasBits0 & 2) != 0) { return ltNow_; } else { return LtNowDefaultValue; } } - set { - _hasBits0 |= 2; - ltNow_ = value; - } - } - /// Gets whether the "lt_now" field is set - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public bool HasLtNow { - get { return (_hasBits0 & 2) != 0; } - } - /// Clears the value of the "lt_now" field - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void ClearLtNow() { - _hasBits0 &= ~2; - } - - /// Field number for the "gt_now" field. - public const int GtNowFieldNumber = 8; - private readonly static bool GtNowDefaultValue = false; - - private bool gtNow_; - /// - /// GtNow specifies that this must be greater than the current time. GtNow - /// can only be used with the Within rule. - /// - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public bool GtNow { - get { if ((_hasBits0 & 4) != 0) { return gtNow_; } else { return GtNowDefaultValue; } } - set { - _hasBits0 |= 4; - gtNow_ = value; - } - } - /// Gets whether the "gt_now" field is set - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public bool HasGtNow { - get { return (_hasBits0 & 4) != 0; } - } - /// Clears the value of the "gt_now" field - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void ClearGtNow() { - _hasBits0 &= ~4; - } - - /// Field number for the "within" field. - public const int WithinFieldNumber = 9; - private global::Google.Protobuf.WellKnownTypes.Duration within_; - /// - /// Within specifies that this field must be within this duration of the - /// current time. This constraint can be used alone or with the LtNow and - /// GtNow rules. - /// - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public global::Google.Protobuf.WellKnownTypes.Duration Within { - get { return within_; } - set { - within_ = value; - } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public override bool Equals(object other) { - return Equals(other as TimestampRules); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public bool Equals(TimestampRules other) { - if (ReferenceEquals(other, null)) { - return false; - } - if (ReferenceEquals(other, this)) { - return true; - } - if (Required != other.Required) return false; - if (!object.Equals(Const, other.Const)) return false; - if (!object.Equals(Lt, other.Lt)) return false; - if (!object.Equals(Lte, other.Lte)) return false; - if (!object.Equals(Gt, other.Gt)) return false; - if (!object.Equals(Gte, other.Gte)) return false; - if (LtNow != other.LtNow) return false; - if (GtNow != other.GtNow) return false; - if (!object.Equals(Within, other.Within)) return false; - return Equals(_unknownFields, other._unknownFields); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public override int GetHashCode() { - int hash = 1; - if (HasRequired) hash ^= Required.GetHashCode(); - if (const_ != null) hash ^= Const.GetHashCode(); - if (lt_ != null) hash ^= Lt.GetHashCode(); - if (lte_ != null) hash ^= Lte.GetHashCode(); - if (gt_ != null) hash ^= Gt.GetHashCode(); - if (gte_ != null) hash ^= Gte.GetHashCode(); - if (HasLtNow) hash ^= LtNow.GetHashCode(); - if (HasGtNow) hash ^= GtNow.GetHashCode(); - if (within_ != null) hash ^= Within.GetHashCode(); - if (_unknownFields != null) { - hash ^= _unknownFields.GetHashCode(); - } - return hash; - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public override string ToString() { - return pb::JsonFormatter.ToDiagnosticString(this); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void WriteTo(pb::CodedOutputStream output) { - #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE - output.WriteRawMessage(this); - #else - if (HasRequired) { - output.WriteRawTag(8); - output.WriteBool(Required); - } - if (const_ != null) { - output.WriteRawTag(18); - output.WriteMessage(Const); - } - if (lt_ != null) { - output.WriteRawTag(26); - output.WriteMessage(Lt); - } - if (lte_ != null) { - output.WriteRawTag(34); - output.WriteMessage(Lte); - } - if (gt_ != null) { - output.WriteRawTag(42); - output.WriteMessage(Gt); - } - if (gte_ != null) { - output.WriteRawTag(50); - output.WriteMessage(Gte); - } - if (HasLtNow) { - output.WriteRawTag(56); - output.WriteBool(LtNow); - } - if (HasGtNow) { - output.WriteRawTag(64); - output.WriteBool(GtNow); - } - if (within_ != null) { - output.WriteRawTag(74); - output.WriteMessage(Within); - } - if (_unknownFields != null) { - _unknownFields.WriteTo(output); - } - #endif - } - - #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - void pb::IBufferMessage.InternalWriteTo(ref pb::WriteContext output) { - if (HasRequired) { - output.WriteRawTag(8); - output.WriteBool(Required); - } - if (const_ != null) { - output.WriteRawTag(18); - output.WriteMessage(Const); - } - if (lt_ != null) { - output.WriteRawTag(26); - output.WriteMessage(Lt); - } - if (lte_ != null) { - output.WriteRawTag(34); - output.WriteMessage(Lte); - } - if (gt_ != null) { - output.WriteRawTag(42); - output.WriteMessage(Gt); - } - if (gte_ != null) { - output.WriteRawTag(50); - output.WriteMessage(Gte); - } - if (HasLtNow) { - output.WriteRawTag(56); - output.WriteBool(LtNow); - } - if (HasGtNow) { - output.WriteRawTag(64); - output.WriteBool(GtNow); - } - if (within_ != null) { - output.WriteRawTag(74); - output.WriteMessage(Within); - } - if (_unknownFields != null) { - _unknownFields.WriteTo(ref output); - } - } - #endif - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public int CalculateSize() { - int size = 0; - if (HasRequired) { - size += 1 + 1; - } - if (const_ != null) { - size += 1 + pb::CodedOutputStream.ComputeMessageSize(Const); - } - if (lt_ != null) { - size += 1 + pb::CodedOutputStream.ComputeMessageSize(Lt); - } - if (lte_ != null) { - size += 1 + pb::CodedOutputStream.ComputeMessageSize(Lte); - } - if (gt_ != null) { - size += 1 + pb::CodedOutputStream.ComputeMessageSize(Gt); - } - if (gte_ != null) { - size += 1 + pb::CodedOutputStream.ComputeMessageSize(Gte); - } - if (HasLtNow) { - size += 1 + 1; - } - if (HasGtNow) { - size += 1 + 1; - } - if (within_ != null) { - size += 1 + pb::CodedOutputStream.ComputeMessageSize(Within); - } - if (_unknownFields != null) { - size += _unknownFields.CalculateSize(); - } - return size; - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void MergeFrom(TimestampRules other) { - if (other == null) { - return; - } - if (other.HasRequired) { - Required = other.Required; - } - if (other.const_ != null) { - if (const_ == null) { - Const = new global::Google.Protobuf.WellKnownTypes.Timestamp(); - } - Const.MergeFrom(other.Const); - } - if (other.lt_ != null) { - if (lt_ == null) { - Lt = new global::Google.Protobuf.WellKnownTypes.Timestamp(); - } - Lt.MergeFrom(other.Lt); - } - if (other.lte_ != null) { - if (lte_ == null) { - Lte = new global::Google.Protobuf.WellKnownTypes.Timestamp(); - } - Lte.MergeFrom(other.Lte); - } - if (other.gt_ != null) { - if (gt_ == null) { - Gt = new global::Google.Protobuf.WellKnownTypes.Timestamp(); - } - Gt.MergeFrom(other.Gt); - } - if (other.gte_ != null) { - if (gte_ == null) { - Gte = new global::Google.Protobuf.WellKnownTypes.Timestamp(); - } - Gte.MergeFrom(other.Gte); - } - if (other.HasLtNow) { - LtNow = other.LtNow; - } - if (other.HasGtNow) { - GtNow = other.GtNow; - } - if (other.within_ != null) { - if (within_ == null) { - Within = new global::Google.Protobuf.WellKnownTypes.Duration(); - } - Within.MergeFrom(other.Within); - } - _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void MergeFrom(pb::CodedInputStream input) { - #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE - input.ReadRawMessage(this); - #else - uint tag; - while ((tag = input.ReadTag()) != 0) { - switch(tag) { - default: - _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input); - break; - case 8: { - Required = input.ReadBool(); - break; - } - case 18: { - if (const_ == null) { - Const = new global::Google.Protobuf.WellKnownTypes.Timestamp(); - } - input.ReadMessage(Const); - break; - } - case 26: { - if (lt_ == null) { - Lt = new global::Google.Protobuf.WellKnownTypes.Timestamp(); - } - input.ReadMessage(Lt); - break; - } - case 34: { - if (lte_ == null) { - Lte = new global::Google.Protobuf.WellKnownTypes.Timestamp(); - } - input.ReadMessage(Lte); - break; - } - case 42: { - if (gt_ == null) { - Gt = new global::Google.Protobuf.WellKnownTypes.Timestamp(); - } - input.ReadMessage(Gt); - break; - } - case 50: { - if (gte_ == null) { - Gte = new global::Google.Protobuf.WellKnownTypes.Timestamp(); - } - input.ReadMessage(Gte); - break; - } - case 56: { - LtNow = input.ReadBool(); - break; - } - case 64: { - GtNow = input.ReadBool(); - break; - } - case 74: { - if (within_ == null) { - Within = new global::Google.Protobuf.WellKnownTypes.Duration(); - } - input.ReadMessage(Within); - break; - } - } - } - #endif - } - - #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - void pb::IBufferMessage.InternalMergeFrom(ref pb::ParseContext input) { - uint tag; - while ((tag = input.ReadTag()) != 0) { - switch(tag) { - default: - _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, ref input); - break; - case 8: { - Required = input.ReadBool(); - break; - } - case 18: { - if (const_ == null) { - Const = new global::Google.Protobuf.WellKnownTypes.Timestamp(); - } - input.ReadMessage(Const); - break; - } - case 26: { - if (lt_ == null) { - Lt = new global::Google.Protobuf.WellKnownTypes.Timestamp(); - } - input.ReadMessage(Lt); - break; - } - case 34: { - if (lte_ == null) { - Lte = new global::Google.Protobuf.WellKnownTypes.Timestamp(); - } - input.ReadMessage(Lte); - break; - } - case 42: { - if (gt_ == null) { - Gt = new global::Google.Protobuf.WellKnownTypes.Timestamp(); - } - input.ReadMessage(Gt); - break; - } - case 50: { - if (gte_ == null) { - Gte = new global::Google.Protobuf.WellKnownTypes.Timestamp(); - } - input.ReadMessage(Gte); - break; - } - case 56: { - LtNow = input.ReadBool(); - break; - } - case 64: { - GtNow = input.ReadBool(); - break; - } - case 74: { - if (within_ == null) { - Within = new global::Google.Protobuf.WellKnownTypes.Duration(); - } - input.ReadMessage(Within); - break; - } - } - } - } - #endif - - } - - #endregion - -} - -#endregion Designer generated code diff --git a/src/Nitric.Sdk/Function/BucketNotificationContext.cs b/src/Nitric.Sdk/Service/BucketNotificationContext.cs similarity index 100% rename from src/Nitric.Sdk/Function/BucketNotificationContext.cs rename to src/Nitric.Sdk/Service/BucketNotificationContext.cs diff --git a/src/Nitric.Sdk/Function/EventContext.cs b/src/Nitric.Sdk/Service/EventContext.cs similarity index 100% rename from src/Nitric.Sdk/Function/EventContext.cs rename to src/Nitric.Sdk/Service/EventContext.cs diff --git a/src/Nitric.Sdk/Function/Faas.cs b/src/Nitric.Sdk/Service/Faas.cs similarity index 100% rename from src/Nitric.Sdk/Function/Faas.cs rename to src/Nitric.Sdk/Service/Faas.cs diff --git a/src/Nitric.Sdk/Function/Frequency.cs b/src/Nitric.Sdk/Service/Frequency.cs similarity index 100% rename from src/Nitric.Sdk/Function/Frequency.cs rename to src/Nitric.Sdk/Service/Frequency.cs diff --git a/src/Nitric.Sdk/Function/HttpContext.cs b/src/Nitric.Sdk/Service/HttpContext.cs similarity index 100% rename from src/Nitric.Sdk/Function/HttpContext.cs rename to src/Nitric.Sdk/Service/HttpContext.cs diff --git a/src/Nitric.Sdk/Function/Middleware.cs b/src/Nitric.Sdk/Service/Middleware.cs similarity index 100% rename from src/Nitric.Sdk/Function/Middleware.cs rename to src/Nitric.Sdk/Service/Middleware.cs diff --git a/src/Nitric.Sdk/Function/TriggerContext.cs b/src/Nitric.Sdk/Service/TriggerContext.cs similarity index 100% rename from src/Nitric.Sdk/Function/TriggerContext.cs rename to src/Nitric.Sdk/Service/TriggerContext.cs diff --git a/src/Nitric.Sdk/Function/WebsocketContext.cs b/src/Nitric.Sdk/Service/WebsocketContext.cs similarity index 100% rename from src/Nitric.Sdk/Function/WebsocketContext.cs rename to src/Nitric.Sdk/Service/WebsocketContext.cs diff --git a/src/Nitric.Sdk/Storage/Bucket.cs b/src/Nitric.Sdk/Storage/Bucket.cs index a9d79f2..447020d 100644 --- a/src/Nitric.Sdk/Storage/Bucket.cs +++ b/src/Nitric.Sdk/Storage/Bucket.cs @@ -15,7 +15,7 @@ using System.Collections.Generic; using Nitric.Proto.Storage.v1; using Nitric.Sdk.Function; -using ProtoFile = Nitric.Proto.Storage.v1.File; +using ProtoFile = Nitric.Proto.Storage.v1.Object; namespace Nitric.Sdk.Storage diff --git a/src/Nitric.Sdk/Storage/File.cs b/src/Nitric.Sdk/Storage/File.cs index 37aaff2..1afb957 100644 --- a/src/Nitric.Sdk/Storage/File.cs +++ b/src/Nitric.Sdk/Storage/File.cs @@ -18,7 +18,7 @@ using Nitric.Proto.Storage.v1; using Nitric.Sdk.Common; using Nitric.Sdk.Function; -using ProtoFile = Nitric.Proto.Storage.v1.File; +using ProtoFile = Nitric.Proto.Storage.v1.Object; namespace Nitric.Sdk.Storage { diff --git a/src/Nitric.Sdk/Event/Event.cs b/src/Nitric.Sdk/Topic/Event.cs.old similarity index 100% rename from src/Nitric.Sdk/Event/Event.cs rename to src/Nitric.Sdk/Topic/Event.cs.old diff --git a/src/Nitric.Sdk/Event/EventsClient.cs b/src/Nitric.Sdk/Topic/EventsClient.cs similarity index 90% rename from src/Nitric.Sdk/Event/EventsClient.cs rename to src/Nitric.Sdk/Topic/EventsClient.cs index 10526ff..4a5ee42 100644 --- a/src/Nitric.Sdk/Event/EventsClient.cs +++ b/src/Nitric.Sdk/Topic/EventsClient.cs @@ -16,12 +16,12 @@ using System.Collections.Generic; using System.Linq; using Nitric.Sdk.Common; -using NitricEvent = Nitric.Proto.Event.v1.NitricEvent; -using Nitric.Proto.Event.v1; -using GrpcClient = Nitric.Proto.Event.v1.EventService.EventServiceClient; -using TopicClient = Nitric.Proto.Event.v1.TopicService.TopicServiceClient; +using NitricEvent = Nitric.Proto.Topics.v1.NitricEvent; +using Nitric.Proto.Topics.v1; +using Nitric.Proto.Topics.v1.Topics.TopicsClient; +using Nitric.Proto.Topics.v1.Topics.SubscriberClient; -namespace Nitric.Sdk.Event +namespace Nitric.Sdk.Topic { /// /// Events service client. diff --git a/src/Nitric.Sdk/Event/Topic.cs b/src/Nitric.Sdk/Topic/Topic.cs similarity index 100% rename from src/Nitric.Sdk/Event/Topic.cs rename to src/Nitric.Sdk/Topic/Topic.cs From 625b191e21cc93c819c71f2f1602f34fae6852e8 Mon Sep 17 00:00:00 2001 From: Tim Holm Date: Thu, 15 Feb 2024 08:58:45 +1100 Subject: [PATCH 02/34] wip resources namespace. --- nitric/proto/deployments/v1/deployments.proto | 7 +- .../proto/deployments/v1/Deployments.cs | 221 ++++++++++-------- src/Nitric.Sdk/Resource/ApiResource.cs | 46 ++-- src/Nitric.Sdk/Resource/BaseResource.cs | 6 +- src/Nitric.Sdk/Resource/BucketResource.cs | 8 +- src/Nitric.Sdk/Resource/CollectionResource.cs | 2 +- src/Nitric.Sdk/Resource/QueueResource.cs | 8 +- src/Nitric.Sdk/Resource/SecretResource.cs | 8 +- src/Nitric.Sdk/Resource/SecureResource.cs | 12 +- src/Nitric.Sdk/Resource/TopicResource.cs | 10 +- src/Nitric.Sdk/Resource/WebsocketResource.cs | 10 +- src/Nitric.Sdk/Websocket/WebsocketClient.cs | 2 +- 12 files changed, 187 insertions(+), 153 deletions(-) diff --git a/nitric/proto/deployments/v1/deployments.proto b/nitric/proto/deployments/v1/deployments.proto index d98dcc9..f2edc96 100644 --- a/nitric/proto/deployments/v1/deployments.proto +++ b/nitric/proto/deployments/v1/deployments.proto @@ -104,8 +104,11 @@ message UpResult { // Indicate the success status bool success = 1; - // Simple formatted string output as result - string details = 2; + + oneof content { + // Simple text output as result + string Text = 2; + } } message DeploymentDownRequest { diff --git a/src/Nitric.Sdk/Proto/nitric/proto/deployments/v1/Deployments.cs b/src/Nitric.Sdk/Proto/nitric/proto/deployments/v1/Deployments.cs index 115a28b..83a4108 100644 --- a/src/Nitric.Sdk/Proto/nitric/proto/deployments/v1/Deployments.cs +++ b/src/Nitric.Sdk/Proto/nitric/proto/deployments/v1/Deployments.cs @@ -40,88 +40,89 @@ static DeploymentsReflection() { "b24YAyABKA4yNS5uaXRyaWMucHJvdG8uZGVwbG95bWVudHMudjEuUmVzb3Vy", "Y2VEZXBsb3ltZW50QWN0aW9uEkUKBnN0YXR1cxgEIAEoDjI1Lm5pdHJpYy5w", "cm90by5kZXBsb3ltZW50cy52MS5SZXNvdXJjZURlcGxveW1lbnRTdGF0dXMS", - "FAoMc3ViX3Jlc291cmNlGAUgASgJEg8KB21lc3NhZ2UYBiABKAkiLAoIVXBS", - "ZXN1bHQSDwoHc3VjY2VzcxgBIAEoCBIPCgdkZXRhaWxzGAIgASgJIlkKFURl", - "cGxveW1lbnREb3duUmVxdWVzdBIrCgphdHRyaWJ1dGVzGAEgASgLMhcuZ29v", - "Z2xlLnByb3RvYnVmLlN0cnVjdBITCgtpbnRlcmFjdGl2ZRgCIAEoCCKtAQoT", - "RGVwbG95bWVudERvd25FdmVudBIRCgdtZXNzYWdlGAEgASgJSAASOQoGcmVz", - "dWx0GAIgASgLMicubml0cmljLnByb3RvLmRlcGxveW1lbnRzLnYxLkRvd25S", - "ZXN1bHRIABI9CgZ1cGRhdGUYAyABKAsyKy5uaXRyaWMucHJvdG8uZGVwbG95", - "bWVudHMudjEuUmVzb3VyY2VVcGRhdGVIAEIJCgdjb250ZW50IgwKCkRvd25S", - "ZXN1bHQiGgoLSW1hZ2VTb3VyY2USCwoDdXJpGAEgASgJIv4BCgdTZXJ2aWNl", - "EjkKBWltYWdlGAEgASgLMigubml0cmljLnByb3RvLmRlcGxveW1lbnRzLnYx", - "LkltYWdlU291cmNlSAASDwoHd29ya2VycxgKIAEoBRITCgd0aW1lb3V0GAsg", - "ASgFQgIYARISCgZtZW1vcnkYDCABKAVCAhgBEgwKBHR5cGUYDSABKAkSOgoD", - "ZW52GA4gAygLMi0ubml0cmljLnByb3RvLmRlcGxveW1lbnRzLnYxLlNlcnZp", - "Y2UuRW52RW50cnkaKgoIRW52RW50cnkSCwoDa2V5GAEgASgJEg0KBXZhbHVl", - "GAIgASgJOgI4AUIICgZzb3VyY2UiSAoGQnVja2V0Ej4KCWxpc3RlbmVycxgB", - "IAMoCzIrLm5pdHJpYy5wcm90by5kZXBsb3ltZW50cy52MS5CdWNrZXRMaXN0", - "ZW5lciJrCg5CdWNrZXRMaXN0ZW5lchI8CgZjb25maWcYASABKAsyLC5uaXRy", - "aWMucHJvdG8uc3RvcmFnZS52MS5SZWdpc3RyYXRpb25SZXF1ZXN0EhEKB3Nl", - "cnZpY2UYAiABKAlIAEIICgZ0YXJnZXQiTwoFVG9waWMSRgoNc3Vic2NyaXB0", - "aW9ucxgBIAMoCzIvLm5pdHJpYy5wcm90by5kZXBsb3ltZW50cy52MS5TdWJz", - "Y3JpcHRpb25UYXJnZXQiBwoFUXVldWUiDwoNS2V5VmFsdWVTdG9yZSIICgZT", - "ZWNyZXQiMQoSU3Vic2NyaXB0aW9uVGFyZ2V0EhEKB3NlcnZpY2UYASABKAlI", - "AEIICgZ0YXJnZXQiVAoRVG9waWNTdWJzY3JpcHRpb24SPwoGdGFyZ2V0GAEg", - "ASgLMi8ubml0cmljLnByb3RvLmRlcGxveW1lbnRzLnYxLlN1YnNjcmlwdGlv", - "blRhcmdldCIpCgpIdHRwVGFyZ2V0EhEKB3NlcnZpY2UYASABKAlIAEIICgZ0", - "YXJnZXQiPwoESHR0cBI3CgZ0YXJnZXQYASABKAsyJy5uaXRyaWMucHJvdG8u", - "ZGVwbG95bWVudHMudjEuSHR0cFRhcmdldCIkCgNBcGkSEQoHb3BlbmFwaRgB", - "IAEoCUgAQgoKCGRvY3VtZW50IuABCglXZWJzb2NrZXQSRAoOY29ubmVjdF90", - "YXJnZXQYASABKAsyLC5uaXRyaWMucHJvdG8uZGVwbG95bWVudHMudjEuV2Vi", - "c29ja2V0VGFyZ2V0EkcKEWRpc2Nvbm5lY3RfdGFyZ2V0GAIgASgLMiwubml0", - "cmljLnByb3RvLmRlcGxveW1lbnRzLnYxLldlYnNvY2tldFRhcmdldBJECg5t", - "ZXNzYWdlX3RhcmdldBgDIAEoCzIsLm5pdHJpYy5wcm90by5kZXBsb3ltZW50", - "cy52MS5XZWJzb2NrZXRUYXJnZXQiLgoPV2Vic29ja2V0VGFyZ2V0EhEKB3Nl", - "cnZpY2UYASABKAlIAEIICgZ0YXJnZXQiLQoOU2NoZWR1bGVUYXJnZXQSEQoH", - "c2VydmljZRgBIAEoCUgAQggKBnRhcmdldCLKAQoIU2NoZWR1bGUSOwoGdGFy", - "Z2V0GAEgASgLMisubml0cmljLnByb3RvLmRlcGxveW1lbnRzLnYxLlNjaGVk", - "dWxlVGFyZ2V0EjsKBWV2ZXJ5GAogASgLMioubml0cmljLnByb3RvLmRlcGxv", - "eW1lbnRzLnYxLlNjaGVkdWxlRXZlcnlIABI5CgRjcm9uGAsgASgLMikubml0", - "cmljLnByb3RvLmRlcGxveW1lbnRzLnYxLlNjaGVkdWxlQ3JvbkgAQgkKB2Nh", - "ZGVuY2UiHQoNU2NoZWR1bGVFdmVyeRIMCgRyYXRlGAEgASgJIiIKDFNjaGVk", - "dWxlQ3JvbhISCgpleHByZXNzaW9uGAEgASgJIroFCghSZXNvdXJjZRI5CgJp", - "ZBgBIAEoCzItLm5pdHJpYy5wcm90by5yZXNvdXJjZXMudjEuUmVzb3VyY2VJ", - "ZGVudGlmaWVyEjcKB3NlcnZpY2UYCiABKAsyJC5uaXRyaWMucHJvdG8uZGVw", - "bG95bWVudHMudjEuU2VydmljZUgAEjUKBmJ1Y2tldBgLIAEoCzIjLm5pdHJp", - "Yy5wcm90by5kZXBsb3ltZW50cy52MS5CdWNrZXRIABIzCgV0b3BpYxgMIAEo", - "CzIiLm5pdHJpYy5wcm90by5kZXBsb3ltZW50cy52MS5Ub3BpY0gAEi8KA2Fw", - "aRgNIAEoCzIgLm5pdHJpYy5wcm90by5kZXBsb3ltZW50cy52MS5BcGlIABI1", - "CgZwb2xpY3kYDiABKAsyIy5uaXRyaWMucHJvdG8uZGVwbG95bWVudHMudjEu", - "UG9saWN5SAASOQoIc2NoZWR1bGUYDyABKAsyJS5uaXRyaWMucHJvdG8uZGVw", - "bG95bWVudHMudjEuU2NoZWR1bGVIABJFCg9rZXlfdmFsdWVfc3RvcmUYECAB", - "KAsyKi5uaXRyaWMucHJvdG8uZGVwbG95bWVudHMudjEuS2V5VmFsdWVTdG9y", - "ZUgAEjUKBnNlY3JldBgRIAEoCzIjLm5pdHJpYy5wcm90by5kZXBsb3ltZW50", - "cy52MS5TZWNyZXRIABI7Cgl3ZWJzb2NrZXQYEiABKAsyJi5uaXRyaWMucHJv", - "dG8uZGVwbG95bWVudHMudjEuV2Vic29ja2V0SAASMQoEaHR0cBgTIAEoCzIh", - "Lm5pdHJpYy5wcm90by5kZXBsb3ltZW50cy52MS5IdHRwSAASMwoFcXVldWUY", - "FCABKAsyIi5uaXRyaWMucHJvdG8uZGVwbG95bWVudHMudjEuUXVldWVIAEII", - "CgZjb25maWcisQEKBlBvbGljeRI5CgpwcmluY2lwYWxzGAEgAygLMiUubml0", - "cmljLnByb3RvLmRlcGxveW1lbnRzLnYxLlJlc291cmNlEjIKB2FjdGlvbnMY", - "AiADKA4yIS5uaXRyaWMucHJvdG8ucmVzb3VyY2VzLnYxLkFjdGlvbhI4Cgly", - "ZXNvdXJjZXMYAyADKAsyJS5uaXRyaWMucHJvdG8uZGVwbG95bWVudHMudjEu", - "UmVzb3VyY2UiQAoEU3BlYxI4CglyZXNvdXJjZXMYASADKAsyJS5uaXRyaWMu", - "cHJvdG8uZGVwbG95bWVudHMudjEuUmVzb3VyY2UqVQoYUmVzb3VyY2VEZXBs", - "b3ltZW50QWN0aW9uEgoKBkNSRUFURRAAEgoKBlVQREFURRABEgsKB1JFUExB", - "Q0UQAhIICgRTQU1FEAMSCgoGREVMRVRFEAQqUQoYUmVzb3VyY2VEZXBsb3lt", - "ZW50U3RhdHVzEgsKB1BFTkRJTkcQABIPCgtJTl9QUk9HUkVTUxABEgsKB1NV", - "Q0NFU1MQAhIKCgZGQUlMRUQQAzLmAQoKRGVwbG95bWVudBJoCgJVcBIwLm5p", - "dHJpYy5wcm90by5kZXBsb3ltZW50cy52MS5EZXBsb3ltZW50VXBSZXF1ZXN0", - "Gi4ubml0cmljLnByb3RvLmRlcGxveW1lbnRzLnYxLkRlcGxveW1lbnRVcEV2", - "ZW50MAESbgoERG93bhIyLm5pdHJpYy5wcm90by5kZXBsb3ltZW50cy52MS5E", - "ZXBsb3ltZW50RG93blJlcXVlc3QaMC5uaXRyaWMucHJvdG8uZGVwbG95bWVu", - "dHMudjEuRGVwbG95bWVudERvd25FdmVudDABQrUBCh5pby5uaXRyaWMucHJv", - "dG8uZGVwbG95bWVudHMudjFCC0RlcGxveW1lbnRzUAFaSGdpdGh1Yi5jb20v", - "bml0cmljdGVjaC9uaXRyaWMvY29yZS9wa2cvcHJvdG8vZGVwbG95bWVudHMv", - "djE7ZGVwbG95bWVudHNwYqoCG05pdHJpYy5Qcm90by5EZXBsb3ltZW50cy52", - "McoCG05pdHJpY1xQcm90b1xEZXBsb3ltZW50c1xWMWIGcHJvdG8z")); + "FAoMc3ViX3Jlc291cmNlGAUgASgJEg8KB21lc3NhZ2UYBiABKAkiNgoIVXBS", + "ZXN1bHQSDwoHc3VjY2VzcxgBIAEoCBIOCgRUZXh0GAIgASgJSABCCQoHY29u", + "dGVudCJZChVEZXBsb3ltZW50RG93blJlcXVlc3QSKwoKYXR0cmlidXRlcxgB", + "IAEoCzIXLmdvb2dsZS5wcm90b2J1Zi5TdHJ1Y3QSEwoLaW50ZXJhY3RpdmUY", + "AiABKAgirQEKE0RlcGxveW1lbnREb3duRXZlbnQSEQoHbWVzc2FnZRgBIAEo", + "CUgAEjkKBnJlc3VsdBgCIAEoCzInLm5pdHJpYy5wcm90by5kZXBsb3ltZW50", + "cy52MS5Eb3duUmVzdWx0SAASPQoGdXBkYXRlGAMgASgLMisubml0cmljLnBy", + "b3RvLmRlcGxveW1lbnRzLnYxLlJlc291cmNlVXBkYXRlSABCCQoHY29udGVu", + "dCIMCgpEb3duUmVzdWx0IhoKC0ltYWdlU291cmNlEgsKA3VyaRgBIAEoCSL+", + "AQoHU2VydmljZRI5CgVpbWFnZRgBIAEoCzIoLm5pdHJpYy5wcm90by5kZXBs", + "b3ltZW50cy52MS5JbWFnZVNvdXJjZUgAEg8KB3dvcmtlcnMYCiABKAUSEwoH", + "dGltZW91dBgLIAEoBUICGAESEgoGbWVtb3J5GAwgASgFQgIYARIMCgR0eXBl", + "GA0gASgJEjoKA2VudhgOIAMoCzItLm5pdHJpYy5wcm90by5kZXBsb3ltZW50", + "cy52MS5TZXJ2aWNlLkVudkVudHJ5GioKCEVudkVudHJ5EgsKA2tleRgBIAEo", + "CRINCgV2YWx1ZRgCIAEoCToCOAFCCAoGc291cmNlIkgKBkJ1Y2tldBI+Cgls", + "aXN0ZW5lcnMYASADKAsyKy5uaXRyaWMucHJvdG8uZGVwbG95bWVudHMudjEu", + "QnVja2V0TGlzdGVuZXIiawoOQnVja2V0TGlzdGVuZXISPAoGY29uZmlnGAEg", + "ASgLMiwubml0cmljLnByb3RvLnN0b3JhZ2UudjEuUmVnaXN0cmF0aW9uUmVx", + "dWVzdBIRCgdzZXJ2aWNlGAIgASgJSABCCAoGdGFyZ2V0Ik8KBVRvcGljEkYK", + "DXN1YnNjcmlwdGlvbnMYASADKAsyLy5uaXRyaWMucHJvdG8uZGVwbG95bWVu", + "dHMudjEuU3Vic2NyaXB0aW9uVGFyZ2V0IgcKBVF1ZXVlIg8KDUtleVZhbHVl", + "U3RvcmUiCAoGU2VjcmV0IjEKElN1YnNjcmlwdGlvblRhcmdldBIRCgdzZXJ2", + "aWNlGAEgASgJSABCCAoGdGFyZ2V0IlQKEVRvcGljU3Vic2NyaXB0aW9uEj8K", + "BnRhcmdldBgBIAEoCzIvLm5pdHJpYy5wcm90by5kZXBsb3ltZW50cy52MS5T", + "dWJzY3JpcHRpb25UYXJnZXQiKQoKSHR0cFRhcmdldBIRCgdzZXJ2aWNlGAEg", + "ASgJSABCCAoGdGFyZ2V0Ij8KBEh0dHASNwoGdGFyZ2V0GAEgASgLMicubml0", + "cmljLnByb3RvLmRlcGxveW1lbnRzLnYxLkh0dHBUYXJnZXQiJAoDQXBpEhEK", + "B29wZW5hcGkYASABKAlIAEIKCghkb2N1bWVudCLgAQoJV2Vic29ja2V0EkQK", + "DmNvbm5lY3RfdGFyZ2V0GAEgASgLMiwubml0cmljLnByb3RvLmRlcGxveW1l", + "bnRzLnYxLldlYnNvY2tldFRhcmdldBJHChFkaXNjb25uZWN0X3RhcmdldBgC", + "IAEoCzIsLm5pdHJpYy5wcm90by5kZXBsb3ltZW50cy52MS5XZWJzb2NrZXRU", + "YXJnZXQSRAoObWVzc2FnZV90YXJnZXQYAyABKAsyLC5uaXRyaWMucHJvdG8u", + "ZGVwbG95bWVudHMudjEuV2Vic29ja2V0VGFyZ2V0Ii4KD1dlYnNvY2tldFRh", + "cmdldBIRCgdzZXJ2aWNlGAEgASgJSABCCAoGdGFyZ2V0Ii0KDlNjaGVkdWxl", + "VGFyZ2V0EhEKB3NlcnZpY2UYASABKAlIAEIICgZ0YXJnZXQiygEKCFNjaGVk", + "dWxlEjsKBnRhcmdldBgBIAEoCzIrLm5pdHJpYy5wcm90by5kZXBsb3ltZW50", + "cy52MS5TY2hlZHVsZVRhcmdldBI7CgVldmVyeRgKIAEoCzIqLm5pdHJpYy5w", + "cm90by5kZXBsb3ltZW50cy52MS5TY2hlZHVsZUV2ZXJ5SAASOQoEY3JvbhgL", + "IAEoCzIpLm5pdHJpYy5wcm90by5kZXBsb3ltZW50cy52MS5TY2hlZHVsZUNy", + "b25IAEIJCgdjYWRlbmNlIh0KDVNjaGVkdWxlRXZlcnkSDAoEcmF0ZRgBIAEo", + "CSIiCgxTY2hlZHVsZUNyb24SEgoKZXhwcmVzc2lvbhgBIAEoCSK6BQoIUmVz", + "b3VyY2USOQoCaWQYASABKAsyLS5uaXRyaWMucHJvdG8ucmVzb3VyY2VzLnYx", + "LlJlc291cmNlSWRlbnRpZmllchI3CgdzZXJ2aWNlGAogASgLMiQubml0cmlj", + "LnByb3RvLmRlcGxveW1lbnRzLnYxLlNlcnZpY2VIABI1CgZidWNrZXQYCyAB", + "KAsyIy5uaXRyaWMucHJvdG8uZGVwbG95bWVudHMudjEuQnVja2V0SAASMwoF", + "dG9waWMYDCABKAsyIi5uaXRyaWMucHJvdG8uZGVwbG95bWVudHMudjEuVG9w", + "aWNIABIvCgNhcGkYDSABKAsyIC5uaXRyaWMucHJvdG8uZGVwbG95bWVudHMu", + "djEuQXBpSAASNQoGcG9saWN5GA4gASgLMiMubml0cmljLnByb3RvLmRlcGxv", + "eW1lbnRzLnYxLlBvbGljeUgAEjkKCHNjaGVkdWxlGA8gASgLMiUubml0cmlj", + "LnByb3RvLmRlcGxveW1lbnRzLnYxLlNjaGVkdWxlSAASRQoPa2V5X3ZhbHVl", + "X3N0b3JlGBAgASgLMioubml0cmljLnByb3RvLmRlcGxveW1lbnRzLnYxLktl", + "eVZhbHVlU3RvcmVIABI1CgZzZWNyZXQYESABKAsyIy5uaXRyaWMucHJvdG8u", + "ZGVwbG95bWVudHMudjEuU2VjcmV0SAASOwoJd2Vic29ja2V0GBIgASgLMiYu", + "bml0cmljLnByb3RvLmRlcGxveW1lbnRzLnYxLldlYnNvY2tldEgAEjEKBGh0", + "dHAYEyABKAsyIS5uaXRyaWMucHJvdG8uZGVwbG95bWVudHMudjEuSHR0cEgA", + "EjMKBXF1ZXVlGBQgASgLMiIubml0cmljLnByb3RvLmRlcGxveW1lbnRzLnYx", + "LlF1ZXVlSABCCAoGY29uZmlnIrEBCgZQb2xpY3kSOQoKcHJpbmNpcGFscxgB", + "IAMoCzIlLm5pdHJpYy5wcm90by5kZXBsb3ltZW50cy52MS5SZXNvdXJjZRIy", + "CgdhY3Rpb25zGAIgAygOMiEubml0cmljLnByb3RvLnJlc291cmNlcy52MS5B", + "Y3Rpb24SOAoJcmVzb3VyY2VzGAMgAygLMiUubml0cmljLnByb3RvLmRlcGxv", + "eW1lbnRzLnYxLlJlc291cmNlIkAKBFNwZWMSOAoJcmVzb3VyY2VzGAEgAygL", + "MiUubml0cmljLnByb3RvLmRlcGxveW1lbnRzLnYxLlJlc291cmNlKlUKGFJl", + "c291cmNlRGVwbG95bWVudEFjdGlvbhIKCgZDUkVBVEUQABIKCgZVUERBVEUQ", + "ARILCgdSRVBMQUNFEAISCAoEU0FNRRADEgoKBkRFTEVURRAEKlEKGFJlc291", + "cmNlRGVwbG95bWVudFN0YXR1cxILCgdQRU5ESU5HEAASDwoLSU5fUFJPR1JF", + "U1MQARILCgdTVUNDRVNTEAISCgoGRkFJTEVEEAMy5gEKCkRlcGxveW1lbnQS", + "aAoCVXASMC5uaXRyaWMucHJvdG8uZGVwbG95bWVudHMudjEuRGVwbG95bWVu", + "dFVwUmVxdWVzdBouLm5pdHJpYy5wcm90by5kZXBsb3ltZW50cy52MS5EZXBs", + "b3ltZW50VXBFdmVudDABEm4KBERvd24SMi5uaXRyaWMucHJvdG8uZGVwbG95", + "bWVudHMudjEuRGVwbG95bWVudERvd25SZXF1ZXN0GjAubml0cmljLnByb3Rv", + "LmRlcGxveW1lbnRzLnYxLkRlcGxveW1lbnREb3duRXZlbnQwAUK1AQoeaW8u", + "bml0cmljLnByb3RvLmRlcGxveW1lbnRzLnYxQgtEZXBsb3ltZW50c1ABWkhn", + "aXRodWIuY29tL25pdHJpY3RlY2gvbml0cmljL2NvcmUvcGtnL3Byb3RvL2Rl", + "cGxveW1lbnRzL3YxO2RlcGxveW1lbnRzcGKqAhtOaXRyaWMuUHJvdG8uRGVw", + "bG95bWVudHMudjHKAhtOaXRyaWNcUHJvdG9cRGVwbG95bWVudHNcVjFiBnBy", + "b3RvMw==")); descriptor = pbr::FileDescriptor.FromGeneratedCode(descriptorData, new pbr::FileDescriptor[] { global::Google.Protobuf.WellKnownTypes.StructReflection.Descriptor, global::Nitric.Proto.Resources.v1.ResourcesReflection.Descriptor, global::Nitric.Proto.Storage.v1.StorageReflection.Descriptor, }, new pbr::GeneratedClrTypeInfo(new[] {typeof(global::Nitric.Proto.Deployments.v1.ResourceDeploymentAction), typeof(global::Nitric.Proto.Deployments.v1.ResourceDeploymentStatus), }, null, new pbr::GeneratedClrTypeInfo[] { new pbr::GeneratedClrTypeInfo(typeof(global::Nitric.Proto.Deployments.v1.DeploymentUpRequest), global::Nitric.Proto.Deployments.v1.DeploymentUpRequest.Parser, new[]{ "Spec", "Attributes", "Interactive" }, null, null, null, null), new pbr::GeneratedClrTypeInfo(typeof(global::Nitric.Proto.Deployments.v1.DeploymentUpEvent), global::Nitric.Proto.Deployments.v1.DeploymentUpEvent.Parser, new[]{ "Message", "Update", "Result" }, new[]{ "Content" }, null, null, null), new pbr::GeneratedClrTypeInfo(typeof(global::Nitric.Proto.Deployments.v1.ResourceUpdate), global::Nitric.Proto.Deployments.v1.ResourceUpdate.Parser, new[]{ "Id", "Action", "Status", "SubResource", "Message" }, null, null, null, null), - new pbr::GeneratedClrTypeInfo(typeof(global::Nitric.Proto.Deployments.v1.UpResult), global::Nitric.Proto.Deployments.v1.UpResult.Parser, new[]{ "Success", "Details" }, null, null, null, null), + new pbr::GeneratedClrTypeInfo(typeof(global::Nitric.Proto.Deployments.v1.UpResult), global::Nitric.Proto.Deployments.v1.UpResult.Parser, new[]{ "Success", "Text" }, new[]{ "Content" }, null, null, null), new pbr::GeneratedClrTypeInfo(typeof(global::Nitric.Proto.Deployments.v1.DeploymentDownRequest), global::Nitric.Proto.Deployments.v1.DeploymentDownRequest.Parser, new[]{ "Attributes", "Interactive" }, null, null, null, null), new pbr::GeneratedClrTypeInfo(typeof(global::Nitric.Proto.Deployments.v1.DeploymentDownEvent), global::Nitric.Proto.Deployments.v1.DeploymentDownEvent.Parser, new[]{ "Message", "Result", "Update" }, new[]{ "Content" }, null, null, null), new pbr::GeneratedClrTypeInfo(typeof(global::Nitric.Proto.Deployments.v1.DownResult), global::Nitric.Proto.Deployments.v1.DownResult.Parser, null, null, null, null, null), @@ -1151,7 +1152,12 @@ public UpResult() { [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public UpResult(UpResult other) : this() { success_ = other.success_; - details_ = other.details_; + switch (other.ContentCase) { + case ContentOneofCase.Text: + Text = other.Text; + break; + } + _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields); } @@ -1174,20 +1180,38 @@ public bool Success { } } - /// Field number for the "details" field. - public const int DetailsFieldNumber = 2; - private string details_ = ""; + /// Field number for the "Text" field. + public const int TextFieldNumber = 2; /// - /// Simple formatted string output as result + /// Simple text output as result /// [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public string Details { - get { return details_; } + public string Text { + get { return contentCase_ == ContentOneofCase.Text ? (string) content_ : ""; } set { - details_ = pb::ProtoPreconditions.CheckNotNull(value, "value"); + content_ = pb::ProtoPreconditions.CheckNotNull(value, "value"); + contentCase_ = ContentOneofCase.Text; } } + private object content_; + /// Enum of possible cases for the "content" oneof. + public enum ContentOneofCase { + None = 0, + Text = 2, + } + private ContentOneofCase contentCase_ = ContentOneofCase.None; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public ContentOneofCase ContentCase { + get { return contentCase_; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public void ClearContent() { + contentCase_ = ContentOneofCase.None; + content_ = null; + } + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public override bool Equals(object other) { return Equals(other as UpResult); @@ -1202,7 +1226,8 @@ public bool Equals(UpResult other) { return true; } if (Success != other.Success) return false; - if (Details != other.Details) return false; + if (Text != other.Text) return false; + if (ContentCase != other.ContentCase) return false; return Equals(_unknownFields, other._unknownFields); } @@ -1210,7 +1235,8 @@ public bool Equals(UpResult other) { public override int GetHashCode() { int hash = 1; if (Success != false) hash ^= Success.GetHashCode(); - if (Details.Length != 0) hash ^= Details.GetHashCode(); + if (contentCase_ == ContentOneofCase.Text) hash ^= Text.GetHashCode(); + hash ^= (int) contentCase_; if (_unknownFields != null) { hash ^= _unknownFields.GetHashCode(); } @@ -1231,9 +1257,9 @@ public void WriteTo(pb::CodedOutputStream output) { output.WriteRawTag(8); output.WriteBool(Success); } - if (Details.Length != 0) { + if (contentCase_ == ContentOneofCase.Text) { output.WriteRawTag(18); - output.WriteString(Details); + output.WriteString(Text); } if (_unknownFields != null) { _unknownFields.WriteTo(output); @@ -1248,9 +1274,9 @@ public void WriteTo(pb::CodedOutputStream output) { output.WriteRawTag(8); output.WriteBool(Success); } - if (Details.Length != 0) { + if (contentCase_ == ContentOneofCase.Text) { output.WriteRawTag(18); - output.WriteString(Details); + output.WriteString(Text); } if (_unknownFields != null) { _unknownFields.WriteTo(ref output); @@ -1264,8 +1290,8 @@ public int CalculateSize() { if (Success != false) { size += 1 + 1; } - if (Details.Length != 0) { - size += 1 + pb::CodedOutputStream.ComputeStringSize(Details); + if (contentCase_ == ContentOneofCase.Text) { + size += 1 + pb::CodedOutputStream.ComputeStringSize(Text); } if (_unknownFields != null) { size += _unknownFields.CalculateSize(); @@ -1281,9 +1307,12 @@ public void MergeFrom(UpResult other) { if (other.Success != false) { Success = other.Success; } - if (other.Details.Length != 0) { - Details = other.Details; + switch (other.ContentCase) { + case ContentOneofCase.Text: + Text = other.Text; + break; } + _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields); } @@ -1303,7 +1332,7 @@ public void MergeFrom(pb::CodedInputStream input) { break; } case 18: { - Details = input.ReadString(); + Text = input.ReadString(); break; } } @@ -1325,7 +1354,7 @@ public void MergeFrom(pb::CodedInputStream input) { break; } case 18: { - Details = input.ReadString(); + Text = input.ReadString(); break; } } diff --git a/src/Nitric.Sdk/Resource/ApiResource.cs b/src/Nitric.Sdk/Resource/ApiResource.cs index 7a60e7c..d6b18c6 100644 --- a/src/Nitric.Sdk/Resource/ApiResource.cs +++ b/src/Nitric.Sdk/Resource/ApiResource.cs @@ -16,13 +16,13 @@ using System.Collections.Generic; using System.Threading.Tasks; using Google.Api; -using Nitric.Proto.Resource.v1; +using Nitric.Proto.Resources.v1; using Nitric.Sdk.Function; -using GrpcClient = Nitric.Proto.Secret.v1.SecretService.SecretServiceClient; -using NitricResource = Nitric.Proto.Resource.v1.Resource; -using ProtoApiResource = Nitric.Proto.Resource.v1.ApiResource; -using ProtoSecurityDefinition = Nitric.Proto.Resource.v1.ApiSecurityDefinition; -using ProtoSecurityDefinitionJwt = Nitric.Proto.Resource.v1.ApiSecurityDefinitionJwt; +using GrpcClient = Nitric.Proto.Secrets.v1.SecretManager.SecretManagerClient; +using NitricResource = Nitric.Proto.Resources.v1.ResourceIdentifier; +using ProtoApiResource = Nitric.Proto.Resources.v1.ApiResource; +using ProtoSecurityDefinition = Nitric.Proto.Resources.v1.ApiSecurityDefinitionResource; +using ProtoSecurityDefinitionJwt = Nitric.Proto.Resources.v1.ApiOpenIdConnectionDefinition; namespace Nitric.Sdk.Resource @@ -260,20 +260,20 @@ internal override BaseResource Register() if (kv.Value.Kind == "jwt") { var jwtSecurityDefinition = kv.Value as JwtSecurityDefinition; - var secDef = new ApiSecurityDefinitionJwt + var secDef = new ApiOpenIdConnectionDefinition { Issuer = jwtSecurityDefinition.Issuer }; secDef.Audiences.AddRange(jwtSecurityDefinition.Audiences); - definition.Jwt = secDef; + definition.Oidc = secDef; } apiResource.SecurityDefinitions.Add(kv.Key, definition); } - var request = new ResourceDeclareRequest { Resource = resource, Api = apiResource }; + var request = new ResourceDeclareRequest { Id = resource, Api = apiResource }; BaseResource.client.Declare(request); return this; @@ -287,20 +287,20 @@ internal override BaseResource Register() /// - URL: the url of the deployed API. /// /// The details of the API - public ApiDetails Details() { - var resource = new NitricResource { Name = this.Name, Type = ResourceType.Api }; - - var request = new ResourceDetailsRequest { Resource = resource }; - var response = client.Details(request); - - return new ApiDetails - { - ID = response.Id, - Provider = response.Provider, - Service = response.Service, - URL = response.Api.Url, - }; - } + // public ApiDetails Details() { + // var resource = new NitricResource { Name = this.Name, Type = ResourceType.Api }; + + // var request = new ResourceDetailsRequest { Resource = resource }; + // var response = client.Details(request); + + // return new ApiDetails + // { + // ID = response.Id, + // Provider = response.Provider, + // Service = response.Service, + // URL = response.Api.Url, + // }; + // } } public class RouteOptions diff --git a/src/Nitric.Sdk/Resource/BaseResource.cs b/src/Nitric.Sdk/Resource/BaseResource.cs index 8b1756f..5f15997 100644 --- a/src/Nitric.Sdk/Resource/BaseResource.cs +++ b/src/Nitric.Sdk/Resource/BaseResource.cs @@ -11,10 +11,10 @@ // 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. -using Nitric.Proto.Resource.v1; +using Nitric.Proto.Resources.v1; using Nitric.Sdk.Common; -using GrpcClient = Nitric.Proto.Resource.v1.ResourceService.ResourceServiceClient; -using ProtoResource = Nitric.Proto.Resource.v1.Resource; +using GrpcClient = Nitric.Proto.Resources.v1.Resources.ResourcesClient; +using ProtoResource = Nitric.Proto.Resources.v1.ResourceIdentifier; namespace Nitric.Sdk.Resource { diff --git a/src/Nitric.Sdk/Resource/BucketResource.cs b/src/Nitric.Sdk/Resource/BucketResource.cs index 08c8e05..e07383a 100644 --- a/src/Nitric.Sdk/Resource/BucketResource.cs +++ b/src/Nitric.Sdk/Resource/BucketResource.cs @@ -15,11 +15,11 @@ using System; using System.Collections.Generic; using System.Linq; -using Nitric.Proto.Resource.v1; +using Nitric.Proto.Resources.v1; using Nitric.Sdk.Function; using Nitric.Sdk.Storage; -using Action = Nitric.Proto.Resource.v1.Action; -using NitricResource = Nitric.Proto.Resource.v1.Resource; +using Action = Nitric.Proto.Resources.v1.Action; +using NitricResource = Nitric.Proto.Resources.v1.ResourceIdentifier; namespace Nitric.Sdk.Resource { @@ -51,7 +51,7 @@ internal BucketResource(string name) : base(name, ResourceType.Bucket) internal override BaseResource Register() { var resource = new NitricResource { Name = this.Name, Type = ResourceType.Bucket }; - var request = new ResourceDeclareRequest { Resource = resource }; + var request = new ResourceDeclareRequest { Id = resource }; BaseResource.client.Declare(request); return this; } diff --git a/src/Nitric.Sdk/Resource/CollectionResource.cs b/src/Nitric.Sdk/Resource/CollectionResource.cs index b076d9e..fc80ab8 100644 --- a/src/Nitric.Sdk/Resource/CollectionResource.cs +++ b/src/Nitric.Sdk/Resource/CollectionResource.cs @@ -13,7 +13,7 @@ // limitations under the License. using System.Collections.Generic; using System.Linq; -using Nitric.Proto.Resource.v1; +using Nitric.Proto.Resources.v1; using Nitric.Sdk.Document; using Action = Nitric.Proto.Resource.v1.Action; using NitricResource = Nitric.Proto.Resource.v1.Resource; diff --git a/src/Nitric.Sdk/Resource/QueueResource.cs b/src/Nitric.Sdk/Resource/QueueResource.cs index b0a5e03..ffcb82c 100644 --- a/src/Nitric.Sdk/Resource/QueueResource.cs +++ b/src/Nitric.Sdk/Resource/QueueResource.cs @@ -13,10 +13,10 @@ // limitations under the License. using System.Collections.Generic; using System.Linq; -using Nitric.Proto.Resource.v1; +using Nitric.Proto.Resources.v1; using Nitric.Sdk.Queue; -using Action = Nitric.Proto.Resource.v1.Action; -using NitricResource = Nitric.Proto.Resource.v1.Resource; +using Action = Nitric.Proto.Resources.v1.Action; +using NitricResource = Nitric.Proto.Resources.v1.ResourceIdentifier; namespace Nitric.Sdk.Resource { @@ -44,7 +44,7 @@ internal QueueResource(string name) : base(name, ResourceType.Queue) internal override BaseResource Register() { var resource = new NitricResource { Name = this.Name, Type = ResourceType.Queue }; - var request = new ResourceDeclareRequest { Resource = resource }; + var request = new ResourceDeclareRequest { Id = resource }; client.Declare(request); return this; } diff --git a/src/Nitric.Sdk/Resource/SecretResource.cs b/src/Nitric.Sdk/Resource/SecretResource.cs index f0837dd..279792f 100644 --- a/src/Nitric.Sdk/Resource/SecretResource.cs +++ b/src/Nitric.Sdk/Resource/SecretResource.cs @@ -13,10 +13,10 @@ // limitations under the License. using System.Collections.Generic; using System.Linq; -using Nitric.Proto.Resource.v1; +using Nitric.Proto.Resources.v1; using Nitric.Sdk.Secret; -using Action = Nitric.Proto.Resource.v1.Action; -using NitricResource = Nitric.Proto.Resource.v1.Resource; +using Action = Nitric.Proto.Resources.v1.Action; +using NitricResource = Nitric.Proto.Resources.v1.ResourceIdentifier; namespace Nitric.Sdk.Resource { @@ -44,7 +44,7 @@ internal SecretResource(string name) : base(name, ResourceType.Secret) internal override BaseResource Register() { var resource = new NitricResource { Name = this.Name, Type = ResourceType.Secret }; - var request = new ResourceDeclareRequest { Resource = resource }; + var request = new ResourceDeclareRequest { Id = resource }; client.Declare(request); return this; } diff --git a/src/Nitric.Sdk/Resource/SecureResource.cs b/src/Nitric.Sdk/Resource/SecureResource.cs index f8b850e..0ab3ff3 100644 --- a/src/Nitric.Sdk/Resource/SecureResource.cs +++ b/src/Nitric.Sdk/Resource/SecureResource.cs @@ -12,9 +12,9 @@ // See the License for the specific language governing permissions and // limitations under the License. using System.Collections.Generic; -using Nitric.Proto.Resource.v1; -using Action = Nitric.Proto.Resource.v1.Action; -using GrpcClient = Nitric.Proto.Secret.v1.SecretService.SecretServiceClient; +using Nitric.Proto.Resources.v1; +using Action = Nitric.Proto.Resources.v1.Action; +using GrpcClient = Nitric.Proto.Secrets.v1.SecretManager.SecretManagerClient; namespace Nitric.Sdk.Resource { @@ -45,15 +45,15 @@ protected SecureResource(string name, ResourceType type) : base(name, type) /// The permissions to include with the resource policy. protected void RegisterPolicy(IEnumerable permissions) { - var policyResource = new Proto.Resource.v1.Resource { Type = ResourceType.Policy }; - var defaultPrincipal = new Proto.Resource.v1.Resource { Type = ResourceType.Function }; + var policyResource = new ResourceIdentifier { Type = ResourceType.Policy }; + var defaultPrincipal = new ResourceIdentifier { Type = ResourceType.Service }; var actions = this.PermissionsToActions(permissions); var policy = new PolicyResource { Principals = { defaultPrincipal }, Actions = { actions } }; policy.Resources.Add(this.AsProtoResource()); - var request = new ResourceDeclareRequest { Resource = policyResource, Policy = policy }; + var request = new ResourceDeclareRequest { Id = policyResource, Policy = policy }; BaseResource.client.Declare(request); } } diff --git a/src/Nitric.Sdk/Resource/TopicResource.cs b/src/Nitric.Sdk/Resource/TopicResource.cs index f456de3..b4765d1 100644 --- a/src/Nitric.Sdk/Resource/TopicResource.cs +++ b/src/Nitric.Sdk/Resource/TopicResource.cs @@ -14,11 +14,13 @@ using System; using System.Collections.Generic; using System.Linq; -using Nitric.Proto.Resource.v1; +using Nitric.Proto.Resources.v1; using Nitric.Sdk.Event; using Nitric.Sdk.Function; -using Action = Nitric.Proto.Resource.v1.Action; -using NitricResource = Nitric.Proto.Resource.v1.Resource; +using Nitric.Sdk.Topic; +using Action = Nitric.Proto.Resources.v1.Action; +using NitricResource = Nitric.Proto.Resources.v1.ResourceIdentifier; +using ResourceType = Nitric.Proto.Resources.v1.ResourceType; namespace Nitric.Sdk.Resource { @@ -42,7 +44,7 @@ internal TopicResource(string name) : base(name, ResourceType.Topic) internal override BaseResource Register() { var resource = new NitricResource { Name = this.Name, Type = ResourceType.Topic }; - var request = new ResourceDeclareRequest { Resource = resource }; + var request = new ResourceDeclareRequest { Id = resource }; BaseResource.client.Declare(request); return this; } diff --git a/src/Nitric.Sdk/Resource/WebsocketResource.cs b/src/Nitric.Sdk/Resource/WebsocketResource.cs index cfcef53..57b6b4a 100644 --- a/src/Nitric.Sdk/Resource/WebsocketResource.cs +++ b/src/Nitric.Sdk/Resource/WebsocketResource.cs @@ -16,13 +16,13 @@ using System.Collections.Generic; using System.Linq; using System.Runtime.CompilerServices; -using Nitric.Proto.Resource.v1; +using Nitric.Proto.Resources.v1; using Nitric.Sdk.Common; using Nitric.Sdk.Function; using Nitric.Sdk.Websocket; -using Action = Nitric.Proto.Resource.v1.Action; -using NitricResource = Nitric.Proto.Resource.v1.Resource; -using GrpcClient = Nitric.Proto.Websocket.v1.WebsocketService.WebsocketServiceClient; +using Action = Nitric.Proto.Resources.v1.Action; +using NitricResource = Nitric.Proto.Resources.v1.ResourceIdentifier; +using GrpcClient = Nitric.Proto.Websockets.v1.Websocket.WebsocketClient; namespace Nitric.Sdk.Resource { @@ -49,7 +49,7 @@ internal WebsocketResource(string name) : base(name, ResourceType.Websocket) internal override BaseResource Register() { var resource = new NitricResource { Name = this.Name, Type = ResourceType.Websocket }; - var request = new ResourceDeclareRequest { Resource = resource }; + var request = new ResourceDeclareRequest { Id = resource }; BaseResource.client.Declare(request); return this; } diff --git a/src/Nitric.Sdk/Websocket/WebsocketClient.cs b/src/Nitric.Sdk/Websocket/WebsocketClient.cs index 5cebeab..ee0e7d0 100644 --- a/src/Nitric.Sdk/Websocket/WebsocketClient.cs +++ b/src/Nitric.Sdk/Websocket/WebsocketClient.cs @@ -13,7 +13,7 @@ // limitations under the License. using System; using Nitric.Sdk.Common; -using GrpcClient = Nitric.Proto.Websocket.v1.WebsocketService.WebsocketServiceClient; +using GrpcClient = Nitric.Proto.Websockets.v1.Websocket.WebsocketClient; namespace Nitric.Sdk.Websocket { From 7357406c3ac0fa914c2df54aca9bad220db53927 Mon Sep 17 00:00:00 2001 From: Jye Cusch Date: Thu, 15 Feb 2024 09:20:47 +1100 Subject: [PATCH 03/34] wip topics --- src/Nitric.Sdk/Topic/Topic.cs | 48 +++++++------------ .../{EventsClient.cs => TopicsClient.cs} | 11 ++--- 2 files changed, 21 insertions(+), 38 deletions(-) rename src/Nitric.Sdk/Topic/{EventsClient.cs => TopicsClient.cs} (87%) diff --git a/src/Nitric.Sdk/Topic/Topic.cs b/src/Nitric.Sdk/Topic/Topic.cs index 68ac657..d513bdb 100644 --- a/src/Nitric.Sdk/Topic/Topic.cs +++ b/src/Nitric.Sdk/Topic/Topic.cs @@ -12,64 +12,50 @@ // See the License for the specific language governing permissions and // limitations under the License. -using Nitric.Proto.Event.v1; +using Google.Protobuf; +using Google.Protobuf.WellKnownTypes; +using Newtonsoft.Json; +using Nitric.Proto.Topics.v1; using Nitric.Sdk.Common; -namespace Nitric.Sdk.Event +namespace Nitric.Sdk.Topic { /// /// Represents a reference to a topic. /// public class Topic { - private readonly EventsClient eventsClient; + private readonly TopicsClient TopicsClient; /// /// The name of topic. /// public string Name { get; private set; } - internal Topic(EventsClient eventsClient, string name) + internal Topic(TopicsClient TopicsClient, string name) { - this.eventsClient = eventsClient; + this.TopicsClient = TopicsClient; this.Name = name; } /// - /// Publish a new event to this topic. + /// Publish a new message to this topic. /// - /// The event to publish - /// The unique id of the published event. + /// The message to publish /// - public string Publish(Event evt) + public void Publish(T message) { - var request = new EventPublishRequest { Topic = this.Name, Event = evt.ToWire() }; - - try - { - var response = this.eventsClient.EventClient.Publish(request); - return response.Id; - } - catch (Grpc.Core.RpcException re) + Struct structPayload = null; + if (message != null) { - throw NitricException.FromRpcException(re); + var jsonPayload = JsonConvert.SerializeObject(message); + structPayload = JsonParser.Default.Parse(jsonPayload); } - } - /// - /// Publish a new event to this topic. - /// - /// The payload of the event - /// The unique id of the published event. - /// - public string Publish(T payload) - { - var evt = new Event { Payload = payload }; - var request = new EventPublishRequest { Topic = this.Name, Event = evt.ToWire() }; + var request = new TopicPublishRequest { TopicName = this.Name, Message = new Message { StructPayload = structPayload } }; try { - var response = this.eventsClient.EventClient.Publish(request); - return response.Id; + this.TopicsClient.TopicClient.Publish(request); } catch (Grpc.Core.RpcException re) { diff --git a/src/Nitric.Sdk/Topic/EventsClient.cs b/src/Nitric.Sdk/Topic/TopicsClient.cs similarity index 87% rename from src/Nitric.Sdk/Topic/EventsClient.cs rename to src/Nitric.Sdk/Topic/TopicsClient.cs index 4a5ee42..3a3a9dc 100644 --- a/src/Nitric.Sdk/Topic/EventsClient.cs +++ b/src/Nitric.Sdk/Topic/TopicsClient.cs @@ -16,27 +16,24 @@ using System.Collections.Generic; using System.Linq; using Nitric.Sdk.Common; -using NitricEvent = Nitric.Proto.Topics.v1.NitricEvent; using Nitric.Proto.Topics.v1; -using Nitric.Proto.Topics.v1.Topics.TopicsClient; -using Nitric.Proto.Topics.v1.Topics.SubscriberClient; namespace Nitric.Sdk.Topic { /// /// Events service client. /// - public class EventsClient + public class TopicsClient { - internal readonly GrpcClient EventClient; - private readonly TopicClient topicClient; + internal readonly Topics.TopicsClient TopicClient; + private readonly Subscriber.SubscriberClient subscriberClient; /// /// Create a new events service client. /// /// The events gRPC client. /// The topics gRPC client. - public EventsClient(GrpcClient client = null, TopicClient topic = null) + public TopicsClient(GrpcClient client = null, TopicClient topic = null) { this.EventClient = client ?? new GrpcClient(GrpcChannelProvider.GetChannel()); this.topicClient = topic ?? new TopicClient(GrpcChannelProvider.GetChannel()); From a270b37e93ee54e34e7af937bc63975e61540100 Mon Sep 17 00:00:00 2001 From: Rak Siva Date: Wed, 14 Feb 2024 15:23:02 -0700 Subject: [PATCH 04/34] wip: secrets --- src/Nitric.Sdk/Secret/Secret.cs | 6 +++--- src/Nitric.Sdk/Secret/SecretVersion.cs | 6 +++--- src/Nitric.Sdk/Secret/SecretsClient.cs | 2 +- 3 files changed, 7 insertions(+), 7 deletions(-) diff --git a/src/Nitric.Sdk/Secret/Secret.cs b/src/Nitric.Sdk/Secret/Secret.cs index 21d4e84..244a457 100644 --- a/src/Nitric.Sdk/Secret/Secret.cs +++ b/src/Nitric.Sdk/Secret/Secret.cs @@ -14,9 +14,9 @@ using System; using System.Text; -using Nitric.Proto.Secret.v1; +using Nitric.Proto.Secrets.v1; using Nitric.Sdk.Common; -using GrpcClient = Nitric.Proto.Secret.v1.SecretService.SecretServiceClient; +using GrpcClient = Nitric.Proto.Secrets.v1.SecretManager.SecretManagerClient; namespace Nitric.Sdk.Secret { @@ -81,7 +81,7 @@ public SecretVersion Put(byte[] value) var request = new SecretPutRequest { - Secret = new Proto.Secret.v1.Secret { Name = this.Name }, + Secret = new Proto.Secrets.v1.Secret { Name = this.Name }, Value = Google.Protobuf.ByteString.CopyFrom(value), }; try diff --git a/src/Nitric.Sdk/Secret/SecretVersion.cs b/src/Nitric.Sdk/Secret/SecretVersion.cs index f7b7a19..8c06514 100644 --- a/src/Nitric.Sdk/Secret/SecretVersion.cs +++ b/src/Nitric.Sdk/Secret/SecretVersion.cs @@ -13,7 +13,7 @@ // limitations under the License. using System; -using Nitric.Proto.Secret.v1; +using Nitric.Proto.Secrets.v1; using Nitric.Sdk.Common; namespace Nitric.Sdk.Secret @@ -58,9 +58,9 @@ public SecretValue Access() { var secret = new SecretAccessRequest { - SecretVersion = new Proto.Secret.v1.SecretVersion + SecretVersion = new Proto.Secrets.v1.SecretVersion { - Secret = new Proto.Secret.v1.Secret { Name = this.Secret.Name }, + Secret = new Proto.Secrets.v1.Secret { Name = this.Secret.Name }, Version = this.Id, } }; diff --git a/src/Nitric.Sdk/Secret/SecretsClient.cs b/src/Nitric.Sdk/Secret/SecretsClient.cs index f8238ca..5572dba 100644 --- a/src/Nitric.Sdk/Secret/SecretsClient.cs +++ b/src/Nitric.Sdk/Secret/SecretsClient.cs @@ -14,7 +14,7 @@ using System; using Nitric.Sdk.Common; -using GrpcClient = Nitric.Proto.Secret.v1.SecretService.SecretServiceClient; +using GrpcClient = Nitric.Proto.Secrets.v1.SecretManager.SecretManagerClient; namespace Nitric.Sdk.Secret { From b8f71f29fa6fccc58b1e23ea8c448db660562026 Mon Sep 17 00:00:00 2001 From: Ryan Cartwright Date: Thu, 15 Feb 2024 22:16:44 +1100 Subject: [PATCH 05/34] wip: workers and schedule workers --- src/Nitric.Sdk/Common/Struct.cs | 90 +++ src/Nitric.Sdk/Nitric.Sdk.csproj | 7 +- src/Nitric.Sdk/Nitric.cs | 7 +- src/Nitric.Sdk/Queue/Queue.cs | 5 +- src/Nitric.Sdk/Queue/QueuesClient.cs | 2 +- src/Nitric.Sdk/Resource/CollectionResource.cs | 8 +- src/Nitric.Sdk/Resource/ScheduleResource.cs | 24 +- src/Nitric.Sdk/Resource/SecureResource.cs | 1 - src/Nitric.Sdk/Resource/TopicResource.cs | 2 - .../Service/BucketNotificationContext.cs | 119 +-- src/Nitric.Sdk/Service/Faas.cs | 723 ------------------ src/Nitric.Sdk/Service/Frequency.cs | 3 +- src/Nitric.Sdk/Service/HttpContext.cs | 49 +- src/Nitric.Sdk/Service/IntervalContext.cs | 78 ++ .../{EventContext.cs => MessageContext.cs} | 50 +- src/Nitric.Sdk/Service/Middleware.cs | 4 +- src/Nitric.Sdk/Service/TriggerContext.cs | 63 +- src/Nitric.Sdk/Service/WebsocketContext.cs | 67 +- src/Nitric.Sdk/Worker/ScheduleWorker.cs | 48 ++ src/Nitric.Sdk/Worker/Worker.cs | 40 + 20 files changed, 415 insertions(+), 975 deletions(-) create mode 100644 src/Nitric.Sdk/Common/Struct.cs delete mode 100644 src/Nitric.Sdk/Service/Faas.cs create mode 100644 src/Nitric.Sdk/Service/IntervalContext.cs rename src/Nitric.Sdk/Service/{EventContext.cs => MessageContext.cs} (61%) create mode 100644 src/Nitric.Sdk/Worker/ScheduleWorker.cs create mode 100644 src/Nitric.Sdk/Worker/Worker.cs diff --git a/src/Nitric.Sdk/Common/Struct.cs b/src/Nitric.Sdk/Common/Struct.cs new file mode 100644 index 0000000..df6a48b --- /dev/null +++ b/src/Nitric.Sdk/Common/Struct.cs @@ -0,0 +1,90 @@ +using System; +using System.Collections.Generic; +using KindOneofCase = Google.Protobuf.WellKnownTypes.Value.KindOneofCase; +using ProtoStruct = Google.Protobuf.WellKnownTypes.Struct; +using ProtoValue = Google.Protobuf.WellKnownTypes.Value; + +namespace Nitric.Sdk.Common +{ + public class Struct + { + public static Dictionary ToDictionary(ProtoStruct @struct) + { + var payload = new Dictionary(); + + foreach (var kv in @struct.Fields) + { + payload.Add(kv.Key, GetValue(kv.Value)); + } + + return payload; + } + + public static ProtoStruct FromDictionary(Dictionary dictionary) + { + ProtoStruct payload = new ProtoStruct(); + + foreach (KeyValuePair kv in dictionary) + { + payload.Fields.Add(kv.Key, Struct.ToValue(kv.Value)); + } + + return payload; + } + + private static ProtoValue ToValue(object val) + { + if (val is string str) + { + return ProtoValue.ForString(str); + } + else if (val is double num) + { + return ProtoValue.ForNumber(num); + } + else if (val is null) + { + return ProtoValue.ForNull(); + } + else if (val is Dictionary dictionary) + { + return ProtoValue.ForStruct(Struct.FromDictionary(dictionary)); + } + else if (val is List list) + { + return ProtoValue.ForList(list.ConvertAll(ToValue).ToArray()); + } + + return null; + } + + private static object GetValue(ProtoValue val) + { + switch (val.KindCase) + { + case KindOneofCase.StringValue: + return val.StringValue; + case KindOneofCase.NumberValue: + return val.NumberValue; + case KindOneofCase.BoolValue: + return val.BoolValue; + case KindOneofCase.NullValue: + return val.NullValue; + case KindOneofCase.ListValue: + var list = new List(); + + foreach (var listVal in val.ListValue.Values) + { + list.Add(Struct.GetValue(listVal)); + } + + return list; + case KindOneofCase.StructValue: + return Struct.ToDictionary(val.StructValue); + default: + return null; + } + } + } +} + diff --git a/src/Nitric.Sdk/Nitric.Sdk.csproj b/src/Nitric.Sdk/Nitric.Sdk.csproj index 6e2db1f..b44f3b1 100644 --- a/src/Nitric.Sdk/Nitric.Sdk.csproj +++ b/src/Nitric.Sdk/Nitric.Sdk.csproj @@ -23,12 +23,15 @@ - + + + + + diff --git a/src/Nitric.Sdk/Nitric.cs b/src/Nitric.Sdk/Nitric.cs index d01b980..94861d1 100644 --- a/src/Nitric.Sdk/Nitric.cs +++ b/src/Nitric.Sdk/Nitric.cs @@ -15,8 +15,9 @@ using System.Collections.Generic; using System.Linq; using System.Threading.Tasks; -using Nitric.Sdk.Function; using Nitric.Sdk.Resource; +using Nitric.Sdk.Worker; +using Nitric.Sdk.Service; namespace Nitric.Sdk { @@ -25,12 +26,12 @@ namespace Nitric.Sdk /// public class Nitric { - private static readonly List Workers = new List(); + private static readonly List Workers = new List(); private static readonly Dictionary> Cache = new Dictionary>(); - internal static void RegisterWorker(Faas worker) + internal static void RegisterWorker(AbstractWorker worker) { Nitric.Workers.Add(worker); } diff --git a/src/Nitric.Sdk/Queue/Queue.cs b/src/Nitric.Sdk/Queue/Queue.cs index c702523..a308980 100644 --- a/src/Nitric.Sdk/Queue/Queue.cs +++ b/src/Nitric.Sdk/Queue/Queue.cs @@ -16,8 +16,8 @@ using System.Linq; using Google.Protobuf.Collections; using Newtonsoft.Json; -using Nitric.Proto.Queue.v1; using Nitric.Sdk.Common; +using Nitric.Proto.Queues.v1; namespace Nitric.Sdk.Queue { @@ -54,8 +54,7 @@ public void Send(Task task) var request = new QueueSendRequest { - Queue = this.Name, - Task = task.ToWire() + Payload = task.Payload; }; try { diff --git a/src/Nitric.Sdk/Queue/QueuesClient.cs b/src/Nitric.Sdk/Queue/QueuesClient.cs index 7d844d6..3903b13 100644 --- a/src/Nitric.Sdk/Queue/QueuesClient.cs +++ b/src/Nitric.Sdk/Queue/QueuesClient.cs @@ -12,7 +12,7 @@ // See the License for the specific language governing permissions and // limitations under the License. -using GrpcClient = Nitric.Proto.Queue.v1.QueueService.QueueServiceClient; +using GrpcClient = Nitric.Proto.Queues.v1.Queues.QueuesClient; using Nitric.Sdk.Common; using System; diff --git a/src/Nitric.Sdk/Resource/CollectionResource.cs b/src/Nitric.Sdk/Resource/CollectionResource.cs index fc80ab8..a546172 100644 --- a/src/Nitric.Sdk/Resource/CollectionResource.cs +++ b/src/Nitric.Sdk/Resource/CollectionResource.cs @@ -14,9 +14,9 @@ using System.Collections.Generic; using System.Linq; using Nitric.Proto.Resources.v1; -using Nitric.Sdk.Document; -using Action = Nitric.Proto.Resource.v1.Action; -using NitricResource = Nitric.Proto.Resource.v1.Resource; +using Action = Nitric.Proto.Resources.v1.Action; +using NitricResource = Nitric.Proto.Resources.v1.ResourceIdentifier; +using ResourceType = Nitric.Proto.Resources.v1.ResourceType; namespace Nitric.Sdk.Resource { @@ -41,7 +41,7 @@ public enum CollectionPermission public class CollectionResource : SecureResource { - internal CollectionResource(string name) : base(name, ResourceType.Collection) + internal CollectionResource(string name) : base(name, ResourceType.KeyValueStore) { } diff --git a/src/Nitric.Sdk/Resource/ScheduleResource.cs b/src/Nitric.Sdk/Resource/ScheduleResource.cs index 1206261..2d1842a 100644 --- a/src/Nitric.Sdk/Resource/ScheduleResource.cs +++ b/src/Nitric.Sdk/Resource/ScheduleResource.cs @@ -12,17 +12,19 @@ // See the License for the specific language governing permissions and // limitations under the License. using System; -using Nitric.Sdk.Function; +using Nitric.Sdk.Service; +using Nitric.Sdk.Worker; +using Nitric.Proto.Schedules.v1; namespace Nitric.Sdk.Resource { public class ScheduleResource { - private string name; + private string Name; internal ScheduleResource(string name) { - this.name = name; + this.Name = name; } /// @@ -31,16 +33,14 @@ internal ScheduleResource(string name) /// The interval for the schedule running. e.g. 7 for every '7 days' /// The frequency for the schedule running. e.g. Days for every '7 days' /// The middleware (code) to run on a schedule. - public void Every(int rate, Frequency frequency, Func middleware) + public void Every(int rate, Frequency frequency, Func middleware) { - var faas = new Faas(new ScheduleRateWorkerOptions + var registration = new RegistrationRequest { - Rate = rate, - Frequency = frequency, - Description = this.name - }); - - faas.Event(middleware); + ScheduleName = this.Name, + Every = new ScheduleEvery { Rate = rate, } + }; + var worker = new ScheduleWorker(); Nitric.RegisterWorker(faas); } @@ -51,7 +51,7 @@ public void Every(int rate, Frequency frequency, FuncThe interval for the schedule running. e.g. 7 for every '7 days' /// The frequency for the schedule running. e.g. Days for every '7 days' /// The middlewares (code) to run on a schedule. - public void Every(int rate, Frequency frequency, params Middleware[] middleware) + public void Every(int rate, Frequency frequency, params Middleware[] middleware) { var faas = new Faas(new ScheduleRateWorkerOptions { diff --git a/src/Nitric.Sdk/Resource/SecureResource.cs b/src/Nitric.Sdk/Resource/SecureResource.cs index 0ab3ff3..d82d158 100644 --- a/src/Nitric.Sdk/Resource/SecureResource.cs +++ b/src/Nitric.Sdk/Resource/SecureResource.cs @@ -14,7 +14,6 @@ using System.Collections.Generic; using Nitric.Proto.Resources.v1; using Action = Nitric.Proto.Resources.v1.Action; -using GrpcClient = Nitric.Proto.Secrets.v1.SecretManager.SecretManagerClient; namespace Nitric.Sdk.Resource { diff --git a/src/Nitric.Sdk/Resource/TopicResource.cs b/src/Nitric.Sdk/Resource/TopicResource.cs index b4765d1..bfa4bb7 100644 --- a/src/Nitric.Sdk/Resource/TopicResource.cs +++ b/src/Nitric.Sdk/Resource/TopicResource.cs @@ -15,8 +15,6 @@ using System.Collections.Generic; using System.Linq; using Nitric.Proto.Resources.v1; -using Nitric.Sdk.Event; -using Nitric.Sdk.Function; using Nitric.Sdk.Topic; using Action = Nitric.Proto.Resources.v1.Action; using NitricResource = Nitric.Proto.Resources.v1.ResourceIdentifier; diff --git a/src/Nitric.Sdk/Service/BucketNotificationContext.cs b/src/Nitric.Sdk/Service/BucketNotificationContext.cs index baa3824..578d8bc 100644 --- a/src/Nitric.Sdk/Service/BucketNotificationContext.cs +++ b/src/Nitric.Sdk/Service/BucketNotificationContext.cs @@ -13,13 +13,9 @@ // limitations under the License. using System; -using System.Text; -using Nitric.Proto.Faas.v1; -using Nitric.Sdk.Storage; -using TriggerRequestProto = Nitric.Proto.Faas.v1.TriggerRequest; -using BucketNotificationTypeProto = Nitric.Proto.Faas.v1.BucketNotificationType; +using Nitric.Proto.Storage.v1; -namespace Nitric.Sdk.Function +namespace Nitric.Sdk.Service { public enum BucketNotificationType { @@ -30,7 +26,7 @@ public enum BucketNotificationType /// /// Represents a bucket notification being created by a write or delete event in the bucket /// - public class BucketNotificationRequest : AbstractRequest + public class BucketNotificationRequest : TriggerRequest { /// /// A reference to the file that triggered this request @@ -50,48 +46,17 @@ public class BucketNotificationRequest : AbstractRequest /// the file that triggered the notification /// the type of bucket notification /// the bucket that triggered the notification - public BucketNotificationRequest(byte[] data, string key, BucketNotificationType notificationType) : base(data) + public BucketNotificationRequest(string key, BucketNotificationType notificationType) : base() { this.Key = key; this.NotificationType = notificationType; } } - - /// - /// Represents a bucket notification being created by a write or delete event in the bucket - /// - public class FileNotificationRequest : AbstractRequest - { - /// - /// A reference to the file that triggered this request - /// - public File File { get; private set; } - - /// - /// The type of event that triggered this request - /// - /// - public BucketNotificationType NotificationType { get; private set; } - - /// - /// Construct a bucket notification request - /// - /// the payload of the message - /// the file that triggered the notification - /// the type of bucket notification - /// the bucket that triggered the notification - public FileNotificationRequest(byte[] data, string key, BucketNotificationType notificationType, Bucket bucket) : base(data) - { - this.File = bucket.File(key); - this.NotificationType = notificationType; - } - } - /// /// Represents the results of processing a bucket notification. /// - public class BucketNotificationResponse + public class BucketNotificationResponse : TriggerResponse { /// /// Indicates whether the event was successfully processed. @@ -120,7 +85,7 @@ public class BucketNotificationContext : TriggerContext /// The request object /// The response object - public BucketNotificationContext(BucketNotificationRequest req, BucketNotificationResponse res) : base(req, res) + public BucketNotificationContext(string id, BucketNotificationRequest req, BucketNotificationResponse res) : base(id, req, res) { } @@ -130,75 +95,27 @@ public BucketNotificationContext(BucketNotificationRequest req, BucketNotificati /// The trigger to convert into a BucketNotificationContext. /// The bucket notification worker options describing the worker options. /// the new bucket notification context - public static BucketNotificationContext FromGrpcTriggerRequest(TriggerRequestProto trigger, BucketNotificationWorkerOptions options) + public static BucketNotificationContext FromRequest(ServerMessage trigger) { - var notificationType = FromGrpcBucketNotificationType(trigger.Notification.Bucket.Type); + var notificationType = FromGrpcBucketNotificationType(trigger.BlobEventRequest.BlobEvent.Type); return new BucketNotificationContext( - new BucketNotificationRequest(trigger.Data.ToByteArray(), trigger.Notification.Bucket.Key, - notificationType), + trigger.Id, + new BucketNotificationRequest( + trigger.BlobEventRequest.BlobEvent.Key, + notificationType + ), new BucketNotificationResponse(true)); } private static BucketNotificationType FromGrpcBucketNotificationType( - BucketNotificationTypeProto notificationType) - { - return notificationType switch - { - BucketNotificationTypeProto.Created => BucketNotificationType.Write, - BucketNotificationTypeProto.Deleted => BucketNotificationType.Delete, - _ => throw new ArgumentException("Unsupported bucket notification type") - }; - } - - /// - /// Create a gRPC trigger response from this context. - /// - /// the new trigger response - public override TriggerResponse ToGrpcTriggerContext() - { - return new TriggerResponse { Notification = new NotificationResponseContext { Success = this.Res.Success } }; - } - } - - /// - /// Represents the request/response context for a bucket notification. - /// - public class FileNotificationContext : TriggerContext - { - /// - /// Construct a new BucketNotificationContext. - /// - /// The request object - /// The response object - public FileNotificationContext(FileNotificationRequest req, BucketNotificationResponse res) : base(req, res) - { - } - - /// - /// Construct a bucket notification context from a trigger request gRPC object. - /// - /// The trigger to convert into a BucketNotificationContext. - /// The bucket notification worker options describing the worker options. - /// the new bucket notification context - public static FileNotificationContext FromGrpcTriggerRequest(TriggerRequestProto trigger, FileNotificationWorkerOptions options) - { - var notificationType = FromGrpcBucketNotificationType(trigger.Notification.Bucket.Type); - - return new FileNotificationContext( - new FileNotificationRequest(trigger.Data.ToByteArray(), trigger.Notification.Bucket.Key, - notificationType, options.Bucket), - new BucketNotificationResponse(true)); - } - - private static BucketNotificationType FromGrpcBucketNotificationType( - BucketNotificationTypeProto notificationType) + BlobEventType notificationType) { return notificationType switch { - BucketNotificationTypeProto.Created => BucketNotificationType.Write, - BucketNotificationTypeProto.Deleted => BucketNotificationType.Delete, + BlobEventType.Created => BucketNotificationType.Write, + BlobEventType.Deleted => BucketNotificationType.Delete, _ => throw new ArgumentException("Unsupported bucket notification type") }; } @@ -207,9 +124,9 @@ private static BucketNotificationType FromGrpcBucketNotificationType( /// Create a gRPC trigger response from this context. /// /// the new trigger response - public override TriggerResponse ToGrpcTriggerContext() + public ClientMessage ToResponse() { - return new TriggerResponse { Notification = new NotificationResponseContext { Success = this.Res.Success }}; + return new ClientMessage { Id = Id, BlobEventResponse = new BlobEventResponse { Success = this.Res.Success } }; } } } diff --git a/src/Nitric.Sdk/Service/Faas.cs b/src/Nitric.Sdk/Service/Faas.cs deleted file mode 100644 index 29266b0..0000000 --- a/src/Nitric.Sdk/Service/Faas.cs +++ /dev/null @@ -1,723 +0,0 @@ -// Copyright 2021, Nitric Technologies Pty Ltd. -// -// 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. - -using System; -using System.Collections.Generic; -using System.Linq; -using System.Threading.Tasks; -using Grpc.Core; -using Nitric.Proto.Faas.v1; -using Nitric.Sdk.Common; -using Nitric.Sdk.Resource; -using Nitric.Sdk.Storage; -using ProtoApiWorkerOptions = Nitric.Proto.Faas.v1.ApiWorkerOptions; -using ProtoClient = Nitric.Proto.Faas.v1.FaasService.FaasServiceClient; -using BucketNotificationTypeProto = Nitric.Proto.Faas.v1.BucketNotificationType; -using WebsocketNotificationTypeProto = Nitric.Proto.Faas.v1.WebsocketEvent; - -namespace Nitric.Sdk.Function -{ - /// - /// Supported HTTP request methods - /// - public enum HttpMethod - { - /// - /// GET - /// - GET, - - /// - /// POST - /// - POST, - - /// - /// PUT - /// - PUT, - - /// - /// DELETE - /// - DELETE, - - /// - /// PATCH - /// - PATCH, - - /// - /// OPTIONS - /// - OPTIONS, - } - - /// - /// Common Function as a Service worker options - /// - public interface IFaasOptions - { - } - - /// - /// Options for API request handling workers. - /// - public class ApiWorkerOptions : IFaasOptions - { - /// - /// The name of the API this worker should register with. - /// - public string Api { get; set; } - - /// - /// The route this worker handlers. - /// - public string Route { get; set; } - - /// - /// The HTTP method this worker can respond to. - /// - public HashSet Methods { get; set; } - - - public MethodOptions Options { get; set; } - } - - public class MethodOptions - { - public Dictionary Security { get; internal set; } - public Dictionary SecurityDefs { get; internal set; } - } - - /// - /// Options for subscription trigger handling workers. - /// - public class SubscriptionWorkerOptions : IFaasOptions - { - /// - /// - /// - public string Topic { get; set; } - } - - /// - /// Options for schedule trigger handling workers by a rate and frequency descriptors. - /// - public class ScheduleRateWorkerOptions : IFaasOptions - { - public string Description { get; set; } - public int Rate { get; set; } - public Frequency Frequency { get; set; } - } - - /// - /// Options for scheduling triggers for workers by a cron expression. - /// - public class ScheduleCronWorkerOptions : IFaasOptions - { - public string Description { get; set; } - public string Cron { get; set; } - } - - public class FileNotificationWorkerOptions : IFaasOptions - { - public Bucket Bucket { get; set; } - - public BucketNotificationTypeProto NotificationType { get; set; } - - public string NotificationPrefixFilter { get; set; } - - public FileNotificationWorkerOptions( - Bucket bucket, - BucketNotificationType notificationType, - string notificationPrefixFilter) - { - this.Bucket = bucket; - this.NotificationType = ToGrpcNotificationType(notificationType); - this.NotificationPrefixFilter = notificationPrefixFilter; - } - - /// - /// Converts a Nitric bucket notification type to the gRPC equivalent for over-the-wire transfer. - /// - /// The type of notification that the bucket should be triggered on - /// A gRPC representation of the bucket notification type - /// If there is no matching notification type - private static BucketNotificationTypeProto ToGrpcNotificationType(BucketNotificationType notificationType) - { - return notificationType switch - { - BucketNotificationType.Write => BucketNotificationTypeProto.Created, - BucketNotificationType.Delete => BucketNotificationTypeProto.Deleted, - _ => throw new ArgumentException("Unsupported bucket notification type") - }; - } - } - - public class BucketNotificationWorkerOptions : IFaasOptions - { - public string Bucket { get; set; } - public BucketNotificationTypeProto NotificationType { get; set; } - - public string NotificationPrefixFilter { get; set; } - - public BucketNotificationWorkerOptions( - string bucket, - BucketNotificationType notificationType, - string notificationPrefixFilter) - { - this.Bucket = bucket; - this.NotificationType = ToGrpcNotificationType(notificationType); - this.NotificationPrefixFilter = notificationPrefixFilter; - - } - - /// - /// Converts a Nitric bucket notification type to the gRPC equivalent for over-the-wire transfer. - /// - /// The type of notification that the bucket should be triggered on - /// A gRPC representation of the bucket notification type - /// If there is no matching notification type - private static BucketNotificationTypeProto ToGrpcNotificationType(BucketNotificationType notificationType) - { - return notificationType switch - { - BucketNotificationType.Write => BucketNotificationTypeProto.Created, - BucketNotificationType.Delete => BucketNotificationTypeProto.Deleted, - _ => throw new ArgumentException("Unsupported bucket notification type") - }; - } - } - - public class WebsocketWorkerOptions : IFaasOptions - { - public string Socket { get; set; } - - public WebsocketNotificationTypeProto NotificationType { get; set; } - - public WebsocketWorkerOptions( - string socket, - WebsocketEventType notificationType - ) - { - this.Socket = socket; - this.NotificationType = ToGrpcNotificationType(notificationType); - } - - /// - /// Converts a Nitric bucket notification type to the gRPC equivalent for over-the-wire transfer. - /// - /// The type of notification that the bucket should be triggered on - /// A gRPC representation of the bucket notification type - /// If there is no matching notification type - private static WebsocketNotificationTypeProto ToGrpcNotificationType(WebsocketEventType notificationType) - { - return notificationType switch - { - WebsocketEventType.Connected => WebsocketNotificationTypeProto.Connect, - WebsocketEventType.Disconnected => WebsocketNotificationTypeProto.Disconnect, - WebsocketEventType.Message => WebsocketNotificationTypeProto.Message, - _ => throw new ArgumentException("Unsupported websocket notification type") - }; - } - } - - /// - /// Function as a Service server. - /// - /// Registers itself with a Nitric Server then routes incoming request to the appropriate workers. - /// - public class Faas - { - /// - /// Function a as service options - /// - public IFaasOptions Options { get; } - - /// - /// Handlers for HTTP requests - /// - private Func HttpHandler; - - private List> HttpHandlers = new List>(); - - /// - /// Handlers for event requests - /// - private Func EventHandler; - - public List> EventHandlers = new List>(); - - /// - /// Handlers for bucket notification requests - /// - private Func BucketNotificationHandler; - - private List> BucketNotificationHandlers = - new List>(); - - private Func FileNotificationHandler; - - private List> FileNotificationHandlers = - new List>(); - - private Func WebsocketHandler; - - private List> WebsocketHandlers = new List>(); - - - public ProtoClient Client { get; } = new ProtoClient(GrpcChannelProvider.GetChannel()); - - public Faas(IFaasOptions options) - { - this.Options = options; - } - - /// - /// Add a handler to the list of HTTP handlers. Used to chain together HTTP middleware. - /// - /// The HTTP handler to add to the handlers list - /// A reference to this Faas object - public Faas Http(Func handler) - { - this.HttpHandler = handler; - - return this; - } - - public Faas Http(Middleware[] middleware) - { - this.HttpHandlers.AddRange(middleware); - - return this; - } - - /// - /// Add a handler to the list of event handlers. Used to chain together event middleware. - /// - /// The event handler to add to the handlers list - /// A reference to this Faas object - public Faas Event(Func handler) - { - this.EventHandler = handler; - - return this; - } - - public Faas Event(Middleware[] middleware) - { - this.EventHandlers.AddRange(middleware); - - return this; - } - - /// - /// Add a handler to the list of bucket notification handlers. Used to chain together notification middleware. - /// - /// The bucket notification to add to the handlers list - /// A reference to this Faas object - public Faas BucketNotification(Func handler) - { - this.BucketNotificationHandler = handler; - - return this; - } - - public Faas BucketNotification(Middleware[] middleware) - { - this.BucketNotificationHandlers.AddRange(middleware); - - return this; - } - - /// - /// Add a handler to the list of bucket notification handlers. Used to chain together notification middleware. - /// - /// The bucket notification to add to the handlers list - /// A reference to this Faas object - public Faas FileNotification(Func handler) - { - this.FileNotificationHandler = handler; - - return this; - } - - public Faas FileNotification(Middleware[] middleware) - { - this.FileNotificationHandlers.AddRange(middleware); - - return this; - } - - public Faas Websocket(Func handler) - { - this.WebsocketHandler = handler; - - return this; - } - - public Faas Websocket(Middleware[] middleware) - { - this.WebsocketHandlers.AddRange(middleware); - - return this; - } - - private static InitRequest OptionsToInit(IFaasOptions options) - { - switch (options) - { - case ApiWorkerOptions a: - var apiInitReq = new InitRequest { Api = new ApiWorker { Api = a.Api, Path = a.Route } }; - - apiInitReq.Api.Methods.Add(a.Methods.Select(m => m.ToString())); - - var opts = new ProtoApiWorkerOptions(); - - if (a.Options.Security.Count == 0) - { - opts.SecurityDisabled = false; - } else - { - foreach (KeyValuePair kv in a.Options.Security) - { - var scopes = new ApiWorkerScopes(); - scopes.Scopes.AddRange(kv.Value); - - opts.Security.Add(kv.Key, scopes); - } - } - - apiInitReq.Api.Options = opts; - - return apiInitReq; - case ScheduleRateWorkerOptions s: - var scheduleInitReq = new InitRequest - { - Schedule = new ScheduleWorker - { - Rate = new ScheduleRate { Rate = s.Rate + " " + s.Frequency.ToString().ToLower() }, - Key = s.Description - } - }; - return scheduleInitReq; - case ScheduleCronWorkerOptions s: - var scheduleCronInitReq = new InitRequest - { - Schedule = new ScheduleWorker - { - Cron = - { - Cron = s.Cron, - }, - Key = s.Description, - } - }; - return scheduleCronInitReq; - case SubscriptionWorkerOptions s: - var subInitReq = new InitRequest - { - Subscription = new SubscriptionWorker - { - Topic = s.Topic, - }, - }; - return subInitReq; - case BucketNotificationWorkerOptions b: - var notificationInitReq = new InitRequest - { - BucketNotification = new BucketNotificationWorker - { - Bucket = b.Bucket, - Config = new BucketNotificationConfig - { - NotificationPrefixFilter = b.NotificationPrefixFilter, - NotificationType = b.NotificationType, - } - } - }; - return notificationInitReq; - case FileNotificationWorkerOptions f: - var fNotificationInitRequest = new InitRequest - { - BucketNotification = new BucketNotificationWorker - { - Bucket = f.Bucket.Name, - Config = new BucketNotificationConfig - { - NotificationPrefixFilter = f.NotificationPrefixFilter, - NotificationType = f.NotificationType, - } - } - }; - return fNotificationInitRequest; - case WebsocketWorkerOptions w: - var websocketInitRequest = new InitRequest - { - Websocket = new WebsocketWorker - { - Socket = w.Socket, - Event = w.NotificationType, - } - }; - return websocketInitRequest; - } - - throw new Exception("Invalid worker options"); - } - - /// - /// Start the FaaS service to start receiving requests from the Nitric Server - /// - /// - /// - /// - /// - public async Task Start() - { - if ( - this.EventHandlers.Count == 0 && this.EventHandler == null && - this.HttpHandlers.Count == 0 && this.HttpHandler == null && - this.BucketNotificationHandlers.Count == 0 && this.BucketNotificationHandler == null && - this.FileNotificationHandlers.Count == 0 && this.FileNotificationHandler == null && - this.WebsocketHandlers.Count == 0 && this.WebsocketHandler == null - ) - { - throw new Exception("At least one handler must be provided."); - } - - using var call = this.Client.TriggerStream(); - - try - { - await call.RequestStream.WriteAsync( - new ClientMessage - { - InitRequest = OptionsToInit(this.Options), - } - ); - } - catch (RpcException re) - { - // If the server is unavailable, provide a informative message - throw re.StatusCode == StatusCode.Unavailable ? - new Exception( - "Unable to connect to a nitric server! If you're running locally make sure to run \"nitric start\"") - : NitricException.FromRpcException(re); - } - - try - { - while (await call.ResponseStream.MoveNext()) - { - var grpcRequest = call.ResponseStream.Current; - switch (grpcRequest.ContentCase) - { - case ServerMessage.ContentOneofCase.InitResponse: - break; //no-op - reserved for future use. - case ServerMessage.ContentOneofCase.TriggerRequest: - IContext resultContext; - switch (grpcRequest.TriggerRequest.ContextCase) - { - case TriggerRequest.ContextOneofCase.Http: - if (this.HttpHandlers.Count == 0 && this.HttpHandler == null) - { - throw new UnimplementedException("Cannot handle HTTP requests."); - } - - var ctxHttp = TriggerContext - .FromGrpcTriggerRequest(grpcRequest.TriggerRequest, this.Options); - - Func composedHttpHandler = this.HttpHandler; - if (this.HttpHandler == null) - { - Func lastCall = (context) => context; - - this.HttpHandlers.Reverse(); - - composedHttpHandler = this.HttpHandlers.Aggregate(lastCall, (next, handler) => - { - Func nextFunc = (context) => handler(context, next) ?? context; - - return nextFunc; - }); - } - - resultContext = composedHttpHandler(ctxHttp); - break; - case TriggerRequest.ContextOneofCase.Topic: - if (this.EventHandlers.Count == 0 && this.EventHandler == null) - { - throw new UnimplementedException("Cannot handle event requests."); - } - - var ctxEvent = TriggerContext - .FromGrpcTriggerRequest(grpcRequest.TriggerRequest, this.Options); - - - Func composedEventHandler = this.EventHandler; - if (this.EventHandler == null) - { - Func lastCall = (context) => context; - - this.EventHandlers.Reverse(); - - composedEventHandler = this.EventHandlers.Aggregate(lastCall, (next, handler) => - { - Func nextFunc = (context) => handler(context, next) ?? context; - - return nextFunc; - }); - - } - - resultContext = composedEventHandler(ctxEvent); - - break; - case TriggerRequest.ContextOneofCase.Notification: - if (this.Options.GetType() == typeof(BucketNotificationWorkerOptions)) - { - if (this.BucketNotificationHandlers.Count == 0 && - this.BucketNotificationHandler == null) - { - throw new UnimplementedException( - "Cannot handle bucket notification requests."); - } - - var ctxNotification = - TriggerContext - .FromGrpcTriggerRequest( - grpcRequest.TriggerRequest, this.Options); - - - var composedNotificationHandler = this.BucketNotificationHandler; - if (this.BucketNotificationHandler == null) - { - Func lastCall = - (context) => context; - - this.BucketNotificationHandlers.Reverse(); - - composedNotificationHandler = this.BucketNotificationHandlers.Aggregate( - lastCall, - (next, handler) => - { - Func - nextFunc = - (context) => handler(context, next) ?? context; - - return nextFunc; - }); - - } - - resultContext = composedNotificationHandler(ctxNotification); - } - else - { - if (this.FileNotificationHandlers.Count == 0 && - this.FileNotificationHandler == null) - { - throw new UnimplementedException( - "Cannot handle file notification requests."); - } - - var ctxNotification = - TriggerContext - .FromGrpcTriggerRequest( - grpcRequest.TriggerRequest, this.Options); - - - var composedNotificationHandler = this.FileNotificationHandler; - if (this.FileNotificationHandler == null) - { - Func lastCall = - (context) => context; - - this.FileNotificationHandlers.Reverse(); - - composedNotificationHandler = this.FileNotificationHandlers.Aggregate( - lastCall, - (next, handler) => - { - Func - nextFunc = - (context) => handler(context, next) ?? context; - - return nextFunc; - }); - - } - - resultContext = composedNotificationHandler(ctxNotification); - } - - break; - case TriggerRequest.ContextOneofCase.Websocket: - if (this.WebsocketHandlers.Count == 0 && this.WebsocketHandler == null) - { - throw new UnimplementedException("Cannot handle Websocket requests."); - } - - var ctxWebsocket = TriggerContext - .FromGrpcTriggerRequest(grpcRequest.TriggerRequest, this.Options); - - Func composedWebsocketHandler = this.WebsocketHandler; - if (this.WebsocketHandler == null) - { - Func lastCall = (context) => context; - - this.WebsocketHandlers.Reverse(); - - composedWebsocketHandler = this.WebsocketHandlers.Aggregate(lastCall, (next, handler) => - { - Func nextFunc = (context) => handler(context, next) ?? context; - - return nextFunc; - }); - } - - resultContext = composedWebsocketHandler(ctxWebsocket); - break; - case TriggerRequest.ContextOneofCase.None: - default: - throw new Exception("Unsupported trigger request type"); - } - - var grpcResponse = resultContext.ToGrpcTriggerContext(); - - //Write back the response to the server - await call.RequestStream.WriteAsync( - new ClientMessage - { - Id = grpcRequest.Id, - TriggerResponse = grpcResponse - } - ); - break; - case ServerMessage.ContentOneofCase.None: - break; - default: - throw new ArgumentOutOfRangeException(); - } - } - } - catch (RpcException re) - { - throw NitricException.FromRpcException(re); - } - } - } -} diff --git a/src/Nitric.Sdk/Service/Frequency.cs b/src/Nitric.Sdk/Service/Frequency.cs index f5abd5d..1bb518b 100644 --- a/src/Nitric.Sdk/Service/Frequency.cs +++ b/src/Nitric.Sdk/Service/Frequency.cs @@ -11,7 +11,8 @@ // 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. -namespace Nitric.Sdk.Function + +namespace Nitric.Sdk.Service { /// /// Represents schedule frequency value. diff --git a/src/Nitric.Sdk/Service/HttpContext.cs b/src/Nitric.Sdk/Service/HttpContext.cs index a971047..26f51c5 100644 --- a/src/Nitric.Sdk/Service/HttpContext.cs +++ b/src/Nitric.Sdk/Service/HttpContext.cs @@ -18,16 +18,20 @@ using Google.Protobuf; using Google.Protobuf.Collections; using Newtonsoft.Json; -using Nitric.Proto.Faas.v1; -using TriggerRequestProto = Nitric.Proto.Faas.v1.TriggerRequest; +using Nitric.Proto.Apis.v1; -namespace Nitric.Sdk.Function +namespace Nitric.Sdk.Service { /// /// Represents a HTTP request. /// - public class HttpRequest : AbstractRequest + public class HttpRequest : TriggerRequest { + /// + /// The raw bytes. + /// + private byte[] data; + /// /// The HTTP Method that generated this request. E.g. GET, POST, PUT, DELETE. /// @@ -59,7 +63,7 @@ public class HttpRequest : AbstractRequest /// Convert the payload of the request to a string, assuming UTF-8 encoding. /// /// - public string Text => System.Text.Encoding.UTF8.GetString(this.data, 0, this.data.Length); + public string Text => Encoding.UTF8.GetString(this.data, 0, this.data.Length); /// /// Get the HTTP body data encoded from json. @@ -81,8 +85,9 @@ public T Json() { /// any provided HTTP headers public HttpRequest(byte[] data, string method, string path, Dictionary pathParams, Dictionary> queryParams, - Dictionary> headers) : base(data) + Dictionary> headers) : base() { + this.data = data; this.Path = path; this.PathParams = pathParams; this.QueryParams = queryParams; @@ -93,7 +98,7 @@ public HttpRequest(byte[] data, string method, string path, Dictionary /// The response to an HTTP trigger. /// - public class HttpResponse + public class HttpResponse : TriggerResponse { /// /// The HTTP status code of the response. @@ -143,7 +148,7 @@ public class HttpContext : TriggerContext /// /// The context's request /// The context's response - public HttpContext(HttpRequest req, HttpResponse res) : base(req, res) + public HttpContext(string id, HttpRequest req, HttpResponse res) : base(id, req, res) { } @@ -152,26 +157,27 @@ public HttpContext(HttpRequest req, HttpResponse res) : base(req, res) /// /// /// - public static HttpContext FromGrpcTriggerRequest(TriggerRequestProto trigger) + public static HttpContext FromRequest(ServerMessage trigger) { var headers = new Dictionary>(); - foreach (var kv in trigger.Http.Headers) + foreach (var kv in trigger.HttpRequest.Headers) { var values = headers.GetValueOrDefault(kv.Key, new List()); headers.Add(kv.Key, values.Concat(kv.Value.Value)); } var queryParams = new Dictionary>(); - foreach (var kv in trigger.Http.QueryParams) + foreach (var kv in trigger.HttpRequest.QueryParams) { var values = queryParams.GetValueOrDefault(kv.Key, new List()); queryParams.Add(kv.Key, values.Concat(kv.Value.Value)); } - var pathParams = trigger.Http.PathParams.ToDictionary(kv => kv.Key, kv => kv.Value); + var pathParams = trigger.HttpRequest.PathParams.ToDictionary(kv => kv.Key, kv => kv.Value); return new HttpContext( - new HttpRequest(trigger.Data.ToByteArray(), trigger.Http.Method, trigger.Http.Path, pathParams, + trigger.Id, + new HttpRequest(trigger.HttpRequest.Body.ToByteArray(), trigger.HttpRequest.Method, trigger.HttpRequest.Path, pathParams, queryParams, headers), new HttpResponse() ); @@ -181,7 +187,7 @@ public static HttpContext FromGrpcTriggerRequest(TriggerRequestProto trigger) /// Create a gRPC trigger response from this context. /// /// - public override TriggerResponse ToGrpcTriggerContext() + public ClientMessage ToResponse() { var responseHeaders = new MapField { @@ -192,10 +198,17 @@ public override TriggerResponse ToGrpcTriggerContext() return hv; }) }; - var triggerResponse = new TriggerResponse - { Http = new HttpResponseContext { Status = this.Res.Status } }; - triggerResponse.Http.Headers.Add(responseHeaders); - triggerResponse.Data = ByteString.CopyFrom(this.Res.Body); + + var triggerResponse = new ClientMessage { + Id = Id, + HttpResponse = new Proto.Apis.v1.HttpResponse + { + Status = this.Res.Status, + Body = ByteString.CopyFrom(this.Res.Body), + } + }; + + triggerResponse.HttpResponse.Headers.Add(responseHeaders); return triggerResponse; } diff --git a/src/Nitric.Sdk/Service/IntervalContext.cs b/src/Nitric.Sdk/Service/IntervalContext.cs new file mode 100644 index 0000000..963a935 --- /dev/null +++ b/src/Nitric.Sdk/Service/IntervalContext.cs @@ -0,0 +1,78 @@ +// Copyright 2021, Nitric Technologies Pty Ltd. +// +// 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. + +using Nitric.Proto.Schedules.v1; + +namespace Nitric.Sdk.Service +{ + /// + /// Represents a message pushed to a subscriber via a topic. + /// + public class IntervalRequest : TriggerRequest + { + /// + /// The name of the schedule that triggered this request + /// + public string ScheduleName { get; private set; } + + /// + /// Construct an interval request + /// + /// the source schedule + public IntervalRequest(string scheduleName) : base() + { + this.ScheduleName = scheduleName; + } + } + + /// + /// Represents the results of processing an event. + /// + public class IntervalResponse : TriggerResponse { } + + /// + /// Represents the request/response context for an event. + /// + public class IntervalContext : TriggerContext + { + /// + /// Construct a new IntervalContext. + /// + /// The request object + /// The response object + public IntervalContext(string id, IntervalRequest req, IntervalResponse res) : base(id, req, res) + { + } + + /// + /// Construct an event topic from a trigger request gRPC object. + /// + /// The trigger to convert into an EventContext. + /// the new event context + public static IntervalContext FromRequest(ServerMessage trigger) + { + return new IntervalContext(trigger.Id, new IntervalRequest(trigger.IntervalRequest.ScheduleName), + new IntervalResponse()); + } + + /// + /// Create a gRPC trigger response from this context. + /// + /// + public ClientMessage ToRequest() + { + return new ClientMessage { Id = Id, IntervalResponse = new Proto.Schedules.v1.IntervalResponse() }; + } + } +} diff --git a/src/Nitric.Sdk/Service/EventContext.cs b/src/Nitric.Sdk/Service/MessageContext.cs similarity index 61% rename from src/Nitric.Sdk/Service/EventContext.cs rename to src/Nitric.Sdk/Service/MessageContext.cs index cde9616..bf3b53e 100644 --- a/src/Nitric.Sdk/Service/EventContext.cs +++ b/src/Nitric.Sdk/Service/MessageContext.cs @@ -12,41 +12,41 @@ // See the License for the specific language governing permissions and // limitations under the License. -using Nitric.Proto.Faas.v1; -using TriggerRequestProto = Nitric.Proto.Faas.v1.TriggerRequest; +using Nitric.Sdk.Common; +using Nitric.Proto.Topics.v1; +using ProtoMessageResponse = Nitric.Proto.Topics.v1.MessageResponse; +using System.Collections.Generic; -namespace Nitric.Sdk.Function +namespace Nitric.Sdk.Service { /// /// Represents a message pushed to a subscriber via a topic. /// - public class EventRequest : AbstractRequest + public class MessageRequest : TriggerRequest { /// /// The name of the topic that triggered this request /// - public string Topic { get; private set; } + public string TopicName { get; private set; } + + public Dictionary Payload { get; private set; } /// /// Construct an event request /// - /// the payload of the message - /// the source topic - public EventRequest(byte[] data, string topic) : base(data) - { - this.Topic = topic; - } - - public Event.Event Payload() + /// the source topic + /// the message payload + public MessageRequest(string topicName, Message message) : base() { - return Event.Event.FromPayload(this.data); + this.TopicName = topicName; + this.Payload = Struct.ToDictionary(message.StructPayload); } } /// /// Represents the results of processing an event. /// - public class EventResponse + public class MessageResponse : TriggerResponse { /// /// Indicates whether the event was successfully processed. @@ -59,7 +59,7 @@ public class EventResponse /// Construct an event response. /// /// Indicates whether the event was successfully processed. - public EventResponse(bool success) + public MessageResponse(bool success) { this.Success = success; } @@ -68,14 +68,14 @@ public EventResponse(bool success) /// /// Represents the request/response context for an event. /// - public class EventContext : TriggerContext + public class MessageContext : TriggerContext { /// /// Construct a new EventContext. /// /// The request object /// The response object - public EventContext(EventRequest req, EventResponse res) : base(req, res) + public MessageContext(string id, MessageRequest req, MessageResponse res) : base(id, req, res) { } @@ -84,19 +84,23 @@ public EventContext(EventRequest req, EventResponse res) : base(req, res) /// /// The trigger to convert into an EventContext. /// the new event context - public static EventContext FromGrpcTriggerRequest(TriggerRequestProto trigger) + protected static MessageContext FromRequest(ServerMessage trigger) { - return new EventContext(new EventRequest(trigger.Data.ToByteArray(), trigger.Topic.Topic), - new EventResponse(true)); + return new MessageContext(trigger.Id, new MessageRequest(trigger.MessageRequest.TopicName, trigger.MessageRequest.Message), + new MessageResponse(true)); } /// /// Create a gRPC trigger response from this context. /// /// - public override TriggerResponse ToGrpcTriggerContext() + protected ClientMessage ToResponse() { - return new TriggerResponse { Topic = new TopicResponseContext { Success = this.Res.Success } }; + return new ClientMessage + { + Id = Id, + MessageResponse = new ProtoMessageResponse { Success = Res.Success }, + }; } } } diff --git a/src/Nitric.Sdk/Service/Middleware.cs b/src/Nitric.Sdk/Service/Middleware.cs index da4a558..a3b1fad 100644 --- a/src/Nitric.Sdk/Service/Middleware.cs +++ b/src/Nitric.Sdk/Service/Middleware.cs @@ -11,14 +11,14 @@ // 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. + using System; -namespace Nitric.Sdk.Function +namespace Nitric.Sdk.Service { /// /// Represents a chainable handler for incoming requests. Useful for decorating existing handlers. /// /// The request context. - public delegate TCtx Middleware(TCtx ctx, Func next); } diff --git a/src/Nitric.Sdk/Service/TriggerContext.cs b/src/Nitric.Sdk/Service/TriggerContext.cs index e93d55e..403ad62 100644 --- a/src/Nitric.Sdk/Service/TriggerContext.cs +++ b/src/Nitric.Sdk/Service/TriggerContext.cs @@ -12,83 +12,38 @@ // See the License for the specific language governing permissions and // limitations under the License. -using System; -using Newtonsoft.Json; -using Nitric.Proto.Faas.v1; -using TriggerRequestProto = Nitric.Proto.Faas.v1.TriggerRequest; - -namespace Nitric.Sdk.Function +namespace Nitric.Sdk.Service { /// /// The base request structure, common to HTTP and Event requests. /// - public abstract class AbstractRequest - { - /// - /// The payload of the request. - /// - protected byte[] data; - - /// - /// Construct a request. - /// - /// The payload of the request. - protected AbstractRequest(byte[] data) - { - this.data = data; - } - } + public abstract class TriggerRequest { } - public interface IContext - { - /// - /// Convert the context object to the gRPC wire representation. - /// - /// A TriggerResponse from the context - public TriggerResponse ToGrpcTriggerContext(); - } + public abstract class TriggerResponse { } /// /// The base context structure, common to HTTP and Event contexts. /// /// The context's request. /// The context's response. - public abstract class TriggerContext : IContext where Request : AbstractRequest + public abstract class TriggerContext + where Request : TriggerRequest + where Response : TriggerResponse { + protected string Id; public Request Req; public Response Res; - public abstract TriggerResponse ToGrpcTriggerContext(); - /// /// Create a new trigger context with the provided request and response objects. /// /// The request object that initiated the trigger /// The response to be returned from processing the trigger - protected TriggerContext(Request req, Response res) + protected TriggerContext(string id, Request req, Response res) { + this.Id = id; this.Req = req; this.Res = res; } - - /// - /// Construct the appropriate context object based on the type of the incoming trigger. - /// - /// The trigger to use to create the context. - /// The expected context type. - /// A new context object. - /// Throws if the context type is unknown or unsupported. - public static T FromGrpcTriggerRequest(TriggerRequestProto trigger, IFaasOptions options) where T : TriggerContext - { - return trigger.ContextCase switch - { - TriggerRequestProto.ContextOneofCase.Http => HttpContext.FromGrpcTriggerRequest(trigger) as T, - TriggerRequestProto.ContextOneofCase.Topic => EventContext.FromGrpcTriggerRequest(trigger) as T, - TriggerRequestProto.ContextOneofCase.Notification => - BucketNotificationContext.FromGrpcTriggerRequest(trigger, (BucketNotificationWorkerOptions)options) as T, - TriggerRequestProto.ContextOneofCase.Websocket => WebsocketContext.FromGrpcTriggerRequest(trigger) as T, - _ => throw new Exception("Unsupported trigger request type") - }; - } } } diff --git a/src/Nitric.Sdk/Service/WebsocketContext.cs b/src/Nitric.Sdk/Service/WebsocketContext.cs index ac956a2..fd5f227 100644 --- a/src/Nitric.Sdk/Service/WebsocketContext.cs +++ b/src/Nitric.Sdk/Service/WebsocketContext.cs @@ -14,14 +14,13 @@ using System; using System.Collections.Generic; using System.Linq; -using System.Runtime.CompilerServices; using System.Text; using Newtonsoft.Json; -using Nitric.Proto.Faas.v1; -using TriggerRequestProto = Nitric.Proto.Faas.v1.TriggerRequest; -using WebsocketNotificationTypeProto = Nitric.Proto.Faas.v1.WebsocketEvent; +using Nitric.Proto.Websockets.v1; +using WebsocketEventTypeProto = Nitric.Proto.Websockets.v1.WebsocketEventRequest.WebsocketEventOneofCase; +using Google.Protobuf.Collections; -namespace Nitric.Sdk.Function +namespace Nitric.Sdk.Service { public enum WebsocketEventType { @@ -30,12 +29,17 @@ public enum WebsocketEventType Message } - public class WebsocketRequest : AbstractRequest + public class WebsocketRequest : TriggerRequest { + /// + /// The raw message bytes + /// + private byte[] data; + /// /// The name of the websocket that triggered this request /// - public string Socket { get; private set; } + public string SocketName { get; private set; } /// /// The type of websocket notification @@ -59,21 +63,21 @@ public class WebsocketRequest : AbstractRequest /// /// Construct an event request /// - /// the payload of the message - /// the source websocket + /// the source websocket /// the type of websocket notification /// the id of the individual connection /// the websocket query parameters - public WebsocketRequest(byte[] data, string socket, WebsocketEventType notificationType, string connectionId, Dictionary query) : base(data) + public WebsocketRequest(byte[] data, string socketName, WebsocketEventType notificationType, string connectionId, Dictionary query) : base() { - this.Socket = socket; + this.data = data; + this.SocketName = socketName; this.NotificationType = notificationType; this.ConnectionId = connectionId; this.Query = query; } } - public class WebsocketResponse + public class WebsocketResponse : TriggerResponse { /// /// Indicates whether the event was successfully processed. @@ -99,7 +103,7 @@ public class WebsocketContext : TriggerContext /// The request object /// The response object - public WebsocketContext(WebsocketRequest req, WebsocketResponse res) : base(req, res) + public WebsocketContext(string id, WebsocketRequest req, WebsocketResponse res) : base(id, req, res) { } @@ -108,26 +112,39 @@ public WebsocketContext(WebsocketRequest req, WebsocketResponse res) : base(req, /// /// The trigger to convert into an EventContext. /// the new event context - public static WebsocketContext FromGrpcTriggerRequest(TriggerRequestProto trigger) + public static WebsocketContext ToRequest(ServerMessage trigger) { - var type = FromGrpcWebsocketNotificationType(trigger.Websocket.Event); - Dictionary query = trigger.Websocket.QueryParams.Select + var type = FromGrpcWebsocketNotificationType(trigger.WebsocketEventRequest.WebsocketEventCase); + var queryParams = GetQueryParams(trigger.WebsocketEventRequest.Connection.QueryParams); + + return new WebsocketContext( + trigger.Id, + new WebsocketRequest( + trigger.WebsocketEventRequest.Message.Body.ToByteArray(), + trigger.WebsocketEventRequest.SocketName, + type, + trigger.WebsocketEventRequest.ConnectionId, + queryParams + ), + new WebsocketResponse(true)); + } + + private static Dictionary GetQueryParams(MapField queryParams) + { + return queryParams.Select (kv => new KeyValuePair(kv.Key, kv.Value.Value.ToArray()) ).ToDictionary(x => x.Key, x => x.Value); - return new WebsocketContext( - new WebsocketRequest(trigger.Data.ToByteArray(), trigger.Websocket.Socket, type, trigger.Websocket.ConnectionId, query), - new WebsocketResponse(true)); } private static WebsocketEventType FromGrpcWebsocketNotificationType( - WebsocketNotificationTypeProto notificationType) + WebsocketEventTypeProto notificationType) { return notificationType switch { - WebsocketNotificationTypeProto.Connect => WebsocketEventType.Connected, - WebsocketNotificationTypeProto.Disconnect => WebsocketEventType.Disconnected, - WebsocketNotificationTypeProto.Message => WebsocketEventType.Message, + WebsocketEventTypeProto.Connection => WebsocketEventType.Connected, + WebsocketEventTypeProto.Disconnection => WebsocketEventType.Disconnected, + WebsocketEventTypeProto.Message => WebsocketEventType.Message, _ => throw new ArgumentException("Unsupported bucket notification type") }; } @@ -136,9 +153,9 @@ private static WebsocketEventType FromGrpcWebsocketNotificationType( /// Create a gRPC trigger response from this context. /// /// - public override TriggerResponse ToGrpcTriggerContext() + public ClientMessage ToResponse() { - return new TriggerResponse { Websocket = new WebsocketResponseContext { Success = this.Res.Success } }; + return new ClientMessage { Id = Id, WebsocketEventResponse = new WebsocketEventResponse { } }; } } } diff --git a/src/Nitric.Sdk/Worker/ScheduleWorker.cs b/src/Nitric.Sdk/Worker/ScheduleWorker.cs new file mode 100644 index 0000000..66112b2 --- /dev/null +++ b/src/Nitric.Sdk/Worker/ScheduleWorker.cs @@ -0,0 +1,48 @@ +using System.Threading; +using System.Threading.Tasks; +using Nitric.Sdk.Common; +using Nitric.Proto.Schedules.v1; +using GrpcClient = Nitric.Proto.Schedules.v1.Schedules.SchedulesClient; +using Nitric.Sdk.Service; +using Nitric.Sdk.Resource; + +namespace Nitric.Sdk.Worker +{ + public class ScheduleWorker : AbstractWorker + { + readonly private RegistrationRequest RegistrationRequest; + + public ScheduleWorker(RegistrationRequest request, params Middleware[] middlewares) : base(middlewares) + { + this.RegistrationRequest = request; + } + + public override Task Start() + { + return Task.Run(async () => + { + var client = new GrpcClient(GrpcChannelProvider.GetChannel()); + + var stream = client.Schedule(); + + await stream.RequestStream.WriteAsync(new ClientMessage { RegistrationRequest = RegistrationRequest }); + + while (!stream.ResponseStream.Current.Equals(null)) + { + var req = stream.ResponseStream.Current; + + var ctx = IntervalContext.FromRequest(req); + + ctx = this.Middleware(ctx); + + await stream.RequestStream.WriteAsync(ctx.ToRequest()); + + await stream.ResponseStream.MoveNext(CancellationToken.None); + } + + await stream.RequestStream.CompleteAsync(); + }); + } + } +} + diff --git a/src/Nitric.Sdk/Worker/Worker.cs b/src/Nitric.Sdk/Worker/Worker.cs new file mode 100644 index 0000000..5877b03 --- /dev/null +++ b/src/Nitric.Sdk/Worker/Worker.cs @@ -0,0 +1,40 @@ +using System; +using System.Threading.Tasks; +using System.Collections.Generic; +using Nitric.Sdk.Service; +using System.Linq; + +namespace Nitric.Sdk.Worker +{ + public abstract class AbstractWorker + { + protected Func, TriggerContext> Middleware; + + public AbstractWorker(params Middleware>[] middlewares) + { + if (middlewares.Count() == 0) + { + throw new ArgumentException("cannot create schedule worker with no handlers"); + } + + // Convert the middleware array into a list + var middlewareList = new List>>(); + + middlewareList.AddRange(middlewares); + + Func, TriggerContext> lastCall = (context) => context; + + middlewares.Reverse(); + + this.Middleware = middlewares.Aggregate(lastCall, (next, handler) => + { + Func, TriggerContext> nextFunc = (context) => handler(context, next) ?? context; + + return nextFunc; + }); + } + + public abstract Task Start(); + } +} + From 2b0b6c7e9494e1d0178996180f1beed626621a39 Mon Sep 17 00:00:00 2001 From: Ryan Cartwright Date: Fri, 16 Feb 2024 13:01:30 +1100 Subject: [PATCH 06/34] working schedule implementation --- src/Nitric.Sdk/Nitric.Sdk.csproj | 4 +- src/Nitric.Sdk/Nitric.cs | 32 +- src/Nitric.Sdk/Queue/FailedTask.cs | 76 +- src/Nitric.Sdk/Queue/Queue.cs | 418 ++++----- src/Nitric.Sdk/Queue/QueuesClient.cs | 96 +- src/Nitric.Sdk/Queue/Task.cs | 198 ++-- src/Nitric.Sdk/Resource/ApiResource.cs | 850 +++++++++--------- src/Nitric.Sdk/Resource/BucketResource.cs | 248 ++--- src/Nitric.Sdk/Resource/CollectionResource.cs | 160 ++-- src/Nitric.Sdk/Resource/QueueResource.cs | 152 ++-- src/Nitric.Sdk/Resource/ScheduleResource.cs | 61 +- src/Nitric.Sdk/Resource/TopicResource.cs | 182 ++-- src/Nitric.Sdk/Resource/WebsocketResource.cs | 180 ++-- src/Nitric.Sdk/Storage/Bucket.cs | 248 ++--- src/Nitric.Sdk/Storage/File.cs | 376 ++++---- src/Nitric.Sdk/Storage/StorageClient.cs | 96 +- src/Nitric.Sdk/Topic/Topic.cs | 120 +-- src/Nitric.Sdk/Topic/TopicsClient.cs | 142 +-- src/Nitric.Sdk/Websocket/Connection.cs | 138 +-- src/Nitric.Sdk/Websocket/WebsocketClient.cs | 78 +- src/Nitric.Sdk/Worker/ScheduleWorker.cs | 37 +- src/Nitric.Sdk/Worker/Worker.cs | 24 +- 22 files changed, 1967 insertions(+), 1949 deletions(-) diff --git a/src/Nitric.Sdk/Nitric.Sdk.csproj b/src/Nitric.Sdk/Nitric.Sdk.csproj index b44f3b1..bb7718d 100644 --- a/src/Nitric.Sdk/Nitric.Sdk.csproj +++ b/src/Nitric.Sdk/Nitric.Sdk.csproj @@ -1,7 +1,7 @@ netstandard2.1 - 0.0.1 + 0.0.12 Nitric.Sdk Nitric Pty Ltd LICENSE.txt @@ -36,4 +36,4 @@ - \ No newline at end of file + diff --git a/src/Nitric.Sdk/Nitric.cs b/src/Nitric.Sdk/Nitric.cs index 94861d1..edc4f00 100644 --- a/src/Nitric.Sdk/Nitric.cs +++ b/src/Nitric.Sdk/Nitric.cs @@ -17,7 +17,6 @@ using System.Threading.Tasks; using Nitric.Sdk.Resource; using Nitric.Sdk.Worker; -using Nitric.Sdk.Service; namespace Nitric.Sdk { @@ -26,13 +25,18 @@ namespace Nitric.Sdk /// public class Nitric { - private static readonly List Workers = new List(); + private static readonly List Workers = new List(); private static readonly Dictionary> Cache = new Dictionary>(); - internal static void RegisterWorker(AbstractWorker worker) + internal static void RegisterWorker(IWorker worker) { + if (worker == null) + { + throw new ArgumentNullException("Cannot register a null worker."); + } + Nitric.Workers.Add(worker); } @@ -54,10 +58,10 @@ public static void Run() /// /// The unique name of this API. /// - public static ApiResource Api(string name, ApiOptions options = null) - { - return new ApiResource(name, options); - } + //public static ApiResource Api(string name, ApiOptions options = null) + //{ + // return new ApiResource(name, options); + //} /// /// Declare a schedule. @@ -93,7 +97,7 @@ private static T Cached(string name, Func make) where T : BaseReso /// /// The unique name of the bucket within this application. /// A bucket resource, if the name has already been declared the same resource will be returned. - public static BucketResource Bucket(string name) => Cached(name, t => new BucketResource(t)); + //public static BucketResource Bucket(string name) => Cached(name, t => new BucketResource(t)); /// @@ -102,8 +106,8 @@ private static T Cached(string name, Func make) where T : BaseReso /// The unique name of the collection within this application. /// The type of documents to be stored in the collection. /// A collection resource, if the name has already been declared the same resource will be returned. - public static CollectionResource Collection(string name) => - Cached(name, t => new CollectionResource(t)); + //public static CollectionResource Collection(string name) => + // Cached(name, t => new CollectionResource(t)); /// /// Declare a secret resource for accessing and putting secret values. @@ -117,20 +121,20 @@ public static CollectionResource Collection(string name) = /// /// The unique name of the queue within this application. /// A queue resource, if the name has already been declared the same resource will be returned. - public static QueueResource Queue(string name) => Cached(name, n => new QueueResource(n)); + //public static QueueResource Queue(string name) => Cached(name, n => new QueueResource(n)); /// /// Declare a topic resource for push-based events and messaging. /// /// The unique name of the topic within this application. /// A topic resource, if the name has already been declared the same resource will be returned. - public static TopicResource Topic(string name) => Cached(name, t => new TopicResource(t)); + //public static TopicResource Topic(string name) => Cached(name, t => new TopicResource(t)); /// - /// Declare a websocket resource for bidirectional HTTP communication. + /// Declare a websocket resource for bidirectional HxwTTP communication. /// /// The unique name of the websocket within this application. /// A websocket resource, if the name has already been declared the same resource will be returned. - public static WebsocketResource Websocket(string name) => Cached(name, t => new WebsocketResource(t)); + //public static WebsocketResource Websocket(string name) => Cached(name, t => new WebsocketResource(t)); } } diff --git a/src/Nitric.Sdk/Queue/FailedTask.cs b/src/Nitric.Sdk/Queue/FailedTask.cs index ac83300..d8f8831 100644 --- a/src/Nitric.Sdk/Queue/FailedTask.cs +++ b/src/Nitric.Sdk/Queue/FailedTask.cs @@ -1,41 +1,41 @@ -// Copyright 2021, Nitric Technologies Pty Ltd. -// -// 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. +//// Copyright 2021, Nitric Technologies Pty Ltd. +//// +//// 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. -namespace Nitric.Sdk.Queue -{ - /// - /// Represents a task that was unable to be sent to a queue. - /// - public class FailedTask - { - /// - /// The error message. - /// - public string Message { get; set; } +//namespace Nitric.Sdk.Queue +//{ +// /// +// /// Represents a task that was unable to be sent to a queue. +// /// +// public class FailedTask +// { +// /// +// /// The error message. +// /// +// public string Message { get; set; } - /// - /// The task that failed to be sent. - /// - public Task Task { get; set; } +// /// +// /// The task that failed to be sent. +// /// +// public Task Task { get; set; } - /// - /// Return a string representation of the failed task. - /// - /// - public override string ToString() - { - return GetType().Name + "[task=" + Task + ", message=" + Message + "]"; - } - } -} +// /// +// /// Return a string representation of the failed task. +// /// +// /// +// public override string ToString() +// { +// return GetType().Name + "[task=" + Task + ", message=" + Message + "]"; +// } +// } +//} diff --git a/src/Nitric.Sdk/Queue/Queue.cs b/src/Nitric.Sdk/Queue/Queue.cs index a308980..953dce8 100644 --- a/src/Nitric.Sdk/Queue/Queue.cs +++ b/src/Nitric.Sdk/Queue/Queue.cs @@ -1,209 +1,209 @@ -// Copyright 2021, Nitric Technologies Pty Ltd. -// -// 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. -using System; -using System.Collections.Generic; -using System.Linq; -using Google.Protobuf.Collections; -using Newtonsoft.Json; -using Nitric.Sdk.Common; -using Nitric.Proto.Queues.v1; - -namespace Nitric.Sdk.Queue -{ - /// - /// A reference to a queue in the queues service. - /// - public class Queue - { - /// - /// The name of the queue. - /// - public string Name { get; internal set; } - - internal readonly QueuesClient QueuesClient; - - internal Queue(QueuesClient client, string name) - { - this.Name = name; - this.QueuesClient = client; - } - - /// - /// Send a task to this queue. - /// - /// The task to send. - /// - /// - public void Send(Task task) - { - if (task == null) - { - throw new ArgumentNullException(nameof(task)); - } - - var request = new QueueSendRequest - { - Payload = task.Payload; - }; - try - { - QueuesClient.Client.Send(request); - } - catch (Grpc.Core.RpcException re) - { - throw NitricException.FromRpcException(re); - } - } - - /// - /// Send a task to this queue. - /// - /// The payload of the task to send. - /// - /// - public void Send(T payload) - { - var task = new Task { Payload = payload }; - - var request = new QueueSendRequest - { - Queue = this.Name, - Task = task.ToWire() - }; - try - { - QueuesClient.Client.Send(request); - } - catch (Grpc.Core.RpcException re) - { - throw NitricException.FromRpcException(re); - } - } - - /// - /// Send multiple tasks to this queue. - /// - /// The tasks to send. - /// Results of sending tasks to the queue, including any tasks that failed to be sent. - /// - public List> Send(params Task[] tasks) - { - var wireEvents = new RepeatedField(); - foreach (var task in tasks) - { - wireEvents.Add(task.ToWire()); - } - - var request = new QueueSendBatchRequest { Queue = this.Name }; - request.Tasks.AddRange(wireEvents); - try - { - var response = QueuesClient.Client.SendBatch(request); - var failedTasks = response.FailedTasks.Select(WireToFailedTask).ToList(); - return failedTasks; - } - catch (Grpc.Core.RpcException re) - { - throw NitricException.FromRpcException(re); - } - } - - /// - /// Send multiple tasks to this queue. - /// - /// The tasks to send. - /// Results of sending tasks to the queue, including any tasks that failed to be sent. - /// - public List> Send(params T[] payloads) - { - var wireEvents = new RepeatedField(); - foreach (var payload in payloads) - { - var task = new Task { Payload = payload }; - wireEvents.Add(task.ToWire()); - } - - var request = new QueueSendBatchRequest { Queue = this.Name }; - request.Tasks.AddRange(wireEvents); - try - { - var response = QueuesClient.Client.SendBatch(request); - var failedTasks = response.FailedTasks.Select(WireToFailedTask).ToList(); - return failedTasks; - } - catch (Grpc.Core.RpcException re) - { - throw NitricException.FromRpcException(re); - } - } - - /// - /// Request tasks from the queue to process. - /// - /// The number of tasks returned will be the same or less than the requested depth, based on the number of tasks - /// available on the queue. - /// - /// The maximum number of tasks to receive. - /// Tasks received from the queue. - /// - public List> Receive(int depth = 1) - { - if (depth < 1) - { - depth = 1; - } - - var request = new QueueReceiveRequest { Queue = this.Name, Depth = depth }; - try - { - var response = this.QueuesClient.Client.Receive(request); - return response.Tasks.Select(WireToQueueItem).ToList(); - } - catch (Grpc.Core.RpcException re) - { - throw NitricException.FromRpcException(re); - } - } - - private ReceivedTask WireToQueueItem(NitricTask nitricTask) - { - var protoPayload = JsonConvert.SerializeObject(nitricTask.Payload); - - return new ReceivedTask - { - Id = nitricTask.Id, - PayloadType = nitricTask.PayloadType, - Payload = JsonConvert.DeserializeObject(protoPayload), - LeaseId = nitricTask.LeaseId, - Queue = this, - }; - } - - private static FailedTask WireToFailedTask(Proto.Queue.v1.FailedTask protoFailedEvent) - { - var protoPayload = JsonConvert.SerializeObject(protoFailedEvent.Task.Payload); - - return new FailedTask - { - Message = protoFailedEvent.Message, - Task = new Task - { - Id = protoFailedEvent.Task.Id, - PayloadType = protoFailedEvent.Task.PayloadType, - Payload = JsonConvert.DeserializeObject(protoPayload), - } - }; - } - } -} +//// Copyright 2021, Nitric Technologies Pty Ltd. +//// +//// 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. +//using System; +//using System.Collections.Generic; +//using System.Linq; +//using Google.Protobuf.Collections; +//using Newtonsoft.Json; +//using Nitric.Sdk.Common; +//using Nitric.Proto.Queues.v1; + +//namespace Nitric.Sdk.Queue +//{ +// /// +// /// A reference to a queue in the queues service. +// /// +// public class Queue +// { +// /// +// /// The name of the queue. +// /// +// public string Name { get; internal set; } + +// internal readonly QueuesClient QueuesClient; + +// internal Queue(QueuesClient client, string name) +// { +// this.Name = name; +// this.QueuesClient = client; +// } + +// /// +// /// Send a task to this queue. +// /// +// /// The task to send. +// /// +// /// +// public void Send(Task task) +// { +// if (task == null) +// { +// throw new ArgumentNullException(nameof(task)); +// } + +// var request = new QueueSendRequest +// { +// Payload = task.Payload; +// }; +// try +// { +// QueuesClient.Client.Send(request); +// } +// catch (Grpc.Core.RpcException re) +// { +// throw NitricException.FromRpcException(re); +// } +// } + +// /// +// /// Send a task to this queue. +// /// +// /// The payload of the task to send. +// /// +// /// +// public void Send(T payload) +// { +// var task = new Task { Payload = payload }; + +// var request = new QueueSendRequest +// { +// Queue = this.Name, +// Task = task.ToWire() +// }; +// try +// { +// QueuesClient.Client.Send(request); +// } +// catch (Grpc.Core.RpcException re) +// { +// throw NitricException.FromRpcException(re); +// } +// } + +// /// +// /// Send multiple tasks to this queue. +// /// +// /// The tasks to send. +// /// Results of sending tasks to the queue, including any tasks that failed to be sent. +// /// +// public List> Send(params Task[] tasks) +// { +// var wireEvents = new RepeatedField(); +// foreach (var task in tasks) +// { +// wireEvents.Add(task.ToWire()); +// } + +// var request = new QueueSendBatchRequest { Queue = this.Name }; +// request.Tasks.AddRange(wireEvents); +// try +// { +// var response = QueuesClient.Client.SendBatch(request); +// var failedTasks = response.FailedTasks.Select(WireToFailedTask).ToList(); +// return failedTasks; +// } +// catch (Grpc.Core.RpcException re) +// { +// throw NitricException.FromRpcException(re); +// } +// } + +// /// +// /// Send multiple tasks to this queue. +// /// +// /// The tasks to send. +// /// Results of sending tasks to the queue, including any tasks that failed to be sent. +// /// +// public List> Send(params T[] payloads) +// { +// var wireEvents = new RepeatedField(); +// foreach (var payload in payloads) +// { +// var task = new Task { Payload = payload }; +// wireEvents.Add(task.ToWire()); +// } + +// var request = new QueueSendBatchRequest { Queue = this.Name }; +// request.Tasks.AddRange(wireEvents); +// try +// { +// var response = QueuesClient.Client.SendBatch(request); +// var failedTasks = response.FailedTasks.Select(WireToFailedTask).ToList(); +// return failedTasks; +// } +// catch (Grpc.Core.RpcException re) +// { +// throw NitricException.FromRpcException(re); +// } +// } + +// /// +// /// Request tasks from the queue to process. +// /// +// /// The number of tasks returned will be the same or less than the requested depth, based on the number of tasks +// /// available on the queue. +// /// +// /// The maximum number of tasks to receive. +// /// Tasks received from the queue. +// /// +// public List> Receive(int depth = 1) +// { +// if (depth < 1) +// { +// depth = 1; +// } + +// var request = new QueueReceiveRequest { Queue = this.Name, Depth = depth }; +// try +// { +// var response = this.QueuesClient.Client.Receive(request); +// return response.Tasks.Select(WireToQueueItem).ToList(); +// } +// catch (Grpc.Core.RpcException re) +// { +// throw NitricException.FromRpcException(re); +// } +// } + +// private ReceivedTask WireToQueueItem(NitricTask nitricTask) +// { +// var protoPayload = JsonConvert.SerializeObject(nitricTask.Payload); + +// return new ReceivedTask +// { +// Id = nitricTask.Id, +// PayloadType = nitricTask.PayloadType, +// Payload = JsonConvert.DeserializeObject(protoPayload), +// LeaseId = nitricTask.LeaseId, +// Queue = this, +// }; +// } + +// private static FailedTask WireToFailedTask(Proto.Queue.v1.FailedTask protoFailedEvent) +// { +// var protoPayload = JsonConvert.SerializeObject(protoFailedEvent.Task.Payload); + +// return new FailedTask +// { +// Message = protoFailedEvent.Message, +// Task = new Task +// { +// Id = protoFailedEvent.Task.Id, +// PayloadType = protoFailedEvent.Task.PayloadType, +// Payload = JsonConvert.DeserializeObject(protoPayload), +// } +// }; +// } +// } +//} diff --git a/src/Nitric.Sdk/Queue/QueuesClient.cs b/src/Nitric.Sdk/Queue/QueuesClient.cs index 3903b13..edac0ad 100644 --- a/src/Nitric.Sdk/Queue/QueuesClient.cs +++ b/src/Nitric.Sdk/Queue/QueuesClient.cs @@ -1,53 +1,53 @@ -// Copyright 2021, Nitric Technologies Pty Ltd. -// -// 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. +//// Copyright 2021, Nitric Technologies Pty Ltd. +//// +//// 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. -using GrpcClient = Nitric.Proto.Queues.v1.Queues.QueuesClient; -using Nitric.Sdk.Common; -using System; +//using GrpcClient = Nitric.Proto.Queues.v1.Queues.QueuesClient; +//using Nitric.Sdk.Common; +//using System; -namespace Nitric.Sdk.Queue -{ - /// - /// A queues service client. - /// - public class QueuesClient - { - internal GrpcClient Client { get; private set; } +//namespace Nitric.Sdk.Queue +//{ +// /// +// /// A queues service client. +// /// +// public class QueuesClient +// { +// internal GrpcClient Client { get; private set; } - /// - /// Create a new queues service client. - /// - /// - public QueuesClient(GrpcClient client = null) - { - this.Client = client ?? new GrpcClient(GrpcChannelProvider.GetChannel()); - } +// /// +// /// Create a new queues service client. +// /// +// /// +// public QueuesClient(GrpcClient client = null) +// { +// this.Client = client ?? new GrpcClient(GrpcChannelProvider.GetChannel()); +// } - /// - /// Create a reference to the queue in the queues service. - /// - /// The queue's name - /// A new queue reference for sending or receiving tasks. - /// - public Queue Queue(string queueName) - { - if (string.IsNullOrEmpty(queueName)) - { - throw new ArgumentNullException(nameof(queueName)); - } +// /// +// /// Create a reference to the queue in the queues service. +// /// +// /// The queue's name +// /// A new queue reference for sending or receiving tasks. +// /// +// public Queue Queue(string queueName) +// { +// if (string.IsNullOrEmpty(queueName)) +// { +// throw new ArgumentNullException(nameof(queueName)); +// } - return new Queue(this, queueName); - } - } -} +// return new Queue(this, queueName); +// } +// } +//} diff --git a/src/Nitric.Sdk/Queue/Task.cs b/src/Nitric.Sdk/Queue/Task.cs index bcb778d..792dd0b 100644 --- a/src/Nitric.Sdk/Queue/Task.cs +++ b/src/Nitric.Sdk/Queue/Task.cs @@ -1,109 +1,109 @@ -// Copyright 2021, Nitric Technologies Pty Ltd. -// -// 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. +//// Copyright 2021, Nitric Technologies Pty Ltd. +//// +//// 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. -using System; -using Google.Protobuf; -using Google.Protobuf.WellKnownTypes; -using Newtonsoft.Json; -using Nitric.Proto.Queue.v1; -using Nitric.Sdk.Common; +//using System; +//using Google.Protobuf; +//using Google.Protobuf.WellKnownTypes; +//using Newtonsoft.Json; +//using Nitric.Proto.Queue.v1; +//using Nitric.Sdk.Common; -namespace Nitric.Sdk.Queue -{ - /// - /// Represents a Message to be delivered via a Queue. - /// - public class Task - { - public string Id { get; set; } - public string PayloadType { get; set; } - public T Payload { get; set; } +//namespace Nitric.Sdk.Queue +//{ +// /// +// /// Represents a Message to be delivered via a Queue. +// /// +// public class Task +// { +// public string Id { get; set; } +// public string PayloadType { get; set; } +// public T Payload { get; set; } - public Task() - { - } +// public Task() +// { +// } - /// - /// Return a string representation of the task. - /// - /// A string - public override string ToString() - { - return GetType().Name + "[ID=" + this.Id + "]"; - } +// /// +// /// Return a string representation of the task. +// /// +// /// A string +// public override string ToString() +// { +// return GetType().Name + "[ID=" + this.Id + "]"; +// } - internal NitricTask ToWire() - { - Struct payload = null; - if (this.Payload != null) - { - var jsonPayload = JsonConvert.SerializeObject(this.Payload); - payload = JsonParser.Default.Parse(jsonPayload); - } +// internal NitricTask ToWire() +// { +// Struct payload = null; +// if (this.Payload != null) +// { +// var jsonPayload = JsonConvert.SerializeObject(this.Payload); +// payload = JsonParser.Default.Parse(jsonPayload); +// } - return new NitricTask - { - Id = this.Id ?? "", - PayloadType = this.PayloadType ?? "", - Payload = payload - }; - } - } +// return new NitricTask +// { +// Id = this.Id ?? "", +// PayloadType = this.PayloadType ?? "", +// Payload = payload +// }; +// } +// } - /// - /// Represents a task received locally for processing. - /// - /// Since received tasks are on a limited time lease they include a lease ID. - /// Received tasks must be completed to be removed from the queue and avoid reprocessing - /// - public class ReceivedTask : Task - { - /// - /// The queue that was the source of this task. - /// - public Queue Queue { get; set; } +// /// +// /// Represents a task received locally for processing. +// /// +// /// Since received tasks are on a limited time lease they include a lease ID. +// /// Received tasks must be completed to be removed from the queue and avoid reprocessing +// /// +// public class ReceivedTask : Task +// { +// /// +// /// The queue that was the source of this task. +// /// +// public Queue Queue { get; set; } - /// - /// The unique lease id for this task lease. - /// - public string LeaseId { get; set; } +// /// +// /// The unique lease id for this task lease. +// /// +// public string LeaseId { get; set; } - /// - /// Complete this task and remove it from the source queue. - /// - /// - /// - public void Complete() - { - if (string.IsNullOrEmpty(this.LeaseId)) - { - throw new ArgumentNullException(nameof(this.LeaseId)); - } +// /// +// /// Complete this task and remove it from the source queue. +// /// +// /// +// /// +// public void Complete() +// { +// if (string.IsNullOrEmpty(this.LeaseId)) +// { +// throw new ArgumentNullException(nameof(this.LeaseId)); +// } - var request = new QueueCompleteRequest - { - Queue = this.Queue.Name, - LeaseId = this.LeaseId, - }; - try - { - Queue.QueuesClient.Client.Complete(request); - } - catch (Grpc.Core.RpcException re) - { - throw NitricException.FromRpcException(re); - } - } - } -} +// var request = new QueueCompleteRequest +// { +// Queue = this.Queue.Name, +// LeaseId = this.LeaseId, +// }; +// try +// { +// Queue.QueuesClient.Client.Complete(request); +// } +// catch (Grpc.Core.RpcException re) +// { +// throw NitricException.FromRpcException(re); +// } +// } +// } +//} diff --git a/src/Nitric.Sdk/Resource/ApiResource.cs b/src/Nitric.Sdk/Resource/ApiResource.cs index d6b18c6..d0032a8 100644 --- a/src/Nitric.Sdk/Resource/ApiResource.cs +++ b/src/Nitric.Sdk/Resource/ApiResource.cs @@ -1,425 +1,425 @@ -// Copyright 2021, Nitric Technologies Pty Ltd. -// -// 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. -using System; -using System.Linq; -using System.Collections.Generic; -using System.Threading.Tasks; -using Google.Api; -using Nitric.Proto.Resources.v1; -using Nitric.Sdk.Function; -using GrpcClient = Nitric.Proto.Secrets.v1.SecretManager.SecretManagerClient; -using NitricResource = Nitric.Proto.Resources.v1.ResourceIdentifier; -using ProtoApiResource = Nitric.Proto.Resources.v1.ApiResource; -using ProtoSecurityDefinition = Nitric.Proto.Resources.v1.ApiSecurityDefinitionResource; -using ProtoSecurityDefinitionJwt = Nitric.Proto.Resources.v1.ApiOpenIdConnectionDefinition; - - -namespace Nitric.Sdk.Resource -{ - public abstract class SecurityDefinition { - internal string Kind { get; private set; } - - internal SecurityDefinition(string kind) - { - this.Kind = kind; - } - } - - public class JwtSecurityDefinition : SecurityDefinition - { - internal string Issuer { get; private set; } - internal string[] Audiences { get; private set; } - - internal JwtSecurityDefinition(string Issuer, string[] Audiences) : base("jwt") - { - this.Issuer = Issuer; - this.Audiences = Audiences; - } - } - - public class ApiDetails { - internal string ID { get; set; } - internal string Provider { get; set; } - internal string Service { get; set; } - internal string URL { get; set; } - } - - - public class ApiOptions - { - public Dictionary SecurityDefinitions { get; private set; } - public Dictionary Security { get; private set; } - public string BasePath { get; private set; } - public Middleware[] Middleware { get; private set; } - - public ApiOptions( - Dictionary securityDefinitions = null, - Dictionary security = null, - string basePath = "", - Middleware[] middleware = null - ) - { - this.SecurityDefinitions = securityDefinitions ?? new Dictionary(); - this.Security = security ?? new Dictionary(); - this.BasePath = basePath; - this.Middleware = middleware ?? new Middleware[] { }; - } - } - - - public class ApiResource : BaseResource - { - internal readonly ApiOptions Opts; - - internal ApiResource(string name, ApiOptions options = null) : base(name, ResourceType.Api) - { - this.Opts = options ?? new ApiOptions(); - } - - internal ApiResource Method(string route, HttpMethod[] methods, Func handler) - { - var opts = new MethodOptions - { - Security = this.Opts.Security, - SecurityDefs = this.Opts.SecurityDefinitions - }; - - var faas = new Faas(new ApiWorkerOptions - { - Api = this.Name, - Route = this.Opts.BasePath + route, - Methods = methods.ToHashSet(), - Options = opts - }); - - faas.Http(this.Opts.Middleware); - - faas.Http(handler); - - Nitric.RegisterWorker(faas); - return this; - } - - internal ApiResource Method(string route, HttpMethod[] methods, Middleware[] middleware) - { - var opts = new MethodOptions - { - Security = this.Opts.Security, - SecurityDefs = this.Opts.SecurityDefinitions - }; - - var faas = new Faas(new ApiWorkerOptions - { - Api = this.Name, - Route = this.Opts.BasePath + route, - Methods = methods.ToHashSet(), - Options = opts - }); - - var combinedMiddleware = this.Opts.Middleware.Concat(middleware).ToArray(); - - faas.Http(combinedMiddleware); - - Nitric.RegisterWorker(faas); - return this; - } - - /// - /// Create a new GET handler on the specified route. - /// - /// - /// - public ApiResource Get(string route, Func handler) => Method(route, new HttpMethod[] { HttpMethod.GET }, handler); - - /// - /// Create a new GET handler on the specified route. - /// - /// - /// - public ApiResource Get(string route, params Middleware[] handlers) => Method(route, new HttpMethod[] { HttpMethod.GET }, handlers); - - /// - /// Create a new POST handler on the specified route. - /// - /// - /// - public ApiResource Post(string route, Func handler) => Method(route, new HttpMethod[] { HttpMethod.POST }, handler); - - /// - /// Create a new POST handler on the specified route. - /// - /// - /// - public ApiResource Post(string route, params Middleware[] handlers) => Method(route, new HttpMethod[] { HttpMethod.POST }, handlers); - - /// - /// Create a new PUT handler on the specified route. - /// - /// - /// - public ApiResource Put(string route, Func handler) => Method(route, new HttpMethod[] { HttpMethod.PUT }, handler); - - /// - /// Create a new PUT handler on the specified route. - /// - /// - /// - public ApiResource Put(string route, params Middleware[] handlers) => Method(route, new HttpMethod[] { HttpMethod.PUT }, handlers); - - /// - /// Create a new DELETE handler on the specified route. - /// - /// - /// - public ApiResource Delete(string route, Func handler) => Method(route, new HttpMethod[] { HttpMethod.DELETE }, handler); - - /// - /// Create a new DELETE handler on the specified route. - /// - /// - /// - public ApiResource Delete(string route, params Middleware[] handlers) => Method(route, new HttpMethod[] { HttpMethod.DELETE }, handlers); - - /// - /// Create a new OPTIONS handler on the specified route. - /// - /// - /// - public ApiResource Options(string route, Func handler) => Method(route, new HttpMethod[] { HttpMethod.OPTIONS }, handler); - - /// - /// Create a new OPTIONS handler on the specified route. - /// - /// - /// - public ApiResource Options(string route, params Middleware[] handlers) => Method(route, new HttpMethod[] { HttpMethod.OPTIONS }, handlers); - - /// - /// Create a new handler on the specified route for every HTTP verb. - /// - /// - /// - public ApiResource All(string route, Func handler) => Method(route, (HttpMethod[])Enum.GetValues(typeof(HttpMethod)), handler); - - /// - /// Create a new handler on the specified route for every HTTP verb. - /// - /// - /// - public ApiResource All(string route, params Middleware[] handlers) => Method(route, (HttpMethod[])Enum.GetValues(typeof(HttpMethod)), handlers); - - /// - /// Create a new route on a specified path. - /// - /// An ApiRoute that handlers can be added to. - /// - public ApiRoute Route(string path) - { - return new ApiRoute(this, this.Opts.BasePath + path, new RouteOptions()); - } - - /// - /// Create a new route on a specified path. - /// - /// An ApiRoute that handlers can be added to. - /// - /// - public ApiRoute Route(string path, RouteOptions options) - { - return new ApiRoute(this, this.Opts.BasePath + path, options); - } - - internal override BaseResource Register() - { - var resource = new NitricResource { Name = this.Name, Type = ResourceType.Api }; - var apiResource = new ProtoApiResource(); - - foreach (KeyValuePair kv in this.Opts.Security) - { - var scopes = new ApiScopes(); - - scopes.Scopes.Add(kv.Value); - - apiResource.Security.Add(kv.Key, scopes); - } - - foreach (KeyValuePair kv in this.Opts.SecurityDefinitions) { - var definition = new ProtoSecurityDefinition(); - - if (kv.Value.Kind == "jwt") - { - var jwtSecurityDefinition = kv.Value as JwtSecurityDefinition; - var secDef = new ApiOpenIdConnectionDefinition - { - Issuer = jwtSecurityDefinition.Issuer - }; - - secDef.Audiences.AddRange(jwtSecurityDefinition.Audiences); - - definition.Oidc = secDef; - } - - apiResource.SecurityDefinitions.Add(kv.Key, definition); - } - - var request = new ResourceDeclareRequest { Id = resource, Api = apiResource }; - BaseResource.client.Declare(request); - - return this; - } - - /// - /// Retrieve details about the deployed API at runtime. These details include: - /// - ID: the identifier for the resource. - /// - Provider: the cloud provider that this API is deployed to. - /// - Service: the cloud service that is running this API (i.e. AWS API Gateway). - /// - URL: the url of the deployed API. - /// - /// The details of the API - // public ApiDetails Details() { - // var resource = new NitricResource { Name = this.Name, Type = ResourceType.Api }; - - // var request = new ResourceDetailsRequest { Resource = resource }; - // var response = client.Details(request); - - // return new ApiDetails - // { - // ID = response.Id, - // Provider = response.Provider, - // Service = response.Service, - // URL = response.Api.Url, - // }; - // } - } - - public class RouteOptions - { - // The middleware that is run on every route - public Middleware[] Middlewares { get; set; } - - // Security rules to apply to this specific route - public Dictionary Security { get; set; } - } - - public class ApiRoute - { - // The api that this route is on - private readonly ApiResource api; - - // The path that this route's handlers respond to - public readonly string Path; - - // Options for the API route, including middleware and security - public readonly RouteOptions Opts; - - internal ApiRoute(ApiResource api, string path, RouteOptions opts) - { - this.api = api; - this.Path = path; - - var composedMiddleware = this.api.Opts.Middleware.Concat(opts.Middlewares).ToArray(); - this.Opts = new RouteOptions { - Middlewares = composedMiddleware, - Security = opts.Security - }; - } - - private Middleware[] ConcatMiddleware(Func handler) - { - HttpContext ComposedMiddleware(HttpContext context, Func next) - { - context = handler(context); - return next(context); - }; - return this.Opts.Middlewares.Append(ComposedMiddleware).ToArray(); - } - - private Middleware[] ConcatMiddleware(Middleware[] middlewares) - { - return this.Opts.Middlewares.Concat(middlewares).ToArray(); - } - - /// - /// Create a new GET handler on the specified route. - /// - /// - public ApiResource Get(Func handler) => this.api.Method(this.Path, new HttpMethod[] { HttpMethod.GET }, ConcatMiddleware(handler)); - - /// - /// Create a new GET middleware chain on the specified route. - /// - /// - public ApiResource Get(params Middleware[] handlers) => this.api.Method(this.Path, new HttpMethod[] { HttpMethod.GET }, ConcatMiddleware(handlers)); - - /// - /// Create a new POST handler on the specified route. - /// - /// - public ApiResource Post(Func handler) => this.api.Method(this.Path, new HttpMethod[] { HttpMethod.POST }, ConcatMiddleware(handler)); - - /// - /// Create a new POST middleware chain on the specified route. - /// - /// - public ApiResource Post(params Middleware[] handlers) => this.api.Method(this.Path, new HttpMethod[] { HttpMethod.POST}, ConcatMiddleware(handlers)); - - /// - /// Create a new PUT handler on the specified route. - /// - /// - public ApiResource Put(Func handler) => this.api.Method(this.Path, new HttpMethod[] { HttpMethod.PUT}, ConcatMiddleware(handler)); - - /// - /// Create a new PUT middleware chain on the specified route. - /// - /// - public ApiResource Put(params Middleware[] handlers) => this.api.Method(this.Path, new HttpMethod[] { HttpMethod.POST }, ConcatMiddleware(handlers)); - - /// - /// Create a new DELETE handler on the specified route. - /// - /// - public ApiResource Delete(Func handler) => this.api.Method(this.Path, new HttpMethod[] { HttpMethod.DELETE }, ConcatMiddleware(handler)); - - /// - /// Create a new DELETE middleware chain on the specified route. - /// - /// - public ApiResource Delete(params Middleware[] handlers) => this.api.Method(this.Path, new HttpMethod[] { HttpMethod.DELETE }, ConcatMiddleware(handlers)); - - /// - /// Create a new OPTIONS handler on the specified route. - /// - /// - public ApiResource Options(Func handler) => this.api.Method(this.Path, new HttpMethod[] { HttpMethod.OPTIONS }, ConcatMiddleware(handler)); - - /// - /// Create a new OPTIONS middleware chain on the specified route. - /// - /// - public ApiResource Options(params Middleware[] handlers) => this.api.Method(this.Path, new HttpMethod[] { HttpMethod.OPTIONS }, ConcatMiddleware(handlers)); - - /// - /// Create a new handler on the specified route for every HTTP verb. - /// - /// - public ApiResource All(Func handler) => this.api.Method(this.Path, (HttpMethod[])Enum.GetValues(typeof(HttpMethod)), ConcatMiddleware(handler)); - - /// - /// Create a new chain of middleware on the specified route for every HTTP verb. - /// - /// - public ApiResource All(params Middleware[] handlers) => this.api.Method(this.Path, (HttpMethod[])Enum.GetValues(typeof(HttpMethod)), ConcatMiddleware(handlers)); - } -} +//// Copyright 2021, Nitric Technologies Pty Ltd. +//// +//// 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. +//using System; +//using System.Linq; +//using System.Collections.Generic; +//using System.Threading.Tasks; +//using Google.Api; +//using Nitric.Proto.Resources.v1; +//using Nitric.Sdk.Function; +//using GrpcClient = Nitric.Proto.Secrets.v1.SecretManager.SecretManagerClient; +//using NitricResource = Nitric.Proto.Resources.v1.ResourceIdentifier; +//using ProtoApiResource = Nitric.Proto.Resources.v1.ApiResource; +//using ProtoSecurityDefinition = Nitric.Proto.Resources.v1.ApiSecurityDefinitionResource; +//using ProtoSecurityDefinitionJwt = Nitric.Proto.Resources.v1.ApiOpenIdConnectionDefinition; + + +//namespace Nitric.Sdk.Resource +//{ +// public abstract class SecurityDefinition { +// internal string Kind { get; private set; } + +// internal SecurityDefinition(string kind) +// { +// this.Kind = kind; +// } +// } + +// public class JwtSecurityDefinition : SecurityDefinition +// { +// internal string Issuer { get; private set; } +// internal string[] Audiences { get; private set; } + +// internal JwtSecurityDefinition(string Issuer, string[] Audiences) : base("jwt") +// { +// this.Issuer = Issuer; +// this.Audiences = Audiences; +// } +// } + +// public class ApiDetails { +// internal string ID { get; set; } +// internal string Provider { get; set; } +// internal string Service { get; set; } +// internal string URL { get; set; } +// } + + +// public class ApiOptions +// { +// public Dictionary SecurityDefinitions { get; private set; } +// public Dictionary Security { get; private set; } +// public string BasePath { get; private set; } +// public Middleware[] Middleware { get; private set; } + +// public ApiOptions( +// Dictionary securityDefinitions = null, +// Dictionary security = null, +// string basePath = "", +// Middleware[] middleware = null +// ) +// { +// this.SecurityDefinitions = securityDefinitions ?? new Dictionary(); +// this.Security = security ?? new Dictionary(); +// this.BasePath = basePath; +// this.Middleware = middleware ?? new Middleware[] { }; +// } +// } + + +// public class ApiResource : BaseResource +// { +// internal readonly ApiOptions Opts; + +// internal ApiResource(string name, ApiOptions options = null) : base(name, ResourceType.Api) +// { +// this.Opts = options ?? new ApiOptions(); +// } + +// internal ApiResource Method(string route, HttpMethod[] methods, Func handler) +// { +// var opts = new MethodOptions +// { +// Security = this.Opts.Security, +// SecurityDefs = this.Opts.SecurityDefinitions +// }; + +// var faas = new Faas(new ApiWorkerOptions +// { +// Api = this.Name, +// Route = this.Opts.BasePath + route, +// Methods = methods.ToHashSet(), +// Options = opts +// }); + +// faas.Http(this.Opts.Middleware); + +// faas.Http(handler); + +// Nitric.RegisterWorker(faas); +// return this; +// } + +// internal ApiResource Method(string route, HttpMethod[] methods, Middleware[] middleware) +// { +// var opts = new MethodOptions +// { +// Security = this.Opts.Security, +// SecurityDefs = this.Opts.SecurityDefinitions +// }; + +// var faas = new Faas(new ApiWorkerOptions +// { +// Api = this.Name, +// Route = this.Opts.BasePath + route, +// Methods = methods.ToHashSet(), +// Options = opts +// }); + +// var combinedMiddleware = this.Opts.Middleware.Concat(middleware).ToArray(); + +// faas.Http(combinedMiddleware); + +// Nitric.RegisterWorker(faas); +// return this; +// } + +// /// +// /// Create a new GET handler on the specified route. +// /// +// /// +// /// +// public ApiResource Get(string route, Func handler) => Method(route, new HttpMethod[] { HttpMethod.GET }, handler); + +// /// +// /// Create a new GET handler on the specified route. +// /// +// /// +// /// +// public ApiResource Get(string route, params Middleware[] handlers) => Method(route, new HttpMethod[] { HttpMethod.GET }, handlers); + +// /// +// /// Create a new POST handler on the specified route. +// /// +// /// +// /// +// public ApiResource Post(string route, Func handler) => Method(route, new HttpMethod[] { HttpMethod.POST }, handler); + +// /// +// /// Create a new POST handler on the specified route. +// /// +// /// +// /// +// public ApiResource Post(string route, params Middleware[] handlers) => Method(route, new HttpMethod[] { HttpMethod.POST }, handlers); + +// /// +// /// Create a new PUT handler on the specified route. +// /// +// /// +// /// +// public ApiResource Put(string route, Func handler) => Method(route, new HttpMethod[] { HttpMethod.PUT }, handler); + +// /// +// /// Create a new PUT handler on the specified route. +// /// +// /// +// /// +// public ApiResource Put(string route, params Middleware[] handlers) => Method(route, new HttpMethod[] { HttpMethod.PUT }, handlers); + +// /// +// /// Create a new DELETE handler on the specified route. +// /// +// /// +// /// +// public ApiResource Delete(string route, Func handler) => Method(route, new HttpMethod[] { HttpMethod.DELETE }, handler); + +// /// +// /// Create a new DELETE handler on the specified route. +// /// +// /// +// /// +// public ApiResource Delete(string route, params Middleware[] handlers) => Method(route, new HttpMethod[] { HttpMethod.DELETE }, handlers); + +// /// +// /// Create a new OPTIONS handler on the specified route. +// /// +// /// +// /// +// public ApiResource Options(string route, Func handler) => Method(route, new HttpMethod[] { HttpMethod.OPTIONS }, handler); + +// /// +// /// Create a new OPTIONS handler on the specified route. +// /// +// /// +// /// +// public ApiResource Options(string route, params Middleware[] handlers) => Method(route, new HttpMethod[] { HttpMethod.OPTIONS }, handlers); + +// /// +// /// Create a new handler on the specified route for every HTTP verb. +// /// +// /// +// /// +// public ApiResource All(string route, Func handler) => Method(route, (HttpMethod[])Enum.GetValues(typeof(HttpMethod)), handler); + +// /// +// /// Create a new handler on the specified route for every HTTP verb. +// /// +// /// +// /// +// public ApiResource All(string route, params Middleware[] handlers) => Method(route, (HttpMethod[])Enum.GetValues(typeof(HttpMethod)), handlers); + +// /// +// /// Create a new route on a specified path. +// /// +// /// An ApiRoute that handlers can be added to. +// /// +// public ApiRoute Route(string path) +// { +// return new ApiRoute(this, this.Opts.BasePath + path, new RouteOptions()); +// } + +// /// +// /// Create a new route on a specified path. +// /// +// /// An ApiRoute that handlers can be added to. +// /// +// /// +// public ApiRoute Route(string path, RouteOptions options) +// { +// return new ApiRoute(this, this.Opts.BasePath + path, options); +// } + +// internal override BaseResource Register() +// { +// var resource = new NitricResource { Name = this.Name, Type = ResourceType.Api }; +// var apiResource = new ProtoApiResource(); + +// foreach (KeyValuePair kv in this.Opts.Security) +// { +// var scopes = new ApiScopes(); + +// scopes.Scopes.Add(kv.Value); + +// apiResource.Security.Add(kv.Key, scopes); +// } + +// foreach (KeyValuePair kv in this.Opts.SecurityDefinitions) { +// var definition = new ProtoSecurityDefinition(); + +// if (kv.Value.Kind == "jwt") +// { +// var jwtSecurityDefinition = kv.Value as JwtSecurityDefinition; +// var secDef = new ApiOpenIdConnectionDefinition +// { +// Issuer = jwtSecurityDefinition.Issuer +// }; + +// secDef.Audiences.AddRange(jwtSecurityDefinition.Audiences); + +// definition.Oidc = secDef; +// } + +// apiResource.SecurityDefinitions.Add(kv.Key, definition); +// } + +// var request = new ResourceDeclareRequest { Id = resource, Api = apiResource }; +// BaseResource.client.Declare(request); + +// return this; +// } + +// /// +// /// Retrieve details about the deployed API at runtime. These details include: +// /// - ID: the identifier for the resource. +// /// - Provider: the cloud provider that this API is deployed to. +// /// - Service: the cloud service that is running this API (i.e. AWS API Gateway). +// /// - URL: the url of the deployed API. +// /// +// /// The details of the API +// // public ApiDetails Details() { +// // var resource = new NitricResource { Name = this.Name, Type = ResourceType.Api }; + +// // var request = new ResourceDetailsRequest { Resource = resource }; +// // var response = client.Details(request); + +// // return new ApiDetails +// // { +// // ID = response.Id, +// // Provider = response.Provider, +// // Service = response.Service, +// // URL = response.Api.Url, +// // }; +// // } +// } + +// public class RouteOptions +// { +// // The middleware that is run on every route +// public Middleware[] Middlewares { get; set; } + +// // Security rules to apply to this specific route +// public Dictionary Security { get; set; } +// } + +// public class ApiRoute +// { +// // The api that this route is on +// private readonly ApiResource api; + +// // The path that this route's handlers respond to +// public readonly string Path; + +// // Options for the API route, including middleware and security +// public readonly RouteOptions Opts; + +// internal ApiRoute(ApiResource api, string path, RouteOptions opts) +// { +// this.api = api; +// this.Path = path; + +// var composedMiddleware = this.api.Opts.Middleware.Concat(opts.Middlewares).ToArray(); +// this.Opts = new RouteOptions { +// Middlewares = composedMiddleware, +// Security = opts.Security +// }; +// } + +// private Middleware[] ConcatMiddleware(Func handler) +// { +// HttpContext ComposedMiddleware(HttpContext context, Func next) +// { +// context = handler(context); +// return next(context); +// }; +// return this.Opts.Middlewares.Append(ComposedMiddleware).ToArray(); +// } + +// private Middleware[] ConcatMiddleware(Middleware[] middlewares) +// { +// return this.Opts.Middlewares.Concat(middlewares).ToArray(); +// } + +// /// +// /// Create a new GET handler on the specified route. +// /// +// /// +// public ApiResource Get(Func handler) => this.api.Method(this.Path, new HttpMethod[] { HttpMethod.GET }, ConcatMiddleware(handler)); + +// /// +// /// Create a new GET middleware chain on the specified route. +// /// +// /// +// public ApiResource Get(params Middleware[] handlers) => this.api.Method(this.Path, new HttpMethod[] { HttpMethod.GET }, ConcatMiddleware(handlers)); + +// /// +// /// Create a new POST handler on the specified route. +// /// +// /// +// public ApiResource Post(Func handler) => this.api.Method(this.Path, new HttpMethod[] { HttpMethod.POST }, ConcatMiddleware(handler)); + +// /// +// /// Create a new POST middleware chain on the specified route. +// /// +// /// +// public ApiResource Post(params Middleware[] handlers) => this.api.Method(this.Path, new HttpMethod[] { HttpMethod.POST}, ConcatMiddleware(handlers)); + +// /// +// /// Create a new PUT handler on the specified route. +// /// +// /// +// public ApiResource Put(Func handler) => this.api.Method(this.Path, new HttpMethod[] { HttpMethod.PUT}, ConcatMiddleware(handler)); + +// /// +// /// Create a new PUT middleware chain on the specified route. +// /// +// /// +// public ApiResource Put(params Middleware[] handlers) => this.api.Method(this.Path, new HttpMethod[] { HttpMethod.POST }, ConcatMiddleware(handlers)); + +// /// +// /// Create a new DELETE handler on the specified route. +// /// +// /// +// public ApiResource Delete(Func handler) => this.api.Method(this.Path, new HttpMethod[] { HttpMethod.DELETE }, ConcatMiddleware(handler)); + +// /// +// /// Create a new DELETE middleware chain on the specified route. +// /// +// /// +// public ApiResource Delete(params Middleware[] handlers) => this.api.Method(this.Path, new HttpMethod[] { HttpMethod.DELETE }, ConcatMiddleware(handlers)); + +// /// +// /// Create a new OPTIONS handler on the specified route. +// /// +// /// +// public ApiResource Options(Func handler) => this.api.Method(this.Path, new HttpMethod[] { HttpMethod.OPTIONS }, ConcatMiddleware(handler)); + +// /// +// /// Create a new OPTIONS middleware chain on the specified route. +// /// +// /// +// public ApiResource Options(params Middleware[] handlers) => this.api.Method(this.Path, new HttpMethod[] { HttpMethod.OPTIONS }, ConcatMiddleware(handlers)); + +// /// +// /// Create a new handler on the specified route for every HTTP verb. +// /// +// /// +// public ApiResource All(Func handler) => this.api.Method(this.Path, (HttpMethod[])Enum.GetValues(typeof(HttpMethod)), ConcatMiddleware(handler)); + +// /// +// /// Create a new chain of middleware on the specified route for every HTTP verb. +// /// +// /// +// public ApiResource All(params Middleware[] handlers) => this.api.Method(this.Path, (HttpMethod[])Enum.GetValues(typeof(HttpMethod)), ConcatMiddleware(handlers)); +// } +//} diff --git a/src/Nitric.Sdk/Resource/BucketResource.cs b/src/Nitric.Sdk/Resource/BucketResource.cs index e07383a..340d31e 100644 --- a/src/Nitric.Sdk/Resource/BucketResource.cs +++ b/src/Nitric.Sdk/Resource/BucketResource.cs @@ -1,137 +1,137 @@ -// Copyright 2021, Nitric Technologies Pty Ltd. -// -// 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. +//// Copyright 2021, Nitric Technologies Pty Ltd. +//// +//// 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. -using System; -using System.Collections.Generic; -using System.Linq; -using Nitric.Proto.Resources.v1; -using Nitric.Sdk.Function; -using Nitric.Sdk.Storage; -using Action = Nitric.Proto.Resources.v1.Action; -using NitricResource = Nitric.Proto.Resources.v1.ResourceIdentifier; +//using System; +//using System.Collections.Generic; +//using System.Linq; +//using Nitric.Proto.Resources.v1; +//using Nitric.Sdk.Function; +//using Nitric.Sdk.Storage; +//using Action = Nitric.Proto.Resources.v1.Action; +//using NitricResource = Nitric.Proto.Resources.v1.ResourceIdentifier; -namespace Nitric.Sdk.Resource -{ - /// - /// Available permissions for bucket resources. - /// - public enum BucketPermission - { - /// - /// Enables listing and reading files in the bucket. - /// - Reading, - /// - /// Enables adding or updating files in the bucket. - /// - Writing, - /// - /// Enables deleting files from the bucket. - /// - Deleting - } +//namespace Nitric.Sdk.Resource +//{ +// /// +// /// Available permissions for bucket resources. +// /// +// public enum BucketPermission +// { +// /// +// /// Enables listing and reading files in the bucket. +// /// +// Reading, +// /// +// /// Enables adding or updating files in the bucket. +// /// +// Writing, +// /// +// /// Enables deleting files from the bucket. +// /// +// Deleting +// } - public class BucketResource : SecureResource - { - internal BucketResource(string name) : base(name, ResourceType.Bucket) - { - } +// public class BucketResource : SecureResource +// { +// internal BucketResource(string name) : base(name, ResourceType.Bucket) +// { +// } - internal override BaseResource Register() - { - var resource = new NitricResource { Name = this.Name, Type = ResourceType.Bucket }; - var request = new ResourceDeclareRequest { Id = resource }; - BaseResource.client.Declare(request); - return this; - } +// internal override BaseResource Register() +// { +// var resource = new NitricResource { Name = this.Name, Type = ResourceType.Bucket }; +// var request = new ResourceDeclareRequest { Id = resource }; +// BaseResource.client.Declare(request); +// return this; +// } - protected override IEnumerable PermissionsToActions(IEnumerable permissions) - { - var actionMap = new Dictionary> - { - { - BucketPermission.Reading, - new List { Action.BucketFileList, Action.BucketFileGet } - }, - { - BucketPermission.Writing, - new List { Action.BucketFilePut } - }, - { - BucketPermission.Deleting, - new List { Action.BucketFileDelete } - } - }; - return permissions.Aggregate((IEnumerable)new List(), (acc, x) => acc.Concat(actionMap[x])).Distinct(); - } +// protected override IEnumerable PermissionsToActions(IEnumerable permissions) +// { +// var actionMap = new Dictionary> +// { +// { +// BucketPermission.Reading, +// new List { Action.BucketFileList, Action.BucketFileGet } +// }, +// { +// BucketPermission.Writing, +// new List { Action.BucketFilePut } +// }, +// { +// BucketPermission.Deleting, +// new List { Action.BucketFileDelete } +// } +// }; +// return permissions.Aggregate((IEnumerable)new List(), (acc, x) => acc.Concat(actionMap[x])).Distinct(); +// } - /// - /// Registers handlers to be called whenever a file triggers an event in the bucket - /// - /// The type of events that should trigger events, Write or Delete - /// The prefix of file names that should trigger events - /// The handlers to call to process notification events - public void On( - BucketNotificationType notificationType, - string notificationPrefixFilter, - params Middleware[] middleware) - { - var notificationWorker = new Faas(new BucketNotificationWorkerOptions( - this.Name, - notificationType, - notificationPrefixFilter - )); +// /// +// /// Registers handlers to be called whenever a file triggers an event in the bucket +// /// +// /// The type of events that should trigger events, Write or Delete +// /// The prefix of file names that should trigger events +// /// The handlers to call to process notification events +// public void On( +// BucketNotificationType notificationType, +// string notificationPrefixFilter, +// params Middleware[] middleware) +// { +// var notificationWorker = new Faas(new BucketNotificationWorkerOptions( +// this.Name, +// notificationType, +// notificationPrefixFilter +// )); - notificationWorker.BucketNotification(middleware); +// notificationWorker.BucketNotification(middleware); - Nitric.RegisterWorker(notificationWorker); - } +// Nitric.RegisterWorker(notificationWorker); +// } - /// - /// Registers a handler to be called whenever a file triggers an event in the bucket - /// - /// The type of events that should trigger events, Write or Delete - /// The prefix of file names that should trigger events - /// The handler to call to process notification events - public void On( - BucketNotificationType notificationType, - string notificationPrefixFilter, - Func handler) - { - var notificationWorker = new Faas(new BucketNotificationWorkerOptions( - this.Name, - notificationType, - notificationPrefixFilter - )); +// /// +// /// Registers a handler to be called whenever a file triggers an event in the bucket +// /// +// /// The type of events that should trigger events, Write or Delete +// /// The prefix of file names that should trigger events +// /// The handler to call to process notification events +// public void On( +// BucketNotificationType notificationType, +// string notificationPrefixFilter, +// Func handler) +// { +// var notificationWorker = new Faas(new BucketNotificationWorkerOptions( +// this.Name, +// notificationType, +// notificationPrefixFilter +// )); - notificationWorker.BucketNotification(handler); +// notificationWorker.BucketNotification(handler); - Nitric.RegisterWorker(notificationWorker); - } +// Nitric.RegisterWorker(notificationWorker); +// } - /// - /// Request specific access to this bucket. - /// - /// The permissions that the function has to access the bucket. - /// A reference to the bucket. - public Bucket With(BucketPermission permission, params BucketPermission[] permissions) - { - var allPerms = new List { permission }; - allPerms.AddRange(permissions); +// /// +// /// Request specific access to this bucket. +// /// +// /// The permissions that the function has to access the bucket. +// /// A reference to the bucket. +// public Bucket With(BucketPermission permission, params BucketPermission[] permissions) +// { +// var allPerms = new List { permission }; +// allPerms.AddRange(permissions); - this.RegisterPolicy(allPerms); - return new Storage.Storage().Bucket(this.Name); - } - } -} +// this.RegisterPolicy(allPerms); +// return new Storage.Storage().Bucket(this.Name); +// } +// } +//} diff --git a/src/Nitric.Sdk/Resource/CollectionResource.cs b/src/Nitric.Sdk/Resource/CollectionResource.cs index a546172..fe30150 100644 --- a/src/Nitric.Sdk/Resource/CollectionResource.cs +++ b/src/Nitric.Sdk/Resource/CollectionResource.cs @@ -1,86 +1,86 @@ -// Copyright 2021, Nitric Technologies Pty Ltd. -// -// 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. -using System.Collections.Generic; -using System.Linq; -using Nitric.Proto.Resources.v1; -using Action = Nitric.Proto.Resources.v1.Action; -using NitricResource = Nitric.Proto.Resources.v1.ResourceIdentifier; -using ResourceType = Nitric.Proto.Resources.v1.ResourceType; +//// Copyright 2021, Nitric Technologies Pty Ltd. +//// +//// 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. +//using System.Collections.Generic; +//using System.Linq; +//using Nitric.Proto.Resources.v1; +//using Action = Nitric.Proto.Resources.v1.Action; +//using NitricResource = Nitric.Proto.Resources.v1.ResourceIdentifier; +//using ResourceType = Nitric.Proto.Resources.v1.ResourceType; -namespace Nitric.Sdk.Resource -{ - /// - /// Available permissions for collection resources. - /// - public enum CollectionPermission - { - /// - /// Enables writing documents to the collection,. - /// - Writing, - /// - /// Enables reading documents from the collection. - /// - Reading, - /// - /// Enables deleting documents from the collection. - /// - Deleting, - } +//namespace Nitric.Sdk.Resource +//{ +// /// +// /// Available permissions for collection resources. +// /// +// public enum CollectionPermission +// { +// /// +// /// Enables writing documents to the collection,. +// /// +// Writing, +// /// +// /// Enables reading documents from the collection. +// /// +// Reading, +// /// +// /// Enables deleting documents from the collection. +// /// +// Deleting, +// } - public class CollectionResource : SecureResource - { - internal CollectionResource(string name) : base(name, ResourceType.KeyValueStore) - { - } +// public class CollectionResource : SecureResource +// { +// internal CollectionResource(string name) : base(name, ResourceType.KeyValueStore) +// { +// } - internal override BaseResource Register() - { - var resource = new NitricResource { Name = this.Name, Type = ResourceType.Collection }; - var request = new ResourceDeclareRequest { Resource = resource }; - client.Declare(request); - return this; - } +// internal override BaseResource Register() +// { +// var resource = new NitricResource { Name = this.Name, Type = ResourceType.Collection }; +// var request = new ResourceDeclareRequest { Resource = resource }; +// client.Declare(request); +// return this; +// } - protected override IEnumerable PermissionsToActions(IEnumerable permissions) - { - var actionMap = new Dictionary> - { - { - CollectionPermission.Writing, - new List { Action.CollectionDocumentWrite } - }, - { - CollectionPermission.Reading, - new List { Action.CollectionList, Action.CollectionQuery, Action.CollectionDocumentRead } - }, - { - CollectionPermission.Deleting, - new List { Action.CollectionDocumentDelete } - } - }; - return permissions.Aggregate((IEnumerable)new List(), (acc, x) => acc.Concat(actionMap[x])) - .Distinct(); - } +// protected override IEnumerable PermissionsToActions(IEnumerable permissions) +// { +// var actionMap = new Dictionary> +// { +// { +// CollectionPermission.Writing, +// new List { Action.CollectionDocumentWrite } +// }, +// { +// CollectionPermission.Reading, +// new List { Action.CollectionList, Action.CollectionQuery, Action.CollectionDocumentRead } +// }, +// { +// CollectionPermission.Deleting, +// new List { Action.CollectionDocumentDelete } +// } +// }; +// return permissions.Aggregate((IEnumerable)new List(), (acc, x) => acc.Concat(actionMap[x])) +// .Distinct(); +// } - public CollectionRef With(CollectionPermission permission, params CollectionPermission[] permissions) - { - var allPerms = new List { permission }; - allPerms.AddRange(permissions); +// public CollectionRef With(CollectionPermission permission, params CollectionPermission[] permissions) +// { +// var allPerms = new List { permission }; +// allPerms.AddRange(permissions); - this.RegisterPolicy(allPerms); - return new DocumentsClient().Collection(this.Name); - } - } -} +// this.RegisterPolicy(allPerms); +// return new DocumentsClient().Collection(this.Name); +// } +// } +//} diff --git a/src/Nitric.Sdk/Resource/QueueResource.cs b/src/Nitric.Sdk/Resource/QueueResource.cs index ffcb82c..d0a7c30 100644 --- a/src/Nitric.Sdk/Resource/QueueResource.cs +++ b/src/Nitric.Sdk/Resource/QueueResource.cs @@ -1,82 +1,82 @@ -// Copyright 2021, Nitric Technologies Pty Ltd. -// -// 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. -using System.Collections.Generic; -using System.Linq; -using Nitric.Proto.Resources.v1; -using Nitric.Sdk.Queue; -using Action = Nitric.Proto.Resources.v1.Action; -using NitricResource = Nitric.Proto.Resources.v1.ResourceIdentifier; +//// Copyright 2021, Nitric Technologies Pty Ltd. +//// +//// 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. +//using System.Collections.Generic; +//using System.Linq; +//using Nitric.Proto.Resources.v1; +//using Nitric.Sdk.Queue; +//using Action = Nitric.Proto.Resources.v1.Action; +//using NitricResource = Nitric.Proto.Resources.v1.ResourceIdentifier; -namespace Nitric.Sdk.Resource -{ - /// - /// Available permissions for queue resources. - /// - public enum QueuePermission - { - /// - /// Enables pushing new tasks to the queue. - /// - Sending, - /// - /// Enables pulling and completing tasks on the queue. - /// - Receiving - } +//namespace Nitric.Sdk.Resource +//{ +// /// +// /// Available permissions for queue resources. +// /// +// public enum QueuePermission +// { +// /// +// /// Enables pushing new tasks to the queue. +// /// +// Sending, +// /// +// /// Enables pulling and completing tasks on the queue. +// /// +// Receiving +// } - public class QueueResource : SecureResource - { - internal QueueResource(string name) : base(name, ResourceType.Queue) - { - } +// public class QueueResource : SecureResource +// { +// internal QueueResource(string name) : base(name, ResourceType.Queue) +// { +// } - internal override BaseResource Register() - { - var resource = new NitricResource { Name = this.Name, Type = ResourceType.Queue }; - var request = new ResourceDeclareRequest { Id = resource }; - client.Declare(request); - return this; - } +// internal override BaseResource Register() +// { +// var resource = new NitricResource { Name = this.Name, Type = ResourceType.Queue }; +// var request = new ResourceDeclareRequest { Id = resource }; +// client.Declare(request); +// return this; +// } - protected override IEnumerable PermissionsToActions(IEnumerable permissions) - { - var actionMap = new Dictionary> - { - { - QueuePermission.Sending, - new List { Action.QueueSend, Action.QueueDetail, Action.QueueList } - }, - { - QueuePermission.Receiving, - new List { Action.QueueReceive, Action.QueueDetail, Action.QueueList } - } - }; - return permissions.Aggregate((IEnumerable)new List(), (acc, x) => acc.Concat(actionMap[x])).Distinct(); - } +// protected override IEnumerable PermissionsToActions(IEnumerable permissions) +// { +// var actionMap = new Dictionary> +// { +// { +// QueuePermission.Sending, +// new List { Action.QueueSend, Action.QueueDetail, Action.QueueList } +// }, +// { +// QueuePermission.Receiving, +// new List { Action.QueueReceive, Action.QueueDetail, Action.QueueList } +// } +// }; +// return permissions.Aggregate((IEnumerable)new List(), (acc, x) => acc.Concat(actionMap[x])).Distinct(); +// } - /// - /// Request specific access to this queue. - /// - /// The permissions that the function has to access the queue. - /// A reference to the queue. - public Queue.Queue With(QueuePermission permission, params QueuePermission[] permissions) - { - var allPerms = new List { permission }; - allPerms.AddRange(permissions); +// /// +// /// Request specific access to this queue. +// /// +// /// The permissions that the function has to access the queue. +// /// A reference to the queue. +// public Queue.Queue With(QueuePermission permission, params QueuePermission[] permissions) +// { +// var allPerms = new List { permission }; +// allPerms.AddRange(permissions); - this.RegisterPolicy(allPerms); - return new QueuesClient().Queue(this.Name); - } - } -} +// this.RegisterPolicy(allPerms); +// return new QueuesClient().Queue(this.Name); +// } +// } +//} diff --git a/src/Nitric.Sdk/Resource/ScheduleResource.cs b/src/Nitric.Sdk/Resource/ScheduleResource.cs index 2d1842a..281a8b5 100644 --- a/src/Nitric.Sdk/Resource/ScheduleResource.cs +++ b/src/Nitric.Sdk/Resource/ScheduleResource.cs @@ -30,39 +30,36 @@ internal ScheduleResource(string name) /// /// Run code at a specific time, represented by a rate and a frequency. e.g. every 7 days /// - /// The interval for the schedule running. e.g. 7 for every '7 days' - /// The frequency for the schedule running. e.g. Days for every '7 days' + /// The interval for the schedule running. e.g. '7 days', '1 hour', '5 minutes' /// The middleware (code) to run on a schedule. - public void Every(int rate, Frequency frequency, Func middleware) + public void Every(string rate, Func middleware) { var registration = new RegistrationRequest { ScheduleName = this.Name, - Every = new ScheduleEvery { Rate = rate, } + Every = new ScheduleEvery { Rate = rate } }; - var worker = new ScheduleWorker(); - Nitric.RegisterWorker(faas); + var worker = new ScheduleWorker(registration, middleware); + + Nitric.RegisterWorker(worker); } /// /// Run code at a specific time, represented by a rate and a frequency. e.g. every 7 days /// - /// The interval for the schedule running. e.g. 7 for every '7 days' - /// The frequency for the schedule running. e.g. Days for every '7 days' + /// The interval for the schedule running. e.g. '7 days', '1 hour', '5 minutes' /// The middlewares (code) to run on a schedule. - public void Every(int rate, Frequency frequency, params Middleware[] middleware) + public void Every(string rate, params Middleware[] middleware) { - var faas = new Faas(new ScheduleRateWorkerOptions + var registration = new RegistrationRequest { - Rate = rate, - Frequency = frequency, - Description = this.name - }); - - faas.Event(middleware); + ScheduleName = this.Name, + Every = new ScheduleEvery { Rate = rate } + }; + var worker = new ScheduleWorker(registration, middleware); - Nitric.RegisterWorker(faas); + Nitric.RegisterWorker(worker); } /// @@ -70,17 +67,16 @@ public void Every(int rate, Frequency frequency, params Middleware /// The cron expression representing when the schedule should run. /// The middleware (code) to run on a schedule. - public void Cron(string expression, Func middleware) + public void Cron(string expression, Func middleware) { - var faas = new Faas(new ScheduleCronWorkerOptions + var registration = new RegistrationRequest { - Description = this.name, - Cron = expression - }); - - faas.Event(middleware); + ScheduleName = this.Name, + Cron = new ScheduleCron { Expression = expression } + }; + var worker = new ScheduleWorker(registration, middleware); - Nitric.RegisterWorker(faas); + Nitric.RegisterWorker(worker); } /// @@ -88,17 +84,16 @@ public void Cron(string expression, Func middleware) /// /// The cron expression representing when the schedule should run. /// The middlewares (code) to run on a schedule. - public void Cron(string expression, params Middleware[] middleware) + public void Cron(string expression, params Middleware[] middleware) { - var faas = new Faas(new ScheduleCronWorkerOptions + var registration = new RegistrationRequest { - Description = this.name, - Cron = expression - }); - - faas.Event(middleware); + ScheduleName = this.Name, + Cron = new ScheduleCron { Expression = expression } + }; + var worker = new ScheduleWorker(registration, middleware); - Nitric.RegisterWorker(faas); + Nitric.RegisterWorker(worker); } } } diff --git a/src/Nitric.Sdk/Resource/TopicResource.cs b/src/Nitric.Sdk/Resource/TopicResource.cs index bfa4bb7..9122cb0 100644 --- a/src/Nitric.Sdk/Resource/TopicResource.cs +++ b/src/Nitric.Sdk/Resource/TopicResource.cs @@ -1,102 +1,102 @@ -// Copyright 2021, Nitric Technologies Pty Ltd. -// -// 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. -using System; -using System.Collections.Generic; -using System.Linq; -using Nitric.Proto.Resources.v1; -using Nitric.Sdk.Topic; -using Action = Nitric.Proto.Resources.v1.Action; -using NitricResource = Nitric.Proto.Resources.v1.ResourceIdentifier; -using ResourceType = Nitric.Proto.Resources.v1.ResourceType; +//// Copyright 2021, Nitric Technologies Pty Ltd. +//// +//// 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. +//using System; +//using System.Collections.Generic; +//using System.Linq; +//using Nitric.Proto.Resources.v1; +//using Nitric.Sdk.Topic; +//using Action = Nitric.Proto.Resources.v1.Action; +//using NitricResource = Nitric.Proto.Resources.v1.ResourceIdentifier; +//using ResourceType = Nitric.Proto.Resources.v1.ResourceType; -namespace Nitric.Sdk.Resource -{ - /// - /// Available permissions for topic resources. - /// - public enum TopicPermission - { - /// - /// Enables pushing new events to the topic. - /// - Publishing - } +//namespace Nitric.Sdk.Resource +//{ +// /// +// /// Available permissions for topic resources. +// /// +// public enum TopicPermission +// { +// /// +// /// Enables pushing new events to the topic. +// /// +// Publishing +// } - public class TopicResource : SecureResource - { - internal TopicResource(string name) : base(name, ResourceType.Topic) - { - } +// public class TopicResource : SecureResource +// { +// internal TopicResource(string name) : base(name, ResourceType.Topic) +// { +// } - internal override BaseResource Register() - { - var resource = new NitricResource { Name = this.Name, Type = ResourceType.Topic }; - var request = new ResourceDeclareRequest { Id = resource }; - BaseResource.client.Declare(request); - return this; - } +// internal override BaseResource Register() +// { +// var resource = new NitricResource { Name = this.Name, Type = ResourceType.Topic }; +// var request = new ResourceDeclareRequest { Id = resource }; +// BaseResource.client.Declare(request); +// return this; +// } - protected override IEnumerable PermissionsToActions(IEnumerable permissions) - { - var actionMap = new Dictionary> - { - { - TopicPermission.Publishing, - new List { Action.TopicEventPublish, Action.TopicList, Action.TopicDetail } - } - }; - return permissions.Aggregate((IEnumerable)new List(), (acc, x) => acc.Concat(actionMap[x])) - .Distinct(); - } +// protected override IEnumerable PermissionsToActions(IEnumerable permissions) +// { +// var actionMap = new Dictionary> +// { +// { +// TopicPermission.Publishing, +// new List { Action.TopicEventPublish, Action.TopicList, Action.TopicDetail } +// } +// }; +// return permissions.Aggregate((IEnumerable)new List(), (acc, x) => acc.Concat(actionMap[x])) +// .Distinct(); +// } - /// - /// Registers a chain of middleware to be called whenever a new event is published to this topic. - /// - /// The middleware to call to process events - public void Subscribe(params Middleware[] middleware) - { - var subWorker = new Faas(new SubscriptionWorkerOptions { Topic = this.Name }); +// /// +// /// Registers a chain of middleware to be called whenever a new event is published to this topic. +// /// +// /// The middleware to call to process events +// public void Subscribe(params Middleware[] middleware) +// { +// var subWorker = new Faas(new SubscriptionWorkerOptions { Topic = this.Name }); - subWorker.Event(middleware); +// subWorker.Event(middleware); - Nitric.RegisterWorker(subWorker); - } +// Nitric.RegisterWorker(subWorker); +// } - /// - /// Registers a handler to be called whenever a new event is published to this topic. - /// - /// The handler to call to process events - public void Subscribe(Func handler) - { - var subWorker = new Faas(new SubscriptionWorkerOptions { Topic = this.Name }); +// /// +// /// Registers a handler to be called whenever a new event is published to this topic. +// /// +// /// The handler to call to process events +// public void Subscribe(Func handler) +// { +// var subWorker = new Faas(new SubscriptionWorkerOptions { Topic = this.Name }); - subWorker.Event(handler); - Nitric.RegisterWorker(subWorker); - } +// subWorker.Event(handler); +// Nitric.RegisterWorker(subWorker); +// } - /// - /// Request specific access to this topic. - /// - /// The permissions that the function has to access the topic. - /// A reference to the topic. - public Topic With(TopicPermission permission, params TopicPermission[] permissions) - { - var allPerms = new List { permission }; - allPerms.AddRange(permissions); +// /// +// /// Request specific access to this topic. +// /// +// /// The permissions that the function has to access the topic. +// /// A reference to the topic. +// public Topic With(TopicPermission permission, params TopicPermission[] permissions) +// { +// var allPerms = new List { permission }; +// allPerms.AddRange(permissions); - this.RegisterPolicy(allPerms); - return new EventsClient().Topic(this.Name); - } - } -} +// this.RegisterPolicy(allPerms); +// return new EventsClient().Topic(this.Name); +// } +// } +//} diff --git a/src/Nitric.Sdk/Resource/WebsocketResource.cs b/src/Nitric.Sdk/Resource/WebsocketResource.cs index 57b6b4a..bed6635 100644 --- a/src/Nitric.Sdk/Resource/WebsocketResource.cs +++ b/src/Nitric.Sdk/Resource/WebsocketResource.cs @@ -1,103 +1,103 @@ -// Copyright 2021, Nitric Technologies Pty Ltd. -// -// 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. +//// Copyright 2021, Nitric Technologies Pty Ltd. +//// +//// 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. -using System; -using System.Collections.Generic; -using System.Linq; -using System.Runtime.CompilerServices; -using Nitric.Proto.Resources.v1; -using Nitric.Sdk.Common; -using Nitric.Sdk.Function; -using Nitric.Sdk.Websocket; -using Action = Nitric.Proto.Resources.v1.Action; -using NitricResource = Nitric.Proto.Resources.v1.ResourceIdentifier; -using GrpcClient = Nitric.Proto.Websockets.v1.Websocket.WebsocketClient; +//using System; +//using System.Collections.Generic; +//using System.Linq; +//using System.Runtime.CompilerServices; +//using Nitric.Proto.Resources.v1; +//using Nitric.Sdk.Common; +//using Nitric.Sdk.Function; +//using Nitric.Sdk.Websocket; +//using Action = Nitric.Proto.Resources.v1.Action; +//using NitricResource = Nitric.Proto.Resources.v1.ResourceIdentifier; +//using GrpcClient = Nitric.Proto.Websockets.v1.Websocket.WebsocketClient; -namespace Nitric.Sdk.Resource -{ - /// - /// Available permissions for websocket resources. - /// - public enum WebsocketPermission - { - /// - /// Enables pushing new events to the websocket. - /// - Manage - } +//namespace Nitric.Sdk.Resource +//{ +// /// +// /// Available permissions for websocket resources. +// /// +// public enum WebsocketPermission +// { +// /// +// /// Enables pushing new events to the websocket. +// /// +// Manage +// } - public class WebsocketResource : SecureResource - { - private readonly WebsocketClient wsClient; +// public class WebsocketResource : SecureResource +// { +// private readonly WebsocketClient wsClient; - internal WebsocketResource(string name) : base(name, ResourceType.Websocket) - { - this.wsClient = new WebsocketClient(new GrpcClient(GrpcChannelProvider.GetChannel())); - } +// internal WebsocketResource(string name) : base(name, ResourceType.Websocket) +// { +// this.wsClient = new WebsocketClient(new GrpcClient(GrpcChannelProvider.GetChannel())); +// } - internal override BaseResource Register() - { - var resource = new NitricResource { Name = this.Name, Type = ResourceType.Websocket }; - var request = new ResourceDeclareRequest { Id = resource }; - BaseResource.client.Declare(request); - return this; - } +// internal override BaseResource Register() +// { +// var resource = new NitricResource { Name = this.Name, Type = ResourceType.Websocket }; +// var request = new ResourceDeclareRequest { Id = resource }; +// BaseResource.client.Declare(request); +// return this; +// } - protected override IEnumerable PermissionsToActions(IEnumerable permissions) - { - var actionMap = new Dictionary> - { - { - WebsocketPermission.Manage, - new List { Action.WebsocketManage } - } - }; - return permissions.Aggregate((IEnumerable)new List(), (acc, x) => acc.Concat(actionMap[x])) - .Distinct(); - } +// protected override IEnumerable PermissionsToActions(IEnumerable permissions) +// { +// var actionMap = new Dictionary> +// { +// { +// WebsocketPermission.Manage, +// new List { Action.WebsocketManage } +// } +// }; +// return permissions.Aggregate((IEnumerable)new List(), (acc, x) => acc.Concat(actionMap[x])) +// .Distinct(); +// } - /// - /// Registers a chain of middleware to be called whenever a new event is published to this topic. - /// - /// The type of websocket event listener - /// The middleware to call to process events - public void On(WebsocketEventType notificationType, params Middleware[] middleware) - { - var websocketWorker = new Faas(new WebsocketWorkerOptions(this.Name, notificationType)); +// /// +// /// Registers a chain of middleware to be called whenever a new event is published to this topic. +// /// +// /// The type of websocket event listener +// /// The middleware to call to process events +// public void On(WebsocketEventType notificationType, params Middleware[] middleware) +// { +// var websocketWorker = new Faas(new WebsocketWorkerOptions(this.Name, notificationType)); - websocketWorker.Websocket(middleware); +// websocketWorker.Websocket(middleware); - Nitric.RegisterWorker(websocketWorker); - } +// Nitric.RegisterWorker(websocketWorker); +// } - /// - /// Registers a handler to be called whenever a new event is published to this websocket. - /// - /// The type of websocket event - /// The handler to call to process websocket events - public void On(WebsocketEventType notificationType, Func handler) - { - var websocketWorker = new Faas(new WebsocketWorkerOptions(this.Name, notificationType)); +// /// +// /// Registers a handler to be called whenever a new event is published to this websocket. +// /// +// /// The type of websocket event +// /// The handler to call to process websocket events +// public void On(WebsocketEventType notificationType, Func handler) +// { +// var websocketWorker = new Faas(new WebsocketWorkerOptions(this.Name, notificationType)); - websocketWorker.Websocket(handler); +// websocketWorker.Websocket(handler); - Nitric.RegisterWorker(websocketWorker); - } +// Nitric.RegisterWorker(websocketWorker); +// } - public Connection Connection(string connectionId) - { - return this.wsClient.Connection(this.Name, connectionId); - } - } -} +// public Connection Connection(string connectionId) +// { +// return this.wsClient.Connection(this.Name, connectionId); +// } +// } +//} diff --git a/src/Nitric.Sdk/Storage/Bucket.cs b/src/Nitric.Sdk/Storage/Bucket.cs index 447020d..07c1a9f 100644 --- a/src/Nitric.Sdk/Storage/Bucket.cs +++ b/src/Nitric.Sdk/Storage/Bucket.cs @@ -1,124 +1,124 @@ -// Copyright 2021, Nitric Technologies Pty Ltd. -// -// 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. -using System; -using System.Collections.Generic; -using Nitric.Proto.Storage.v1; -using Nitric.Sdk.Function; -using ProtoFile = Nitric.Proto.Storage.v1.Object; - - -namespace Nitric.Sdk.Storage -{ - /// - /// A reference to a bucket in the storage service. - /// - public class Bucket - { - private readonly Storage storage; - - /// - /// The name of the bucket. - /// - public string Name { get; private set; } - - internal Bucket(Storage storage, string name) - { - this.storage = storage; - this.Name = name; - } - - /// - /// Create a reference to a file in the bucket. - /// - /// The files name/path - /// The file reference. - /// - public File File(string key) - { - if (string.IsNullOrEmpty(key)) - { - throw new ArgumentNullException(nameof(key)); - } - - return new File(storage, this, key); - } - - /// - /// Get a list of files in a bucket. - /// - /// All the files in the bucket as Nitric file references. - public List Files() - { - var request = new StorageListFilesRequest - { - BucketName = this.Name, - }; - - var resp = this.storage.Client.ListFiles(request); - - List files = new List(); - - foreach (ProtoFile file in resp.Files) - { - files.Add(new File(this.storage, this, file.Key)); - } - - return files; - } - - /// - /// Registers handlers to be called whenever a file triggers an event in the bucket - /// - /// The type of events that should trigger events, Write or Delete - /// The prefix of file names that should trigger events - /// The handlers to call to process notification events - public void On( - BucketNotificationType notificationType, - string notificationPrefixFilter, - params Middleware[] middleware) - { - var notificationWorker = new Faas(new FileNotificationWorkerOptions( - this, - notificationType, - notificationPrefixFilter - )); - - notificationWorker.FileNotification(middleware); - - Nitric.RegisterWorker(notificationWorker); - } - - /// - /// Registers a handler to be called whenever a file triggers an event in the bucket - /// - /// The type of events that should trigger events, Write or Delete - /// The prefix of file names that should trigger events - /// The handler to call to process notification events - public void On( - BucketNotificationType notificationType, - string notificationPrefixFilter, - Func handler) - { - var notificationWorker = new Faas(new FileNotificationWorkerOptions( - this, - notificationType, - notificationPrefixFilter - )); - - notificationWorker.FileNotification(handler); - - Nitric.RegisterWorker(notificationWorker); - } - } -} +//// Copyright 2021, Nitric Technologies Pty Ltd. +//// +//// 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. +//using System; +//using System.Collections.Generic; +//using Nitric.Proto.Storage.v1; +//using Nitric.Sdk.Service; +//using ProtoFile = Nitric.Proto.Storage.v1.Object; + + +//namespace Nitric.Sdk.Storage +//{ +// /// +// /// A reference to a bucket in the storage service. +// /// +// public class Bucket +// { +// private readonly Storage storage; + +// /// +// /// The name of the bucket. +// /// +// public string Name { get; private set; } + +// internal Bucket(Storage storage, string name) +// { +// this.storage = storage; +// this.Name = name; +// } + +// /// +// /// Create a reference to a file in the bucket. +// /// +// /// The files name/path +// /// The file reference. +// /// +// public File File(string key) +// { +// if (string.IsNullOrEmpty(key)) +// { +// throw new ArgumentNullException(nameof(key)); +// } + +// return new File(storage, this, key); +// } + +// /// +// /// Get a list of files in a bucket. +// /// +// /// All the files in the bucket as Nitric file references. +// public List Files() +// { +// var request = new StorageListFilesRequest +// { +// BucketName = this.Name, +// }; + +// var resp = this.storage.Client.ListFiles(request); + +// List files = new List(); + +// foreach (ProtoFile file in resp.Files) +// { +// files.Add(new File(this.storage, this, file.Key)); +// } + +// return files; +// } + +// /// +// /// Registers handlers to be called whenever a file triggers an event in the bucket +// /// +// /// The type of events that should trigger events, Write or Delete +// /// The prefix of file names that should trigger events +// /// The handlers to call to process notification events +// public void On( +// BucketNotificationType notificationType, +// string notificationPrefixFilter, +// params Middleware[] middleware) +// { +// var notificationWorker = new Faas(new FileNotificationWorkerOptions( +// this, +// notificationType, +// notificationPrefixFilter +// )); + +// notificationWorker.FileNotification(middleware); + +// Nitric.RegisterWorker(notificationWorker); +// } + +// /// +// /// Registers a handler to be called whenever a file triggers an event in the bucket +// /// +// /// The type of events that should trigger events, Write or Delete +// /// The prefix of file names that should trigger events +// /// The handler to call to process notification events +// public void On( +// BucketNotificationType notificationType, +// string notificationPrefixFilter, +// Func handler) +// { +// var notificationWorker = new Faas(new FileNotificationWorkerOptions( +// this, +// notificationType, +// notificationPrefixFilter +// )); + +// notificationWorker.FileNotification(handler); + +// Nitric.RegisterWorker(notificationWorker); +// } +// } +//} diff --git a/src/Nitric.Sdk/Storage/File.cs b/src/Nitric.Sdk/Storage/File.cs index 1afb957..375c521 100644 --- a/src/Nitric.Sdk/Storage/File.cs +++ b/src/Nitric.Sdk/Storage/File.cs @@ -1,203 +1,203 @@ -// Copyright 2021, Nitric Technologies Pty Ltd. -// -// 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. +//// Copyright 2021, Nitric Technologies Pty Ltd. +//// +//// 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. -using System; -using System.Text; -using Google.Protobuf; -using Nitric.Proto.Storage.v1; -using Nitric.Sdk.Common; -using Nitric.Sdk.Function; -using ProtoFile = Nitric.Proto.Storage.v1.Object; +//using System; +//using System.Text; +//using Google.Protobuf; +//using Nitric.Proto.Storage.v1; +//using Nitric.Sdk.Common; +//using Nitric.Sdk.Function; +//using ProtoFile = Nitric.Proto.Storage.v1.Object; -namespace Nitric.Sdk.Storage -{ - /// - /// Available operations for signing a url. - /// - public enum FileMode - { - /// - /// Download a file from a bucket. - /// - Read, - /// - /// Upload a file to a bucket. - /// - Write, - } +//namespace Nitric.Sdk.Storage +//{ +// /// +// /// Available operations for signing a url. +// /// +// public enum FileMode +// { +// /// +// /// Download a file from a bucket. +// /// +// Read, +// /// +// /// Upload a file to a bucket. +// /// +// Write, +// } - /// - /// A reference to a specific file in a bucket. - /// - public class File - { - private readonly Storage storage; - private readonly Bucket bucket; - public string Name { get; private set; } +// /// +// /// A reference to a specific file in a bucket. +// /// +// public class File +// { +// private readonly Storage storage; +// private readonly Bucket bucket; +// public string Name { get; private set; } - internal File(Storage storage, Bucket bucket, string key) - { - this.storage = storage; - this.bucket = bucket; - this.Name = key; - } +// internal File(Storage storage, Bucket bucket, string key) +// { +// this.storage = storage; +// this.bucket = bucket; +// this.Name = key; +// } - /// - /// Create or update the contents of the file. - /// - /// The contents to write. - /// - public void Write(byte[] body) - { - var request = new StorageWriteRequest - { - BucketName = bucket.Name, - Key = this.Name, - Body = ByteString.CopyFrom(body) - }; - try - { - storage.Client.Write(request); - } - catch (Grpc.Core.RpcException re) - { - throw NitricException.FromRpcException(re); - } - } +// /// +// /// Create or update the contents of the file. +// /// +// /// The contents to write. +// /// +// public void Write(byte[] body) +// { +// var request = new StorageWriteRequest +// { +// BucketName = bucket.Name, +// Key = this.Name, +// Body = ByteString.CopyFrom(body) +// }; +// try +// { +// storage.Client.Write(request); +// } +// catch (Grpc.Core.RpcException re) +// { +// throw NitricException.FromRpcException(re); +// } +// } - /// - /// Create or update the contents of the file. - /// - /// The contents to write. - /// - public void Write(string body) - { - var request = new StorageWriteRequest - { - BucketName = bucket.Name, - Key = this.Name, - Body = ByteString.CopyFromUtf8(body) - }; - try - { - storage.Client.Write(request); - } - catch (Grpc.Core.RpcException re) - { - throw NitricException.FromRpcException(re); - } - } +// /// +// /// Create or update the contents of the file. +// /// +// /// The contents to write. +// /// +// public void Write(string body) +// { +// var request = new StorageWriteRequest +// { +// BucketName = bucket.Name, +// Key = this.Name, +// Body = ByteString.CopyFromUtf8(body) +// }; +// try +// { +// storage.Client.Write(request); +// } +// catch (Grpc.Core.RpcException re) +// { +// throw NitricException.FromRpcException(re); +// } +// } - /// - /// Retrieve the contents of a file. - /// - /// The file contents. - /// - public byte[] Read() - { - var request = new StorageReadRequest - { - BucketName = bucket.Name, - Key = this.Name - }; - try - { - var response = storage.Client.Read(request); - return response.Body.ToByteArray(); - } - catch (Grpc.Core.RpcException re) - { - throw NitricException.FromRpcException(re); - } - } +// /// +// /// Retrieve the contents of a file. +// /// +// /// The file contents. +// /// +// public byte[] Read() +// { +// var request = new StorageReadRequest +// { +// BucketName = bucket.Name, +// Key = this.Name +// }; +// try +// { +// var response = storage.Client.Read(request); +// return response.Body.ToByteArray(); +// } +// catch (Grpc.Core.RpcException re) +// { +// throw NitricException.FromRpcException(re); +// } +// } - /// - /// Delete the file. - /// - /// - public void Delete() - { - var request = new StorageDeleteRequest - { - BucketName = bucket.Name, - Key = this.Name - }; - try - { - storage.Client.Delete(request); - } - catch (Grpc.Core.RpcException re) - { - throw NitricException.FromRpcException(re); - } - } +// /// +// /// Delete the file. +// /// +// /// +// public void Delete() +// { +// var request = new StorageDeleteRequest +// { +// BucketName = bucket.Name, +// Key = this.Name +// }; +// try +// { +// storage.Client.Delete(request); +// } +// catch (Grpc.Core.RpcException re) +// { +// throw NitricException.FromRpcException(re); +// } +// } - /// - /// Create a presigned URL for reading or writing for the given file reference. - /// - /// The mode the URL will access the file with. E.g. reading or writing. - /// How long the URL should be valid for in seconds. - /// The signed URL for reading or writing - internal string PreSignUrl(FileMode mode, int expiry) - { - var request = new StoragePreSignUrlRequest - { - BucketName = this.bucket.Name, - Key = this.Name, - Operation = mode == FileMode.Read ? StoragePreSignUrlRequest.Types.Operation.Read : StoragePreSignUrlRequest.Types.Operation.Write, - Expiry = expiry < 0 ? 0 : (uint)expiry, +// /// +// /// Create a presigned URL for reading or writing for the given file reference. +// /// +// /// The mode the URL will access the file with. E.g. reading or writing. +// /// How long the URL should be valid for in seconds. +// /// The signed URL for reading or writing +// internal string PreSignUrl(FileMode mode, int expiry) +// { +// var request = new StoragePreSignUrlRequest +// { +// BucketName = this.bucket.Name, +// Key = this.Name, +// Operation = mode == FileMode.Read ? StoragePreSignUrlRequest.Types.Operation.Read : StoragePreSignUrlRequest.Types.Operation.Write, +// Expiry = expiry < 0 ? 0 : (uint)expiry, - }; +// }; - try - { - var resp = storage.Client.PreSignUrl(request); - return resp.Url; - } catch (Grpc.Core.RpcException re) - { - throw NitricException.FromRpcException(re); - } - } +// try +// { +// var resp = storage.Client.PreSignUrl(request); +// return resp.Url; +// } catch (Grpc.Core.RpcException re) +// { +// throw NitricException.FromRpcException(re); +// } +// } - /// - /// Create a presigned URL for reading a given file reference. - /// - /// How long the URL should be valid for in seconds. Defaults to 600 seconds (10 minutes). - /// The signed URL for reading. - public string GetDownloadUrl(int expiry = 600) - { - return this.PreSignUrl(FileMode.Write, expiry); - } +// /// +// /// Create a presigned URL for reading a given file reference. +// /// +// /// How long the URL should be valid for in seconds. Defaults to 600 seconds (10 minutes). +// /// The signed URL for reading. +// public string GetDownloadUrl(int expiry = 600) +// { +// return this.PreSignUrl(FileMode.Write, expiry); +// } - /// - /// Create a presigned URL for writing to a given file reference. - /// - /// How long the URL should be valid for in seconds. Defaults to 600 seconds (10 minutes). - /// The signed URL for writing. - public string GetUploadUrl(int expiry = 600) - { - return this.PreSignUrl(FileMode.Read, expiry); - } +// /// +// /// Create a presigned URL for writing to a given file reference. +// /// +// /// How long the URL should be valid for in seconds. Defaults to 600 seconds (10 minutes). +// /// The signed URL for writing. +// public string GetUploadUrl(int expiry = 600) +// { +// return this.PreSignUrl(FileMode.Read, expiry); +// } - /// - /// Return a string representation of the file. Will not contain the file contents. - /// - /// - public override string ToString() - { - return GetType().Name + "[name=" + Name + "\nbucket=" + bucket.Name + "]"; - } - } -} +// /// +// /// Return a string representation of the file. Will not contain the file contents. +// /// +// /// +// public override string ToString() +// { +// return GetType().Name + "[name=" + Name + "\nbucket=" + bucket.Name + "]"; +// } +// } +//} diff --git a/src/Nitric.Sdk/Storage/StorageClient.cs b/src/Nitric.Sdk/Storage/StorageClient.cs index 0203a23..2f48f35 100644 --- a/src/Nitric.Sdk/Storage/StorageClient.cs +++ b/src/Nitric.Sdk/Storage/StorageClient.cs @@ -1,53 +1,53 @@ -// Copyright 2021, Nitric Technologies Pty Ltd. -// -// 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. +//// Copyright 2021, Nitric Technologies Pty Ltd. +//// +//// 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. -using System; -using Nitric.Sdk.Common; -using GrpcClient = Nitric.Proto.Storage.v1.StorageService.StorageServiceClient; +//using System; +//using Nitric.Sdk.Common; +//using GrpcClient = Nitric.Proto.Storage.v1.StorageService.StorageServiceClient; -namespace Nitric.Sdk.Storage -{ - /// - /// A storage client. - /// - public class Storage - { - internal readonly GrpcClient Client; +//namespace Nitric.Sdk.Storage +//{ +// /// +// /// A storage client. +// /// +// public class Storage +// { +// internal readonly GrpcClient Client; - /// - /// Create a new storage client. - /// - /// Optional internal gRPC client to reuse. - public Storage(GrpcClient client = null) - { - this.Client = client ?? new GrpcClient(GrpcChannelProvider.GetChannel()); - } +// /// +// /// Create a new storage client. +// /// +// /// Optional internal gRPC client to reuse. +// public Storage(GrpcClient client = null) +// { +// this.Client = client ?? new GrpcClient(GrpcChannelProvider.GetChannel()); +// } - /// - /// Create a reference to a bucket in the storage service. - /// - /// The name of the bucket. - /// The new bucket reference. - /// - public Bucket Bucket(string bucketName) - { - if (string.IsNullOrEmpty(bucketName)) - { - throw new ArgumentNullException(nameof(bucketName)); - } +// /// +// /// Create a reference to a bucket in the storage service. +// /// +// /// The name of the bucket. +// /// The new bucket reference. +// /// +// public Bucket Bucket(string bucketName) +// { +// if (string.IsNullOrEmpty(bucketName)) +// { +// throw new ArgumentNullException(nameof(bucketName)); +// } - return new Bucket(this, bucketName); - } - } -} +// return new Bucket(this, bucketName); +// } +// } +//} diff --git a/src/Nitric.Sdk/Topic/Topic.cs b/src/Nitric.Sdk/Topic/Topic.cs index d513bdb..c4c2d70 100644 --- a/src/Nitric.Sdk/Topic/Topic.cs +++ b/src/Nitric.Sdk/Topic/Topic.cs @@ -1,66 +1,66 @@ -// Copyright 2021, Nitric Technologies Pty Ltd. -// -// 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. +//// Copyright 2021, Nitric Technologies Pty Ltd. +//// +//// 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. -using Google.Protobuf; -using Google.Protobuf.WellKnownTypes; -using Newtonsoft.Json; -using Nitric.Proto.Topics.v1; -using Nitric.Sdk.Common; +//using Google.Protobuf; +//using Google.Protobuf.WellKnownTypes; +//using Newtonsoft.Json; +//using Nitric.Proto.Topics.v1; +//using Nitric.Sdk.Common; -namespace Nitric.Sdk.Topic -{ - /// - /// Represents a reference to a topic. - /// - public class Topic - { - private readonly TopicsClient TopicsClient; - /// - /// The name of topic. - /// - public string Name { get; private set; } +//namespace Nitric.Sdk.Topic +//{ +// /// +// /// Represents a reference to a topic. +// /// +// public class Topic +// { +// private readonly TopicsClient TopicsClient; +// /// +// /// The name of topic. +// /// +// public string Name { get; private set; } - internal Topic(TopicsClient TopicsClient, string name) - { - this.TopicsClient = TopicsClient; - this.Name = name; - } +// internal Topic(TopicsClient TopicsClient, string name) +// { +// this.TopicsClient = TopicsClient; +// this.Name = name; +// } - /// - /// Publish a new message to this topic. - /// - /// The message to publish - /// - public void Publish(T message) - { - Struct structPayload = null; - if (message != null) - { - var jsonPayload = JsonConvert.SerializeObject(message); - structPayload = JsonParser.Default.Parse(jsonPayload); - } +// /// +// /// Publish a new message to this topic. +// /// +// /// The message to publish +// /// +// public void Publish(T message) +// { +// Struct structPayload = null; +// if (message != null) +// { +// var jsonPayload = JsonConvert.SerializeObject(message); +// structPayload = JsonParser.Default.Parse(jsonPayload); +// } - var request = new TopicPublishRequest { TopicName = this.Name, Message = new Message { StructPayload = structPayload } }; +// var request = new TopicPublishRequest { TopicName = this.Name, Message = new Message { StructPayload = structPayload } }; - try - { - this.TopicsClient.TopicClient.Publish(request); - } - catch (Grpc.Core.RpcException re) - { - throw NitricException.FromRpcException(re); - } - } - } -} +// try +// { +// this.TopicsClient.TopicClient.Publish(request); +// } +// catch (Grpc.Core.RpcException re) +// { +// throw NitricException.FromRpcException(re); +// } +// } +// } +//} diff --git a/src/Nitric.Sdk/Topic/TopicsClient.cs b/src/Nitric.Sdk/Topic/TopicsClient.cs index 3a3a9dc..af90875 100644 --- a/src/Nitric.Sdk/Topic/TopicsClient.cs +++ b/src/Nitric.Sdk/Topic/TopicsClient.cs @@ -1,78 +1,78 @@ -// Copyright 2021, Nitric Technologies Pty Ltd. -// -// 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. +//// Copyright 2021, Nitric Technologies Pty Ltd. +//// +//// 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. -using System; -using System.Collections.Generic; -using System.Linq; -using Nitric.Sdk.Common; -using Nitric.Proto.Topics.v1; +//using System; +//using System.Collections.Generic; +//using System.Linq; +//using Nitric.Sdk.Common; +//using Nitric.Proto.Topics.v1; -namespace Nitric.Sdk.Topic -{ - /// - /// Events service client. - /// - public class TopicsClient - { - internal readonly Topics.TopicsClient TopicClient; - private readonly Subscriber.SubscriberClient subscriberClient; +//namespace Nitric.Sdk.Topic +//{ +// /// +// /// Events service client. +// /// +// public class TopicsClient +// { +// internal readonly Topics.TopicsClient TopicClient; +// private readonly Subscriber.SubscriberClient subscriberClient; - /// - /// Create a new events service client. - /// - /// The events gRPC client. - /// The topics gRPC client. - public TopicsClient(GrpcClient client = null, TopicClient topic = null) - { - this.EventClient = client ?? new GrpcClient(GrpcChannelProvider.GetChannel()); - this.topicClient = topic ?? new TopicClient(GrpcChannelProvider.GetChannel()); - } +// /// +// /// Create a new events service client. +// /// +// /// The events gRPC client. +// /// The topics gRPC client. +// public TopicsClient(GrpcClient client = null, TopicClient topic = null) +// { +// this.EventClient = client ?? new GrpcClient(GrpcChannelProvider.GetChannel()); +// this.topicClient = topic ?? new TopicClient(GrpcChannelProvider.GetChannel()); +// } - /// - /// Create a reference to a topic. - /// - /// The name of the topic. - /// The topic reference. - /// - public Topic Topic(string topicName) - { - if (string.IsNullOrEmpty(topicName)) - { - throw new ArgumentNullException(nameof(topicName)); - } +// /// +// /// Create a reference to a topic. +// /// +// /// The name of the topic. +// /// The topic reference. +// /// +// public Topic Topic(string topicName) +// { +// if (string.IsNullOrEmpty(topicName)) +// { +// throw new ArgumentNullException(nameof(topicName)); +// } - return new Topic(this, topicName); - } +// return new Topic(this, topicName); +// } - /// - /// Return a list of all accessible topics. - /// - /// A list of accessible topics. - /// - public List> List() - { - var request = new TopicListRequest { }; +// /// +// /// Return a list of all accessible topics. +// /// +// /// A list of accessible topics. +// /// +// public List> List() +// { +// var request = new TopicListRequest { }; - try - { - var response = topicClient.List(request); - return response.Topics.Select(topic => new Topic(this, topic.Name)).ToList(); - } - catch (Grpc.Core.RpcException re) - { - throw NitricException.FromRpcException(re); - } - } - } -} +// try +// { +// var response = topicClient.List(request); +// return response.Topics.Select(topic => new Topic(this, topic.Name)).ToList(); +// } +// catch (Grpc.Core.RpcException re) +// { +// throw NitricException.FromRpcException(re); +// } +// } +// } +//} diff --git a/src/Nitric.Sdk/Websocket/Connection.cs b/src/Nitric.Sdk/Websocket/Connection.cs index 4ca284e..1ce92bf 100644 --- a/src/Nitric.Sdk/Websocket/Connection.cs +++ b/src/Nitric.Sdk/Websocket/Connection.cs @@ -1,76 +1,76 @@ -// Copyright 2021, Nitric Technologies Pty Ltd. -// -// 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. -using Google.Protobuf; -using Grpc.Core; -using Nitric.Proto.Websocket.v1; -using Nitric.Sdk.Common; -using Nitric.Sdk.Resource; +//// Copyright 2021, Nitric Technologies Pty Ltd. +//// +//// 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. +//using Google.Protobuf; +//using Grpc.Core; +//using Nitric.Proto.Websocket.v1; +//using Nitric.Sdk.Common; +//using Nitric.Sdk.Resource; -namespace Nitric.Sdk.Websocket -{ - public class Connection - { - /// - /// The unique connection Id - /// - public string Id { get; set; } +//namespace Nitric.Sdk.Websocket +//{ +// public class Connection +// { +// /// +// /// The unique connection Id +// /// +// public string Id { get; set; } - public string Socket { get; set; } +// public string Socket { get; set; } - private readonly WebsocketClient websocket; +// private readonly WebsocketClient websocket; - internal Connection(WebsocketClient websocket, string id, string socket) - { - this.websocket = websocket; - this.Id = id; - this.Socket = socket; - } +// internal Connection(WebsocketClient websocket, string id, string socket) +// { +// this.websocket = websocket; +// this.Id = id; +// this.Socket = socket; +// } - public void Send(string data) - { - var request = new WebsocketSendRequest - { - ConnectionId = this.Id, - Socket = this.Socket, - Data = ByteString.CopyFromUtf8(data) - }; - try - { - this.websocket.client.Send(request); - } - catch (RpcException e) - { - throw NitricException.FromRpcException(e); - } - } +// public void Send(string data) +// { +// var request = new WebsocketSendRequest +// { +// ConnectionId = this.Id, +// Socket = this.Socket, +// Data = ByteString.CopyFromUtf8(data) +// }; +// try +// { +// this.websocket.client.Send(request); +// } +// catch (RpcException e) +// { +// throw NitricException.FromRpcException(e); +// } +// } - public void Close() - { - var request = new WebsocketCloseRequest - { - ConnectionId = this.Id, - Socket = this.Socket, - }; +// public void Close() +// { +// var request = new WebsocketCloseRequest +// { +// ConnectionId = this.Id, +// Socket = this.Socket, +// }; - try - { - this.websocket.client.Close(request); - } - catch (RpcException e) - { - throw NitricException.FromRpcException(e); - } - } - } -} +// try +// { +// this.websocket.client.Close(request); +// } +// catch (RpcException e) +// { +// throw NitricException.FromRpcException(e); +// } +// } +// } +//} diff --git a/src/Nitric.Sdk/Websocket/WebsocketClient.cs b/src/Nitric.Sdk/Websocket/WebsocketClient.cs index ee0e7d0..0b5a834 100644 --- a/src/Nitric.Sdk/Websocket/WebsocketClient.cs +++ b/src/Nitric.Sdk/Websocket/WebsocketClient.cs @@ -1,43 +1,43 @@ -// Copyright 2021, Nitric Technologies Pty Ltd. -// -// 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. -using System; -using Nitric.Sdk.Common; -using GrpcClient = Nitric.Proto.Websockets.v1.Websocket.WebsocketClient; +//// Copyright 2021, Nitric Technologies Pty Ltd. +//// +//// 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. +//using System; +//using Nitric.Sdk.Common; +//using GrpcClient = Nitric.Proto.Websockets.v1.Websocket.WebsocketClient; -namespace Nitric.Sdk.Websocket -{ - public class WebsocketClient - { - internal readonly GrpcClient client; +//namespace Nitric.Sdk.Websocket +//{ +// public class WebsocketClient +// { +// internal readonly GrpcClient client; - public WebsocketClient(GrpcClient client = null) - { - this.client = client ?? new GrpcClient(GrpcChannelProvider.GetChannel()); - } +// public WebsocketClient(GrpcClient client = null) +// { +// this.client = client ?? new GrpcClient(GrpcChannelProvider.GetChannel()); +// } - public Connection Connection(string socket, string connectionId) - { - if (string.IsNullOrEmpty(socket)) - { - throw new ArgumentNullException(nameof(socket)); - } +// public Connection Connection(string socket, string connectionId) +// { +// if (string.IsNullOrEmpty(socket)) +// { +// throw new ArgumentNullException(nameof(socket)); +// } - if (string.IsNullOrEmpty(connectionId)) - { - throw new ArgumentNullException(nameof(connectionId)); - } - return new Connection(this, connectionId, socket); - } - } -} +// if (string.IsNullOrEmpty(connectionId)) +// { +// throw new ArgumentNullException(nameof(connectionId)); +// } +// return new Connection(this, connectionId, socket); +// } +// } +//} diff --git a/src/Nitric.Sdk/Worker/ScheduleWorker.cs b/src/Nitric.Sdk/Worker/ScheduleWorker.cs index 66112b2..9623e2b 100644 --- a/src/Nitric.Sdk/Worker/ScheduleWorker.cs +++ b/src/Nitric.Sdk/Worker/ScheduleWorker.cs @@ -4,7 +4,7 @@ using Nitric.Proto.Schedules.v1; using GrpcClient = Nitric.Proto.Schedules.v1.Schedules.SchedulesClient; using Nitric.Sdk.Service; -using Nitric.Sdk.Resource; +using System; namespace Nitric.Sdk.Worker { @@ -12,36 +12,45 @@ public class ScheduleWorker : AbstractWorker { readonly private RegistrationRequest RegistrationRequest; + public ScheduleWorker(RegistrationRequest request, Func middleware) : base(middleware) + { + this.RegistrationRequest = request; + } + public ScheduleWorker(RegistrationRequest request, params Middleware[] middlewares) : base(middlewares) { this.RegistrationRequest = request; } - public override Task Start() + public override async Task Start() { - return Task.Run(async () => - { - var client = new GrpcClient(GrpcChannelProvider.GetChannel()); + var client = new GrpcClient(GrpcChannelProvider.GetChannel()); - var stream = client.Schedule(); + var stream = client.Schedule(); - await stream.RequestStream.WriteAsync(new ClientMessage { RegistrationRequest = RegistrationRequest }); + await stream.RequestStream.WriteAsync(new ClientMessage { RegistrationRequest = RegistrationRequest }); - while (!stream.ResponseStream.Current.Equals(null)) - { - var req = stream.ResponseStream.Current; + Console.WriteLine(RegistrationRequest); + while (await stream.ResponseStream.MoveNext(CancellationToken.None)) + { + var req = stream.ResponseStream.Current; + + if (req.RegistrationResponse != null) + { + Console.WriteLine("Schedule connected with Nitric server."); + } + else if (req.IntervalRequest != null) + { var ctx = IntervalContext.FromRequest(req); ctx = this.Middleware(ctx); await stream.RequestStream.WriteAsync(ctx.ToRequest()); - - await stream.ResponseStream.MoveNext(CancellationToken.None); } + } - await stream.RequestStream.CompleteAsync(); - }); + await stream.RequestStream.CompleteAsync(); } } } diff --git a/src/Nitric.Sdk/Worker/Worker.cs b/src/Nitric.Sdk/Worker/Worker.cs index 5877b03..247945b 100644 --- a/src/Nitric.Sdk/Worker/Worker.cs +++ b/src/Nitric.Sdk/Worker/Worker.cs @@ -6,34 +6,44 @@ namespace Nitric.Sdk.Worker { - public abstract class AbstractWorker + interface IWorker { - protected Func, TriggerContext> Middleware; + public Task Start(); + } + + public abstract class AbstractWorker : IWorker + { + protected Func Middleware; - public AbstractWorker(params Middleware>[] middlewares) + public AbstractWorker(params Middleware[] middlewares) { if (middlewares.Count() == 0) { - throw new ArgumentException("cannot create schedule worker with no handlers"); + throw new ArgumentException("cannot create worker with no handlers"); } // Convert the middleware array into a list - var middlewareList = new List>>(); + var middlewareList = new List>(); middlewareList.AddRange(middlewares); - Func, TriggerContext> lastCall = (context) => context; + Func lastCall = (context) => context; middlewares.Reverse(); this.Middleware = middlewares.Aggregate(lastCall, (next, handler) => { - Func, TriggerContext> nextFunc = (context) => handler(context, next) ?? context; + Func nextFunc = (context) => handler(context, next) ?? context; return nextFunc; }); } + public AbstractWorker(Func middleware) + { + this.Middleware = middleware; + } + public abstract Task Start(); } } From d0b3ac014066ae7a13cdd03cf69af63b1c26083f Mon Sep 17 00:00:00 2001 From: Ryan Cartwright Date: Fri, 16 Feb 2024 17:13:13 +1100 Subject: [PATCH 07/34] wip: update proto and implement other workers --- nitric/proto/apis/v1/apis.proto | 14 +- nitric/proto/deployments/v1/deployments.proto | 32 +- nitric/proto/http/v1/http.proto | 4 +- nitric/proto/keyvalue/v1/keyvalue.proto | 10 +- nitric/proto/queues/v1/queues.proto | 58 +- nitric/proto/resources/v1/resources.proto | 12 +- nitric/proto/schedules/v1/schedules.proto | 14 +- nitric/proto/secrets/v1/secrets.proto | 1 + nitric/proto/storage/v1/storage.proto | 8 +- nitric/proto/topics/v1/topics.proto | 8 +- nitric/proto/websockets/v1/websockets.proto | 16 +- src/Nitric.Sdk/Common/Struct.cs | 80 +- src/Nitric.Sdk/Nitric.Sdk.csproj | 15 +- .../Proto/nitric/proto/apis/v1/Apis.cs | 28 +- .../Proto/nitric/proto/apis/v1/ApisGrpc.cs | 28 +- .../proto/deployments/v1/Deployments.cs | 14 +- .../Proto/nitric/proto/http/v1/Http.cs | 2 +- .../Proto/nitric/proto/http/v1/HttpGrpc.cs | 2 +- .../nitric/proto/keyvalue/v1/Keyvalue.cs | 2 +- .../nitric/proto/keyvalue/v1/KeyvalueGrpc.cs | 30 +- .../Proto/nitric/proto/queues/v1/Queues.cs | 546 ++++++----- .../nitric/proto/queues/v1/QueuesGrpc.cs | 88 +- .../nitric/proto/resources/v1/Resources.cs | 40 +- .../nitric/proto/schedules/v1/Schedules.cs | 235 +---- .../proto/schedules/v1/SchedulesGrpc.cs | 2 +- .../nitric/proto/secrets/v1/SecretsGrpc.cs | 3 + .../Proto/nitric/proto/storage/v1/Storage.cs | 10 +- .../Proto/nitric/proto/topics/v1/Topics.cs | 96 +- .../nitric/proto/websockets/v1/Websockets.cs | 150 +-- .../proto/websockets/v1/WebsocketsGrpc.cs | 86 +- src/Nitric.Sdk/Resource/ApiResource.cs | 879 +++++++++--------- src/Nitric.Sdk/Resource/TopicResource.cs | 187 ++-- ...ficationContext.cs => BlobEventContext.cs} | 33 +- src/Nitric.Sdk/Service/HttpContext.cs | 4 +- src/Nitric.Sdk/Service/IntervalContext.cs | 4 +- src/Nitric.Sdk/Service/MessageContext.cs | 19 +- src/Nitric.Sdk/Storage/Bucket.cs | 248 ++--- src/Nitric.Sdk/Storage/File.cs | 377 ++++---- src/Nitric.Sdk/Storage/StorageClient.cs | 96 +- src/Nitric.Sdk/Topic/Topic.cs | 112 ++- src/Nitric.Sdk/Topic/TopicsClient.cs | 123 +-- src/Nitric.Sdk/Worker/ApiWorker.cs | 55 ++ src/Nitric.Sdk/Worker/BlobEventWorker.cs | 57 ++ src/Nitric.Sdk/Worker/ScheduleWorker.cs | 6 +- src/Nitric.Sdk/Worker/SubscriptionWorker.cs | 57 ++ 45 files changed, 1929 insertions(+), 1962 deletions(-) rename src/Nitric.Sdk/Service/{BucketNotificationContext.cs => BlobEventContext.cs} (78%) create mode 100644 src/Nitric.Sdk/Worker/ApiWorker.cs create mode 100644 src/Nitric.Sdk/Worker/BlobEventWorker.cs create mode 100644 src/Nitric.Sdk/Worker/SubscriptionWorker.cs diff --git a/nitric/proto/apis/v1/apis.proto b/nitric/proto/apis/v1/apis.proto index 6996e61..ba7f9a6 100644 --- a/nitric/proto/apis/v1/apis.proto +++ b/nitric/proto/apis/v1/apis.proto @@ -9,13 +9,13 @@ option java_outer_classname = "Apis"; option php_namespace = "Nitric\\Proto\\Apis\\V1"; option csharp_namespace = "Nitric.Proto.Apis.v1"; -// Service for publishing asynchronous messages +// Service for API routing and handlers service Api { // Serve a route on an API rpc Serve(stream ClientMessage) returns (stream ServerMessage); // Retrieve details about an API - rpc Details(ApiDetailsRequest) returns (ApiDetailsResponse); + rpc ApiDetails(ApiDetailsRequest) returns (ApiDetailsResponse); } message ApiDetailsRequest { @@ -26,12 +26,13 @@ message ApiDetailsResponse { string url = 1; } +// ClientMessage sent by the service to the nitric server message ClientMessage { // globally unique ID of the request/response pair string id = 1; oneof content { - // Register a subscription to a topic + // Register an API route handler RegistrationRequest registration_request = 2; // Response to an HTTP request @@ -65,7 +66,7 @@ message HttpRequest { // HttpResponseMessage message HttpResponse { - // The HTTP status of the request + // The HTTP response status code int32 status = 1; // HTTP response headers @@ -75,15 +76,16 @@ message HttpResponse { bytes body = 3; } +// ServerMessage sent by the nitric server to the service message ServerMessage { // globally unique ID of the request/response pair string id = 1; oneof content { - // Response to a topic subscription request + // Response to an API serve request RegistrationResponse registration_response = 2; - // Response to a topic message request + // HTTP request to be routed to the service (handler) HttpRequest http_request = 3; } } diff --git a/nitric/proto/deployments/v1/deployments.proto b/nitric/proto/deployments/v1/deployments.proto index f2edc96..b7890b3 100644 --- a/nitric/proto/deployments/v1/deployments.proto +++ b/nitric/proto/deployments/v1/deployments.proto @@ -70,15 +70,6 @@ enum ResourceDeploymentStatus { FAILED = 3; } -/* - -hello : service : created -| latest message goes here. -|- Container Image : created -|- ECR Repository : failed - -*/ - message ResourceUpdate { // The resource being updated, if this is nil the update applies to the stack nitric.proto.resources.v1.ResourceIdentifier id = 1; @@ -135,11 +126,11 @@ message DownResult {} // An image source to be used for service deployment message ImageSource { // URI of the docker image - // TODO: May also need to provide auth information (although this should just be configured on the running client already) + // To support remote images this may also need to provide auth information string uri = 1; } -// A unit of service (i.e. function/container) +// A unit of compute (i.e. function/container) message Service { // Source of the service oneof source { @@ -187,19 +178,14 @@ message Topic { message Queue {} -message KeyValueStore { - -} +message KeyValueStore {} -message Secret { - -} +message Secret {} message SubscriptionTarget { oneof target { // The name of an service to target string service = 1; - // Additional targets could potentially include // - HTTP/API Endpoints // - Queues @@ -217,7 +203,7 @@ message HttpTarget { } } -// A http resource +// An http proxy resource message Http { HttpTarget target = 1; } @@ -244,7 +230,6 @@ message WebsocketTarget { oneof target { // The name of an service to target string service = 1; - // Additional targets could potentially include // - HTTP/API Endpoints } @@ -254,7 +239,6 @@ message ScheduleTarget { oneof target { // The name of an service to target string service = 1; - // Additional targets could potentially include // - HTTP/API Endpoints } @@ -297,14 +281,10 @@ message Resource { } } -// This is already defined in the resource contracts... -// Need to determine if it's worth re-using +// This is already defined in the resource contracts, // unfortunately there are parts we don't want to duplicate, such as API config message Policy { repeated Resource principals = 1; - // TODO: Split out discrete action definitions from resources - // Also need to allow custom action types as well - // Should incorporate action re-use here... repeated nitric.proto.resources.v1.Action actions = 2; repeated Resource resources = 3; } diff --git a/nitric/proto/http/v1/http.proto b/nitric/proto/http/v1/http.proto index 293fd05..72c060b 100644 --- a/nitric/proto/http/v1/http.proto +++ b/nitric/proto/http/v1/http.proto @@ -9,7 +9,7 @@ option java_outer_classname = "Https"; option php_namespace = "Nitric\\Proto\\Http\\V1"; option csharp_namespace = "Nitric.Proto.Http.v1"; -// Service for publishing asynchronous messages +// Service for proxying HTTP requests service Http { // Proxy an HTTP server rpc Proxy(stream ClientMessage) returns (stream ServerMessage); @@ -23,7 +23,7 @@ message ClientMessage { message ServerMessage {} message HttpProxyRequest { - // The local port the server can be accessed on + // The address the server can be accessed on string host = 1; } diff --git a/nitric/proto/keyvalue/v1/keyvalue.proto b/nitric/proto/keyvalue/v1/keyvalue.proto index e328dcf..1ef0e29 100644 --- a/nitric/proto/keyvalue/v1/keyvalue.proto +++ b/nitric/proto/keyvalue/v1/keyvalue.proto @@ -14,17 +14,17 @@ option csharp_namespace = "Nitric.Proto.KeyValue.v1"; // Service for storage and retrieval of simple JSON keyValue service KeyValue { - // Get an existing document + // Get an existing value rpc Get (KeyValueGetRequest) returns (KeyValueGetResponse); - // Create a new or overwrite an existing document + // Create a new or overwrite an existing value rpc Set (KeyValueSetRequest) returns (KeyValueSetResponse); - // Delete an existing document + // Delete a key and its value rpc Delete (KeyValueDeleteRequest) returns (KeyValueDeleteResponse); } -// Provides a Key Value Store type for storing documents +// Provides a Key/Value Store message Store { // The store name string name = 1; @@ -48,8 +48,6 @@ message Value { google.protobuf.Struct content = 2; } -// Service Request & Response Messages - message KeyValueGetRequest { // ValueRef of the key/value pair to get, which includes the store and key ValueRef ref = 1; diff --git a/nitric/proto/queues/v1/queues.proto b/nitric/proto/queues/v1/queues.proto index 337be4d..bcc146c 100644 --- a/nitric/proto/queues/v1/queues.proto +++ b/nitric/proto/queues/v1/queues.proto @@ -13,39 +13,39 @@ option csharp_namespace = "Nitric.Proto.Queues.v1"; // The Nitric Queue Service contract service Queues { - // Send messages to a queue - rpc Send (QueueSendRequestBatch) returns (QueueSendResponse); + // Send message(s) to a queue + rpc Enqueue (QueueEnqueueRequest) returns (QueueEnqueueResponse); // Receive message(s) from a queue - rpc Receive (QueueReceiveRequest) returns (QueueReceiveResponse); - // Complete an item previously popped from a queue + rpc Dequeue (QueueDequeueRequest) returns (QueueDequeueResponse); + // Complete an message previously popped from a queue rpc Complete (QueueCompleteRequest) returns (QueueCompleteResponse); } -message QueueSendRequestBatch { +message QueueEnqueueRequest { // The Nitric name for the queue // this will automatically be resolved to the provider specific queue identifier. string queue_name = 1; - // Array of tasks to push to the queue - repeated QueueSendRequest requests = 2; + // Array of messages to push to the queue + repeated QueueMessage messages = 2; } -// Response for sending a collection of tasks -message QueueSendResponse { - // A list of tasks that failed to be queued - repeated FailedSendRequest failed_requests = 1; +// Response for sending messages to a queue +message QueueEnqueueResponse { + // A list of messages that failed to be queued + repeated FailedEnqueueMessage failed_messages = 1; } -message QueueReceiveRequest { +message QueueDequeueRequest { // The nitric name for the queue // this will automatically be resolved to the provider specific queue identifier. string queue_name = 1; - // The max number of items to pop off the queue, may be capped by provider specific limitations + // The max number of messages to pop off the queue, may be capped by provider specific limitations int32 depth = 2; } -message QueueReceiveResponse { - // Array of tasks popped off the queue - repeated ReceivedTask tasks = 1; +message QueueDequeueResponse { + // Array of messages popped off the queue + repeated DequeuedMessage messages = 1; } message QueueCompleteRequest { @@ -53,27 +53,29 @@ message QueueCompleteRequest { // this will automatically be resolved to the provider specific queue identifier. string queue_name = 1; - // Lease id of the task to be completed + // Lease id of the message to be completed string lease_id = 2; } message QueueCompleteResponse {} -// A task to be sent to a queue. -message QueueSendRequest { - // The payload of the task - google.protobuf.Struct payload = 1; +// An message to be sent to a queue. +message QueueMessage { + // The queue message contents + oneof content { + google.protobuf.Struct struct_payload = 1; + } } -message ReceivedTask { +message DequeuedMessage { string lease_id = 1; - google.protobuf.Struct payload = 2; + QueueMessage message = 2; } -message FailedSendRequest { - // The task that failed to be pushed - QueueSendRequest request = 1; - // A message describing the failure - string message = 2; +message FailedEnqueueMessage { + // The message that failed to be pushed + QueueMessage message = 1; + // A description of the failure + string details = 2; } diff --git a/nitric/proto/resources/v1/resources.proto b/nitric/proto/resources/v1/resources.proto index 987b783..79bbb14 100644 --- a/nitric/proto/resources/v1/resources.proto +++ b/nitric/proto/resources/v1/resources.proto @@ -99,11 +99,9 @@ enum Action { BucketFileDelete = 3; // Topic Permissions: 2XX - TopicList = 200; - TopicDetail = 201; - TopicEventPublish = 202; + TopicPublish = 200; - // Collection Permissions: 3XX + // KeyValue Store Permissions: 3XX KeyValueStoreRead = 300; KeyValueStoreWrite = 301; KeyValueStoreDelete = 302; @@ -116,10 +114,8 @@ enum Action { WebsocketManage = 500; // Queue Permissions: 6XX - QueueSend = 600; - QueueReceive = 601; - QueueList = 602; - QueueDetail = 603; + QueueEnqueue = 600; + QueueDequeue = 601; } message ResourceDeclareResponse {} diff --git a/nitric/proto/schedules/v1/schedules.proto b/nitric/proto/schedules/v1/schedules.proto index 5957b35..83d4f59 100644 --- a/nitric/proto/schedules/v1/schedules.proto +++ b/nitric/proto/schedules/v1/schedules.proto @@ -9,20 +9,21 @@ option java_outer_classname = "SchedulesService"; option php_namespace = "Nitric\\Proto\\Schedules\\V1"; option csharp_namespace = "Nitric.Proto.Schedules.v1"; -// Service for publishing asynchronous messages +// Service for scheduling callbacks on a cadence service Schedules { rpc Schedule(stream ClientMessage) returns (stream ServerMessage); } +// ClientMessages are sent from the service to the nitric server message ClientMessage { // globally unique ID of the request/response pair string id = 1; oneof content { - // Register a subscription to a schedule + // Register new a schedule RegistrationRequest registration_request = 2; - // Response to a schedule interval + // Response to a schedule interval (i.e. response from callback function) IntervalResponse interval_response = 3; } } @@ -31,10 +32,7 @@ message IntervalRequest { string schedule_name = 1; } -message MessageResponse { - bool success = 1; -} - +// ServerMessages are sent from the nitric server to the service message ServerMessage { // globally unique ID of the request/response pair string id = 1; @@ -43,7 +41,7 @@ message ServerMessage { // Response to a schedule subscription request RegistrationResponse registration_response = 2; - // A schedule interval trigger request + // A schedule interval trigger request (i.e. call the callback) IntervalRequest interval_request = 3; } } diff --git a/nitric/proto/secrets/v1/secrets.proto b/nitric/proto/secrets/v1/secrets.proto index ced438a..7d64e8c 100644 --- a/nitric/proto/secrets/v1/secrets.proto +++ b/nitric/proto/secrets/v1/secrets.proto @@ -9,6 +9,7 @@ option java_outer_classname = "SecretsService"; option php_namespace = "Nitric\\Proto\\Secrets\\V1"; option csharp_namespace = "Nitric.Proto.Secrets.v1"; +// The Nitric Secret Service service SecretManager { // Updates a secret, creating a new one if it doesn't already exist rpc Put (SecretPutRequest) returns (SecretPutResponse); diff --git a/nitric/proto/storage/v1/storage.proto b/nitric/proto/storage/v1/storage.proto index 7ec6c6c..ae89900 100644 --- a/nitric/proto/storage/v1/storage.proto +++ b/nitric/proto/storage/v1/storage.proto @@ -32,7 +32,7 @@ service StorageListener { rpc Listen (stream ClientMessage) returns (stream ServerMessage); } - +// ClientMessages are sent from the service to the nitric server message ClientMessage { // globally unique ID of the request/response pair string id = 1; @@ -40,11 +40,12 @@ message ClientMessage { oneof content { // Watch for changes on a bucket RegistrationRequest registration_request = 2; - // Stop watching for changes on a bucket + // Response to a blob event (change to a blob) BlobEventResponse blob_event_response = 3; } } +// ServerMessages are sent from the nitric server to the service message ServerMessage { // globally unique ID of the request/response pair string id = 1; @@ -52,7 +53,7 @@ message ServerMessage { oneof content { // Watch for changes on a bucket RegistrationResponse registration_response = 2; - // Stop watching for changes on a bucket + // Event for a blob in a bucket BlobEventRequest blob_event_request = 3; } } @@ -60,7 +61,6 @@ message ServerMessage { message BlobEventRequest { string bucket_name = 1; - // Now we don't need to specify a type enum, the specific contents/type comes in a single field of the context. oneof event { BlobEvent blob_event = 10; } diff --git a/nitric/proto/topics/v1/topics.proto b/nitric/proto/topics/v1/topics.proto index e03ee75..690a526 100644 --- a/nitric/proto/topics/v1/topics.proto +++ b/nitric/proto/topics/v1/topics.proto @@ -24,6 +24,7 @@ service Subscriber { rpc Subscribe (stream ClientMessage) returns (stream ServerMessage); } +// ClientMessage is the message sent from the service to the nitric server message ClientMessage { // globally unique ID of the request/response pair string id = 1; @@ -41,13 +42,14 @@ message MessageRequest { string topic_name = 1; // Message Type - Message message = 2; + TopicMessage message = 2; } message MessageResponse { bool success = 1; } +// ServerMessage is the message sent from the nitric server to the service message ServerMessage { // globally unique ID of the request/response pair string id = 1; @@ -67,7 +69,7 @@ message RegistrationRequest { message RegistrationResponse {} -message Message { +message TopicMessage { // The topic message contents oneof content { google.protobuf.Struct struct_payload = 1; @@ -80,7 +82,7 @@ message TopicPublishRequest { string topic_name = 1; // The message to be published - Message message = 2; + TopicMessage message = 2; // An optional delay specified in seconds (minimum 10 seconds) google.protobuf.Duration delay = 3; diff --git a/nitric/proto/websockets/v1/websockets.proto b/nitric/proto/websockets/v1/websockets.proto index 606a6c6..bf54715 100644 --- a/nitric/proto/websockets/v1/websockets.proto +++ b/nitric/proto/websockets/v1/websockets.proto @@ -11,14 +11,14 @@ option csharp_namespace = "Nitric.Proto.Websockets.v1"; service Websocket { // Send a messages to a websocket - rpc Send(WebsocketSendRequest) returns (WebsocketSendResponse); + rpc SendMessage(WebsocketSendRequest) returns (WebsocketSendResponse); // Close a websocket connection // This can be used to force a client to disconnect - rpc Close(WebsocketCloseRequest) returns (WebsocketCloseResponse); + rpc CloseConnection(WebsocketCloseConnectionRequest) returns (WebsocketCloseConnectionResponse); // Retrieve details about an API - rpc Details(WebsocketDetailsRequest) returns (WebsocketDetailsResponse); + rpc SocketDetails(WebsocketDetailsRequest) returns (WebsocketDetailsResponse); } message WebsocketDetailsRequest { @@ -45,19 +45,19 @@ message WebsocketSendRequest { message WebsocketSendResponse {} -message WebsocketCloseRequest { +message WebsocketCloseConnectionRequest { // The nitric name of the socket to send on string socket_name = 1; // The connection ID of the client to send to string connection_id = 2; } -message WebsocketCloseResponse {} +message WebsocketCloseConnectionResponse {} -// Messages the client is able to send to the server +// ClientMessages are sent from the service to the nitric server message ClientMessage { - // Client message ID, used to pair requests/responses + // Globally unique id to pair requests/responses string id = 1; oneof content { @@ -106,7 +106,7 @@ message WebsocketEventRequest { message QueryValue { repeated string value = 1; } -// Messages the server is able to send to the client +// ServerMessages are sent from the nitric server to the service message ServerMessage { // Server message ID, used to pair requests/responses string id = 1; diff --git a/src/Nitric.Sdk/Common/Struct.cs b/src/Nitric.Sdk/Common/Struct.cs index df6a48b..3c6779c 100644 --- a/src/Nitric.Sdk/Common/Struct.cs +++ b/src/Nitric.Sdk/Common/Struct.cs @@ -1,5 +1,7 @@ using System; using System.Collections.Generic; +using Google.Protobuf; +using Newtonsoft.Json; using KindOneofCase = Google.Protobuf.WellKnownTypes.Value.KindOneofCase; using ProtoStruct = Google.Protobuf.WellKnownTypes.Struct; using ProtoValue = Google.Protobuf.WellKnownTypes.Value; @@ -8,82 +10,28 @@ namespace Nitric.Sdk.Common { public class Struct { - public static Dictionary ToDictionary(ProtoStruct @struct) + public static T ToJsonSerializable(ProtoStruct @struct) { - var payload = new Dictionary(); - - foreach (var kv in @struct.Fields) + T jsonSerializable = default; + if (@struct != null) { - payload.Add(kv.Key, GetValue(kv.Value)); + JsonFormatter formatter = new JsonFormatter(JsonFormatter.Settings.Default); + jsonSerializable = JsonConvert.DeserializeObject(formatter.Format(@struct)); } - return payload; + return jsonSerializable; } - public static ProtoStruct FromDictionary(Dictionary dictionary) + public static ProtoStruct FromJsonSerializable(T jsonSerializable) { - ProtoStruct payload = new ProtoStruct(); - - foreach (KeyValuePair kv in dictionary) + ProtoStruct structPayload = null; + if (jsonSerializable != null) { - payload.Fields.Add(kv.Key, Struct.ToValue(kv.Value)); + var jsonPayload = JsonConvert.SerializeObject(jsonSerializable); + structPayload = JsonParser.Default.Parse(jsonPayload); } - return payload; - } - - private static ProtoValue ToValue(object val) - { - if (val is string str) - { - return ProtoValue.ForString(str); - } - else if (val is double num) - { - return ProtoValue.ForNumber(num); - } - else if (val is null) - { - return ProtoValue.ForNull(); - } - else if (val is Dictionary dictionary) - { - return ProtoValue.ForStruct(Struct.FromDictionary(dictionary)); - } - else if (val is List list) - { - return ProtoValue.ForList(list.ConvertAll(ToValue).ToArray()); - } - - return null; - } - - private static object GetValue(ProtoValue val) - { - switch (val.KindCase) - { - case KindOneofCase.StringValue: - return val.StringValue; - case KindOneofCase.NumberValue: - return val.NumberValue; - case KindOneofCase.BoolValue: - return val.BoolValue; - case KindOneofCase.NullValue: - return val.NullValue; - case KindOneofCase.ListValue: - var list = new List(); - - foreach (var listVal in val.ListValue.Values) - { - list.Add(Struct.GetValue(listVal)); - } - - return list; - case KindOneofCase.StructValue: - return Struct.ToDictionary(val.StructValue); - default: - return null; - } + return structPayload; } } } diff --git a/src/Nitric.Sdk/Nitric.Sdk.csproj b/src/Nitric.Sdk/Nitric.Sdk.csproj index bb7718d..d2a784d 100644 --- a/src/Nitric.Sdk/Nitric.Sdk.csproj +++ b/src/Nitric.Sdk/Nitric.Sdk.csproj @@ -1,7 +1,7 @@ netstandard2.1 - 0.0.12 + 0.0.13 Nitric.Sdk Nitric Pty Ltd LICENSE.txt @@ -22,17 +22,10 @@ - - - + + + - - - - - - - diff --git a/src/Nitric.Sdk/Proto/nitric/proto/apis/v1/Apis.cs b/src/Nitric.Sdk/Proto/nitric/proto/apis/v1/Apis.cs index fb39536..65a7543 100644 --- a/src/Nitric.Sdk/Proto/nitric/proto/apis/v1/Apis.cs +++ b/src/Nitric.Sdk/Proto/nitric/proto/apis/v1/Apis.cs @@ -60,14 +60,14 @@ static ApisReflection() { "clNjb3BlczoCOAEiegoTUmVnaXN0cmF0aW9uUmVxdWVzdBILCgNhcGkYASAB", "KAkSDAoEcGF0aBgCIAEoCRIPCgdtZXRob2RzGAMgAygJEjcKB29wdGlvbnMY", "BCABKAsyJi5uaXRyaWMucHJvdG8uYXBpcy52MS5BcGlXb3JrZXJPcHRpb25z", - "MroBCgNBcGkSVQoFU2VydmUSIy5uaXRyaWMucHJvdG8uYXBpcy52MS5DbGll", + "Mr0BCgNBcGkSVQoFU2VydmUSIy5uaXRyaWMucHJvdG8uYXBpcy52MS5DbGll", "bnRNZXNzYWdlGiMubml0cmljLnByb3RvLmFwaXMudjEuU2VydmVyTWVzc2Fn", - "ZSgBMAESXAoHRGV0YWlscxInLm5pdHJpYy5wcm90by5hcGlzLnYxLkFwaURl", - "dGFpbHNSZXF1ZXN0Gigubml0cmljLnByb3RvLmFwaXMudjEuQXBpRGV0YWls", - "c1Jlc3BvbnNlQosBChdpby5uaXRyaWMucHJvdG8uYXBpcy52MUIEQXBpc1AB", - "WjpnaXRodWIuY29tL25pdHJpY3RlY2gvbml0cmljL2NvcmUvcGtnL3Byb3Rv", - "L2FwaXMvdjE7YXBpc3BiqgIUTml0cmljLlByb3RvLkFwaXMudjHKAhROaXRy", - "aWNcUHJvdG9cQXBpc1xWMWIGcHJvdG8z")); + "ZSgBMAESXwoKQXBpRGV0YWlscxInLm5pdHJpYy5wcm90by5hcGlzLnYxLkFw", + "aURldGFpbHNSZXF1ZXN0Gigubml0cmljLnByb3RvLmFwaXMudjEuQXBpRGV0", + "YWlsc1Jlc3BvbnNlQosBChdpby5uaXRyaWMucHJvdG8uYXBpcy52MUIEQXBp", + "c1ABWjpnaXRodWIuY29tL25pdHJpY3RlY2gvbml0cmljL2NvcmUvcGtnL3By", + "b3RvL2FwaXMvdjE7YXBpc3BiqgIUTml0cmljLlByb3RvLkFwaXMudjHKAhRO", + "aXRyaWNcUHJvdG9cQXBpc1xWMWIGcHJvdG8z")); descriptor = pbr::FileDescriptor.FromGeneratedCode(descriptorData, new pbr::FileDescriptor[] { }, new pbr::GeneratedClrTypeInfo(null, null, new pbr::GeneratedClrTypeInfo[] { @@ -433,6 +433,9 @@ public void MergeFrom(pb::CodedInputStream input) { } + /// + /// ClientMessage sent by the service to the nitric server + /// public sealed partial class ClientMessage : pb::IMessage #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE , pb::IBufferMessage @@ -497,7 +500,7 @@ public string Id { /// Field number for the "registration_request" field. public const int RegistrationRequestFieldNumber = 2; /// - /// Register a subscription to a topic + /// Register an API route handler /// [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public global::Nitric.Proto.Apis.v1.RegistrationRequest RegistrationRequest { @@ -1449,7 +1452,7 @@ public HttpResponse Clone() { public const int StatusFieldNumber = 1; private int status_; /// - /// The HTTP status of the request + /// The HTTP response status code /// [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public int Status { @@ -1647,6 +1650,9 @@ public void MergeFrom(pb::CodedInputStream input) { } + /// + /// ServerMessage sent by the nitric server to the service + /// public sealed partial class ServerMessage : pb::IMessage #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE , pb::IBufferMessage @@ -1711,7 +1717,7 @@ public string Id { /// Field number for the "registration_response" field. public const int RegistrationResponseFieldNumber = 2; /// - /// Response to a topic subscription request + /// Response to an API serve request /// [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public global::Nitric.Proto.Apis.v1.RegistrationResponse RegistrationResponse { @@ -1725,7 +1731,7 @@ public string Id { /// Field number for the "http_request" field. public const int HttpRequestFieldNumber = 3; /// - /// Response to a topic message request + /// HTTP request to be routed to the service (handler) /// [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public global::Nitric.Proto.Apis.v1.HttpRequest HttpRequest { diff --git a/src/Nitric.Sdk/Proto/nitric/proto/apis/v1/ApisGrpc.cs b/src/Nitric.Sdk/Proto/nitric/proto/apis/v1/ApisGrpc.cs index fd82ae0..2e8595a 100644 --- a/src/Nitric.Sdk/Proto/nitric/proto/apis/v1/ApisGrpc.cs +++ b/src/Nitric.Sdk/Proto/nitric/proto/apis/v1/ApisGrpc.cs @@ -9,7 +9,7 @@ namespace Nitric.Proto.Apis.v1 { /// - /// Service for publishing asynchronous messages + /// Service for API routing and handlers /// public static partial class Api { @@ -57,10 +57,10 @@ static T __Helper_DeserializeMessage(grpc::DeserializationContext context, gl __Marshaller_nitric_proto_apis_v1_ClientMessage, __Marshaller_nitric_proto_apis_v1_ServerMessage); - static readonly grpc::Method __Method_Details = new grpc::Method( + static readonly grpc::Method __Method_ApiDetails = new grpc::Method( grpc::MethodType.Unary, __ServiceName, - "Details", + "ApiDetails", __Marshaller_nitric_proto_apis_v1_ApiDetailsRequest, __Marshaller_nitric_proto_apis_v1_ApiDetailsResponse); @@ -92,7 +92,7 @@ public abstract partial class ApiBase /// The request received from the client. /// The context of the server-side call handler being invoked. /// The response to send back to the client (wrapped by a task). - public virtual global::System.Threading.Tasks.Task Details(global::Nitric.Proto.Apis.v1.ApiDetailsRequest request, grpc::ServerCallContext context) + public virtual global::System.Threading.Tasks.Task ApiDetails(global::Nitric.Proto.Apis.v1.ApiDetailsRequest request, grpc::ServerCallContext context) { throw new grpc::RpcException(new grpc::Status(grpc::StatusCode.Unimplemented, "")); } @@ -150,9 +150,9 @@ protected ApiClient(ClientBaseConfiguration configuration) : base(configuration) /// An optional deadline for the call. The call will be cancelled if deadline is hit. /// An optional token for canceling the call. /// The response received from the server. - public virtual global::Nitric.Proto.Apis.v1.ApiDetailsResponse Details(global::Nitric.Proto.Apis.v1.ApiDetailsRequest request, grpc::Metadata headers = null, global::System.DateTime? deadline = null, global::System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken)) + public virtual global::Nitric.Proto.Apis.v1.ApiDetailsResponse ApiDetails(global::Nitric.Proto.Apis.v1.ApiDetailsRequest request, grpc::Metadata headers = null, global::System.DateTime? deadline = null, global::System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken)) { - return Details(request, new grpc::CallOptions(headers, deadline, cancellationToken)); + return ApiDetails(request, new grpc::CallOptions(headers, deadline, cancellationToken)); } /// /// Retrieve details about an API @@ -160,9 +160,9 @@ protected ApiClient(ClientBaseConfiguration configuration) : base(configuration) /// The request to send to the server. /// The options for the call. /// The response received from the server. - public virtual global::Nitric.Proto.Apis.v1.ApiDetailsResponse Details(global::Nitric.Proto.Apis.v1.ApiDetailsRequest request, grpc::CallOptions options) + public virtual global::Nitric.Proto.Apis.v1.ApiDetailsResponse ApiDetails(global::Nitric.Proto.Apis.v1.ApiDetailsRequest request, grpc::CallOptions options) { - return CallInvoker.BlockingUnaryCall(__Method_Details, null, options, request); + return CallInvoker.BlockingUnaryCall(__Method_ApiDetails, null, options, request); } /// /// Retrieve details about an API @@ -172,9 +172,9 @@ protected ApiClient(ClientBaseConfiguration configuration) : base(configuration) /// An optional deadline for the call. The call will be cancelled if deadline is hit. /// An optional token for canceling the call. /// The call object. - public virtual grpc::AsyncUnaryCall DetailsAsync(global::Nitric.Proto.Apis.v1.ApiDetailsRequest request, grpc::Metadata headers = null, global::System.DateTime? deadline = null, global::System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken)) + public virtual grpc::AsyncUnaryCall ApiDetailsAsync(global::Nitric.Proto.Apis.v1.ApiDetailsRequest request, grpc::Metadata headers = null, global::System.DateTime? deadline = null, global::System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken)) { - return DetailsAsync(request, new grpc::CallOptions(headers, deadline, cancellationToken)); + return ApiDetailsAsync(request, new grpc::CallOptions(headers, deadline, cancellationToken)); } /// /// Retrieve details about an API @@ -182,9 +182,9 @@ protected ApiClient(ClientBaseConfiguration configuration) : base(configuration) /// The request to send to the server. /// The options for the call. /// The call object. - public virtual grpc::AsyncUnaryCall DetailsAsync(global::Nitric.Proto.Apis.v1.ApiDetailsRequest request, grpc::CallOptions options) + public virtual grpc::AsyncUnaryCall ApiDetailsAsync(global::Nitric.Proto.Apis.v1.ApiDetailsRequest request, grpc::CallOptions options) { - return CallInvoker.AsyncUnaryCall(__Method_Details, null, options, request); + return CallInvoker.AsyncUnaryCall(__Method_ApiDetails, null, options, request); } /// Creates a new instance of client from given ClientBaseConfiguration. protected override ApiClient NewInstance(ClientBaseConfiguration configuration) @@ -199,7 +199,7 @@ protected override ApiClient NewInstance(ClientBaseConfiguration configuration) { return grpc::ServerServiceDefinition.CreateBuilder() .AddMethod(__Method_Serve, serviceImpl.Serve) - .AddMethod(__Method_Details, serviceImpl.Details).Build(); + .AddMethod(__Method_ApiDetails, serviceImpl.ApiDetails).Build(); } /// Register service method with a service binder with or without implementation. Useful when customizing the service binding logic. @@ -209,7 +209,7 @@ protected override ApiClient NewInstance(ClientBaseConfiguration configuration) public static void BindService(grpc::ServiceBinderBase serviceBinder, ApiBase serviceImpl) { serviceBinder.AddMethod(__Method_Serve, serviceImpl == null ? null : new grpc::DuplexStreamingServerMethod(serviceImpl.Serve)); - serviceBinder.AddMethod(__Method_Details, serviceImpl == null ? null : new grpc::UnaryServerMethod(serviceImpl.Details)); + serviceBinder.AddMethod(__Method_ApiDetails, serviceImpl == null ? null : new grpc::UnaryServerMethod(serviceImpl.ApiDetails)); } } diff --git a/src/Nitric.Sdk/Proto/nitric/proto/deployments/v1/Deployments.cs b/src/Nitric.Sdk/Proto/nitric/proto/deployments/v1/Deployments.cs index 83a4108..caaa8ca 100644 --- a/src/Nitric.Sdk/Proto/nitric/proto/deployments/v1/Deployments.cs +++ b/src/Nitric.Sdk/Proto/nitric/proto/deployments/v1/Deployments.cs @@ -2078,7 +2078,7 @@ public ImageSource Clone() { private string uri_ = ""; /// /// URI of the docker image - /// TODO: May also need to provide auth information (although this should just be configured on the running client already) + /// To support remote images this may also need to provide auth information /// [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public string Uri { @@ -2212,7 +2212,7 @@ public void MergeFrom(pb::CodedInputStream input) { } /// - /// A unit of service (i.e. function/container) + /// A unit of compute (i.e. function/container) /// public sealed partial class Service : pb::IMessage #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE @@ -4185,7 +4185,7 @@ public void MergeFrom(pb::CodedInputStream input) { } /// - /// A http resource + /// An http proxy resource /// public sealed partial class Http : pb::IMessage #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE @@ -6700,8 +6700,7 @@ public void MergeFrom(pb::CodedInputStream input) { } /// - /// This is already defined in the resource contracts... - /// Need to determine if it's worth re-using + /// This is already defined in the resource contracts, /// unfortunately there are parts we don't want to duplicate, such as API config /// public sealed partial class Policy : pb::IMessage @@ -6759,11 +6758,6 @@ public Policy Clone() { private static readonly pb::FieldCodec _repeated_actions_codec = pb::FieldCodec.ForEnum(18, x => (int) x, x => (global::Nitric.Proto.Resources.v1.Action) x); private readonly pbc::RepeatedField actions_ = new pbc::RepeatedField(); - /// - /// TODO: Split out discrete action definitions from resources - /// Also need to allow custom action types as well - /// Should incorporate action re-use here... - /// [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public pbc::RepeatedField Actions { get { return actions_; } diff --git a/src/Nitric.Sdk/Proto/nitric/proto/http/v1/Http.cs b/src/Nitric.Sdk/Proto/nitric/proto/http/v1/Http.cs index 6b3de25..7806b81 100644 --- a/src/Nitric.Sdk/Proto/nitric/proto/http/v1/Http.cs +++ b/src/Nitric.Sdk/Proto/nitric/proto/http/v1/Http.cs @@ -408,7 +408,7 @@ public HttpProxyRequest Clone() { public const int HostFieldNumber = 1; private string host_ = ""; /// - /// The local port the server can be accessed on + /// The address the server can be accessed on /// [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public string Host { diff --git a/src/Nitric.Sdk/Proto/nitric/proto/http/v1/HttpGrpc.cs b/src/Nitric.Sdk/Proto/nitric/proto/http/v1/HttpGrpc.cs index bd5f7c3..d8704fb 100644 --- a/src/Nitric.Sdk/Proto/nitric/proto/http/v1/HttpGrpc.cs +++ b/src/Nitric.Sdk/Proto/nitric/proto/http/v1/HttpGrpc.cs @@ -9,7 +9,7 @@ namespace Nitric.Proto.Http.v1 { /// - /// Service for publishing asynchronous messages + /// Service for proxying HTTP requests /// public static partial class Http { diff --git a/src/Nitric.Sdk/Proto/nitric/proto/keyvalue/v1/Keyvalue.cs b/src/Nitric.Sdk/Proto/nitric/proto/keyvalue/v1/Keyvalue.cs index 203d0f6..6dfb686 100644 --- a/src/Nitric.Sdk/Proto/nitric/proto/keyvalue/v1/Keyvalue.cs +++ b/src/Nitric.Sdk/Proto/nitric/proto/keyvalue/v1/Keyvalue.cs @@ -69,7 +69,7 @@ static KeyvalueReflection() { } #region Messages /// - /// Provides a Key Value Store type for storing documents + /// Provides a Key/Value Store /// public sealed partial class Store : pb::IMessage #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE diff --git a/src/Nitric.Sdk/Proto/nitric/proto/keyvalue/v1/KeyvalueGrpc.cs b/src/Nitric.Sdk/Proto/nitric/proto/keyvalue/v1/KeyvalueGrpc.cs index 496d26a..8f758b0 100644 --- a/src/Nitric.Sdk/Proto/nitric/proto/keyvalue/v1/KeyvalueGrpc.cs +++ b/src/Nitric.Sdk/Proto/nitric/proto/keyvalue/v1/KeyvalueGrpc.cs @@ -84,7 +84,7 @@ static T __Helper_DeserializeMessage(grpc::DeserializationContext context, gl public abstract partial class KeyValueBase { /// - /// Get an existing document + /// Get an existing value /// /// The request received from the client. /// The context of the server-side call handler being invoked. @@ -95,7 +95,7 @@ public abstract partial class KeyValueBase } /// - /// Create a new or overwrite an existing document + /// Create a new or overwrite an existing value /// /// The request received from the client. /// The context of the server-side call handler being invoked. @@ -106,7 +106,7 @@ public abstract partial class KeyValueBase } /// - /// Delete an existing document + /// Delete a key and its value /// /// The request received from the client. /// The context of the server-side call handler being invoked. @@ -142,7 +142,7 @@ protected KeyValueClient(ClientBaseConfiguration configuration) : base(configura } /// - /// Get an existing document + /// Get an existing value /// /// The request to send to the server. /// The initial metadata to send with the call. This parameter is optional. @@ -154,7 +154,7 @@ protected KeyValueClient(ClientBaseConfiguration configuration) : base(configura return Get(request, new grpc::CallOptions(headers, deadline, cancellationToken)); } /// - /// Get an existing document + /// Get an existing value /// /// The request to send to the server. /// The options for the call. @@ -164,7 +164,7 @@ protected KeyValueClient(ClientBaseConfiguration configuration) : base(configura return CallInvoker.BlockingUnaryCall(__Method_Get, null, options, request); } /// - /// Get an existing document + /// Get an existing value /// /// The request to send to the server. /// The initial metadata to send with the call. This parameter is optional. @@ -176,7 +176,7 @@ protected KeyValueClient(ClientBaseConfiguration configuration) : base(configura return GetAsync(request, new grpc::CallOptions(headers, deadline, cancellationToken)); } /// - /// Get an existing document + /// Get an existing value /// /// The request to send to the server. /// The options for the call. @@ -186,7 +186,7 @@ protected KeyValueClient(ClientBaseConfiguration configuration) : base(configura return CallInvoker.AsyncUnaryCall(__Method_Get, null, options, request); } /// - /// Create a new or overwrite an existing document + /// Create a new or overwrite an existing value /// /// The request to send to the server. /// The initial metadata to send with the call. This parameter is optional. @@ -198,7 +198,7 @@ protected KeyValueClient(ClientBaseConfiguration configuration) : base(configura return Set(request, new grpc::CallOptions(headers, deadline, cancellationToken)); } /// - /// Create a new or overwrite an existing document + /// Create a new or overwrite an existing value /// /// The request to send to the server. /// The options for the call. @@ -208,7 +208,7 @@ protected KeyValueClient(ClientBaseConfiguration configuration) : base(configura return CallInvoker.BlockingUnaryCall(__Method_Set, null, options, request); } /// - /// Create a new or overwrite an existing document + /// Create a new or overwrite an existing value /// /// The request to send to the server. /// The initial metadata to send with the call. This parameter is optional. @@ -220,7 +220,7 @@ protected KeyValueClient(ClientBaseConfiguration configuration) : base(configura return SetAsync(request, new grpc::CallOptions(headers, deadline, cancellationToken)); } /// - /// Create a new or overwrite an existing document + /// Create a new or overwrite an existing value /// /// The request to send to the server. /// The options for the call. @@ -230,7 +230,7 @@ protected KeyValueClient(ClientBaseConfiguration configuration) : base(configura return CallInvoker.AsyncUnaryCall(__Method_Set, null, options, request); } /// - /// Delete an existing document + /// Delete a key and its value /// /// The request to send to the server. /// The initial metadata to send with the call. This parameter is optional. @@ -242,7 +242,7 @@ protected KeyValueClient(ClientBaseConfiguration configuration) : base(configura return Delete(request, new grpc::CallOptions(headers, deadline, cancellationToken)); } /// - /// Delete an existing document + /// Delete a key and its value /// /// The request to send to the server. /// The options for the call. @@ -252,7 +252,7 @@ protected KeyValueClient(ClientBaseConfiguration configuration) : base(configura return CallInvoker.BlockingUnaryCall(__Method_Delete, null, options, request); } /// - /// Delete an existing document + /// Delete a key and its value /// /// The request to send to the server. /// The initial metadata to send with the call. This parameter is optional. @@ -264,7 +264,7 @@ protected KeyValueClient(ClientBaseConfiguration configuration) : base(configura return DeleteAsync(request, new grpc::CallOptions(headers, deadline, cancellationToken)); } /// - /// Delete an existing document + /// Delete a key and its value /// /// The request to send to the server. /// The options for the call. diff --git a/src/Nitric.Sdk/Proto/nitric/proto/queues/v1/Queues.cs b/src/Nitric.Sdk/Proto/nitric/proto/queues/v1/Queues.cs index 321042a..48a0e37 100644 --- a/src/Nitric.Sdk/Proto/nitric/proto/queues/v1/Queues.cs +++ b/src/Nitric.Sdk/Proto/nitric/proto/queues/v1/Queues.cs @@ -26,59 +26,60 @@ static QueuesReflection() { string.Concat( "CiNuaXRyaWMvcHJvdG8vcXVldWVzL3YxL3F1ZXVlcy5wcm90bxIWbml0cmlj", "LnByb3RvLnF1ZXVlcy52MRocZ29vZ2xlL3Byb3RvYnVmL3N0cnVjdC5wcm90", - "byJnChVRdWV1ZVNlbmRSZXF1ZXN0QmF0Y2gSEgoKcXVldWVfbmFtZRgBIAEo", - "CRI6CghyZXF1ZXN0cxgCIAMoCzIoLm5pdHJpYy5wcm90by5xdWV1ZXMudjEu", - "UXVldWVTZW5kUmVxdWVzdCJXChFRdWV1ZVNlbmRSZXNwb25zZRJCCg9mYWls", - "ZWRfcmVxdWVzdHMYASADKAsyKS5uaXRyaWMucHJvdG8ucXVldWVzLnYxLkZh", - "aWxlZFNlbmRSZXF1ZXN0IjgKE1F1ZXVlUmVjZWl2ZVJlcXVlc3QSEgoKcXVl", - "dWVfbmFtZRgBIAEoCRINCgVkZXB0aBgCIAEoBSJLChRRdWV1ZVJlY2VpdmVS", - "ZXNwb25zZRIzCgV0YXNrcxgBIAMoCzIkLm5pdHJpYy5wcm90by5xdWV1ZXMu", - "djEuUmVjZWl2ZWRUYXNrIjwKFFF1ZXVlQ29tcGxldGVSZXF1ZXN0EhIKCnF1", - "ZXVlX25hbWUYASABKAkSEAoIbGVhc2VfaWQYAiABKAkiFwoVUXVldWVDb21w", - "bGV0ZVJlc3BvbnNlIjwKEFF1ZXVlU2VuZFJlcXVlc3QSKAoHcGF5bG9hZBgB", - "IAEoCzIXLmdvb2dsZS5wcm90b2J1Zi5TdHJ1Y3QiSgoMUmVjZWl2ZWRUYXNr", - "EhAKCGxlYXNlX2lkGAEgASgJEigKB3BheWxvYWQYAiABKAsyFy5nb29nbGUu", - "cHJvdG9idWYuU3RydWN0Il8KEUZhaWxlZFNlbmRSZXF1ZXN0EjkKB3JlcXVl", - "c3QYASABKAsyKC5uaXRyaWMucHJvdG8ucXVldWVzLnYxLlF1ZXVlU2VuZFJl", - "cXVlc3QSDwoHbWVzc2FnZRgCIAEoCTK5AgoGUXVldWVzEmAKBFNlbmQSLS5u", - "aXRyaWMucHJvdG8ucXVldWVzLnYxLlF1ZXVlU2VuZFJlcXVlc3RCYXRjaBop", - "Lm5pdHJpYy5wcm90by5xdWV1ZXMudjEuUXVldWVTZW5kUmVzcG9uc2USZAoH", - "UmVjZWl2ZRIrLm5pdHJpYy5wcm90by5xdWV1ZXMudjEuUXVldWVSZWNlaXZl", - "UmVxdWVzdBosLm5pdHJpYy5wcm90by5xdWV1ZXMudjEuUXVldWVSZWNlaXZl", - "UmVzcG9uc2USZwoIQ29tcGxldGUSLC5uaXRyaWMucHJvdG8ucXVldWVzLnYx", - "LlF1ZXVlQ29tcGxldGVSZXF1ZXN0Gi0ubml0cmljLnByb3RvLnF1ZXVlcy52", - "MS5RdWV1ZUNvbXBsZXRlUmVzcG9uc2VCngEKGWlvLm5pdHJpYy5wcm90by5x", - "dWV1ZXMudjFCDVF1ZXVlc1NlcnZpY2VQAVo+Z2l0aHViLmNvbS9uaXRyaWN0", - "ZWNoL25pdHJpYy9jb3JlL3BrZy9wcm90by9xdWV1ZXMvdjE7cXVldWVzcGKq", - "AhZOaXRyaWMuUHJvdG8uUXVldWVzLnYxygIWTml0cmljXFByb3RvXFF1ZXVl", - "c1xWMWIGcHJvdG8z")); + "byJhChNRdWV1ZUVucXVldWVSZXF1ZXN0EhIKCnF1ZXVlX25hbWUYASABKAkS", + "NgoIbWVzc2FnZXMYAiADKAsyJC5uaXRyaWMucHJvdG8ucXVldWVzLnYxLlF1", + "ZXVlTWVzc2FnZSJdChRRdWV1ZUVucXVldWVSZXNwb25zZRJFCg9mYWlsZWRf", + "bWVzc2FnZXMYASADKAsyLC5uaXRyaWMucHJvdG8ucXVldWVzLnYxLkZhaWxl", + "ZEVucXVldWVNZXNzYWdlIjgKE1F1ZXVlRGVxdWV1ZVJlcXVlc3QSEgoKcXVl", + "dWVfbmFtZRgBIAEoCRINCgVkZXB0aBgCIAEoBSJRChRRdWV1ZURlcXVldWVS", + "ZXNwb25zZRI5CghtZXNzYWdlcxgBIAMoCzInLm5pdHJpYy5wcm90by5xdWV1", + "ZXMudjEuRGVxdWV1ZWRNZXNzYWdlIjwKFFF1ZXVlQ29tcGxldGVSZXF1ZXN0", + "EhIKCnF1ZXVlX25hbWUYASABKAkSEAoIbGVhc2VfaWQYAiABKAkiFwoVUXVl", + "dWVDb21wbGV0ZVJlc3BvbnNlIkwKDFF1ZXVlTWVzc2FnZRIxCg5zdHJ1Y3Rf", + "cGF5bG9hZBgBIAEoCzIXLmdvb2dsZS5wcm90b2J1Zi5TdHJ1Y3RIAEIJCgdj", + "b250ZW50IloKD0RlcXVldWVkTWVzc2FnZRIQCghsZWFzZV9pZBgBIAEoCRI1", + "CgdtZXNzYWdlGAIgASgLMiQubml0cmljLnByb3RvLnF1ZXVlcy52MS5RdWV1", + "ZU1lc3NhZ2UiXgoURmFpbGVkRW5xdWV1ZU1lc3NhZ2USNQoHbWVzc2FnZRgB", + "IAEoCzIkLm5pdHJpYy5wcm90by5xdWV1ZXMudjEuUXVldWVNZXNzYWdlEg8K", + "B2RldGFpbHMYAiABKAkyvQIKBlF1ZXVlcxJkCgdFbnF1ZXVlEisubml0cmlj", + "LnByb3RvLnF1ZXVlcy52MS5RdWV1ZUVucXVldWVSZXF1ZXN0Giwubml0cmlj", + "LnByb3RvLnF1ZXVlcy52MS5RdWV1ZUVucXVldWVSZXNwb25zZRJkCgdEZXF1", + "ZXVlEisubml0cmljLnByb3RvLnF1ZXVlcy52MS5RdWV1ZURlcXVldWVSZXF1", + "ZXN0Giwubml0cmljLnByb3RvLnF1ZXVlcy52MS5RdWV1ZURlcXVldWVSZXNw", + "b25zZRJnCghDb21wbGV0ZRIsLm5pdHJpYy5wcm90by5xdWV1ZXMudjEuUXVl", + "dWVDb21wbGV0ZVJlcXVlc3QaLS5uaXRyaWMucHJvdG8ucXVldWVzLnYxLlF1", + "ZXVlQ29tcGxldGVSZXNwb25zZUKeAQoZaW8ubml0cmljLnByb3RvLnF1ZXVl", + "cy52MUINUXVldWVzU2VydmljZVABWj5naXRodWIuY29tL25pdHJpY3RlY2gv", + "bml0cmljL2NvcmUvcGtnL3Byb3RvL3F1ZXVlcy92MTtxdWV1ZXNwYqoCFk5p", + "dHJpYy5Qcm90by5RdWV1ZXMudjHKAhZOaXRyaWNcUHJvdG9cUXVldWVzXFYx", + "YgZwcm90bzM=")); descriptor = pbr::FileDescriptor.FromGeneratedCode(descriptorData, new pbr::FileDescriptor[] { global::Google.Protobuf.WellKnownTypes.StructReflection.Descriptor, }, new pbr::GeneratedClrTypeInfo(null, null, new pbr::GeneratedClrTypeInfo[] { - new pbr::GeneratedClrTypeInfo(typeof(global::Nitric.Proto.Queues.v1.QueueSendRequestBatch), global::Nitric.Proto.Queues.v1.QueueSendRequestBatch.Parser, new[]{ "QueueName", "Requests" }, null, null, null, null), - new pbr::GeneratedClrTypeInfo(typeof(global::Nitric.Proto.Queues.v1.QueueSendResponse), global::Nitric.Proto.Queues.v1.QueueSendResponse.Parser, new[]{ "FailedRequests" }, null, null, null, null), - new pbr::GeneratedClrTypeInfo(typeof(global::Nitric.Proto.Queues.v1.QueueReceiveRequest), global::Nitric.Proto.Queues.v1.QueueReceiveRequest.Parser, new[]{ "QueueName", "Depth" }, null, null, null, null), - new pbr::GeneratedClrTypeInfo(typeof(global::Nitric.Proto.Queues.v1.QueueReceiveResponse), global::Nitric.Proto.Queues.v1.QueueReceiveResponse.Parser, new[]{ "Tasks" }, null, null, null, null), + new pbr::GeneratedClrTypeInfo(typeof(global::Nitric.Proto.Queues.v1.QueueEnqueueRequest), global::Nitric.Proto.Queues.v1.QueueEnqueueRequest.Parser, new[]{ "QueueName", "Messages" }, null, null, null, null), + new pbr::GeneratedClrTypeInfo(typeof(global::Nitric.Proto.Queues.v1.QueueEnqueueResponse), global::Nitric.Proto.Queues.v1.QueueEnqueueResponse.Parser, new[]{ "FailedMessages" }, null, null, null, null), + new pbr::GeneratedClrTypeInfo(typeof(global::Nitric.Proto.Queues.v1.QueueDequeueRequest), global::Nitric.Proto.Queues.v1.QueueDequeueRequest.Parser, new[]{ "QueueName", "Depth" }, null, null, null, null), + new pbr::GeneratedClrTypeInfo(typeof(global::Nitric.Proto.Queues.v1.QueueDequeueResponse), global::Nitric.Proto.Queues.v1.QueueDequeueResponse.Parser, new[]{ "Messages" }, null, null, null, null), new pbr::GeneratedClrTypeInfo(typeof(global::Nitric.Proto.Queues.v1.QueueCompleteRequest), global::Nitric.Proto.Queues.v1.QueueCompleteRequest.Parser, new[]{ "QueueName", "LeaseId" }, null, null, null, null), new pbr::GeneratedClrTypeInfo(typeof(global::Nitric.Proto.Queues.v1.QueueCompleteResponse), global::Nitric.Proto.Queues.v1.QueueCompleteResponse.Parser, null, null, null, null, null), - new pbr::GeneratedClrTypeInfo(typeof(global::Nitric.Proto.Queues.v1.QueueSendRequest), global::Nitric.Proto.Queues.v1.QueueSendRequest.Parser, new[]{ "Payload" }, null, null, null, null), - new pbr::GeneratedClrTypeInfo(typeof(global::Nitric.Proto.Queues.v1.ReceivedTask), global::Nitric.Proto.Queues.v1.ReceivedTask.Parser, new[]{ "LeaseId", "Payload" }, null, null, null, null), - new pbr::GeneratedClrTypeInfo(typeof(global::Nitric.Proto.Queues.v1.FailedSendRequest), global::Nitric.Proto.Queues.v1.FailedSendRequest.Parser, new[]{ "Request", "Message" }, null, null, null, null) + new pbr::GeneratedClrTypeInfo(typeof(global::Nitric.Proto.Queues.v1.QueueMessage), global::Nitric.Proto.Queues.v1.QueueMessage.Parser, new[]{ "StructPayload" }, new[]{ "Content" }, null, null, null), + new pbr::GeneratedClrTypeInfo(typeof(global::Nitric.Proto.Queues.v1.DequeuedMessage), global::Nitric.Proto.Queues.v1.DequeuedMessage.Parser, new[]{ "LeaseId", "Message" }, null, null, null, null), + new pbr::GeneratedClrTypeInfo(typeof(global::Nitric.Proto.Queues.v1.FailedEnqueueMessage), global::Nitric.Proto.Queues.v1.FailedEnqueueMessage.Parser, new[]{ "Message", "Details" }, null, null, null, null) })); } #endregion } #region Messages - public sealed partial class QueueSendRequestBatch : pb::IMessage + public sealed partial class QueueEnqueueRequest : pb::IMessage #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE , pb::IBufferMessage #endif { - private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new QueueSendRequestBatch()); + private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new QueueEnqueueRequest()); private pb::UnknownFieldSet _unknownFields; [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public static pb::MessageParser Parser { get { return _parser; } } + public static pb::MessageParser Parser { get { return _parser; } } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public static pbr::MessageDescriptor Descriptor { @@ -91,22 +92,22 @@ public sealed partial class QueueSendRequestBatch : pb::IMessageField number for the "queue_name" field. @@ -124,26 +125,26 @@ public string QueueName { } } - /// Field number for the "requests" field. - public const int RequestsFieldNumber = 2; - private static readonly pb::FieldCodec _repeated_requests_codec - = pb::FieldCodec.ForMessage(18, global::Nitric.Proto.Queues.v1.QueueSendRequest.Parser); - private readonly pbc::RepeatedField requests_ = new pbc::RepeatedField(); + /// Field number for the "messages" field. + public const int MessagesFieldNumber = 2; + private static readonly pb::FieldCodec _repeated_messages_codec + = pb::FieldCodec.ForMessage(18, global::Nitric.Proto.Queues.v1.QueueMessage.Parser); + private readonly pbc::RepeatedField messages_ = new pbc::RepeatedField(); /// - /// Array of tasks to push to the queue + /// Array of messages to push to the queue /// [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public pbc::RepeatedField Requests { - get { return requests_; } + public pbc::RepeatedField Messages { + get { return messages_; } } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public override bool Equals(object other) { - return Equals(other as QueueSendRequestBatch); + return Equals(other as QueueEnqueueRequest); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public bool Equals(QueueSendRequestBatch other) { + public bool Equals(QueueEnqueueRequest other) { if (ReferenceEquals(other, null)) { return false; } @@ -151,7 +152,7 @@ public bool Equals(QueueSendRequestBatch other) { return true; } if (QueueName != other.QueueName) return false; - if(!requests_.Equals(other.requests_)) return false; + if(!messages_.Equals(other.messages_)) return false; return Equals(_unknownFields, other._unknownFields); } @@ -159,7 +160,7 @@ public bool Equals(QueueSendRequestBatch other) { public override int GetHashCode() { int hash = 1; if (QueueName.Length != 0) hash ^= QueueName.GetHashCode(); - hash ^= requests_.GetHashCode(); + hash ^= messages_.GetHashCode(); if (_unknownFields != null) { hash ^= _unknownFields.GetHashCode(); } @@ -180,7 +181,7 @@ public void WriteTo(pb::CodedOutputStream output) { output.WriteRawTag(10); output.WriteString(QueueName); } - requests_.WriteTo(output, _repeated_requests_codec); + messages_.WriteTo(output, _repeated_messages_codec); if (_unknownFields != null) { _unknownFields.WriteTo(output); } @@ -194,7 +195,7 @@ public void WriteTo(pb::CodedOutputStream output) { output.WriteRawTag(10); output.WriteString(QueueName); } - requests_.WriteTo(ref output, _repeated_requests_codec); + messages_.WriteTo(ref output, _repeated_messages_codec); if (_unknownFields != null) { _unknownFields.WriteTo(ref output); } @@ -207,7 +208,7 @@ public int CalculateSize() { if (QueueName.Length != 0) { size += 1 + pb::CodedOutputStream.ComputeStringSize(QueueName); } - size += requests_.CalculateSize(_repeated_requests_codec); + size += messages_.CalculateSize(_repeated_messages_codec); if (_unknownFields != null) { size += _unknownFields.CalculateSize(); } @@ -215,14 +216,14 @@ public int CalculateSize() { } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void MergeFrom(QueueSendRequestBatch other) { + public void MergeFrom(QueueEnqueueRequest other) { if (other == null) { return; } if (other.QueueName.Length != 0) { QueueName = other.QueueName; } - requests_.Add(other.requests_); + messages_.Add(other.messages_); _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields); } @@ -242,7 +243,7 @@ public void MergeFrom(pb::CodedInputStream input) { break; } case 18: { - requests_.AddEntriesFrom(input, _repeated_requests_codec); + messages_.AddEntriesFrom(input, _repeated_messages_codec); break; } } @@ -264,7 +265,7 @@ public void MergeFrom(pb::CodedInputStream input) { break; } case 18: { - requests_.AddEntriesFrom(ref input, _repeated_requests_codec); + messages_.AddEntriesFrom(ref input, _repeated_messages_codec); break; } } @@ -275,17 +276,17 @@ public void MergeFrom(pb::CodedInputStream input) { } /// - /// Response for sending a collection of tasks + /// Response for sending messages to a queue /// - public sealed partial class QueueSendResponse : pb::IMessage + public sealed partial class QueueEnqueueResponse : pb::IMessage #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE , pb::IBufferMessage #endif { - private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new QueueSendResponse()); + private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new QueueEnqueueResponse()); private pb::UnknownFieldSet _unknownFields; [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public static pb::MessageParser Parser { get { return _parser; } } + public static pb::MessageParser Parser { get { return _parser; } } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public static pbr::MessageDescriptor Descriptor { @@ -298,57 +299,57 @@ public sealed partial class QueueSendResponse : pb::IMessage } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public QueueSendResponse() { + public QueueEnqueueResponse() { OnConstruction(); } partial void OnConstruction(); [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public QueueSendResponse(QueueSendResponse other) : this() { - failedRequests_ = other.failedRequests_.Clone(); + public QueueEnqueueResponse(QueueEnqueueResponse other) : this() { + failedMessages_ = other.failedMessages_.Clone(); _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public QueueSendResponse Clone() { - return new QueueSendResponse(this); + public QueueEnqueueResponse Clone() { + return new QueueEnqueueResponse(this); } - /// Field number for the "failed_requests" field. - public const int FailedRequestsFieldNumber = 1; - private static readonly pb::FieldCodec _repeated_failedRequests_codec - = pb::FieldCodec.ForMessage(10, global::Nitric.Proto.Queues.v1.FailedSendRequest.Parser); - private readonly pbc::RepeatedField failedRequests_ = new pbc::RepeatedField(); + /// Field number for the "failed_messages" field. + public const int FailedMessagesFieldNumber = 1; + private static readonly pb::FieldCodec _repeated_failedMessages_codec + = pb::FieldCodec.ForMessage(10, global::Nitric.Proto.Queues.v1.FailedEnqueueMessage.Parser); + private readonly pbc::RepeatedField failedMessages_ = new pbc::RepeatedField(); /// - /// A list of tasks that failed to be queued + /// A list of messages that failed to be queued /// [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public pbc::RepeatedField FailedRequests { - get { return failedRequests_; } + public pbc::RepeatedField FailedMessages { + get { return failedMessages_; } } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public override bool Equals(object other) { - return Equals(other as QueueSendResponse); + return Equals(other as QueueEnqueueResponse); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public bool Equals(QueueSendResponse other) { + public bool Equals(QueueEnqueueResponse other) { if (ReferenceEquals(other, null)) { return false; } if (ReferenceEquals(other, this)) { return true; } - if(!failedRequests_.Equals(other.failedRequests_)) return false; + if(!failedMessages_.Equals(other.failedMessages_)) return false; return Equals(_unknownFields, other._unknownFields); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public override int GetHashCode() { int hash = 1; - hash ^= failedRequests_.GetHashCode(); + hash ^= failedMessages_.GetHashCode(); if (_unknownFields != null) { hash ^= _unknownFields.GetHashCode(); } @@ -365,7 +366,7 @@ public void WriteTo(pb::CodedOutputStream output) { #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE output.WriteRawMessage(this); #else - failedRequests_.WriteTo(output, _repeated_failedRequests_codec); + failedMessages_.WriteTo(output, _repeated_failedMessages_codec); if (_unknownFields != null) { _unknownFields.WriteTo(output); } @@ -375,7 +376,7 @@ public void WriteTo(pb::CodedOutputStream output) { #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE [global::System.Diagnostics.DebuggerNonUserCodeAttribute] void pb::IBufferMessage.InternalWriteTo(ref pb::WriteContext output) { - failedRequests_.WriteTo(ref output, _repeated_failedRequests_codec); + failedMessages_.WriteTo(ref output, _repeated_failedMessages_codec); if (_unknownFields != null) { _unknownFields.WriteTo(ref output); } @@ -385,7 +386,7 @@ public void WriteTo(pb::CodedOutputStream output) { [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public int CalculateSize() { int size = 0; - size += failedRequests_.CalculateSize(_repeated_failedRequests_codec); + size += failedMessages_.CalculateSize(_repeated_failedMessages_codec); if (_unknownFields != null) { size += _unknownFields.CalculateSize(); } @@ -393,11 +394,11 @@ public int CalculateSize() { } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void MergeFrom(QueueSendResponse other) { + public void MergeFrom(QueueEnqueueResponse other) { if (other == null) { return; } - failedRequests_.Add(other.failedRequests_); + failedMessages_.Add(other.failedMessages_); _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields); } @@ -413,7 +414,7 @@ public void MergeFrom(pb::CodedInputStream input) { _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input); break; case 10: { - failedRequests_.AddEntriesFrom(input, _repeated_failedRequests_codec); + failedMessages_.AddEntriesFrom(input, _repeated_failedMessages_codec); break; } } @@ -431,7 +432,7 @@ public void MergeFrom(pb::CodedInputStream input) { _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, ref input); break; case 10: { - failedRequests_.AddEntriesFrom(ref input, _repeated_failedRequests_codec); + failedMessages_.AddEntriesFrom(ref input, _repeated_failedMessages_codec); break; } } @@ -441,15 +442,15 @@ public void MergeFrom(pb::CodedInputStream input) { } - public sealed partial class QueueReceiveRequest : pb::IMessage + public sealed partial class QueueDequeueRequest : pb::IMessage #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE , pb::IBufferMessage #endif { - private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new QueueReceiveRequest()); + private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new QueueDequeueRequest()); private pb::UnknownFieldSet _unknownFields; [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public static pb::MessageParser Parser { get { return _parser; } } + public static pb::MessageParser Parser { get { return _parser; } } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public static pbr::MessageDescriptor Descriptor { @@ -462,22 +463,22 @@ public sealed partial class QueueReceiveRequest : pb::IMessageField number for the "queue_name" field. @@ -499,7 +500,7 @@ public string QueueName { public const int DepthFieldNumber = 2; private int depth_; /// - /// The max number of items to pop off the queue, may be capped by provider specific limitations + /// The max number of messages to pop off the queue, may be capped by provider specific limitations /// [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public int Depth { @@ -511,11 +512,11 @@ public int Depth { [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public override bool Equals(object other) { - return Equals(other as QueueReceiveRequest); + return Equals(other as QueueDequeueRequest); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public bool Equals(QueueReceiveRequest other) { + public bool Equals(QueueDequeueRequest other) { if (ReferenceEquals(other, null)) { return false; } @@ -595,7 +596,7 @@ public int CalculateSize() { } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void MergeFrom(QueueReceiveRequest other) { + public void MergeFrom(QueueDequeueRequest other) { if (other == null) { return; } @@ -656,15 +657,15 @@ public void MergeFrom(pb::CodedInputStream input) { } - public sealed partial class QueueReceiveResponse : pb::IMessage + public sealed partial class QueueDequeueResponse : pb::IMessage #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE , pb::IBufferMessage #endif { - private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new QueueReceiveResponse()); + private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new QueueDequeueResponse()); private pb::UnknownFieldSet _unknownFields; [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public static pb::MessageParser Parser { get { return _parser; } } + public static pb::MessageParser Parser { get { return _parser; } } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public static pbr::MessageDescriptor Descriptor { @@ -677,57 +678,57 @@ public sealed partial class QueueReceiveResponse : pb::IMessageField number for the "tasks" field. - public const int TasksFieldNumber = 1; - private static readonly pb::FieldCodec _repeated_tasks_codec - = pb::FieldCodec.ForMessage(10, global::Nitric.Proto.Queues.v1.ReceivedTask.Parser); - private readonly pbc::RepeatedField tasks_ = new pbc::RepeatedField(); + /// Field number for the "messages" field. + public const int MessagesFieldNumber = 1; + private static readonly pb::FieldCodec _repeated_messages_codec + = pb::FieldCodec.ForMessage(10, global::Nitric.Proto.Queues.v1.DequeuedMessage.Parser); + private readonly pbc::RepeatedField messages_ = new pbc::RepeatedField(); /// - /// Array of tasks popped off the queue + /// Array of messages popped off the queue /// [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public pbc::RepeatedField Tasks { - get { return tasks_; } + public pbc::RepeatedField Messages { + get { return messages_; } } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public override bool Equals(object other) { - return Equals(other as QueueReceiveResponse); + return Equals(other as QueueDequeueResponse); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public bool Equals(QueueReceiveResponse other) { + public bool Equals(QueueDequeueResponse other) { if (ReferenceEquals(other, null)) { return false; } if (ReferenceEquals(other, this)) { return true; } - if(!tasks_.Equals(other.tasks_)) return false; + if(!messages_.Equals(other.messages_)) return false; return Equals(_unknownFields, other._unknownFields); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public override int GetHashCode() { int hash = 1; - hash ^= tasks_.GetHashCode(); + hash ^= messages_.GetHashCode(); if (_unknownFields != null) { hash ^= _unknownFields.GetHashCode(); } @@ -744,7 +745,7 @@ public void WriteTo(pb::CodedOutputStream output) { #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE output.WriteRawMessage(this); #else - tasks_.WriteTo(output, _repeated_tasks_codec); + messages_.WriteTo(output, _repeated_messages_codec); if (_unknownFields != null) { _unknownFields.WriteTo(output); } @@ -754,7 +755,7 @@ public void WriteTo(pb::CodedOutputStream output) { #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE [global::System.Diagnostics.DebuggerNonUserCodeAttribute] void pb::IBufferMessage.InternalWriteTo(ref pb::WriteContext output) { - tasks_.WriteTo(ref output, _repeated_tasks_codec); + messages_.WriteTo(ref output, _repeated_messages_codec); if (_unknownFields != null) { _unknownFields.WriteTo(ref output); } @@ -764,7 +765,7 @@ public void WriteTo(pb::CodedOutputStream output) { [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public int CalculateSize() { int size = 0; - size += tasks_.CalculateSize(_repeated_tasks_codec); + size += messages_.CalculateSize(_repeated_messages_codec); if (_unknownFields != null) { size += _unknownFields.CalculateSize(); } @@ -772,11 +773,11 @@ public int CalculateSize() { } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void MergeFrom(QueueReceiveResponse other) { + public void MergeFrom(QueueDequeueResponse other) { if (other == null) { return; } - tasks_.Add(other.tasks_); + messages_.Add(other.messages_); _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields); } @@ -792,7 +793,7 @@ public void MergeFrom(pb::CodedInputStream input) { _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input); break; case 10: { - tasks_.AddEntriesFrom(input, _repeated_tasks_codec); + messages_.AddEntriesFrom(input, _repeated_messages_codec); break; } } @@ -810,7 +811,7 @@ public void MergeFrom(pb::CodedInputStream input) { _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, ref input); break; case 10: { - tasks_.AddEntriesFrom(ref input, _repeated_tasks_codec); + messages_.AddEntriesFrom(ref input, _repeated_messages_codec); break; } } @@ -878,7 +879,7 @@ public string QueueName { public const int LeaseIdFieldNumber = 2; private string leaseId_ = ""; /// - /// Lease id of the task to be completed + /// Lease id of the message to be completed /// [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public string LeaseId { @@ -1172,17 +1173,17 @@ public void MergeFrom(pb::CodedInputStream input) { } /// - /// A task to be sent to a queue. + /// An message to be sent to a queue. /// - public sealed partial class QueueSendRequest : pb::IMessage + public sealed partial class QueueMessage : pb::IMessage #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE , pb::IBufferMessage #endif { - private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new QueueSendRequest()); + private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new QueueMessage()); private pb::UnknownFieldSet _unknownFields; [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public static pb::MessageParser Parser { get { return _parser; } } + public static pb::MessageParser Parser { get { return _parser; } } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public static pbr::MessageDescriptor Descriptor { @@ -1195,58 +1196,80 @@ public sealed partial class QueueSendRequest : pb::IMessage } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public QueueSendRequest() { + public QueueMessage() { OnConstruction(); } partial void OnConstruction(); [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public QueueSendRequest(QueueSendRequest other) : this() { - payload_ = other.payload_ != null ? other.payload_.Clone() : null; + public QueueMessage(QueueMessage other) : this() { + switch (other.ContentCase) { + case ContentOneofCase.StructPayload: + StructPayload = other.StructPayload.Clone(); + break; + } + _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public QueueSendRequest Clone() { - return new QueueSendRequest(this); + public QueueMessage Clone() { + return new QueueMessage(this); } - /// Field number for the "payload" field. - public const int PayloadFieldNumber = 1; - private global::Google.Protobuf.WellKnownTypes.Struct payload_; - /// - /// The payload of the task - /// + /// Field number for the "struct_payload" field. + public const int StructPayloadFieldNumber = 1; [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public global::Google.Protobuf.WellKnownTypes.Struct Payload { - get { return payload_; } + public global::Google.Protobuf.WellKnownTypes.Struct StructPayload { + get { return contentCase_ == ContentOneofCase.StructPayload ? (global::Google.Protobuf.WellKnownTypes.Struct) content_ : null; } set { - payload_ = value; + content_ = value; + contentCase_ = value == null ? ContentOneofCase.None : ContentOneofCase.StructPayload; } } + private object content_; + /// Enum of possible cases for the "content" oneof. + public enum ContentOneofCase { + None = 0, + StructPayload = 1, + } + private ContentOneofCase contentCase_ = ContentOneofCase.None; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public ContentOneofCase ContentCase { + get { return contentCase_; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public void ClearContent() { + contentCase_ = ContentOneofCase.None; + content_ = null; + } + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public override bool Equals(object other) { - return Equals(other as QueueSendRequest); + return Equals(other as QueueMessage); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public bool Equals(QueueSendRequest other) { + public bool Equals(QueueMessage other) { if (ReferenceEquals(other, null)) { return false; } if (ReferenceEquals(other, this)) { return true; } - if (!object.Equals(Payload, other.Payload)) return false; + if (!object.Equals(StructPayload, other.StructPayload)) return false; + if (ContentCase != other.ContentCase) return false; return Equals(_unknownFields, other._unknownFields); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public override int GetHashCode() { int hash = 1; - if (payload_ != null) hash ^= Payload.GetHashCode(); + if (contentCase_ == ContentOneofCase.StructPayload) hash ^= StructPayload.GetHashCode(); + hash ^= (int) contentCase_; if (_unknownFields != null) { hash ^= _unknownFields.GetHashCode(); } @@ -1263,9 +1286,9 @@ public void WriteTo(pb::CodedOutputStream output) { #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE output.WriteRawMessage(this); #else - if (payload_ != null) { + if (contentCase_ == ContentOneofCase.StructPayload) { output.WriteRawTag(10); - output.WriteMessage(Payload); + output.WriteMessage(StructPayload); } if (_unknownFields != null) { _unknownFields.WriteTo(output); @@ -1276,9 +1299,9 @@ public void WriteTo(pb::CodedOutputStream output) { #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE [global::System.Diagnostics.DebuggerNonUserCodeAttribute] void pb::IBufferMessage.InternalWriteTo(ref pb::WriteContext output) { - if (payload_ != null) { + if (contentCase_ == ContentOneofCase.StructPayload) { output.WriteRawTag(10); - output.WriteMessage(Payload); + output.WriteMessage(StructPayload); } if (_unknownFields != null) { _unknownFields.WriteTo(ref output); @@ -1289,8 +1312,8 @@ public void WriteTo(pb::CodedOutputStream output) { [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public int CalculateSize() { int size = 0; - if (payload_ != null) { - size += 1 + pb::CodedOutputStream.ComputeMessageSize(Payload); + if (contentCase_ == ContentOneofCase.StructPayload) { + size += 1 + pb::CodedOutputStream.ComputeMessageSize(StructPayload); } if (_unknownFields != null) { size += _unknownFields.CalculateSize(); @@ -1299,16 +1322,19 @@ public int CalculateSize() { } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void MergeFrom(QueueSendRequest other) { + public void MergeFrom(QueueMessage other) { if (other == null) { return; } - if (other.payload_ != null) { - if (payload_ == null) { - Payload = new global::Google.Protobuf.WellKnownTypes.Struct(); - } - Payload.MergeFrom(other.Payload); + switch (other.ContentCase) { + case ContentOneofCase.StructPayload: + if (StructPayload == null) { + StructPayload = new global::Google.Protobuf.WellKnownTypes.Struct(); + } + StructPayload.MergeFrom(other.StructPayload); + break; } + _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields); } @@ -1324,10 +1350,12 @@ public void MergeFrom(pb::CodedInputStream input) { _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input); break; case 10: { - if (payload_ == null) { - Payload = new global::Google.Protobuf.WellKnownTypes.Struct(); + global::Google.Protobuf.WellKnownTypes.Struct subBuilder = new global::Google.Protobuf.WellKnownTypes.Struct(); + if (contentCase_ == ContentOneofCase.StructPayload) { + subBuilder.MergeFrom(StructPayload); } - input.ReadMessage(Payload); + input.ReadMessage(subBuilder); + StructPayload = subBuilder; break; } } @@ -1345,10 +1373,12 @@ public void MergeFrom(pb::CodedInputStream input) { _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, ref input); break; case 10: { - if (payload_ == null) { - Payload = new global::Google.Protobuf.WellKnownTypes.Struct(); + global::Google.Protobuf.WellKnownTypes.Struct subBuilder = new global::Google.Protobuf.WellKnownTypes.Struct(); + if (contentCase_ == ContentOneofCase.StructPayload) { + subBuilder.MergeFrom(StructPayload); } - input.ReadMessage(Payload); + input.ReadMessage(subBuilder); + StructPayload = subBuilder; break; } } @@ -1358,15 +1388,15 @@ public void MergeFrom(pb::CodedInputStream input) { } - public sealed partial class ReceivedTask : pb::IMessage + public sealed partial class DequeuedMessage : pb::IMessage #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE , pb::IBufferMessage #endif { - private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new ReceivedTask()); + private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new DequeuedMessage()); private pb::UnknownFieldSet _unknownFields; [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public static pb::MessageParser Parser { get { return _parser; } } + public static pb::MessageParser Parser { get { return _parser; } } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public static pbr::MessageDescriptor Descriptor { @@ -1379,22 +1409,22 @@ public sealed partial class ReceivedTask : pb::IMessage } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public ReceivedTask() { + public DequeuedMessage() { OnConstruction(); } partial void OnConstruction(); [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public ReceivedTask(ReceivedTask other) : this() { + public DequeuedMessage(DequeuedMessage other) : this() { leaseId_ = other.leaseId_; - payload_ = other.payload_ != null ? other.payload_.Clone() : null; + message_ = other.message_ != null ? other.message_.Clone() : null; _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public ReceivedTask Clone() { - return new ReceivedTask(this); + public DequeuedMessage Clone() { + return new DequeuedMessage(this); } /// Field number for the "lease_id" field. @@ -1408,24 +1438,24 @@ public string LeaseId { } } - /// Field number for the "payload" field. - public const int PayloadFieldNumber = 2; - private global::Google.Protobuf.WellKnownTypes.Struct payload_; + /// Field number for the "message" field. + public const int MessageFieldNumber = 2; + private global::Nitric.Proto.Queues.v1.QueueMessage message_; [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public global::Google.Protobuf.WellKnownTypes.Struct Payload { - get { return payload_; } + public global::Nitric.Proto.Queues.v1.QueueMessage Message { + get { return message_; } set { - payload_ = value; + message_ = value; } } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public override bool Equals(object other) { - return Equals(other as ReceivedTask); + return Equals(other as DequeuedMessage); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public bool Equals(ReceivedTask other) { + public bool Equals(DequeuedMessage other) { if (ReferenceEquals(other, null)) { return false; } @@ -1433,7 +1463,7 @@ public bool Equals(ReceivedTask other) { return true; } if (LeaseId != other.LeaseId) return false; - if (!object.Equals(Payload, other.Payload)) return false; + if (!object.Equals(Message, other.Message)) return false; return Equals(_unknownFields, other._unknownFields); } @@ -1441,7 +1471,7 @@ public bool Equals(ReceivedTask other) { public override int GetHashCode() { int hash = 1; if (LeaseId.Length != 0) hash ^= LeaseId.GetHashCode(); - if (payload_ != null) hash ^= Payload.GetHashCode(); + if (message_ != null) hash ^= Message.GetHashCode(); if (_unknownFields != null) { hash ^= _unknownFields.GetHashCode(); } @@ -1462,9 +1492,9 @@ public void WriteTo(pb::CodedOutputStream output) { output.WriteRawTag(10); output.WriteString(LeaseId); } - if (payload_ != null) { + if (message_ != null) { output.WriteRawTag(18); - output.WriteMessage(Payload); + output.WriteMessage(Message); } if (_unknownFields != null) { _unknownFields.WriteTo(output); @@ -1479,9 +1509,9 @@ public void WriteTo(pb::CodedOutputStream output) { output.WriteRawTag(10); output.WriteString(LeaseId); } - if (payload_ != null) { + if (message_ != null) { output.WriteRawTag(18); - output.WriteMessage(Payload); + output.WriteMessage(Message); } if (_unknownFields != null) { _unknownFields.WriteTo(ref output); @@ -1495,8 +1525,8 @@ public int CalculateSize() { if (LeaseId.Length != 0) { size += 1 + pb::CodedOutputStream.ComputeStringSize(LeaseId); } - if (payload_ != null) { - size += 1 + pb::CodedOutputStream.ComputeMessageSize(Payload); + if (message_ != null) { + size += 1 + pb::CodedOutputStream.ComputeMessageSize(Message); } if (_unknownFields != null) { size += _unknownFields.CalculateSize(); @@ -1505,18 +1535,18 @@ public int CalculateSize() { } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void MergeFrom(ReceivedTask other) { + public void MergeFrom(DequeuedMessage other) { if (other == null) { return; } if (other.LeaseId.Length != 0) { LeaseId = other.LeaseId; } - if (other.payload_ != null) { - if (payload_ == null) { - Payload = new global::Google.Protobuf.WellKnownTypes.Struct(); + if (other.message_ != null) { + if (message_ == null) { + Message = new global::Nitric.Proto.Queues.v1.QueueMessage(); } - Payload.MergeFrom(other.Payload); + Message.MergeFrom(other.Message); } _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields); } @@ -1537,10 +1567,10 @@ public void MergeFrom(pb::CodedInputStream input) { break; } case 18: { - if (payload_ == null) { - Payload = new global::Google.Protobuf.WellKnownTypes.Struct(); + if (message_ == null) { + Message = new global::Nitric.Proto.Queues.v1.QueueMessage(); } - input.ReadMessage(Payload); + input.ReadMessage(Message); break; } } @@ -1562,10 +1592,10 @@ public void MergeFrom(pb::CodedInputStream input) { break; } case 18: { - if (payload_ == null) { - Payload = new global::Google.Protobuf.WellKnownTypes.Struct(); + if (message_ == null) { + Message = new global::Nitric.Proto.Queues.v1.QueueMessage(); } - input.ReadMessage(Payload); + input.ReadMessage(Message); break; } } @@ -1575,15 +1605,15 @@ public void MergeFrom(pb::CodedInputStream input) { } - public sealed partial class FailedSendRequest : pb::IMessage + public sealed partial class FailedEnqueueMessage : pb::IMessage #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE , pb::IBufferMessage #endif { - private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new FailedSendRequest()); + private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new FailedEnqueueMessage()); private pb::UnknownFieldSet _unknownFields; [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public static pb::MessageParser Parser { get { return _parser; } } + public static pb::MessageParser Parser { get { return _parser; } } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public static pbr::MessageDescriptor Descriptor { @@ -1596,75 +1626,75 @@ public sealed partial class FailedSendRequest : pb::IMessage } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public FailedSendRequest() { + public FailedEnqueueMessage() { OnConstruction(); } partial void OnConstruction(); [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public FailedSendRequest(FailedSendRequest other) : this() { - request_ = other.request_ != null ? other.request_.Clone() : null; - message_ = other.message_; + public FailedEnqueueMessage(FailedEnqueueMessage other) : this() { + message_ = other.message_ != null ? other.message_.Clone() : null; + details_ = other.details_; _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public FailedSendRequest Clone() { - return new FailedSendRequest(this); + public FailedEnqueueMessage Clone() { + return new FailedEnqueueMessage(this); } - /// Field number for the "request" field. - public const int RequestFieldNumber = 1; - private global::Nitric.Proto.Queues.v1.QueueSendRequest request_; + /// Field number for the "message" field. + public const int MessageFieldNumber = 1; + private global::Nitric.Proto.Queues.v1.QueueMessage message_; /// - /// The task that failed to be pushed + /// The message that failed to be pushed /// [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public global::Nitric.Proto.Queues.v1.QueueSendRequest Request { - get { return request_; } + public global::Nitric.Proto.Queues.v1.QueueMessage Message { + get { return message_; } set { - request_ = value; + message_ = value; } } - /// Field number for the "message" field. - public const int MessageFieldNumber = 2; - private string message_ = ""; + /// Field number for the "details" field. + public const int DetailsFieldNumber = 2; + private string details_ = ""; /// - /// A message describing the failure + /// A description of the failure /// [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public string Message { - get { return message_; } + public string Details { + get { return details_; } set { - message_ = pb::ProtoPreconditions.CheckNotNull(value, "value"); + details_ = pb::ProtoPreconditions.CheckNotNull(value, "value"); } } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public override bool Equals(object other) { - return Equals(other as FailedSendRequest); + return Equals(other as FailedEnqueueMessage); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public bool Equals(FailedSendRequest other) { + public bool Equals(FailedEnqueueMessage other) { if (ReferenceEquals(other, null)) { return false; } if (ReferenceEquals(other, this)) { return true; } - if (!object.Equals(Request, other.Request)) return false; - if (Message != other.Message) return false; + if (!object.Equals(Message, other.Message)) return false; + if (Details != other.Details) return false; return Equals(_unknownFields, other._unknownFields); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public override int GetHashCode() { int hash = 1; - if (request_ != null) hash ^= Request.GetHashCode(); - if (Message.Length != 0) hash ^= Message.GetHashCode(); + if (message_ != null) hash ^= Message.GetHashCode(); + if (Details.Length != 0) hash ^= Details.GetHashCode(); if (_unknownFields != null) { hash ^= _unknownFields.GetHashCode(); } @@ -1681,13 +1711,13 @@ public void WriteTo(pb::CodedOutputStream output) { #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE output.WriteRawMessage(this); #else - if (request_ != null) { + if (message_ != null) { output.WriteRawTag(10); - output.WriteMessage(Request); + output.WriteMessage(Message); } - if (Message.Length != 0) { + if (Details.Length != 0) { output.WriteRawTag(18); - output.WriteString(Message); + output.WriteString(Details); } if (_unknownFields != null) { _unknownFields.WriteTo(output); @@ -1698,13 +1728,13 @@ public void WriteTo(pb::CodedOutputStream output) { #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE [global::System.Diagnostics.DebuggerNonUserCodeAttribute] void pb::IBufferMessage.InternalWriteTo(ref pb::WriteContext output) { - if (request_ != null) { + if (message_ != null) { output.WriteRawTag(10); - output.WriteMessage(Request); + output.WriteMessage(Message); } - if (Message.Length != 0) { + if (Details.Length != 0) { output.WriteRawTag(18); - output.WriteString(Message); + output.WriteString(Details); } if (_unknownFields != null) { _unknownFields.WriteTo(ref output); @@ -1715,11 +1745,11 @@ public void WriteTo(pb::CodedOutputStream output) { [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public int CalculateSize() { int size = 0; - if (request_ != null) { - size += 1 + pb::CodedOutputStream.ComputeMessageSize(Request); + if (message_ != null) { + size += 1 + pb::CodedOutputStream.ComputeMessageSize(Message); } - if (Message.Length != 0) { - size += 1 + pb::CodedOutputStream.ComputeStringSize(Message); + if (Details.Length != 0) { + size += 1 + pb::CodedOutputStream.ComputeStringSize(Details); } if (_unknownFields != null) { size += _unknownFields.CalculateSize(); @@ -1728,18 +1758,18 @@ public int CalculateSize() { } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void MergeFrom(FailedSendRequest other) { + public void MergeFrom(FailedEnqueueMessage other) { if (other == null) { return; } - if (other.request_ != null) { - if (request_ == null) { - Request = new global::Nitric.Proto.Queues.v1.QueueSendRequest(); + if (other.message_ != null) { + if (message_ == null) { + Message = new global::Nitric.Proto.Queues.v1.QueueMessage(); } - Request.MergeFrom(other.Request); + Message.MergeFrom(other.Message); } - if (other.Message.Length != 0) { - Message = other.Message; + if (other.Details.Length != 0) { + Details = other.Details; } _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields); } @@ -1756,14 +1786,14 @@ public void MergeFrom(pb::CodedInputStream input) { _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input); break; case 10: { - if (request_ == null) { - Request = new global::Nitric.Proto.Queues.v1.QueueSendRequest(); + if (message_ == null) { + Message = new global::Nitric.Proto.Queues.v1.QueueMessage(); } - input.ReadMessage(Request); + input.ReadMessage(Message); break; } case 18: { - Message = input.ReadString(); + Details = input.ReadString(); break; } } @@ -1781,14 +1811,14 @@ public void MergeFrom(pb::CodedInputStream input) { _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, ref input); break; case 10: { - if (request_ == null) { - Request = new global::Nitric.Proto.Queues.v1.QueueSendRequest(); + if (message_ == null) { + Message = new global::Nitric.Proto.Queues.v1.QueueMessage(); } - input.ReadMessage(Request); + input.ReadMessage(Message); break; } case 18: { - Message = input.ReadString(); + Details = input.ReadString(); break; } } diff --git a/src/Nitric.Sdk/Proto/nitric/proto/queues/v1/QueuesGrpc.cs b/src/Nitric.Sdk/Proto/nitric/proto/queues/v1/QueuesGrpc.cs index a38fe43..3279787 100644 --- a/src/Nitric.Sdk/Proto/nitric/proto/queues/v1/QueuesGrpc.cs +++ b/src/Nitric.Sdk/Proto/nitric/proto/queues/v1/QueuesGrpc.cs @@ -45,26 +45,26 @@ static T __Helper_DeserializeMessage(grpc::DeserializationContext context, gl return parser.ParseFrom(context.PayloadAsNewBuffer()); } - static readonly grpc::Marshaller __Marshaller_nitric_proto_queues_v1_QueueSendRequestBatch = grpc::Marshallers.Create(__Helper_SerializeMessage, context => __Helper_DeserializeMessage(context, global::Nitric.Proto.Queues.v1.QueueSendRequestBatch.Parser)); - static readonly grpc::Marshaller __Marshaller_nitric_proto_queues_v1_QueueSendResponse = grpc::Marshallers.Create(__Helper_SerializeMessage, context => __Helper_DeserializeMessage(context, global::Nitric.Proto.Queues.v1.QueueSendResponse.Parser)); - static readonly grpc::Marshaller __Marshaller_nitric_proto_queues_v1_QueueReceiveRequest = grpc::Marshallers.Create(__Helper_SerializeMessage, context => __Helper_DeserializeMessage(context, global::Nitric.Proto.Queues.v1.QueueReceiveRequest.Parser)); - static readonly grpc::Marshaller __Marshaller_nitric_proto_queues_v1_QueueReceiveResponse = grpc::Marshallers.Create(__Helper_SerializeMessage, context => __Helper_DeserializeMessage(context, global::Nitric.Proto.Queues.v1.QueueReceiveResponse.Parser)); + static readonly grpc::Marshaller __Marshaller_nitric_proto_queues_v1_QueueEnqueueRequest = grpc::Marshallers.Create(__Helper_SerializeMessage, context => __Helper_DeserializeMessage(context, global::Nitric.Proto.Queues.v1.QueueEnqueueRequest.Parser)); + static readonly grpc::Marshaller __Marshaller_nitric_proto_queues_v1_QueueEnqueueResponse = grpc::Marshallers.Create(__Helper_SerializeMessage, context => __Helper_DeserializeMessage(context, global::Nitric.Proto.Queues.v1.QueueEnqueueResponse.Parser)); + static readonly grpc::Marshaller __Marshaller_nitric_proto_queues_v1_QueueDequeueRequest = grpc::Marshallers.Create(__Helper_SerializeMessage, context => __Helper_DeserializeMessage(context, global::Nitric.Proto.Queues.v1.QueueDequeueRequest.Parser)); + static readonly grpc::Marshaller __Marshaller_nitric_proto_queues_v1_QueueDequeueResponse = grpc::Marshallers.Create(__Helper_SerializeMessage, context => __Helper_DeserializeMessage(context, global::Nitric.Proto.Queues.v1.QueueDequeueResponse.Parser)); static readonly grpc::Marshaller __Marshaller_nitric_proto_queues_v1_QueueCompleteRequest = grpc::Marshallers.Create(__Helper_SerializeMessage, context => __Helper_DeserializeMessage(context, global::Nitric.Proto.Queues.v1.QueueCompleteRequest.Parser)); static readonly grpc::Marshaller __Marshaller_nitric_proto_queues_v1_QueueCompleteResponse = grpc::Marshallers.Create(__Helper_SerializeMessage, context => __Helper_DeserializeMessage(context, global::Nitric.Proto.Queues.v1.QueueCompleteResponse.Parser)); - static readonly grpc::Method __Method_Send = new grpc::Method( + static readonly grpc::Method __Method_Enqueue = new grpc::Method( grpc::MethodType.Unary, __ServiceName, - "Send", - __Marshaller_nitric_proto_queues_v1_QueueSendRequestBatch, - __Marshaller_nitric_proto_queues_v1_QueueSendResponse); + "Enqueue", + __Marshaller_nitric_proto_queues_v1_QueueEnqueueRequest, + __Marshaller_nitric_proto_queues_v1_QueueEnqueueResponse); - static readonly grpc::Method __Method_Receive = new grpc::Method( + static readonly grpc::Method __Method_Dequeue = new grpc::Method( grpc::MethodType.Unary, __ServiceName, - "Receive", - __Marshaller_nitric_proto_queues_v1_QueueReceiveRequest, - __Marshaller_nitric_proto_queues_v1_QueueReceiveResponse); + "Dequeue", + __Marshaller_nitric_proto_queues_v1_QueueDequeueRequest, + __Marshaller_nitric_proto_queues_v1_QueueDequeueResponse); static readonly grpc::Method __Method_Complete = new grpc::Method( grpc::MethodType.Unary, @@ -84,12 +84,12 @@ static T __Helper_DeserializeMessage(grpc::DeserializationContext context, gl public abstract partial class QueuesBase { /// - /// Send messages to a queue + /// Send message(s) to a queue /// /// The request received from the client. /// The context of the server-side call handler being invoked. /// The response to send back to the client (wrapped by a task). - public virtual global::System.Threading.Tasks.Task Send(global::Nitric.Proto.Queues.v1.QueueSendRequestBatch request, grpc::ServerCallContext context) + public virtual global::System.Threading.Tasks.Task Enqueue(global::Nitric.Proto.Queues.v1.QueueEnqueueRequest request, grpc::ServerCallContext context) { throw new grpc::RpcException(new grpc::Status(grpc::StatusCode.Unimplemented, "")); } @@ -100,13 +100,13 @@ public abstract partial class QueuesBase /// The request received from the client. /// The context of the server-side call handler being invoked. /// The response to send back to the client (wrapped by a task). - public virtual global::System.Threading.Tasks.Task Receive(global::Nitric.Proto.Queues.v1.QueueReceiveRequest request, grpc::ServerCallContext context) + public virtual global::System.Threading.Tasks.Task Dequeue(global::Nitric.Proto.Queues.v1.QueueDequeueRequest request, grpc::ServerCallContext context) { throw new grpc::RpcException(new grpc::Status(grpc::StatusCode.Unimplemented, "")); } /// - /// Complete an item previously popped from a queue + /// Complete an message previously popped from a queue /// /// The request received from the client. /// The context of the server-side call handler being invoked. @@ -142,48 +142,48 @@ protected QueuesClient(ClientBaseConfiguration configuration) : base(configurati } /// - /// Send messages to a queue + /// Send message(s) to a queue /// /// The request to send to the server. /// The initial metadata to send with the call. This parameter is optional. /// An optional deadline for the call. The call will be cancelled if deadline is hit. /// An optional token for canceling the call. /// The response received from the server. - public virtual global::Nitric.Proto.Queues.v1.QueueSendResponse Send(global::Nitric.Proto.Queues.v1.QueueSendRequestBatch request, grpc::Metadata headers = null, global::System.DateTime? deadline = null, global::System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken)) + public virtual global::Nitric.Proto.Queues.v1.QueueEnqueueResponse Enqueue(global::Nitric.Proto.Queues.v1.QueueEnqueueRequest request, grpc::Metadata headers = null, global::System.DateTime? deadline = null, global::System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken)) { - return Send(request, new grpc::CallOptions(headers, deadline, cancellationToken)); + return Enqueue(request, new grpc::CallOptions(headers, deadline, cancellationToken)); } /// - /// Send messages to a queue + /// Send message(s) to a queue /// /// The request to send to the server. /// The options for the call. /// The response received from the server. - public virtual global::Nitric.Proto.Queues.v1.QueueSendResponse Send(global::Nitric.Proto.Queues.v1.QueueSendRequestBatch request, grpc::CallOptions options) + public virtual global::Nitric.Proto.Queues.v1.QueueEnqueueResponse Enqueue(global::Nitric.Proto.Queues.v1.QueueEnqueueRequest request, grpc::CallOptions options) { - return CallInvoker.BlockingUnaryCall(__Method_Send, null, options, request); + return CallInvoker.BlockingUnaryCall(__Method_Enqueue, null, options, request); } /// - /// Send messages to a queue + /// Send message(s) to a queue /// /// The request to send to the server. /// The initial metadata to send with the call. This parameter is optional. /// An optional deadline for the call. The call will be cancelled if deadline is hit. /// An optional token for canceling the call. /// The call object. - public virtual grpc::AsyncUnaryCall SendAsync(global::Nitric.Proto.Queues.v1.QueueSendRequestBatch request, grpc::Metadata headers = null, global::System.DateTime? deadline = null, global::System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken)) + public virtual grpc::AsyncUnaryCall EnqueueAsync(global::Nitric.Proto.Queues.v1.QueueEnqueueRequest request, grpc::Metadata headers = null, global::System.DateTime? deadline = null, global::System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken)) { - return SendAsync(request, new grpc::CallOptions(headers, deadline, cancellationToken)); + return EnqueueAsync(request, new grpc::CallOptions(headers, deadline, cancellationToken)); } /// - /// Send messages to a queue + /// Send message(s) to a queue /// /// The request to send to the server. /// The options for the call. /// The call object. - public virtual grpc::AsyncUnaryCall SendAsync(global::Nitric.Proto.Queues.v1.QueueSendRequestBatch request, grpc::CallOptions options) + public virtual grpc::AsyncUnaryCall EnqueueAsync(global::Nitric.Proto.Queues.v1.QueueEnqueueRequest request, grpc::CallOptions options) { - return CallInvoker.AsyncUnaryCall(__Method_Send, null, options, request); + return CallInvoker.AsyncUnaryCall(__Method_Enqueue, null, options, request); } /// /// Receive message(s) from a queue @@ -193,9 +193,9 @@ protected QueuesClient(ClientBaseConfiguration configuration) : base(configurati /// An optional deadline for the call. The call will be cancelled if deadline is hit. /// An optional token for canceling the call. /// The response received from the server. - public virtual global::Nitric.Proto.Queues.v1.QueueReceiveResponse Receive(global::Nitric.Proto.Queues.v1.QueueReceiveRequest request, grpc::Metadata headers = null, global::System.DateTime? deadline = null, global::System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken)) + public virtual global::Nitric.Proto.Queues.v1.QueueDequeueResponse Dequeue(global::Nitric.Proto.Queues.v1.QueueDequeueRequest request, grpc::Metadata headers = null, global::System.DateTime? deadline = null, global::System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken)) { - return Receive(request, new grpc::CallOptions(headers, deadline, cancellationToken)); + return Dequeue(request, new grpc::CallOptions(headers, deadline, cancellationToken)); } /// /// Receive message(s) from a queue @@ -203,9 +203,9 @@ protected QueuesClient(ClientBaseConfiguration configuration) : base(configurati /// The request to send to the server. /// The options for the call. /// The response received from the server. - public virtual global::Nitric.Proto.Queues.v1.QueueReceiveResponse Receive(global::Nitric.Proto.Queues.v1.QueueReceiveRequest request, grpc::CallOptions options) + public virtual global::Nitric.Proto.Queues.v1.QueueDequeueResponse Dequeue(global::Nitric.Proto.Queues.v1.QueueDequeueRequest request, grpc::CallOptions options) { - return CallInvoker.BlockingUnaryCall(__Method_Receive, null, options, request); + return CallInvoker.BlockingUnaryCall(__Method_Dequeue, null, options, request); } /// /// Receive message(s) from a queue @@ -215,9 +215,9 @@ protected QueuesClient(ClientBaseConfiguration configuration) : base(configurati /// An optional deadline for the call. The call will be cancelled if deadline is hit. /// An optional token for canceling the call. /// The call object. - public virtual grpc::AsyncUnaryCall ReceiveAsync(global::Nitric.Proto.Queues.v1.QueueReceiveRequest request, grpc::Metadata headers = null, global::System.DateTime? deadline = null, global::System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken)) + public virtual grpc::AsyncUnaryCall DequeueAsync(global::Nitric.Proto.Queues.v1.QueueDequeueRequest request, grpc::Metadata headers = null, global::System.DateTime? deadline = null, global::System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken)) { - return ReceiveAsync(request, new grpc::CallOptions(headers, deadline, cancellationToken)); + return DequeueAsync(request, new grpc::CallOptions(headers, deadline, cancellationToken)); } /// /// Receive message(s) from a queue @@ -225,12 +225,12 @@ protected QueuesClient(ClientBaseConfiguration configuration) : base(configurati /// The request to send to the server. /// The options for the call. /// The call object. - public virtual grpc::AsyncUnaryCall ReceiveAsync(global::Nitric.Proto.Queues.v1.QueueReceiveRequest request, grpc::CallOptions options) + public virtual grpc::AsyncUnaryCall DequeueAsync(global::Nitric.Proto.Queues.v1.QueueDequeueRequest request, grpc::CallOptions options) { - return CallInvoker.AsyncUnaryCall(__Method_Receive, null, options, request); + return CallInvoker.AsyncUnaryCall(__Method_Dequeue, null, options, request); } /// - /// Complete an item previously popped from a queue + /// Complete an message previously popped from a queue /// /// The request to send to the server. /// The initial metadata to send with the call. This parameter is optional. @@ -242,7 +242,7 @@ protected QueuesClient(ClientBaseConfiguration configuration) : base(configurati return Complete(request, new grpc::CallOptions(headers, deadline, cancellationToken)); } /// - /// Complete an item previously popped from a queue + /// Complete an message previously popped from a queue /// /// The request to send to the server. /// The options for the call. @@ -252,7 +252,7 @@ protected QueuesClient(ClientBaseConfiguration configuration) : base(configurati return CallInvoker.BlockingUnaryCall(__Method_Complete, null, options, request); } /// - /// Complete an item previously popped from a queue + /// Complete an message previously popped from a queue /// /// The request to send to the server. /// The initial metadata to send with the call. This parameter is optional. @@ -264,7 +264,7 @@ protected QueuesClient(ClientBaseConfiguration configuration) : base(configurati return CompleteAsync(request, new grpc::CallOptions(headers, deadline, cancellationToken)); } /// - /// Complete an item previously popped from a queue + /// Complete an message previously popped from a queue /// /// The request to send to the server. /// The options for the call. @@ -285,8 +285,8 @@ protected override QueuesClient NewInstance(ClientBaseConfiguration configuratio public static grpc::ServerServiceDefinition BindService(QueuesBase serviceImpl) { return grpc::ServerServiceDefinition.CreateBuilder() - .AddMethod(__Method_Send, serviceImpl.Send) - .AddMethod(__Method_Receive, serviceImpl.Receive) + .AddMethod(__Method_Enqueue, serviceImpl.Enqueue) + .AddMethod(__Method_Dequeue, serviceImpl.Dequeue) .AddMethod(__Method_Complete, serviceImpl.Complete).Build(); } @@ -296,8 +296,8 @@ protected override QueuesClient NewInstance(ClientBaseConfiguration configuratio /// An object implementing the server-side handling logic. public static void BindService(grpc::ServiceBinderBase serviceBinder, QueuesBase serviceImpl) { - serviceBinder.AddMethod(__Method_Send, serviceImpl == null ? null : new grpc::UnaryServerMethod(serviceImpl.Send)); - serviceBinder.AddMethod(__Method_Receive, serviceImpl == null ? null : new grpc::UnaryServerMethod(serviceImpl.Receive)); + serviceBinder.AddMethod(__Method_Enqueue, serviceImpl == null ? null : new grpc::UnaryServerMethod(serviceImpl.Enqueue)); + serviceBinder.AddMethod(__Method_Dequeue, serviceImpl == null ? null : new grpc::UnaryServerMethod(serviceImpl.Dequeue)); serviceBinder.AddMethod(__Method_Complete, serviceImpl == null ? null : new grpc::UnaryServerMethod(serviceImpl.Complete)); } diff --git a/src/Nitric.Sdk/Proto/nitric/proto/resources/v1/Resources.cs b/src/Nitric.Sdk/Proto/nitric/proto/resources/v1/Resources.cs index 725bb81..cb7581f 100644 --- a/src/Nitric.Sdk/Proto/nitric/proto/resources/v1/Resources.cs +++ b/src/Nitric.Sdk/Proto/nitric/proto/resources/v1/Resources.cs @@ -62,22 +62,20 @@ static ResourcesReflection() { "BVRvcGljEAMSDAoIU2NoZWR1bGUQBBIQCgxTdWJzY3JpcHRpb24QBRIRCg1L", "ZXlWYWx1ZVN0b3JlEAYSCgoGUG9saWN5EAcSCgoGU2VjcmV0EAgSEgoOQnVj", "a2V0TGlzdGVuZXIQCRINCglXZWJzb2NrZXQQChIICgRIdHRwEAsSGQoVQXBp", - "U2VjdXJpdHlEZWZpbml0aW9uEAwSCQoFUXVldWUQDSrbAgoGQWN0aW9uEhIK", + "U2VjdXJpdHlEZWZpbml0aW9uEAwSCQoFUXVldWUQDSqVAgoGQWN0aW9uEhIK", "DkJ1Y2tldEZpbGVMaXN0EAASEQoNQnVja2V0RmlsZUdldBABEhEKDUJ1Y2tl", - "dEZpbGVQdXQQAhIUChBCdWNrZXRGaWxlRGVsZXRlEAMSDgoJVG9waWNMaXN0", - "EMgBEhAKC1RvcGljRGV0YWlsEMkBEhYKEVRvcGljRXZlbnRQdWJsaXNoEMoB", - "EhYKEUtleVZhbHVlU3RvcmVSZWFkEKwCEhcKEktleVZhbHVlU3RvcmVXcml0", - "ZRCtAhIYChNLZXlWYWx1ZVN0b3JlRGVsZXRlEK4CEg4KCVNlY3JldFB1dBCQ", - "AxIRCgxTZWNyZXRBY2Nlc3MQkQMSFAoPV2Vic29ja2V0TWFuYWdlEPQDEg4K", - "CVF1ZXVlU2VuZBDYBBIRCgxRdWV1ZVJlY2VpdmUQ2QQSDgoJUXVldWVMaXN0", - "ENoEEhAKC1F1ZXVlRGV0YWlsENsEMn0KCVJlc291cmNlcxJwCgdEZWNsYXJl", - "EjEubml0cmljLnByb3RvLnJlc291cmNlcy52MS5SZXNvdXJjZURlY2xhcmVS", - "ZXF1ZXN0GjIubml0cmljLnByb3RvLnJlc291cmNlcy52MS5SZXNvdXJjZURl", - "Y2xhcmVSZXNwb25zZUKpAQocaW8ubml0cmljLnByb3RvLnJlc291cmNlcy52", - "MUIJUmVzb3VyY2VzUAFaRGdpdGh1Yi5jb20vbml0cmljdGVjaC9uaXRyaWMv", - "Y29yZS9wa2cvcHJvdG8vcmVzb3VyY2VzL3YxO3Jlc291cmNlc3BiqgIZTml0", - "cmljLlByb3RvLlJlc291cmNlcy52McoCGU5pdHJpY1xQcm90b1xSZXNvdXJj", - "ZXNcVjFiBnByb3RvMw==")); + "dEZpbGVQdXQQAhIUChBCdWNrZXRGaWxlRGVsZXRlEAMSEQoMVG9waWNQdWJs", + "aXNoEMgBEhYKEUtleVZhbHVlU3RvcmVSZWFkEKwCEhcKEktleVZhbHVlU3Rv", + "cmVXcml0ZRCtAhIYChNLZXlWYWx1ZVN0b3JlRGVsZXRlEK4CEg4KCVNlY3Jl", + "dFB1dBCQAxIRCgxTZWNyZXRBY2Nlc3MQkQMSFAoPV2Vic29ja2V0TWFuYWdl", + "EPQDEhEKDFF1ZXVlRW5xdWV1ZRDYBBIRCgxRdWV1ZURlcXVldWUQ2QQyfQoJ", + "UmVzb3VyY2VzEnAKB0RlY2xhcmUSMS5uaXRyaWMucHJvdG8ucmVzb3VyY2Vz", + "LnYxLlJlc291cmNlRGVjbGFyZVJlcXVlc3QaMi5uaXRyaWMucHJvdG8ucmVz", + "b3VyY2VzLnYxLlJlc291cmNlRGVjbGFyZVJlc3BvbnNlQqkBChxpby5uaXRy", + "aWMucHJvdG8ucmVzb3VyY2VzLnYxQglSZXNvdXJjZXNQAVpEZ2l0aHViLmNv", + "bS9uaXRyaWN0ZWNoL25pdHJpYy9jb3JlL3BrZy9wcm90by9yZXNvdXJjZXMv", + "djE7cmVzb3VyY2VzcGKqAhlOaXRyaWMuUHJvdG8uUmVzb3VyY2VzLnYxygIZ", + "Tml0cmljXFByb3RvXFJlc291cmNlc1xWMWIGcHJvdG8z")); descriptor = pbr::FileDescriptor.FromGeneratedCode(descriptorData, new pbr::FileDescriptor[] { }, new pbr::GeneratedClrTypeInfo(new[] {typeof(global::Nitric.Proto.Resources.v1.ResourceType), typeof(global::Nitric.Proto.Resources.v1.Action), }, null, new pbr::GeneratedClrTypeInfo[] { @@ -128,11 +126,9 @@ public enum Action { /// /// Topic Permissions: 2XX /// - [pbr::OriginalName("TopicList")] TopicList = 200, - [pbr::OriginalName("TopicDetail")] TopicDetail = 201, - [pbr::OriginalName("TopicEventPublish")] TopicEventPublish = 202, + [pbr::OriginalName("TopicPublish")] TopicPublish = 200, /// - /// Collection Permissions: 3XX + /// KeyValue Store Permissions: 3XX /// [pbr::OriginalName("KeyValueStoreRead")] KeyValueStoreRead = 300, [pbr::OriginalName("KeyValueStoreWrite")] KeyValueStoreWrite = 301, @@ -149,10 +145,8 @@ public enum Action { /// /// Queue Permissions: 6XX /// - [pbr::OriginalName("QueueSend")] QueueSend = 600, - [pbr::OriginalName("QueueReceive")] QueueReceive = 601, - [pbr::OriginalName("QueueList")] QueueList = 602, - [pbr::OriginalName("QueueDetail")] QueueDetail = 603, + [pbr::OriginalName("QueueEnqueue")] QueueEnqueue = 600, + [pbr::OriginalName("QueueDequeue")] QueueDequeue = 601, } #endregion diff --git a/src/Nitric.Sdk/Proto/nitric/proto/schedules/v1/Schedules.cs b/src/Nitric.Sdk/Proto/nitric/proto/schedules/v1/Schedules.cs index 0f8ec57..a2866c0 100644 --- a/src/Nitric.Sdk/Proto/nitric/proto/schedules/v1/Schedules.cs +++ b/src/Nitric.Sdk/Proto/nitric/proto/schedules/v1/Schedules.cs @@ -30,31 +30,30 @@ static SchedulesReflection() { "dHJpYy5wcm90by5zY2hlZHVsZXMudjEuUmVnaXN0cmF0aW9uUmVxdWVzdEgA", "EkgKEWludGVydmFsX3Jlc3BvbnNlGAMgASgLMisubml0cmljLnByb3RvLnNj", "aGVkdWxlcy52MS5JbnRlcnZhbFJlc3BvbnNlSABCCQoHY29udGVudCIoCg9J", - "bnRlcnZhbFJlcXVlc3QSFQoNc2NoZWR1bGVfbmFtZRgBIAEoCSIiCg9NZXNz", - "YWdlUmVzcG9uc2USDwoHc3VjY2VzcxgBIAEoCCLAAQoNU2VydmVyTWVzc2Fn", - "ZRIKCgJpZBgBIAEoCRJQChVyZWdpc3RyYXRpb25fcmVzcG9uc2UYAiABKAsy", - "Ly5uaXRyaWMucHJvdG8uc2NoZWR1bGVzLnYxLlJlZ2lzdHJhdGlvblJlc3Bv", - "bnNlSAASRgoQaW50ZXJ2YWxfcmVxdWVzdBgDIAEoCzIqLm5pdHJpYy5wcm90", - "by5zY2hlZHVsZXMudjEuSW50ZXJ2YWxSZXF1ZXN0SABCCQoHY29udGVudCKr", - "AQoTUmVnaXN0cmF0aW9uUmVxdWVzdBIVCg1zY2hlZHVsZV9uYW1lGAEgASgJ", - "EjkKBWV2ZXJ5GAogASgLMigubml0cmljLnByb3RvLnNjaGVkdWxlcy52MS5T", - "Y2hlZHVsZUV2ZXJ5SAASNwoEY3JvbhgLIAEoCzInLm5pdHJpYy5wcm90by5z", - "Y2hlZHVsZXMudjEuU2NoZWR1bGVDcm9uSABCCQoHY2FkZW5jZSIdCg1TY2hl", - "ZHVsZUV2ZXJ5EgwKBHJhdGUYASABKAkiIgoMU2NoZWR1bGVDcm9uEhIKCmV4", - "cHJlc3Npb24YASABKAkiFgoUUmVnaXN0cmF0aW9uUmVzcG9uc2UiEgoQSW50", - "ZXJ2YWxSZXNwb25zZTJvCglTY2hlZHVsZXMSYgoIU2NoZWR1bGUSKC5uaXRy", - "aWMucHJvdG8uc2NoZWR1bGVzLnYxLkNsaWVudE1lc3NhZ2UaKC5uaXRyaWMu", - "cHJvdG8uc2NoZWR1bGVzLnYxLlNlcnZlck1lc3NhZ2UoATABQrABChxpby5u", - "aXRyaWMucHJvdG8uc2NoZWR1bGVzLnYxQhBTY2hlZHVsZXNTZXJ2aWNlUAFa", - "RGdpdGh1Yi5jb20vbml0cmljdGVjaC9uaXRyaWMvY29yZS9wa2cvcHJvdG8v", - "c2NoZWR1bGVzL3YxO3NjaGVkdWxlc3BiqgIZTml0cmljLlByb3RvLlNjaGVk", - "dWxlcy52McoCGU5pdHJpY1xQcm90b1xTY2hlZHVsZXNcVjFiBnByb3RvMw==")); + "bnRlcnZhbFJlcXVlc3QSFQoNc2NoZWR1bGVfbmFtZRgBIAEoCSLAAQoNU2Vy", + "dmVyTWVzc2FnZRIKCgJpZBgBIAEoCRJQChVyZWdpc3RyYXRpb25fcmVzcG9u", + "c2UYAiABKAsyLy5uaXRyaWMucHJvdG8uc2NoZWR1bGVzLnYxLlJlZ2lzdHJh", + "dGlvblJlc3BvbnNlSAASRgoQaW50ZXJ2YWxfcmVxdWVzdBgDIAEoCzIqLm5p", + "dHJpYy5wcm90by5zY2hlZHVsZXMudjEuSW50ZXJ2YWxSZXF1ZXN0SABCCQoH", + "Y29udGVudCKrAQoTUmVnaXN0cmF0aW9uUmVxdWVzdBIVCg1zY2hlZHVsZV9u", + "YW1lGAEgASgJEjkKBWV2ZXJ5GAogASgLMigubml0cmljLnByb3RvLnNjaGVk", + "dWxlcy52MS5TY2hlZHVsZUV2ZXJ5SAASNwoEY3JvbhgLIAEoCzInLm5pdHJp", + "Yy5wcm90by5zY2hlZHVsZXMudjEuU2NoZWR1bGVDcm9uSABCCQoHY2FkZW5j", + "ZSIdCg1TY2hlZHVsZUV2ZXJ5EgwKBHJhdGUYASABKAkiIgoMU2NoZWR1bGVD", + "cm9uEhIKCmV4cHJlc3Npb24YASABKAkiFgoUUmVnaXN0cmF0aW9uUmVzcG9u", + "c2UiEgoQSW50ZXJ2YWxSZXNwb25zZTJvCglTY2hlZHVsZXMSYgoIU2NoZWR1", + "bGUSKC5uaXRyaWMucHJvdG8uc2NoZWR1bGVzLnYxLkNsaWVudE1lc3NhZ2Ua", + "KC5uaXRyaWMucHJvdG8uc2NoZWR1bGVzLnYxLlNlcnZlck1lc3NhZ2UoATAB", + "QrABChxpby5uaXRyaWMucHJvdG8uc2NoZWR1bGVzLnYxQhBTY2hlZHVsZXNT", + "ZXJ2aWNlUAFaRGdpdGh1Yi5jb20vbml0cmljdGVjaC9uaXRyaWMvY29yZS9w", + "a2cvcHJvdG8vc2NoZWR1bGVzL3YxO3NjaGVkdWxlc3BiqgIZTml0cmljLlBy", + "b3RvLlNjaGVkdWxlcy52McoCGU5pdHJpY1xQcm90b1xTY2hlZHVsZXNcVjFi", + "BnByb3RvMw==")); descriptor = pbr::FileDescriptor.FromGeneratedCode(descriptorData, new pbr::FileDescriptor[] { }, new pbr::GeneratedClrTypeInfo(null, null, new pbr::GeneratedClrTypeInfo[] { new pbr::GeneratedClrTypeInfo(typeof(global::Nitric.Proto.Schedules.v1.ClientMessage), global::Nitric.Proto.Schedules.v1.ClientMessage.Parser, new[]{ "Id", "RegistrationRequest", "IntervalResponse" }, new[]{ "Content" }, null, null, null), new pbr::GeneratedClrTypeInfo(typeof(global::Nitric.Proto.Schedules.v1.IntervalRequest), global::Nitric.Proto.Schedules.v1.IntervalRequest.Parser, new[]{ "ScheduleName" }, null, null, null, null), - new pbr::GeneratedClrTypeInfo(typeof(global::Nitric.Proto.Schedules.v1.MessageResponse), global::Nitric.Proto.Schedules.v1.MessageResponse.Parser, new[]{ "Success" }, null, null, null, null), new pbr::GeneratedClrTypeInfo(typeof(global::Nitric.Proto.Schedules.v1.ServerMessage), global::Nitric.Proto.Schedules.v1.ServerMessage.Parser, new[]{ "Id", "RegistrationResponse", "IntervalRequest" }, new[]{ "Content" }, null, null, null), new pbr::GeneratedClrTypeInfo(typeof(global::Nitric.Proto.Schedules.v1.RegistrationRequest), global::Nitric.Proto.Schedules.v1.RegistrationRequest.Parser, new[]{ "ScheduleName", "Every", "Cron" }, new[]{ "Cadence" }, null, null, null), new pbr::GeneratedClrTypeInfo(typeof(global::Nitric.Proto.Schedules.v1.ScheduleEvery), global::Nitric.Proto.Schedules.v1.ScheduleEvery.Parser, new[]{ "Rate" }, null, null, null, null), @@ -67,6 +66,9 @@ static SchedulesReflection() { } #region Messages + /// + /// ClientMessages are sent from the service to the nitric server + /// public sealed partial class ClientMessage : pb::IMessage #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE , pb::IBufferMessage @@ -131,7 +133,7 @@ public string Id { /// Field number for the "registration_request" field. public const int RegistrationRequestFieldNumber = 2; /// - /// Register a subscription to a schedule + /// Register new a schedule /// [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public global::Nitric.Proto.Schedules.v1.RegistrationRequest RegistrationRequest { @@ -145,7 +147,7 @@ public string Id { /// Field number for the "interval_response" field. public const int IntervalResponseFieldNumber = 3; /// - /// Response to a schedule interval + /// Response to a schedule interval (i.e. response from callback function) /// [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public global::Nitric.Proto.Schedules.v1.IntervalResponse IntervalResponse { @@ -549,178 +551,9 @@ public void MergeFrom(pb::CodedInputStream input) { } - public sealed partial class MessageResponse : pb::IMessage - #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE - , pb::IBufferMessage - #endif - { - private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new MessageResponse()); - private pb::UnknownFieldSet _unknownFields; - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public static pb::MessageParser Parser { get { return _parser; } } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public static pbr::MessageDescriptor Descriptor { - get { return global::Nitric.Proto.Schedules.v1.SchedulesReflection.Descriptor.MessageTypes[2]; } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - pbr::MessageDescriptor pb::IMessage.Descriptor { - get { return Descriptor; } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public MessageResponse() { - OnConstruction(); - } - - partial void OnConstruction(); - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public MessageResponse(MessageResponse other) : this() { - success_ = other.success_; - _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public MessageResponse Clone() { - return new MessageResponse(this); - } - - /// Field number for the "success" field. - public const int SuccessFieldNumber = 1; - private bool success_; - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public bool Success { - get { return success_; } - set { - success_ = value; - } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public override bool Equals(object other) { - return Equals(other as MessageResponse); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public bool Equals(MessageResponse other) { - if (ReferenceEquals(other, null)) { - return false; - } - if (ReferenceEquals(other, this)) { - return true; - } - if (Success != other.Success) return false; - return Equals(_unknownFields, other._unknownFields); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public override int GetHashCode() { - int hash = 1; - if (Success != false) hash ^= Success.GetHashCode(); - if (_unknownFields != null) { - hash ^= _unknownFields.GetHashCode(); - } - return hash; - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public override string ToString() { - return pb::JsonFormatter.ToDiagnosticString(this); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void WriteTo(pb::CodedOutputStream output) { - #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE - output.WriteRawMessage(this); - #else - if (Success != false) { - output.WriteRawTag(8); - output.WriteBool(Success); - } - if (_unknownFields != null) { - _unknownFields.WriteTo(output); - } - #endif - } - - #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - void pb::IBufferMessage.InternalWriteTo(ref pb::WriteContext output) { - if (Success != false) { - output.WriteRawTag(8); - output.WriteBool(Success); - } - if (_unknownFields != null) { - _unknownFields.WriteTo(ref output); - } - } - #endif - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public int CalculateSize() { - int size = 0; - if (Success != false) { - size += 1 + 1; - } - if (_unknownFields != null) { - size += _unknownFields.CalculateSize(); - } - return size; - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void MergeFrom(MessageResponse other) { - if (other == null) { - return; - } - if (other.Success != false) { - Success = other.Success; - } - _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void MergeFrom(pb::CodedInputStream input) { - #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE - input.ReadRawMessage(this); - #else - uint tag; - while ((tag = input.ReadTag()) != 0) { - switch(tag) { - default: - _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input); - break; - case 8: { - Success = input.ReadBool(); - break; - } - } - } - #endif - } - - #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - void pb::IBufferMessage.InternalMergeFrom(ref pb::ParseContext input) { - uint tag; - while ((tag = input.ReadTag()) != 0) { - switch(tag) { - default: - _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, ref input); - break; - case 8: { - Success = input.ReadBool(); - break; - } - } - } - } - #endif - - } - + /// + /// ServerMessages are sent from the nitric server to the service + /// public sealed partial class ServerMessage : pb::IMessage #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE , pb::IBufferMessage @@ -733,7 +566,7 @@ public sealed partial class ServerMessage : pb::IMessage [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public static pbr::MessageDescriptor Descriptor { - get { return global::Nitric.Proto.Schedules.v1.SchedulesReflection.Descriptor.MessageTypes[3]; } + get { return global::Nitric.Proto.Schedules.v1.SchedulesReflection.Descriptor.MessageTypes[2]; } } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] @@ -799,7 +632,7 @@ public string Id { /// Field number for the "interval_request" field. public const int IntervalRequestFieldNumber = 3; /// - /// A schedule interval trigger request + /// A schedule interval trigger request (i.e. call the callback) /// [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public global::Nitric.Proto.Schedules.v1.IntervalRequest IntervalRequest { @@ -1043,7 +876,7 @@ public sealed partial class RegistrationRequest : pb::IMessage [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public static pbr::MessageDescriptor Descriptor { - get { return global::Nitric.Proto.Schedules.v1.SchedulesReflection.Descriptor.MessageTypes[5]; } + get { return global::Nitric.Proto.Schedules.v1.SchedulesReflection.Descriptor.MessageTypes[4]; } } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] @@ -1516,7 +1349,7 @@ public sealed partial class ScheduleCron : pb::IMessage [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public static pbr::MessageDescriptor Descriptor { - get { return global::Nitric.Proto.Schedules.v1.SchedulesReflection.Descriptor.MessageTypes[6]; } + get { return global::Nitric.Proto.Schedules.v1.SchedulesReflection.Descriptor.MessageTypes[5]; } } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] @@ -1688,7 +1521,7 @@ public sealed partial class RegistrationResponse : pb::IMessage [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public static pbr::MessageDescriptor Descriptor { - get { return global::Nitric.Proto.Schedules.v1.SchedulesReflection.Descriptor.MessageTypes[8]; } + get { return global::Nitric.Proto.Schedules.v1.SchedulesReflection.Descriptor.MessageTypes[7]; } } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] diff --git a/src/Nitric.Sdk/Proto/nitric/proto/schedules/v1/SchedulesGrpc.cs b/src/Nitric.Sdk/Proto/nitric/proto/schedules/v1/SchedulesGrpc.cs index bd38bf2..a941e6e 100644 --- a/src/Nitric.Sdk/Proto/nitric/proto/schedules/v1/SchedulesGrpc.cs +++ b/src/Nitric.Sdk/Proto/nitric/proto/schedules/v1/SchedulesGrpc.cs @@ -9,7 +9,7 @@ namespace Nitric.Proto.Schedules.v1 { /// - /// Service for publishing asynchronous messages + /// Service for scheduling callbacks on a cadence /// public static partial class Schedules { diff --git a/src/Nitric.Sdk/Proto/nitric/proto/secrets/v1/SecretsGrpc.cs b/src/Nitric.Sdk/Proto/nitric/proto/secrets/v1/SecretsGrpc.cs index 8be1987..d9d223d 100644 --- a/src/Nitric.Sdk/Proto/nitric/proto/secrets/v1/SecretsGrpc.cs +++ b/src/Nitric.Sdk/Proto/nitric/proto/secrets/v1/SecretsGrpc.cs @@ -8,6 +8,9 @@ using grpc = global::Grpc.Core; namespace Nitric.Proto.Secrets.v1 { + /// + /// The Nitric Secret Service + /// public static partial class SecretManager { static readonly string __ServiceName = "nitric.proto.secrets.v1.SecretManager"; diff --git a/src/Nitric.Sdk/Proto/nitric/proto/storage/v1/Storage.cs b/src/Nitric.Sdk/Proto/nitric/proto/storage/v1/Storage.cs index 0df1285..6186066 100644 --- a/src/Nitric.Sdk/Proto/nitric/proto/storage/v1/Storage.cs +++ b/src/Nitric.Sdk/Proto/nitric/proto/storage/v1/Storage.cs @@ -121,6 +121,9 @@ public enum BlobEventType { #endregion #region Messages + /// + /// ClientMessages are sent from the service to the nitric server + /// public sealed partial class ClientMessage : pb::IMessage #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE , pb::IBufferMessage @@ -199,7 +202,7 @@ public string Id { /// Field number for the "blob_event_response" field. public const int BlobEventResponseFieldNumber = 3; /// - /// Stop watching for changes on a bucket + /// Response to a blob event (change to a blob) /// [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public global::Nitric.Proto.Storage.v1.BlobEventResponse BlobEventResponse { @@ -431,6 +434,9 @@ public void MergeFrom(pb::CodedInputStream input) { } + /// + /// ServerMessages are sent from the nitric server to the service + /// public sealed partial class ServerMessage : pb::IMessage #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE , pb::IBufferMessage @@ -509,7 +515,7 @@ public string Id { /// Field number for the "blob_event_request" field. public const int BlobEventRequestFieldNumber = 3; /// - /// Stop watching for changes on a bucket + /// Event for a blob in a bucket /// [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public global::Nitric.Proto.Storage.v1.BlobEventRequest BlobEventRequest { diff --git a/src/Nitric.Sdk/Proto/nitric/proto/topics/v1/Topics.cs b/src/Nitric.Sdk/Proto/nitric/proto/topics/v1/Topics.cs index b822422..f85d37d 100644 --- a/src/Nitric.Sdk/Proto/nitric/proto/topics/v1/Topics.cs +++ b/src/Nitric.Sdk/Proto/nitric/proto/topics/v1/Topics.cs @@ -30,30 +30,30 @@ static TopicsReflection() { "ZXNzYWdlEgoKAmlkGAEgASgJEksKFHJlZ2lzdHJhdGlvbl9yZXF1ZXN0GAIg", "ASgLMisubml0cmljLnByb3RvLnRvcGljcy52MS5SZWdpc3RyYXRpb25SZXF1", "ZXN0SAASQwoQbWVzc2FnZV9yZXNwb25zZRgDIAEoCzInLm5pdHJpYy5wcm90", - "by50b3BpY3MudjEuTWVzc2FnZVJlc3BvbnNlSABCCQoHY29udGVudCJWCg5N", - "ZXNzYWdlUmVxdWVzdBISCgp0b3BpY19uYW1lGAEgASgJEjAKB21lc3NhZ2UY", - "AiABKAsyHy5uaXRyaWMucHJvdG8udG9waWNzLnYxLk1lc3NhZ2UiIgoPTWVz", - "c2FnZVJlc3BvbnNlEg8KB3N1Y2Nlc3MYASABKAgiuAEKDVNlcnZlck1lc3Nh", - "Z2USCgoCaWQYASABKAkSTQoVcmVnaXN0cmF0aW9uX3Jlc3BvbnNlGAIgASgL", - "Miwubml0cmljLnByb3RvLnRvcGljcy52MS5SZWdpc3RyYXRpb25SZXNwb25z", - "ZUgAEkEKD21lc3NhZ2VfcmVxdWVzdBgDIAEoCzImLm5pdHJpYy5wcm90by50", - "b3BpY3MudjEuTWVzc2FnZVJlcXVlc3RIAEIJCgdjb250ZW50IikKE1JlZ2lz", - "dHJhdGlvblJlcXVlc3QSEgoKdG9waWNfbmFtZRgBIAEoCSIWChRSZWdpc3Ry", - "YXRpb25SZXNwb25zZSJHCgdNZXNzYWdlEjEKDnN0cnVjdF9wYXlsb2FkGAEg", - "ASgLMhcuZ29vZ2xlLnByb3RvYnVmLlN0cnVjdEgAQgkKB2NvbnRlbnQihQEK", - "E1RvcGljUHVibGlzaFJlcXVlc3QSEgoKdG9waWNfbmFtZRgBIAEoCRIwCgdt", - "ZXNzYWdlGAIgASgLMh8ubml0cmljLnByb3RvLnRvcGljcy52MS5NZXNzYWdl", - "EigKBWRlbGF5GAMgASgLMhkuZ29vZ2xlLnByb3RvYnVmLkR1cmF0aW9uIhYK", - "FFRvcGljUHVibGlzaFJlc3BvbnNlMm4KBlRvcGljcxJkCgdQdWJsaXNoEisu", - "bml0cmljLnByb3RvLnRvcGljcy52MS5Ub3BpY1B1Ymxpc2hSZXF1ZXN0Giwu", - "bml0cmljLnByb3RvLnRvcGljcy52MS5Ub3BpY1B1Ymxpc2hSZXNwb25zZTJr", - "CgpTdWJzY3JpYmVyEl0KCVN1YnNjcmliZRIlLm5pdHJpYy5wcm90by50b3Bp", - "Y3MudjEuQ2xpZW50TWVzc2FnZRolLm5pdHJpYy5wcm90by50b3BpY3MudjEu", - "U2VydmVyTWVzc2FnZSgBMAFCngEKGWlvLm5pdHJpYy5wcm90by50b3BpY3Mu", - "djFCDVRvcGljc1NlcnZpY2VQAVo+Z2l0aHViLmNvbS9uaXRyaWN0ZWNoL25p", - "dHJpYy9jb3JlL3BrZy9wcm90by90b3BpY3MvdjE7dG9waWNzcGKqAhZOaXRy", - "aWMuUHJvdG8uVG9waWNzLnYxygIWTml0cmljXFByb3RvXFRvcGljc1xWMWIG", - "cHJvdG8z")); + "by50b3BpY3MudjEuTWVzc2FnZVJlc3BvbnNlSABCCQoHY29udGVudCJbCg5N", + "ZXNzYWdlUmVxdWVzdBISCgp0b3BpY19uYW1lGAEgASgJEjUKB21lc3NhZ2UY", + "AiABKAsyJC5uaXRyaWMucHJvdG8udG9waWNzLnYxLlRvcGljTWVzc2FnZSIi", + "Cg9NZXNzYWdlUmVzcG9uc2USDwoHc3VjY2VzcxgBIAEoCCK4AQoNU2VydmVy", + "TWVzc2FnZRIKCgJpZBgBIAEoCRJNChVyZWdpc3RyYXRpb25fcmVzcG9uc2UY", + "AiABKAsyLC5uaXRyaWMucHJvdG8udG9waWNzLnYxLlJlZ2lzdHJhdGlvblJl", + "c3BvbnNlSAASQQoPbWVzc2FnZV9yZXF1ZXN0GAMgASgLMiYubml0cmljLnBy", + "b3RvLnRvcGljcy52MS5NZXNzYWdlUmVxdWVzdEgAQgkKB2NvbnRlbnQiKQoT", + "UmVnaXN0cmF0aW9uUmVxdWVzdBISCgp0b3BpY19uYW1lGAEgASgJIhYKFFJl", + "Z2lzdHJhdGlvblJlc3BvbnNlIkwKDFRvcGljTWVzc2FnZRIxCg5zdHJ1Y3Rf", + "cGF5bG9hZBgBIAEoCzIXLmdvb2dsZS5wcm90b2J1Zi5TdHJ1Y3RIAEIJCgdj", + "b250ZW50IooBChNUb3BpY1B1Ymxpc2hSZXF1ZXN0EhIKCnRvcGljX25hbWUY", + "ASABKAkSNQoHbWVzc2FnZRgCIAEoCzIkLm5pdHJpYy5wcm90by50b3BpY3Mu", + "djEuVG9waWNNZXNzYWdlEigKBWRlbGF5GAMgASgLMhkuZ29vZ2xlLnByb3Rv", + "YnVmLkR1cmF0aW9uIhYKFFRvcGljUHVibGlzaFJlc3BvbnNlMm4KBlRvcGlj", + "cxJkCgdQdWJsaXNoEisubml0cmljLnByb3RvLnRvcGljcy52MS5Ub3BpY1B1", + "Ymxpc2hSZXF1ZXN0Giwubml0cmljLnByb3RvLnRvcGljcy52MS5Ub3BpY1B1", + "Ymxpc2hSZXNwb25zZTJrCgpTdWJzY3JpYmVyEl0KCVN1YnNjcmliZRIlLm5p", + "dHJpYy5wcm90by50b3BpY3MudjEuQ2xpZW50TWVzc2FnZRolLm5pdHJpYy5w", + "cm90by50b3BpY3MudjEuU2VydmVyTWVzc2FnZSgBMAFCngEKGWlvLm5pdHJp", + "Yy5wcm90by50b3BpY3MudjFCDVRvcGljc1NlcnZpY2VQAVo+Z2l0aHViLmNv", + "bS9uaXRyaWN0ZWNoL25pdHJpYy9jb3JlL3BrZy9wcm90by90b3BpY3MvdjE7", + "dG9waWNzcGKqAhZOaXRyaWMuUHJvdG8uVG9waWNzLnYxygIWTml0cmljXFBy", + "b3RvXFRvcGljc1xWMWIGcHJvdG8z")); descriptor = pbr::FileDescriptor.FromGeneratedCode(descriptorData, new pbr::FileDescriptor[] { global::Google.Protobuf.WellKnownTypes.StructReflection.Descriptor, global::Google.Protobuf.WellKnownTypes.DurationReflection.Descriptor, }, new pbr::GeneratedClrTypeInfo(null, null, new pbr::GeneratedClrTypeInfo[] { @@ -63,7 +63,7 @@ static TopicsReflection() { new pbr::GeneratedClrTypeInfo(typeof(global::Nitric.Proto.Topics.v1.ServerMessage), global::Nitric.Proto.Topics.v1.ServerMessage.Parser, new[]{ "Id", "RegistrationResponse", "MessageRequest" }, new[]{ "Content" }, null, null, null), new pbr::GeneratedClrTypeInfo(typeof(global::Nitric.Proto.Topics.v1.RegistrationRequest), global::Nitric.Proto.Topics.v1.RegistrationRequest.Parser, new[]{ "TopicName" }, null, null, null, null), new pbr::GeneratedClrTypeInfo(typeof(global::Nitric.Proto.Topics.v1.RegistrationResponse), global::Nitric.Proto.Topics.v1.RegistrationResponse.Parser, null, null, null, null, null), - new pbr::GeneratedClrTypeInfo(typeof(global::Nitric.Proto.Topics.v1.Message), global::Nitric.Proto.Topics.v1.Message.Parser, new[]{ "StructPayload" }, new[]{ "Content" }, null, null, null), + new pbr::GeneratedClrTypeInfo(typeof(global::Nitric.Proto.Topics.v1.TopicMessage), global::Nitric.Proto.Topics.v1.TopicMessage.Parser, new[]{ "StructPayload" }, new[]{ "Content" }, null, null, null), new pbr::GeneratedClrTypeInfo(typeof(global::Nitric.Proto.Topics.v1.TopicPublishRequest), global::Nitric.Proto.Topics.v1.TopicPublishRequest.Parser, new[]{ "TopicName", "Message", "Delay" }, null, null, null, null), new pbr::GeneratedClrTypeInfo(typeof(global::Nitric.Proto.Topics.v1.TopicPublishResponse), global::Nitric.Proto.Topics.v1.TopicPublishResponse.Parser, null, null, null, null, null) })); @@ -72,6 +72,9 @@ static TopicsReflection() { } #region Messages + /// + /// ClientMessage is the message sent from the service to the nitric server + /// public sealed partial class ClientMessage : pb::IMessage #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE , pb::IBufferMessage @@ -434,12 +437,12 @@ public string TopicName { /// Field number for the "message" field. public const int MessageFieldNumber = 2; - private global::Nitric.Proto.Topics.v1.Message message_; + private global::Nitric.Proto.Topics.v1.TopicMessage message_; /// /// Message Type /// [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public global::Nitric.Proto.Topics.v1.Message Message { + public global::Nitric.Proto.Topics.v1.TopicMessage Message { get { return message_; } set { message_ = value; @@ -541,7 +544,7 @@ public void MergeFrom(MessageRequest other) { } if (other.message_ != null) { if (message_ == null) { - Message = new global::Nitric.Proto.Topics.v1.Message(); + Message = new global::Nitric.Proto.Topics.v1.TopicMessage(); } Message.MergeFrom(other.Message); } @@ -565,7 +568,7 @@ public void MergeFrom(pb::CodedInputStream input) { } case 18: { if (message_ == null) { - Message = new global::Nitric.Proto.Topics.v1.Message(); + Message = new global::Nitric.Proto.Topics.v1.TopicMessage(); } input.ReadMessage(Message); break; @@ -590,7 +593,7 @@ public void MergeFrom(pb::CodedInputStream input) { } case 18: { if (message_ == null) { - Message = new global::Nitric.Proto.Topics.v1.Message(); + Message = new global::Nitric.Proto.Topics.v1.TopicMessage(); } input.ReadMessage(Message); break; @@ -774,6 +777,9 @@ public void MergeFrom(pb::CodedInputStream input) { } + /// + /// ServerMessage is the message sent from the nitric server to the service + /// public sealed partial class ServerMessage : pb::IMessage #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE , pb::IBufferMessage @@ -1392,15 +1398,15 @@ public void MergeFrom(pb::CodedInputStream input) { } - public sealed partial class Message : pb::IMessage + public sealed partial class TopicMessage : pb::IMessage #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE , pb::IBufferMessage #endif { - private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new Message()); + private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new TopicMessage()); private pb::UnknownFieldSet _unknownFields; [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public static pb::MessageParser Parser { get { return _parser; } } + public static pb::MessageParser Parser { get { return _parser; } } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public static pbr::MessageDescriptor Descriptor { @@ -1413,14 +1419,14 @@ public sealed partial class Message : pb::IMessage } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public Message() { + public TopicMessage() { OnConstruction(); } partial void OnConstruction(); [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public Message(Message other) : this() { + public TopicMessage(TopicMessage other) : this() { switch (other.ContentCase) { case ContentOneofCase.StructPayload: StructPayload = other.StructPayload.Clone(); @@ -1431,8 +1437,8 @@ public Message(Message other) : this() { } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public Message Clone() { - return new Message(this); + public TopicMessage Clone() { + return new TopicMessage(this); } /// Field number for the "struct_payload" field. @@ -1466,11 +1472,11 @@ public void ClearContent() { [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public override bool Equals(object other) { - return Equals(other as Message); + return Equals(other as TopicMessage); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public bool Equals(Message other) { + public bool Equals(TopicMessage other) { if (ReferenceEquals(other, null)) { return false; } @@ -1539,7 +1545,7 @@ public int CalculateSize() { } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void MergeFrom(Message other) { + public void MergeFrom(TopicMessage other) { if (other == null) { return; } @@ -1664,12 +1670,12 @@ public string TopicName { /// Field number for the "message" field. public const int MessageFieldNumber = 2; - private global::Nitric.Proto.Topics.v1.Message message_; + private global::Nitric.Proto.Topics.v1.TopicMessage message_; /// /// The message to be published /// [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public global::Nitric.Proto.Topics.v1.Message Message { + public global::Nitric.Proto.Topics.v1.TopicMessage Message { get { return message_; } set { message_ = value; @@ -1798,7 +1804,7 @@ public void MergeFrom(TopicPublishRequest other) { } if (other.message_ != null) { if (message_ == null) { - Message = new global::Nitric.Proto.Topics.v1.Message(); + Message = new global::Nitric.Proto.Topics.v1.TopicMessage(); } Message.MergeFrom(other.Message); } @@ -1828,7 +1834,7 @@ public void MergeFrom(pb::CodedInputStream input) { } case 18: { if (message_ == null) { - Message = new global::Nitric.Proto.Topics.v1.Message(); + Message = new global::Nitric.Proto.Topics.v1.TopicMessage(); } input.ReadMessage(Message); break; @@ -1860,7 +1866,7 @@ public void MergeFrom(pb::CodedInputStream input) { } case 18: { if (message_ == null) { - Message = new global::Nitric.Proto.Topics.v1.Message(); + Message = new global::Nitric.Proto.Topics.v1.TopicMessage(); } input.ReadMessage(Message); break; diff --git a/src/Nitric.Sdk/Proto/nitric/proto/websockets/v1/Websockets.cs b/src/Nitric.Sdk/Proto/nitric/proto/websockets/v1/Websockets.cs index dd87b75..d860c53 100644 --- a/src/Nitric.Sdk/Proto/nitric/proto/websockets/v1/Websockets.cs +++ b/src/Nitric.Sdk/Proto/nitric/proto/websockets/v1/Websockets.cs @@ -30,55 +30,57 @@ static WebsocketsReflection() { "ZXRhaWxzUmVzcG9uc2USCwoDdXJsGAEgASgJIlAKFFdlYnNvY2tldFNlbmRS", "ZXF1ZXN0EhMKC3NvY2tldF9uYW1lGAEgASgJEhUKDWNvbm5lY3Rpb25faWQY", "AiABKAkSDAoEZGF0YRgDIAEoDCIXChVXZWJzb2NrZXRTZW5kUmVzcG9uc2Ui", - "QwoVV2Vic29ja2V0Q2xvc2VSZXF1ZXN0EhMKC3NvY2tldF9uYW1lGAEgASgJ", - "EhUKDWNvbm5lY3Rpb25faWQYAiABKAkiGAoWV2Vic29ja2V0Q2xvc2VSZXNw", - "b25zZSLPAQoNQ2xpZW50TWVzc2FnZRIKCgJpZBgBIAEoCRJPChRyZWdpc3Ry", - "YXRpb25fcmVxdWVzdBgCIAEoCzIvLm5pdHJpYy5wcm90by53ZWJzb2NrZXRz", - "LnYxLlJlZ2lzdHJhdGlvblJlcXVlc3RIABJWChh3ZWJzb2NrZXRfZXZlbnRf", - "cmVzcG9uc2UYAyABKAsyMi5uaXRyaWMucHJvdG8ud2Vic29ja2V0cy52MS5X", - "ZWJzb2NrZXRFdmVudFJlc3BvbnNlSABCCQoHY29udGVudCIWChRSZWdpc3Ry", - "YXRpb25SZXNwb25zZSJuChNSZWdpc3RyYXRpb25SZXF1ZXN0EhMKC3NvY2tl", - "dF9uYW1lGAEgASgJEkIKCmV2ZW50X3R5cGUYAiABKA4yLi5uaXRyaWMucHJv", - "dG8ud2Vic29ja2V0cy52MS5XZWJzb2NrZXRFdmVudFR5cGUiuQIKFVdlYnNv", - "Y2tldEV2ZW50UmVxdWVzdBITCgtzb2NrZXRfbmFtZRgBIAEoCRIUCgxjb25u", - "ZWN0aW9uSWQYAiABKAkSSgoKY29ubmVjdGlvbhgKIAEoCzI0Lm5pdHJpYy5w", - "cm90by53ZWJzb2NrZXRzLnYxLldlYnNvY2tldENvbm5lY3Rpb25FdmVudEgA", - "ElAKDWRpc2Nvbm5lY3Rpb24YCyABKAsyNy5uaXRyaWMucHJvdG8ud2Vic29j", - "a2V0cy52MS5XZWJzb2NrZXREaXNjb25uZWN0aW9uRXZlbnRIABJECgdtZXNz", - "YWdlGAwgASgLMjEubml0cmljLnByb3RvLndlYnNvY2tldHMudjEuV2Vic29j", - "a2V0TWVzc2FnZUV2ZW50SABCEQoPd2Vic29ja2V0X2V2ZW50IhsKClF1ZXJ5", - "VmFsdWUSDQoFdmFsdWUYASADKAkizwEKDVNlcnZlck1lc3NhZ2USCgoCaWQY", - "ASABKAkSUQoVcmVnaXN0cmF0aW9uX3Jlc3BvbnNlGAIgASgLMjAubml0cmlj", - "LnByb3RvLndlYnNvY2tldHMudjEuUmVnaXN0cmF0aW9uUmVzcG9uc2VIABJU", - "Chd3ZWJzb2NrZXRfZXZlbnRfcmVxdWVzdBgDIAEoCzIxLm5pdHJpYy5wcm90", - "by53ZWJzb2NrZXRzLnYxLldlYnNvY2tldEV2ZW50UmVxdWVzdEgAQgkKB2Nv", - "bnRlbnQihgEKFldlYnNvY2tldEV2ZW50UmVzcG9uc2USVgoTY29ubmVjdGlv", - "bl9yZXNwb25zZRgKIAEoCzI3Lm5pdHJpYy5wcm90by53ZWJzb2NrZXRzLnYx", - "LldlYnNvY2tldENvbm5lY3Rpb25SZXNwb25zZUgAQhQKEndlYnNvY2tldF9y", - "ZXNwb25zZSLTAQoYV2Vic29ja2V0Q29ubmVjdGlvbkV2ZW50ElsKDHF1ZXJ5", - "X3BhcmFtcxgBIAMoCzJFLm5pdHJpYy5wcm90by53ZWJzb2NrZXRzLnYxLldl", - "YnNvY2tldENvbm5lY3Rpb25FdmVudC5RdWVyeVBhcmFtc0VudHJ5GloKEFF1", - "ZXJ5UGFyYW1zRW50cnkSCwoDa2V5GAEgASgJEjUKBXZhbHVlGAIgASgLMiYu", - "bml0cmljLnByb3RvLndlYnNvY2tldHMudjEuUXVlcnlWYWx1ZToCOAEiLQob", - "V2Vic29ja2V0Q29ubmVjdGlvblJlc3BvbnNlEg4KBnJlamVjdBgBIAEoCCId", - "ChtXZWJzb2NrZXREaXNjb25uZWN0aW9uRXZlbnQiJQoVV2Vic29ja2V0TWVz", - "c2FnZUV2ZW50EgwKBGJvZHkYASABKAwqPgoSV2Vic29ja2V0RXZlbnRUeXBl", - "EgsKB0Nvbm5lY3QQABIOCgpEaXNjb25uZWN0EAESCwoHTWVzc2FnZRACMt4C", - "CglXZWJzb2NrZXQSawoEU2VuZBIwLm5pdHJpYy5wcm90by53ZWJzb2NrZXRz", - "LnYxLldlYnNvY2tldFNlbmRSZXF1ZXN0GjEubml0cmljLnByb3RvLndlYnNv", - "Y2tldHMudjEuV2Vic29ja2V0U2VuZFJlc3BvbnNlEm4KBUNsb3NlEjEubml0", - "cmljLnByb3RvLndlYnNvY2tldHMudjEuV2Vic29ja2V0Q2xvc2VSZXF1ZXN0", - "GjIubml0cmljLnByb3RvLndlYnNvY2tldHMudjEuV2Vic29ja2V0Q2xvc2VS", - "ZXNwb25zZRJ0CgdEZXRhaWxzEjMubml0cmljLnByb3RvLndlYnNvY2tldHMu", - "djEuV2Vic29ja2V0RGV0YWlsc1JlcXVlc3QaNC5uaXRyaWMucHJvdG8ud2Vi", - "c29ja2V0cy52MS5XZWJzb2NrZXREZXRhaWxzUmVzcG9uc2UyfAoQV2Vic29j", - "a2V0SGFuZGxlchJoCgxIYW5kbGVFdmVudHMSKS5uaXRyaWMucHJvdG8ud2Vi", - "c29ja2V0cy52MS5DbGllbnRNZXNzYWdlGikubml0cmljLnByb3RvLndlYnNv", - "Y2tldHMudjEuU2VydmVyTWVzc2FnZSgBMAFCtgEKHWlvLm5pdHJpYy5wcm90", - "by53ZWJzb2NrZXRzLnYxQhFXZWJzb2NrZXRzU2VydmljZVABWkZnaXRodWIu", - "Y29tL25pdHJpY3RlY2gvbml0cmljL2NvcmUvcGtnL3Byb3RvL3dlYnNvY2tl", - "dHMvdjE7d2Vic29ja2V0c3BiqgIaTml0cmljLlByb3RvLldlYnNvY2tldHMu", - "djHKAhpOaXRyaWNcUHJvdG9cV2Vic29ja2V0c1xWMWIGcHJvdG8z")); + "TQofV2Vic29ja2V0Q2xvc2VDb25uZWN0aW9uUmVxdWVzdBITCgtzb2NrZXRf", + "bmFtZRgBIAEoCRIVCg1jb25uZWN0aW9uX2lkGAIgASgJIiIKIFdlYnNvY2tl", + "dENsb3NlQ29ubmVjdGlvblJlc3BvbnNlIs8BCg1DbGllbnRNZXNzYWdlEgoK", + "AmlkGAEgASgJEk8KFHJlZ2lzdHJhdGlvbl9yZXF1ZXN0GAIgASgLMi8ubml0", + "cmljLnByb3RvLndlYnNvY2tldHMudjEuUmVnaXN0cmF0aW9uUmVxdWVzdEgA", + "ElYKGHdlYnNvY2tldF9ldmVudF9yZXNwb25zZRgDIAEoCzIyLm5pdHJpYy5w", + "cm90by53ZWJzb2NrZXRzLnYxLldlYnNvY2tldEV2ZW50UmVzcG9uc2VIAEIJ", + "Cgdjb250ZW50IhYKFFJlZ2lzdHJhdGlvblJlc3BvbnNlIm4KE1JlZ2lzdHJh", + "dGlvblJlcXVlc3QSEwoLc29ja2V0X25hbWUYASABKAkSQgoKZXZlbnRfdHlw", + "ZRgCIAEoDjIuLm5pdHJpYy5wcm90by53ZWJzb2NrZXRzLnYxLldlYnNvY2tl", + "dEV2ZW50VHlwZSK5AgoVV2Vic29ja2V0RXZlbnRSZXF1ZXN0EhMKC3NvY2tl", + "dF9uYW1lGAEgASgJEhQKDGNvbm5lY3Rpb25JZBgCIAEoCRJKCgpjb25uZWN0", + "aW9uGAogASgLMjQubml0cmljLnByb3RvLndlYnNvY2tldHMudjEuV2Vic29j", + "a2V0Q29ubmVjdGlvbkV2ZW50SAASUAoNZGlzY29ubmVjdGlvbhgLIAEoCzI3", + "Lm5pdHJpYy5wcm90by53ZWJzb2NrZXRzLnYxLldlYnNvY2tldERpc2Nvbm5l", + "Y3Rpb25FdmVudEgAEkQKB21lc3NhZ2UYDCABKAsyMS5uaXRyaWMucHJvdG8u", + "d2Vic29ja2V0cy52MS5XZWJzb2NrZXRNZXNzYWdlRXZlbnRIAEIRCg93ZWJz", + "b2NrZXRfZXZlbnQiGwoKUXVlcnlWYWx1ZRINCgV2YWx1ZRgBIAMoCSLPAQoN", + "U2VydmVyTWVzc2FnZRIKCgJpZBgBIAEoCRJRChVyZWdpc3RyYXRpb25fcmVz", + "cG9uc2UYAiABKAsyMC5uaXRyaWMucHJvdG8ud2Vic29ja2V0cy52MS5SZWdp", + "c3RyYXRpb25SZXNwb25zZUgAElQKF3dlYnNvY2tldF9ldmVudF9yZXF1ZXN0", + "GAMgASgLMjEubml0cmljLnByb3RvLndlYnNvY2tldHMudjEuV2Vic29ja2V0", + "RXZlbnRSZXF1ZXN0SABCCQoHY29udGVudCKGAQoWV2Vic29ja2V0RXZlbnRS", + "ZXNwb25zZRJWChNjb25uZWN0aW9uX3Jlc3BvbnNlGAogASgLMjcubml0cmlj", + "LnByb3RvLndlYnNvY2tldHMudjEuV2Vic29ja2V0Q29ubmVjdGlvblJlc3Bv", + "bnNlSABCFAoSd2Vic29ja2V0X3Jlc3BvbnNlItMBChhXZWJzb2NrZXRDb25u", + "ZWN0aW9uRXZlbnQSWwoMcXVlcnlfcGFyYW1zGAEgAygLMkUubml0cmljLnBy", + "b3RvLndlYnNvY2tldHMudjEuV2Vic29ja2V0Q29ubmVjdGlvbkV2ZW50LlF1", + "ZXJ5UGFyYW1zRW50cnkaWgoQUXVlcnlQYXJhbXNFbnRyeRILCgNrZXkYASAB", + "KAkSNQoFdmFsdWUYAiABKAsyJi5uaXRyaWMucHJvdG8ud2Vic29ja2V0cy52", + "MS5RdWVyeVZhbHVlOgI4ASItChtXZWJzb2NrZXRDb25uZWN0aW9uUmVzcG9u", + "c2USDgoGcmVqZWN0GAEgASgIIh0KG1dlYnNvY2tldERpc2Nvbm5lY3Rpb25F", + "dmVudCIlChVXZWJzb2NrZXRNZXNzYWdlRXZlbnQSDAoEYm9keRgBIAEoDCo+", + "ChJXZWJzb2NrZXRFdmVudFR5cGUSCwoHQ29ubmVjdBAAEg4KCkRpc2Nvbm5l", + "Y3QQARILCgdNZXNzYWdlEAIyigMKCVdlYnNvY2tldBJyCgtTZW5kTWVzc2Fn", + "ZRIwLm5pdHJpYy5wcm90by53ZWJzb2NrZXRzLnYxLldlYnNvY2tldFNlbmRS", + "ZXF1ZXN0GjEubml0cmljLnByb3RvLndlYnNvY2tldHMudjEuV2Vic29ja2V0", + "U2VuZFJlc3BvbnNlEowBCg9DbG9zZUNvbm5lY3Rpb24SOy5uaXRyaWMucHJv", + "dG8ud2Vic29ja2V0cy52MS5XZWJzb2NrZXRDbG9zZUNvbm5lY3Rpb25SZXF1", + "ZXN0Gjwubml0cmljLnByb3RvLndlYnNvY2tldHMudjEuV2Vic29ja2V0Q2xv", + "c2VDb25uZWN0aW9uUmVzcG9uc2USegoNU29ja2V0RGV0YWlscxIzLm5pdHJp", + "Yy5wcm90by53ZWJzb2NrZXRzLnYxLldlYnNvY2tldERldGFpbHNSZXF1ZXN0", + "GjQubml0cmljLnByb3RvLndlYnNvY2tldHMudjEuV2Vic29ja2V0RGV0YWls", + "c1Jlc3BvbnNlMnwKEFdlYnNvY2tldEhhbmRsZXISaAoMSGFuZGxlRXZlbnRz", + "Eikubml0cmljLnByb3RvLndlYnNvY2tldHMudjEuQ2xpZW50TWVzc2FnZRop", + "Lm5pdHJpYy5wcm90by53ZWJzb2NrZXRzLnYxLlNlcnZlck1lc3NhZ2UoATAB", + "QrYBCh1pby5uaXRyaWMucHJvdG8ud2Vic29ja2V0cy52MUIRV2Vic29ja2V0", + "c1NlcnZpY2VQAVpGZ2l0aHViLmNvbS9uaXRyaWN0ZWNoL25pdHJpYy9jb3Jl", + "L3BrZy9wcm90by93ZWJzb2NrZXRzL3YxO3dlYnNvY2tldHNwYqoCGk5pdHJp", + "Yy5Qcm90by5XZWJzb2NrZXRzLnYxygIaTml0cmljXFByb3RvXFdlYnNvY2tl", + "dHNcVjFiBnByb3RvMw==")); descriptor = pbr::FileDescriptor.FromGeneratedCode(descriptorData, new pbr::FileDescriptor[] { }, new pbr::GeneratedClrTypeInfo(new[] {typeof(global::Nitric.Proto.Websockets.v1.WebsocketEventType), }, null, new pbr::GeneratedClrTypeInfo[] { @@ -86,8 +88,8 @@ static WebsocketsReflection() { new pbr::GeneratedClrTypeInfo(typeof(global::Nitric.Proto.Websockets.v1.WebsocketDetailsResponse), global::Nitric.Proto.Websockets.v1.WebsocketDetailsResponse.Parser, new[]{ "Url" }, null, null, null, null), new pbr::GeneratedClrTypeInfo(typeof(global::Nitric.Proto.Websockets.v1.WebsocketSendRequest), global::Nitric.Proto.Websockets.v1.WebsocketSendRequest.Parser, new[]{ "SocketName", "ConnectionId", "Data" }, null, null, null, null), new pbr::GeneratedClrTypeInfo(typeof(global::Nitric.Proto.Websockets.v1.WebsocketSendResponse), global::Nitric.Proto.Websockets.v1.WebsocketSendResponse.Parser, null, null, null, null, null), - new pbr::GeneratedClrTypeInfo(typeof(global::Nitric.Proto.Websockets.v1.WebsocketCloseRequest), global::Nitric.Proto.Websockets.v1.WebsocketCloseRequest.Parser, new[]{ "SocketName", "ConnectionId" }, null, null, null, null), - new pbr::GeneratedClrTypeInfo(typeof(global::Nitric.Proto.Websockets.v1.WebsocketCloseResponse), global::Nitric.Proto.Websockets.v1.WebsocketCloseResponse.Parser, null, null, null, null, null), + new pbr::GeneratedClrTypeInfo(typeof(global::Nitric.Proto.Websockets.v1.WebsocketCloseConnectionRequest), global::Nitric.Proto.Websockets.v1.WebsocketCloseConnectionRequest.Parser, new[]{ "SocketName", "ConnectionId" }, null, null, null, null), + new pbr::GeneratedClrTypeInfo(typeof(global::Nitric.Proto.Websockets.v1.WebsocketCloseConnectionResponse), global::Nitric.Proto.Websockets.v1.WebsocketCloseConnectionResponse.Parser, null, null, null, null, null), new pbr::GeneratedClrTypeInfo(typeof(global::Nitric.Proto.Websockets.v1.ClientMessage), global::Nitric.Proto.Websockets.v1.ClientMessage.Parser, new[]{ "Id", "RegistrationRequest", "WebsocketEventResponse" }, new[]{ "Content" }, null, null, null), new pbr::GeneratedClrTypeInfo(typeof(global::Nitric.Proto.Websockets.v1.RegistrationResponse), global::Nitric.Proto.Websockets.v1.RegistrationResponse.Parser, null, null, null, null, null), new pbr::GeneratedClrTypeInfo(typeof(global::Nitric.Proto.Websockets.v1.RegistrationRequest), global::Nitric.Proto.Websockets.v1.RegistrationRequest.Parser, new[]{ "SocketName", "EventType" }, null, null, null, null), @@ -856,15 +858,15 @@ public void MergeFrom(pb::CodedInputStream input) { } - public sealed partial class WebsocketCloseRequest : pb::IMessage + public sealed partial class WebsocketCloseConnectionRequest : pb::IMessage #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE , pb::IBufferMessage #endif { - private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new WebsocketCloseRequest()); + private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new WebsocketCloseConnectionRequest()); private pb::UnknownFieldSet _unknownFields; [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public static pb::MessageParser Parser { get { return _parser; } } + public static pb::MessageParser Parser { get { return _parser; } } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public static pbr::MessageDescriptor Descriptor { @@ -877,22 +879,22 @@ public sealed partial class WebsocketCloseRequest : pb::IMessageField number for the "socket_name" field. @@ -925,11 +927,11 @@ public string ConnectionId { [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public override bool Equals(object other) { - return Equals(other as WebsocketCloseRequest); + return Equals(other as WebsocketCloseConnectionRequest); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public bool Equals(WebsocketCloseRequest other) { + public bool Equals(WebsocketCloseConnectionRequest other) { if (ReferenceEquals(other, null)) { return false; } @@ -1009,7 +1011,7 @@ public int CalculateSize() { } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void MergeFrom(WebsocketCloseRequest other) { + public void MergeFrom(WebsocketCloseConnectionRequest other) { if (other == null) { return; } @@ -1070,15 +1072,15 @@ public void MergeFrom(pb::CodedInputStream input) { } - public sealed partial class WebsocketCloseResponse : pb::IMessage + public sealed partial class WebsocketCloseConnectionResponse : pb::IMessage #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE , pb::IBufferMessage #endif { - private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new WebsocketCloseResponse()); + private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new WebsocketCloseConnectionResponse()); private pb::UnknownFieldSet _unknownFields; [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public static pb::MessageParser Parser { get { return _parser; } } + public static pb::MessageParser Parser { get { return _parser; } } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public static pbr::MessageDescriptor Descriptor { @@ -1091,29 +1093,29 @@ public sealed partial class WebsocketCloseResponse : pb::IMessage - /// Messages the client is able to send to the server + /// ClientMessages are sent from the service to the nitric server /// public sealed partial class ClientMessage : pb::IMessage #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE @@ -1260,7 +1262,7 @@ public ClientMessage Clone() { public const int IdFieldNumber = 1; private string id_ = ""; /// - /// Client message ID, used to pair requests/responses + /// Globally unique id to pair requests/responses /// [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public string Id { @@ -2431,7 +2433,7 @@ public void MergeFrom(pb::CodedInputStream input) { } /// - /// Messages the server is able to send to the client + /// ServerMessages are sent from the nitric server to the service /// public sealed partial class ServerMessage : pb::IMessage #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE diff --git a/src/Nitric.Sdk/Proto/nitric/proto/websockets/v1/WebsocketsGrpc.cs b/src/Nitric.Sdk/Proto/nitric/proto/websockets/v1/WebsocketsGrpc.cs index 5bae226..5cd8c8c 100644 --- a/src/Nitric.Sdk/Proto/nitric/proto/websockets/v1/WebsocketsGrpc.cs +++ b/src/Nitric.Sdk/Proto/nitric/proto/websockets/v1/WebsocketsGrpc.cs @@ -44,29 +44,29 @@ static T __Helper_DeserializeMessage(grpc::DeserializationContext context, gl static readonly grpc::Marshaller __Marshaller_nitric_proto_websockets_v1_WebsocketSendRequest = grpc::Marshallers.Create(__Helper_SerializeMessage, context => __Helper_DeserializeMessage(context, global::Nitric.Proto.Websockets.v1.WebsocketSendRequest.Parser)); static readonly grpc::Marshaller __Marshaller_nitric_proto_websockets_v1_WebsocketSendResponse = grpc::Marshallers.Create(__Helper_SerializeMessage, context => __Helper_DeserializeMessage(context, global::Nitric.Proto.Websockets.v1.WebsocketSendResponse.Parser)); - static readonly grpc::Marshaller __Marshaller_nitric_proto_websockets_v1_WebsocketCloseRequest = grpc::Marshallers.Create(__Helper_SerializeMessage, context => __Helper_DeserializeMessage(context, global::Nitric.Proto.Websockets.v1.WebsocketCloseRequest.Parser)); - static readonly grpc::Marshaller __Marshaller_nitric_proto_websockets_v1_WebsocketCloseResponse = grpc::Marshallers.Create(__Helper_SerializeMessage, context => __Helper_DeserializeMessage(context, global::Nitric.Proto.Websockets.v1.WebsocketCloseResponse.Parser)); + static readonly grpc::Marshaller __Marshaller_nitric_proto_websockets_v1_WebsocketCloseConnectionRequest = grpc::Marshallers.Create(__Helper_SerializeMessage, context => __Helper_DeserializeMessage(context, global::Nitric.Proto.Websockets.v1.WebsocketCloseConnectionRequest.Parser)); + static readonly grpc::Marshaller __Marshaller_nitric_proto_websockets_v1_WebsocketCloseConnectionResponse = grpc::Marshallers.Create(__Helper_SerializeMessage, context => __Helper_DeserializeMessage(context, global::Nitric.Proto.Websockets.v1.WebsocketCloseConnectionResponse.Parser)); static readonly grpc::Marshaller __Marshaller_nitric_proto_websockets_v1_WebsocketDetailsRequest = grpc::Marshallers.Create(__Helper_SerializeMessage, context => __Helper_DeserializeMessage(context, global::Nitric.Proto.Websockets.v1.WebsocketDetailsRequest.Parser)); static readonly grpc::Marshaller __Marshaller_nitric_proto_websockets_v1_WebsocketDetailsResponse = grpc::Marshallers.Create(__Helper_SerializeMessage, context => __Helper_DeserializeMessage(context, global::Nitric.Proto.Websockets.v1.WebsocketDetailsResponse.Parser)); - static readonly grpc::Method __Method_Send = new grpc::Method( + static readonly grpc::Method __Method_SendMessage = new grpc::Method( grpc::MethodType.Unary, __ServiceName, - "Send", + "SendMessage", __Marshaller_nitric_proto_websockets_v1_WebsocketSendRequest, __Marshaller_nitric_proto_websockets_v1_WebsocketSendResponse); - static readonly grpc::Method __Method_Close = new grpc::Method( + static readonly grpc::Method __Method_CloseConnection = new grpc::Method( grpc::MethodType.Unary, __ServiceName, - "Close", - __Marshaller_nitric_proto_websockets_v1_WebsocketCloseRequest, - __Marshaller_nitric_proto_websockets_v1_WebsocketCloseResponse); + "CloseConnection", + __Marshaller_nitric_proto_websockets_v1_WebsocketCloseConnectionRequest, + __Marshaller_nitric_proto_websockets_v1_WebsocketCloseConnectionResponse); - static readonly grpc::Method __Method_Details = new grpc::Method( + static readonly grpc::Method __Method_SocketDetails = new grpc::Method( grpc::MethodType.Unary, __ServiceName, - "Details", + "SocketDetails", __Marshaller_nitric_proto_websockets_v1_WebsocketDetailsRequest, __Marshaller_nitric_proto_websockets_v1_WebsocketDetailsResponse); @@ -86,7 +86,7 @@ public abstract partial class WebsocketBase /// The request received from the client. /// The context of the server-side call handler being invoked. /// The response to send back to the client (wrapped by a task). - public virtual global::System.Threading.Tasks.Task Send(global::Nitric.Proto.Websockets.v1.WebsocketSendRequest request, grpc::ServerCallContext context) + public virtual global::System.Threading.Tasks.Task SendMessage(global::Nitric.Proto.Websockets.v1.WebsocketSendRequest request, grpc::ServerCallContext context) { throw new grpc::RpcException(new grpc::Status(grpc::StatusCode.Unimplemented, "")); } @@ -98,7 +98,7 @@ public abstract partial class WebsocketBase /// The request received from the client. /// The context of the server-side call handler being invoked. /// The response to send back to the client (wrapped by a task). - public virtual global::System.Threading.Tasks.Task Close(global::Nitric.Proto.Websockets.v1.WebsocketCloseRequest request, grpc::ServerCallContext context) + public virtual global::System.Threading.Tasks.Task CloseConnection(global::Nitric.Proto.Websockets.v1.WebsocketCloseConnectionRequest request, grpc::ServerCallContext context) { throw new grpc::RpcException(new grpc::Status(grpc::StatusCode.Unimplemented, "")); } @@ -109,7 +109,7 @@ public abstract partial class WebsocketBase /// The request received from the client. /// The context of the server-side call handler being invoked. /// The response to send back to the client (wrapped by a task). - public virtual global::System.Threading.Tasks.Task Details(global::Nitric.Proto.Websockets.v1.WebsocketDetailsRequest request, grpc::ServerCallContext context) + public virtual global::System.Threading.Tasks.Task SocketDetails(global::Nitric.Proto.Websockets.v1.WebsocketDetailsRequest request, grpc::ServerCallContext context) { throw new grpc::RpcException(new grpc::Status(grpc::StatusCode.Unimplemented, "")); } @@ -147,9 +147,9 @@ protected WebsocketClient(ClientBaseConfiguration configuration) : base(configur /// An optional deadline for the call. The call will be cancelled if deadline is hit. /// An optional token for canceling the call. /// The response received from the server. - public virtual global::Nitric.Proto.Websockets.v1.WebsocketSendResponse Send(global::Nitric.Proto.Websockets.v1.WebsocketSendRequest request, grpc::Metadata headers = null, global::System.DateTime? deadline = null, global::System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken)) + public virtual global::Nitric.Proto.Websockets.v1.WebsocketSendResponse SendMessage(global::Nitric.Proto.Websockets.v1.WebsocketSendRequest request, grpc::Metadata headers = null, global::System.DateTime? deadline = null, global::System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken)) { - return Send(request, new grpc::CallOptions(headers, deadline, cancellationToken)); + return SendMessage(request, new grpc::CallOptions(headers, deadline, cancellationToken)); } /// /// Send a messages to a websocket @@ -157,9 +157,9 @@ protected WebsocketClient(ClientBaseConfiguration configuration) : base(configur /// The request to send to the server. /// The options for the call. /// The response received from the server. - public virtual global::Nitric.Proto.Websockets.v1.WebsocketSendResponse Send(global::Nitric.Proto.Websockets.v1.WebsocketSendRequest request, grpc::CallOptions options) + public virtual global::Nitric.Proto.Websockets.v1.WebsocketSendResponse SendMessage(global::Nitric.Proto.Websockets.v1.WebsocketSendRequest request, grpc::CallOptions options) { - return CallInvoker.BlockingUnaryCall(__Method_Send, null, options, request); + return CallInvoker.BlockingUnaryCall(__Method_SendMessage, null, options, request); } /// /// Send a messages to a websocket @@ -169,9 +169,9 @@ protected WebsocketClient(ClientBaseConfiguration configuration) : base(configur /// An optional deadline for the call. The call will be cancelled if deadline is hit. /// An optional token for canceling the call. /// The call object. - public virtual grpc::AsyncUnaryCall SendAsync(global::Nitric.Proto.Websockets.v1.WebsocketSendRequest request, grpc::Metadata headers = null, global::System.DateTime? deadline = null, global::System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken)) + public virtual grpc::AsyncUnaryCall SendMessageAsync(global::Nitric.Proto.Websockets.v1.WebsocketSendRequest request, grpc::Metadata headers = null, global::System.DateTime? deadline = null, global::System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken)) { - return SendAsync(request, new grpc::CallOptions(headers, deadline, cancellationToken)); + return SendMessageAsync(request, new grpc::CallOptions(headers, deadline, cancellationToken)); } /// /// Send a messages to a websocket @@ -179,9 +179,9 @@ protected WebsocketClient(ClientBaseConfiguration configuration) : base(configur /// The request to send to the server. /// The options for the call. /// The call object. - public virtual grpc::AsyncUnaryCall SendAsync(global::Nitric.Proto.Websockets.v1.WebsocketSendRequest request, grpc::CallOptions options) + public virtual grpc::AsyncUnaryCall SendMessageAsync(global::Nitric.Proto.Websockets.v1.WebsocketSendRequest request, grpc::CallOptions options) { - return CallInvoker.AsyncUnaryCall(__Method_Send, null, options, request); + return CallInvoker.AsyncUnaryCall(__Method_SendMessage, null, options, request); } /// /// Close a websocket connection @@ -192,9 +192,9 @@ protected WebsocketClient(ClientBaseConfiguration configuration) : base(configur /// An optional deadline for the call. The call will be cancelled if deadline is hit. /// An optional token for canceling the call. /// The response received from the server. - public virtual global::Nitric.Proto.Websockets.v1.WebsocketCloseResponse Close(global::Nitric.Proto.Websockets.v1.WebsocketCloseRequest request, grpc::Metadata headers = null, global::System.DateTime? deadline = null, global::System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken)) + public virtual global::Nitric.Proto.Websockets.v1.WebsocketCloseConnectionResponse CloseConnection(global::Nitric.Proto.Websockets.v1.WebsocketCloseConnectionRequest request, grpc::Metadata headers = null, global::System.DateTime? deadline = null, global::System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken)) { - return Close(request, new grpc::CallOptions(headers, deadline, cancellationToken)); + return CloseConnection(request, new grpc::CallOptions(headers, deadline, cancellationToken)); } /// /// Close a websocket connection @@ -203,9 +203,9 @@ protected WebsocketClient(ClientBaseConfiguration configuration) : base(configur /// The request to send to the server. /// The options for the call. /// The response received from the server. - public virtual global::Nitric.Proto.Websockets.v1.WebsocketCloseResponse Close(global::Nitric.Proto.Websockets.v1.WebsocketCloseRequest request, grpc::CallOptions options) + public virtual global::Nitric.Proto.Websockets.v1.WebsocketCloseConnectionResponse CloseConnection(global::Nitric.Proto.Websockets.v1.WebsocketCloseConnectionRequest request, grpc::CallOptions options) { - return CallInvoker.BlockingUnaryCall(__Method_Close, null, options, request); + return CallInvoker.BlockingUnaryCall(__Method_CloseConnection, null, options, request); } /// /// Close a websocket connection @@ -216,9 +216,9 @@ protected WebsocketClient(ClientBaseConfiguration configuration) : base(configur /// An optional deadline for the call. The call will be cancelled if deadline is hit. /// An optional token for canceling the call. /// The call object. - public virtual grpc::AsyncUnaryCall CloseAsync(global::Nitric.Proto.Websockets.v1.WebsocketCloseRequest request, grpc::Metadata headers = null, global::System.DateTime? deadline = null, global::System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken)) + public virtual grpc::AsyncUnaryCall CloseConnectionAsync(global::Nitric.Proto.Websockets.v1.WebsocketCloseConnectionRequest request, grpc::Metadata headers = null, global::System.DateTime? deadline = null, global::System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken)) { - return CloseAsync(request, new grpc::CallOptions(headers, deadline, cancellationToken)); + return CloseConnectionAsync(request, new grpc::CallOptions(headers, deadline, cancellationToken)); } /// /// Close a websocket connection @@ -227,9 +227,9 @@ protected WebsocketClient(ClientBaseConfiguration configuration) : base(configur /// The request to send to the server. /// The options for the call. /// The call object. - public virtual grpc::AsyncUnaryCall CloseAsync(global::Nitric.Proto.Websockets.v1.WebsocketCloseRequest request, grpc::CallOptions options) + public virtual grpc::AsyncUnaryCall CloseConnectionAsync(global::Nitric.Proto.Websockets.v1.WebsocketCloseConnectionRequest request, grpc::CallOptions options) { - return CallInvoker.AsyncUnaryCall(__Method_Close, null, options, request); + return CallInvoker.AsyncUnaryCall(__Method_CloseConnection, null, options, request); } /// /// Retrieve details about an API @@ -239,9 +239,9 @@ protected WebsocketClient(ClientBaseConfiguration configuration) : base(configur /// An optional deadline for the call. The call will be cancelled if deadline is hit. /// An optional token for canceling the call. /// The response received from the server. - public virtual global::Nitric.Proto.Websockets.v1.WebsocketDetailsResponse Details(global::Nitric.Proto.Websockets.v1.WebsocketDetailsRequest request, grpc::Metadata headers = null, global::System.DateTime? deadline = null, global::System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken)) + public virtual global::Nitric.Proto.Websockets.v1.WebsocketDetailsResponse SocketDetails(global::Nitric.Proto.Websockets.v1.WebsocketDetailsRequest request, grpc::Metadata headers = null, global::System.DateTime? deadline = null, global::System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken)) { - return Details(request, new grpc::CallOptions(headers, deadline, cancellationToken)); + return SocketDetails(request, new grpc::CallOptions(headers, deadline, cancellationToken)); } /// /// Retrieve details about an API @@ -249,9 +249,9 @@ protected WebsocketClient(ClientBaseConfiguration configuration) : base(configur /// The request to send to the server. /// The options for the call. /// The response received from the server. - public virtual global::Nitric.Proto.Websockets.v1.WebsocketDetailsResponse Details(global::Nitric.Proto.Websockets.v1.WebsocketDetailsRequest request, grpc::CallOptions options) + public virtual global::Nitric.Proto.Websockets.v1.WebsocketDetailsResponse SocketDetails(global::Nitric.Proto.Websockets.v1.WebsocketDetailsRequest request, grpc::CallOptions options) { - return CallInvoker.BlockingUnaryCall(__Method_Details, null, options, request); + return CallInvoker.BlockingUnaryCall(__Method_SocketDetails, null, options, request); } /// /// Retrieve details about an API @@ -261,9 +261,9 @@ protected WebsocketClient(ClientBaseConfiguration configuration) : base(configur /// An optional deadline for the call. The call will be cancelled if deadline is hit. /// An optional token for canceling the call. /// The call object. - public virtual grpc::AsyncUnaryCall DetailsAsync(global::Nitric.Proto.Websockets.v1.WebsocketDetailsRequest request, grpc::Metadata headers = null, global::System.DateTime? deadline = null, global::System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken)) + public virtual grpc::AsyncUnaryCall SocketDetailsAsync(global::Nitric.Proto.Websockets.v1.WebsocketDetailsRequest request, grpc::Metadata headers = null, global::System.DateTime? deadline = null, global::System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken)) { - return DetailsAsync(request, new grpc::CallOptions(headers, deadline, cancellationToken)); + return SocketDetailsAsync(request, new grpc::CallOptions(headers, deadline, cancellationToken)); } /// /// Retrieve details about an API @@ -271,9 +271,9 @@ protected WebsocketClient(ClientBaseConfiguration configuration) : base(configur /// The request to send to the server. /// The options for the call. /// The call object. - public virtual grpc::AsyncUnaryCall DetailsAsync(global::Nitric.Proto.Websockets.v1.WebsocketDetailsRequest request, grpc::CallOptions options) + public virtual grpc::AsyncUnaryCall SocketDetailsAsync(global::Nitric.Proto.Websockets.v1.WebsocketDetailsRequest request, grpc::CallOptions options) { - return CallInvoker.AsyncUnaryCall(__Method_Details, null, options, request); + return CallInvoker.AsyncUnaryCall(__Method_SocketDetails, null, options, request); } /// Creates a new instance of client from given ClientBaseConfiguration. protected override WebsocketClient NewInstance(ClientBaseConfiguration configuration) @@ -287,9 +287,9 @@ protected override WebsocketClient NewInstance(ClientBaseConfiguration configura public static grpc::ServerServiceDefinition BindService(WebsocketBase serviceImpl) { return grpc::ServerServiceDefinition.CreateBuilder() - .AddMethod(__Method_Send, serviceImpl.Send) - .AddMethod(__Method_Close, serviceImpl.Close) - .AddMethod(__Method_Details, serviceImpl.Details).Build(); + .AddMethod(__Method_SendMessage, serviceImpl.SendMessage) + .AddMethod(__Method_CloseConnection, serviceImpl.CloseConnection) + .AddMethod(__Method_SocketDetails, serviceImpl.SocketDetails).Build(); } /// Register service method with a service binder with or without implementation. Useful when customizing the service binding logic. @@ -298,9 +298,9 @@ protected override WebsocketClient NewInstance(ClientBaseConfiguration configura /// An object implementing the server-side handling logic. public static void BindService(grpc::ServiceBinderBase serviceBinder, WebsocketBase serviceImpl) { - serviceBinder.AddMethod(__Method_Send, serviceImpl == null ? null : new grpc::UnaryServerMethod(serviceImpl.Send)); - serviceBinder.AddMethod(__Method_Close, serviceImpl == null ? null : new grpc::UnaryServerMethod(serviceImpl.Close)); - serviceBinder.AddMethod(__Method_Details, serviceImpl == null ? null : new grpc::UnaryServerMethod(serviceImpl.Details)); + serviceBinder.AddMethod(__Method_SendMessage, serviceImpl == null ? null : new grpc::UnaryServerMethod(serviceImpl.SendMessage)); + serviceBinder.AddMethod(__Method_CloseConnection, serviceImpl == null ? null : new grpc::UnaryServerMethod(serviceImpl.CloseConnection)); + serviceBinder.AddMethod(__Method_SocketDetails, serviceImpl == null ? null : new grpc::UnaryServerMethod(serviceImpl.SocketDetails)); } } diff --git a/src/Nitric.Sdk/Resource/ApiResource.cs b/src/Nitric.Sdk/Resource/ApiResource.cs index d0032a8..ee65d2a 100644 --- a/src/Nitric.Sdk/Resource/ApiResource.cs +++ b/src/Nitric.Sdk/Resource/ApiResource.cs @@ -1,425 +1,454 @@ -//// Copyright 2021, Nitric Technologies Pty Ltd. -//// -//// 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. -//using System; -//using System.Linq; -//using System.Collections.Generic; -//using System.Threading.Tasks; -//using Google.Api; -//using Nitric.Proto.Resources.v1; -//using Nitric.Sdk.Function; -//using GrpcClient = Nitric.Proto.Secrets.v1.SecretManager.SecretManagerClient; -//using NitricResource = Nitric.Proto.Resources.v1.ResourceIdentifier; -//using ProtoApiResource = Nitric.Proto.Resources.v1.ApiResource; -//using ProtoSecurityDefinition = Nitric.Proto.Resources.v1.ApiSecurityDefinitionResource; -//using ProtoSecurityDefinitionJwt = Nitric.Proto.Resources.v1.ApiOpenIdConnectionDefinition; - - -//namespace Nitric.Sdk.Resource -//{ -// public abstract class SecurityDefinition { -// internal string Kind { get; private set; } - -// internal SecurityDefinition(string kind) -// { -// this.Kind = kind; -// } -// } - -// public class JwtSecurityDefinition : SecurityDefinition -// { -// internal string Issuer { get; private set; } -// internal string[] Audiences { get; private set; } - -// internal JwtSecurityDefinition(string Issuer, string[] Audiences) : base("jwt") -// { -// this.Issuer = Issuer; -// this.Audiences = Audiences; -// } -// } - -// public class ApiDetails { -// internal string ID { get; set; } -// internal string Provider { get; set; } -// internal string Service { get; set; } -// internal string URL { get; set; } -// } - - -// public class ApiOptions -// { -// public Dictionary SecurityDefinitions { get; private set; } -// public Dictionary Security { get; private set; } -// public string BasePath { get; private set; } -// public Middleware[] Middleware { get; private set; } - -// public ApiOptions( -// Dictionary securityDefinitions = null, -// Dictionary security = null, -// string basePath = "", -// Middleware[] middleware = null -// ) -// { -// this.SecurityDefinitions = securityDefinitions ?? new Dictionary(); -// this.Security = security ?? new Dictionary(); -// this.BasePath = basePath; -// this.Middleware = middleware ?? new Middleware[] { }; -// } -// } - - -// public class ApiResource : BaseResource -// { -// internal readonly ApiOptions Opts; - -// internal ApiResource(string name, ApiOptions options = null) : base(name, ResourceType.Api) -// { -// this.Opts = options ?? new ApiOptions(); -// } - -// internal ApiResource Method(string route, HttpMethod[] methods, Func handler) -// { -// var opts = new MethodOptions -// { -// Security = this.Opts.Security, -// SecurityDefs = this.Opts.SecurityDefinitions -// }; - -// var faas = new Faas(new ApiWorkerOptions -// { -// Api = this.Name, -// Route = this.Opts.BasePath + route, -// Methods = methods.ToHashSet(), -// Options = opts -// }); - -// faas.Http(this.Opts.Middleware); - -// faas.Http(handler); - -// Nitric.RegisterWorker(faas); -// return this; -// } - -// internal ApiResource Method(string route, HttpMethod[] methods, Middleware[] middleware) -// { -// var opts = new MethodOptions -// { -// Security = this.Opts.Security, -// SecurityDefs = this.Opts.SecurityDefinitions -// }; - -// var faas = new Faas(new ApiWorkerOptions -// { -// Api = this.Name, -// Route = this.Opts.BasePath + route, -// Methods = methods.ToHashSet(), -// Options = opts -// }); - -// var combinedMiddleware = this.Opts.Middleware.Concat(middleware).ToArray(); - -// faas.Http(combinedMiddleware); - -// Nitric.RegisterWorker(faas); -// return this; -// } - -// /// -// /// Create a new GET handler on the specified route. -// /// -// /// -// /// -// public ApiResource Get(string route, Func handler) => Method(route, new HttpMethod[] { HttpMethod.GET }, handler); - -// /// -// /// Create a new GET handler on the specified route. -// /// -// /// -// /// -// public ApiResource Get(string route, params Middleware[] handlers) => Method(route, new HttpMethod[] { HttpMethod.GET }, handlers); - -// /// -// /// Create a new POST handler on the specified route. -// /// -// /// -// /// -// public ApiResource Post(string route, Func handler) => Method(route, new HttpMethod[] { HttpMethod.POST }, handler); - -// /// -// /// Create a new POST handler on the specified route. -// /// -// /// -// /// -// public ApiResource Post(string route, params Middleware[] handlers) => Method(route, new HttpMethod[] { HttpMethod.POST }, handlers); - -// /// -// /// Create a new PUT handler on the specified route. -// /// -// /// -// /// -// public ApiResource Put(string route, Func handler) => Method(route, new HttpMethod[] { HttpMethod.PUT }, handler); - -// /// -// /// Create a new PUT handler on the specified route. -// /// -// /// -// /// -// public ApiResource Put(string route, params Middleware[] handlers) => Method(route, new HttpMethod[] { HttpMethod.PUT }, handlers); - -// /// -// /// Create a new DELETE handler on the specified route. -// /// -// /// -// /// -// public ApiResource Delete(string route, Func handler) => Method(route, new HttpMethod[] { HttpMethod.DELETE }, handler); - -// /// -// /// Create a new DELETE handler on the specified route. -// /// -// /// -// /// -// public ApiResource Delete(string route, params Middleware[] handlers) => Method(route, new HttpMethod[] { HttpMethod.DELETE }, handlers); - -// /// -// /// Create a new OPTIONS handler on the specified route. -// /// -// /// -// /// -// public ApiResource Options(string route, Func handler) => Method(route, new HttpMethod[] { HttpMethod.OPTIONS }, handler); - -// /// -// /// Create a new OPTIONS handler on the specified route. -// /// -// /// -// /// -// public ApiResource Options(string route, params Middleware[] handlers) => Method(route, new HttpMethod[] { HttpMethod.OPTIONS }, handlers); - -// /// -// /// Create a new handler on the specified route for every HTTP verb. -// /// -// /// -// /// -// public ApiResource All(string route, Func handler) => Method(route, (HttpMethod[])Enum.GetValues(typeof(HttpMethod)), handler); - -// /// -// /// Create a new handler on the specified route for every HTTP verb. -// /// -// /// -// /// -// public ApiResource All(string route, params Middleware[] handlers) => Method(route, (HttpMethod[])Enum.GetValues(typeof(HttpMethod)), handlers); - -// /// -// /// Create a new route on a specified path. -// /// -// /// An ApiRoute that handlers can be added to. -// /// -// public ApiRoute Route(string path) -// { -// return new ApiRoute(this, this.Opts.BasePath + path, new RouteOptions()); -// } - -// /// -// /// Create a new route on a specified path. -// /// -// /// An ApiRoute that handlers can be added to. -// /// -// /// -// public ApiRoute Route(string path, RouteOptions options) -// { -// return new ApiRoute(this, this.Opts.BasePath + path, options); -// } - -// internal override BaseResource Register() -// { -// var resource = new NitricResource { Name = this.Name, Type = ResourceType.Api }; -// var apiResource = new ProtoApiResource(); - -// foreach (KeyValuePair kv in this.Opts.Security) -// { -// var scopes = new ApiScopes(); - -// scopes.Scopes.Add(kv.Value); - -// apiResource.Security.Add(kv.Key, scopes); -// } - -// foreach (KeyValuePair kv in this.Opts.SecurityDefinitions) { -// var definition = new ProtoSecurityDefinition(); - -// if (kv.Value.Kind == "jwt") -// { -// var jwtSecurityDefinition = kv.Value as JwtSecurityDefinition; -// var secDef = new ApiOpenIdConnectionDefinition -// { -// Issuer = jwtSecurityDefinition.Issuer -// }; - -// secDef.Audiences.AddRange(jwtSecurityDefinition.Audiences); - -// definition.Oidc = secDef; -// } - -// apiResource.SecurityDefinitions.Add(kv.Key, definition); -// } - -// var request = new ResourceDeclareRequest { Id = resource, Api = apiResource }; -// BaseResource.client.Declare(request); - -// return this; -// } - -// /// -// /// Retrieve details about the deployed API at runtime. These details include: -// /// - ID: the identifier for the resource. -// /// - Provider: the cloud provider that this API is deployed to. -// /// - Service: the cloud service that is running this API (i.e. AWS API Gateway). -// /// - URL: the url of the deployed API. -// /// -// /// The details of the API -// // public ApiDetails Details() { -// // var resource = new NitricResource { Name = this.Name, Type = ResourceType.Api }; - -// // var request = new ResourceDetailsRequest { Resource = resource }; -// // var response = client.Details(request); - -// // return new ApiDetails -// // { -// // ID = response.Id, -// // Provider = response.Provider, -// // Service = response.Service, -// // URL = response.Api.Url, -// // }; -// // } -// } - -// public class RouteOptions -// { -// // The middleware that is run on every route -// public Middleware[] Middlewares { get; set; } - -// // Security rules to apply to this specific route -// public Dictionary Security { get; set; } -// } - -// public class ApiRoute -// { -// // The api that this route is on -// private readonly ApiResource api; - -// // The path that this route's handlers respond to -// public readonly string Path; - -// // Options for the API route, including middleware and security -// public readonly RouteOptions Opts; - -// internal ApiRoute(ApiResource api, string path, RouteOptions opts) -// { -// this.api = api; -// this.Path = path; - -// var composedMiddleware = this.api.Opts.Middleware.Concat(opts.Middlewares).ToArray(); -// this.Opts = new RouteOptions { -// Middlewares = composedMiddleware, -// Security = opts.Security -// }; -// } - -// private Middleware[] ConcatMiddleware(Func handler) -// { -// HttpContext ComposedMiddleware(HttpContext context, Func next) -// { -// context = handler(context); -// return next(context); -// }; -// return this.Opts.Middlewares.Append(ComposedMiddleware).ToArray(); -// } - -// private Middleware[] ConcatMiddleware(Middleware[] middlewares) -// { -// return this.Opts.Middlewares.Concat(middlewares).ToArray(); -// } - -// /// -// /// Create a new GET handler on the specified route. -// /// -// /// -// public ApiResource Get(Func handler) => this.api.Method(this.Path, new HttpMethod[] { HttpMethod.GET }, ConcatMiddleware(handler)); - -// /// -// /// Create a new GET middleware chain on the specified route. -// /// -// /// -// public ApiResource Get(params Middleware[] handlers) => this.api.Method(this.Path, new HttpMethod[] { HttpMethod.GET }, ConcatMiddleware(handlers)); - -// /// -// /// Create a new POST handler on the specified route. -// /// -// /// -// public ApiResource Post(Func handler) => this.api.Method(this.Path, new HttpMethod[] { HttpMethod.POST }, ConcatMiddleware(handler)); - -// /// -// /// Create a new POST middleware chain on the specified route. -// /// -// /// -// public ApiResource Post(params Middleware[] handlers) => this.api.Method(this.Path, new HttpMethod[] { HttpMethod.POST}, ConcatMiddleware(handlers)); - -// /// -// /// Create a new PUT handler on the specified route. -// /// -// /// -// public ApiResource Put(Func handler) => this.api.Method(this.Path, new HttpMethod[] { HttpMethod.PUT}, ConcatMiddleware(handler)); - -// /// -// /// Create a new PUT middleware chain on the specified route. -// /// -// /// -// public ApiResource Put(params Middleware[] handlers) => this.api.Method(this.Path, new HttpMethod[] { HttpMethod.POST }, ConcatMiddleware(handlers)); - -// /// -// /// Create a new DELETE handler on the specified route. -// /// -// /// -// public ApiResource Delete(Func handler) => this.api.Method(this.Path, new HttpMethod[] { HttpMethod.DELETE }, ConcatMiddleware(handler)); - -// /// -// /// Create a new DELETE middleware chain on the specified route. -// /// -// /// -// public ApiResource Delete(params Middleware[] handlers) => this.api.Method(this.Path, new HttpMethod[] { HttpMethod.DELETE }, ConcatMiddleware(handlers)); - -// /// -// /// Create a new OPTIONS handler on the specified route. -// /// -// /// -// public ApiResource Options(Func handler) => this.api.Method(this.Path, new HttpMethod[] { HttpMethod.OPTIONS }, ConcatMiddleware(handler)); - -// /// -// /// Create a new OPTIONS middleware chain on the specified route. -// /// -// /// -// public ApiResource Options(params Middleware[] handlers) => this.api.Method(this.Path, new HttpMethod[] { HttpMethod.OPTIONS }, ConcatMiddleware(handlers)); - -// /// -// /// Create a new handler on the specified route for every HTTP verb. -// /// -// /// -// public ApiResource All(Func handler) => this.api.Method(this.Path, (HttpMethod[])Enum.GetValues(typeof(HttpMethod)), ConcatMiddleware(handler)); - -// /// -// /// Create a new chain of middleware on the specified route for every HTTP verb. -// /// -// /// -// public ApiResource All(params Middleware[] handlers) => this.api.Method(this.Path, (HttpMethod[])Enum.GetValues(typeof(HttpMethod)), ConcatMiddleware(handlers)); -// } -//} +// Copyright 2021, Nitric Technologies Pty Ltd. +// +// 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. +using System; +using System.Linq; +using System.Collections.Generic; +using Nitric.Proto.Resources.v1; +using Nitric.Proto.Apis.v1; +using Nitric.Sdk.Service; +using Nitric.Sdk.Worker; +using NitricResource = Nitric.Proto.Resources.v1.ResourceIdentifier; +using ProtoApiResource = Nitric.Proto.Resources.v1.ApiResource; +using ProtoSecurityDefinition = Nitric.Proto.Resources.v1.ApiSecurityDefinitionResource; +using ProtoSecurityDefinitionJwt = Nitric.Proto.Resources.v1.ApiOpenIdConnectionDefinition; +using System.Net.Http; +using Google.Protobuf.Collections; +using System.Runtime.InteropServices; + +namespace Nitric.Sdk.Resource +{ + public abstract class SecurityDefinition + { + internal string Kind { get; private set; } + + internal SecurityDefinition(string kind) + { + this.Kind = kind; + } + } + + public class JwtSecurityDefinition : SecurityDefinition + { + internal string Issuer { get; private set; } + internal string[] Audiences { get; private set; } + + internal JwtSecurityDefinition(string Issuer, string[] Audiences) : base("jwt") + { + this.Issuer = Issuer; + this.Audiences = Audiences; + } + } + + public class ApiDetails + { + internal string ID { get; set; } + internal string Provider { get; set; } + internal string Service { get; set; } + internal string URL { get; set; } + } + + + public class ApiOptions + { + public Dictionary SecurityDefinitions { get; private set; } + public Dictionary Security { get; private set; } + public string BasePath { get; private set; } + public Middleware[] Middleware { get; private set; } + + public ApiOptions( + Dictionary securityDefinitions = null, + Dictionary security = null, + string basePath = "", + Middleware[] middleware = null + ) + { + this.SecurityDefinitions = securityDefinitions ?? new Dictionary(); + this.Security = security ?? new Dictionary(); + this.BasePath = basePath; + this.Middleware = middleware ?? new Middleware[] { }; + } + } + + + public class ApiResource : BaseResource + { + internal readonly ApiOptions Opts; + + internal ApiResource(string name, ApiOptions options = null) : base(name, ResourceType.Api) + { + this.Opts = options ?? new ApiOptions(); + } + + internal ApiResource Method(string route, HttpMethod[] methods, Func handler) + { + var opts = new ApiWorkerOptions + { + SecurityDisabled = true, + }; + + if (this.Opts.Security.Count > 0) + { + var security = this.Opts.Security.ToDictionary((kv) => kv.Key, kv => + { + var scopes = new ApiWorkerScopes(); + scopes.Scopes.Add(kv.Value); + + return scopes; + }); + + opts.Security.Add(security); + opts.SecurityDisabled = false; + } + + var registrationRequest = new RegistrationRequest + { + Api = this.Name, + Options = opts, + Path = route, + }; + + registrationRequest.Methods.AddRange(methods.Select((method) => method.Method).ToHashSet()); + + + var apiWorker = new ApiWorker(registrationRequest, handler); + + Nitric.RegisterWorker(apiWorker); + return this; + } + + internal ApiResource Method(string route, HttpMethod[] methods, Middleware[] middleware) + { + var opts = new ApiWorkerOptions + { + SecurityDisabled = true, + }; + + if (this.Opts.Security.Count > 0) + { + var security = this.Opts.Security.ToDictionary((kv) => kv.Key, kv => + { + var scopes = new ApiWorkerScopes(); + scopes.Scopes.Add(kv.Value); + + return scopes; + }); + + opts.Security.Add(security); + opts.SecurityDisabled = false; + } + + var registrationRequest = new RegistrationRequest + { + Api = this.Name, + Options = opts, + Path = route, + }; + + registrationRequest.Methods.AddRange(methods.Select((method) => method.Method).ToHashSet()); + + + var apiWorker = new ApiWorker(registrationRequest, middleware); + + Nitric.RegisterWorker(apiWorker); + return this; + } + + /// + /// Create a new GET handler on the specified route. + /// + /// + /// + public ApiResource Get(string route, Func handler) => Method(route, new HttpMethod[] { HttpMethod.Get }, handler); + + /// + /// Create a new GET handler on the specified route. + /// + /// + /// + public ApiResource Get(string route, params Middleware[] handlers) => Method(route, new HttpMethod[] { HttpMethod.Get }, handlers); + + /// + /// Create a new POST handler on the specified route. + /// + /// + /// + public ApiResource Post(string route, Func handler) => Method(route, new HttpMethod[] { HttpMethod.Post }, handler); + + /// + /// Create a new POST handler on the specified route. + /// + /// + /// + public ApiResource Post(string route, params Middleware[] handlers) => Method(route, new HttpMethod[] { HttpMethod.Post }, handlers); + + /// + /// Create a new PUT handler on the specified route. + /// + /// + /// + public ApiResource Put(string route, Func handler) => Method(route, new HttpMethod[] { HttpMethod.Put }, handler); + + /// + /// Create a new PUT handler on the specified route. + /// + /// + /// + public ApiResource Put(string route, params Middleware[] handlers) => Method(route, new HttpMethod[] { HttpMethod.Put }, handlers); + + /// + /// Create a new DELETE handler on the specified route. + /// + /// + /// + public ApiResource Delete(string route, Func handler) => Method(route, new HttpMethod[] { HttpMethod.Delete }, handler); + + /// + /// Create a new DELETE handler on the specified route. + /// + /// + /// + public ApiResource Delete(string route, params Middleware[] handlers) => Method(route, new HttpMethod[] { HttpMethod.Delete }, handlers); + + /// + /// Create a new OPTIONS handler on the specified route. + /// + /// + /// + public ApiResource Options(string route, Func handler) => Method(route, new HttpMethod[] { HttpMethod.Options }, handler); + + /// + /// Create a new OPTIONS handler on the specified route. + /// + /// + /// + public ApiResource Options(string route, params Middleware[] handlers) => Method(route, new HttpMethod[] { HttpMethod.Options }, handlers); + + /// + /// Create a new handler on the specified route for every HTTP verb. + /// + /// + /// + public ApiResource All(string route, Func handler) => Method(route, (HttpMethod[])Enum.GetValues(typeof(HttpMethod)), handler); + + /// + /// Create a new handler on the specified route for every HTTP verb. + /// + /// + /// + public ApiResource All(string route, params Middleware[] handlers) => Method(route, (HttpMethod[])Enum.GetValues(typeof(HttpMethod)), handlers); + + /// + /// Create a new route on a specified path. + /// + /// An ApiRoute that handlers can be added to. + /// + public ApiRoute Route(string path) + { + return new ApiRoute(this, this.Opts.BasePath + path, new RouteOptions()); + } + + /// + /// Create a new route on a specified path. + /// + /// An ApiRoute that handlers can be added to. + /// + /// + public ApiRoute Route(string path, RouteOptions options) + { + return new ApiRoute(this, this.Opts.BasePath + path, options); + } + + internal override BaseResource Register() + { + var resource = new NitricResource { Name = this.Name, Type = ResourceType.Api }; + var apiResource = new ProtoApiResource(); + + foreach (KeyValuePair kv in this.Opts.Security) + { + var scopes = new ApiScopes(); + + scopes.Scopes.Add(kv.Value); + + apiResource.Security.Add(kv.Key, scopes); + } + + foreach (KeyValuePair kv in this.Opts.SecurityDefinitions) + { + var definition = new ProtoSecurityDefinition(); + + if (kv.Value.Kind == "jwt") + { + var jwtSecurityDefinition = kv.Value as JwtSecurityDefinition; + var secDef = new ProtoSecurityDefinitionJwt + { + Issuer = jwtSecurityDefinition.Issuer + }; + + secDef.Audiences.AddRange(jwtSecurityDefinition.Audiences); + + definition.Oidc = secDef; + } + } + + var request = new ResourceDeclareRequest { Id = resource, Api = apiResource }; + BaseResource.client.Declare(request); + + return this; + } + + /// + /// Retrieve details about the deployed API at runtime. These details include: + /// - ID: the identifier for the resource. + /// - Provider: the cloud provider that this API is deployed to. + /// - Service: the cloud service that is running this API (i.e. AWS API Gateway). + /// - URL: the url of the deployed API. + /// + /// The details of the API + // public ApiDetails Details() { + // var resource = new NitricResource { Name = this.Name, Type = ResourceType.Api }; + + // var request = new ResourceDetailsRequest { Resource = resource }; + // var response = client.Details(request); + + // return new ApiDetails + // { + // ID = response.Id, + // Provider = response.Provider, + // Service = response.Service, + // URL = response.Api.Url, + // }; + // } + } + + public class RouteOptions + { + // The middleware that is run on every route + public Middleware[] Middlewares { get; set; } + + // Security rules to apply to this specific route + public Dictionary Security { get; set; } + } + + public class ApiRoute + { + // The api that this route is on + private readonly ApiResource api; + + // The path that this route's handlers respond to + public readonly string Path; + + // Options for the API route, including middleware and security + public readonly RouteOptions Opts; + + internal ApiRoute(ApiResource api, string path, RouteOptions opts) + { + this.api = api; + this.Path = path; + + var composedMiddleware = this.api.Opts.Middleware.Concat(opts.Middlewares).ToArray(); + this.Opts = new RouteOptions + { + Middlewares = composedMiddleware, + Security = opts.Security + }; + } + + private Middleware[] ConcatMiddleware(Func handler) + { + HttpContext ComposedMiddleware(HttpContext context, Func next) + { + context = handler(context); + return next(context); + }; + return this.Opts.Middlewares.Append(ComposedMiddleware).ToArray(); + } + + private Middleware[] ConcatMiddleware(Middleware[] middlewares) + { + return this.Opts.Middlewares.Concat(middlewares).ToArray(); + } + + /// + /// Create a new GET handler on the specified route. + /// + /// + public ApiResource Get(Func handler) => this.api.Method(this.Path, new HttpMethod[] { HttpMethod.Get }, ConcatMiddleware(handler)); + + /// + /// Create a new GET middleware chain on the specified route. + /// + /// + public ApiResource Get(params Middleware[] handlers) => this.api.Method(this.Path, new HttpMethod[] { HttpMethod.Get }, ConcatMiddleware(handlers)); + + /// + /// Create a new POST handler on the specified route. + /// + /// + public ApiResource Post(Func handler) => this.api.Method(this.Path, new HttpMethod[] { HttpMethod.Post }, ConcatMiddleware(handler)); + + /// + /// Create a new POST middleware chain on the specified route. + /// + /// + public ApiResource Post(params Middleware[] handlers) => this.api.Method(this.Path, new HttpMethod[] { HttpMethod.Post }, ConcatMiddleware(handlers)); + + /// + /// Create a new PUT handler on the specified route. + /// + /// + public ApiResource Put(Func handler) => this.api.Method(this.Path, new HttpMethod[] { HttpMethod.Put }, ConcatMiddleware(handler)); + + /// + /// Create a new PUT middleware chain on the specified route. + /// + /// + public ApiResource Put(params Middleware[] handlers) => this.api.Method(this.Path, new HttpMethod[] { HttpMethod.Post }, ConcatMiddleware(handlers)); + + /// + /// Create a new DELETE handler on the specified route. + /// + /// + public ApiResource Delete(Func handler) => this.api.Method(this.Path, new HttpMethod[] { HttpMethod.Delete }, ConcatMiddleware(handler)); + + /// + /// Create a new DELETE middleware chain on the specified route. + /// + /// + public ApiResource Delete(params Middleware[] handlers) => this.api.Method(this.Path, new HttpMethod[] { HttpMethod.Delete }, ConcatMiddleware(handlers)); + + /// + /// Create a new OPTIONS handler on the specified route. + /// + /// + public ApiResource Options(Func handler) => this.api.Method(this.Path, new HttpMethod[] { HttpMethod.Options }, ConcatMiddleware(handler)); + + /// + /// Create a new OPTIONS middleware chain on the specified route. + /// + /// + public ApiResource Options(params Middleware[] handlers) => this.api.Method(this.Path, new HttpMethod[] { HttpMethod.Options }, ConcatMiddleware(handlers)); + + /// + /// Create a new handler on the specified route for every HTTP verb. + /// + /// + public ApiResource All(Func handler) => this.api.Method(this.Path, (HttpMethod[])Enum.GetValues(typeof(HttpMethod)), ConcatMiddleware(handler)); + + /// + /// Create a new chain of middleware on the specified route for every HTTP verb. + /// + /// + public ApiResource All(params Middleware[] handlers) => this.api.Method(this.Path, (HttpMethod[])Enum.GetValues(typeof(HttpMethod)), ConcatMiddleware(handlers)); + } +} diff --git a/src/Nitric.Sdk/Resource/TopicResource.cs b/src/Nitric.Sdk/Resource/TopicResource.cs index 9122cb0..3a3b551 100644 --- a/src/Nitric.Sdk/Resource/TopicResource.cs +++ b/src/Nitric.Sdk/Resource/TopicResource.cs @@ -1,102 +1,107 @@ -//// Copyright 2021, Nitric Technologies Pty Ltd. -//// -//// 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. -//using System; -//using System.Collections.Generic; -//using System.Linq; -//using Nitric.Proto.Resources.v1; -//using Nitric.Sdk.Topic; -//using Action = Nitric.Proto.Resources.v1.Action; -//using NitricResource = Nitric.Proto.Resources.v1.ResourceIdentifier; -//using ResourceType = Nitric.Proto.Resources.v1.ResourceType; +// Copyright 2021, Nitric Technologies Pty Ltd. +// +// 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. +using System; +using System.Collections.Generic; +using System.Linq; +using Nitric.Proto.Resources.v1; +using Nitric.Proto.Topics.v1; +using Nitric.Sdk.Service; +using Nitric.Sdk.Topic; +using Nitric.Sdk.Worker; +using Action = Nitric.Proto.Resources.v1.Action; +using NitricResource = Nitric.Proto.Resources.v1.ResourceIdentifier; +using ResourceType = Nitric.Proto.Resources.v1.ResourceType; -//namespace Nitric.Sdk.Resource -//{ -// /// -// /// Available permissions for topic resources. -// /// -// public enum TopicPermission -// { -// /// -// /// Enables pushing new events to the topic. -// /// -// Publishing -// } +namespace Nitric.Sdk.Resource +{ + /// + /// Available permissions for topic resources. + /// + public enum TopicPermission + { + /// + /// Enables pushing new events to the topic. + /// + Publishing + } -// public class TopicResource : SecureResource -// { -// internal TopicResource(string name) : base(name, ResourceType.Topic) -// { -// } + public class TopicResource : SecureResource + { + internal TopicResource(string name) : base(name, ResourceType.Topic) + { + } -// internal override BaseResource Register() -// { -// var resource = new NitricResource { Name = this.Name, Type = ResourceType.Topic }; -// var request = new ResourceDeclareRequest { Id = resource }; -// BaseResource.client.Declare(request); -// return this; -// } + internal override BaseResource Register() + { + var resource = new NitricResource { Name = this.Name, Type = ResourceType.Topic }; + var request = new ResourceDeclareRequest { Id = resource }; + BaseResource.client.Declare(request); + return this; + } -// protected override IEnumerable PermissionsToActions(IEnumerable permissions) -// { -// var actionMap = new Dictionary> -// { -// { -// TopicPermission.Publishing, -// new List { Action.TopicEventPublish, Action.TopicList, Action.TopicDetail } -// } -// }; -// return permissions.Aggregate((IEnumerable)new List(), (acc, x) => acc.Concat(actionMap[x])) -// .Distinct(); -// } + protected override IEnumerable PermissionsToActions(IEnumerable permissions) + { + var actionMap = new Dictionary> + { + { + TopicPermission.Publishing, + new List { Action.TopicPublish } + } + }; + return permissions.Aggregate((IEnumerable)new List(), (acc, x) => acc.Concat(actionMap[x])) + .Distinct(); + } -// /// -// /// Registers a chain of middleware to be called whenever a new event is published to this topic. -// /// -// /// The middleware to call to process events -// public void Subscribe(params Middleware[] middleware) -// { -// var subWorker = new Faas(new SubscriptionWorkerOptions { Topic = this.Name }); + /// + /// Registers a chain of middleware to be called whenever a new event is published to this topic. + /// + /// The middleware to call to process events + public void Subscribe(params Middleware>[] middleware) + { + var registrationRequest = new RegistrationRequest { TopicName = this.Name }; -// subWorker.Event(middleware); + var subWorker = new SubscriptionWorker(registrationRequest, middleware); -// Nitric.RegisterWorker(subWorker); -// } + Nitric.RegisterWorker(subWorker); + } -// /// -// /// Registers a handler to be called whenever a new event is published to this topic. -// /// -// /// The handler to call to process events -// public void Subscribe(Func handler) -// { -// var subWorker = new Faas(new SubscriptionWorkerOptions { Topic = this.Name }); + /// + /// Registers a handler to be called whenever a new event is published to this topic. + /// + /// The handler to call to process events + public void Subscribe(Func, MessageContext> handler) + { + var registrationRequest = new RegistrationRequest { TopicName = this.Name }; -// subWorker.Event(handler); -// Nitric.RegisterWorker(subWorker); -// } + var subWorker = new SubscriptionWorker(registrationRequest, handler); -// /// -// /// Request specific access to this topic. -// /// -// /// The permissions that the function has to access the topic. -// /// A reference to the topic. -// public Topic With(TopicPermission permission, params TopicPermission[] permissions) -// { -// var allPerms = new List { permission }; -// allPerms.AddRange(permissions); + Nitric.RegisterWorker(subWorker); + } -// this.RegisterPolicy(allPerms); -// return new EventsClient().Topic(this.Name); -// } -// } -//} + /// + /// Request specific access to this topic. + /// + /// The permissions that the function has to access the topic. + /// A reference to the topic. + public Topic With(TopicPermission permission, params TopicPermission[] permissions) + { + var allPerms = new List { permission }; + allPerms.AddRange(permissions); + + this.RegisterPolicy(allPerms); + + return new TopicsClient().Topic(this.Name); + } + } +} diff --git a/src/Nitric.Sdk/Service/BucketNotificationContext.cs b/src/Nitric.Sdk/Service/BlobEventContext.cs similarity index 78% rename from src/Nitric.Sdk/Service/BucketNotificationContext.cs rename to src/Nitric.Sdk/Service/BlobEventContext.cs index 578d8bc..a563cea 100644 --- a/src/Nitric.Sdk/Service/BucketNotificationContext.cs +++ b/src/Nitric.Sdk/Service/BlobEventContext.cs @@ -14,6 +14,8 @@ using System; using Nitric.Proto.Storage.v1; +using Nitric.Sdk.Storage; +using ProtoBlobEventResponse = Nitric.Proto.Storage.v1.BlobEventResponse; namespace Nitric.Sdk.Service { @@ -26,12 +28,12 @@ public enum BucketNotificationType /// /// Represents a bucket notification being created by a write or delete event in the bucket /// - public class BucketNotificationRequest : TriggerRequest + public class BlobEventRequest : TriggerRequest { /// /// A reference to the file that triggered this request /// - public string Key { get; private set; } + public File File { get; private set; } /// /// The type of event that triggered this request @@ -46,9 +48,9 @@ public class BucketNotificationRequest : TriggerRequest /// the file that triggered the notification /// the type of bucket notification /// the bucket that triggered the notification - public BucketNotificationRequest(string key, BucketNotificationType notificationType) : base() + public BlobEventRequest(string key, BucketNotificationType notificationType, Bucket bucket) : base() { - this.Key = key; + this.File = bucket.File(key); this.NotificationType = notificationType; } } @@ -56,7 +58,7 @@ public BucketNotificationRequest(string key, BucketNotificationType notification /// /// Represents the results of processing a bucket notification. /// - public class BucketNotificationResponse : TriggerResponse + public class BlobEventResponse : TriggerResponse { /// /// Indicates whether the event was successfully processed. @@ -68,8 +70,8 @@ public class BucketNotificationResponse : TriggerResponse /// /// Construct a bucket notification response. /// - /// Indicates whether the event was successfully processed. - public BucketNotificationResponse(bool success) + /// Indicates whether the event was successfully processed. + public BlobEventResponse(bool success) { this.Success = success; } @@ -78,14 +80,14 @@ public BucketNotificationResponse(bool success) /// /// Represents the request/response context for a bucket notification. /// - public class BucketNotificationContext : TriggerContext + public class BlobEventContext : TriggerContext { /// /// Construct a new BucketNotificationContext. /// /// The request object /// The response object - public BucketNotificationContext(string id, BucketNotificationRequest req, BucketNotificationResponse res) : base(id, req, res) + public BlobEventContext(string id, BlobEventRequest req, BlobEventResponse res) : base(id, req, res) { } @@ -95,17 +97,18 @@ public BucketNotificationContext(string id, BucketNotificationRequest req, Bucke /// The trigger to convert into a BucketNotificationContext. /// The bucket notification worker options describing the worker options. /// the new bucket notification context - public static BucketNotificationContext FromRequest(ServerMessage trigger) + public static BlobEventContext FromRequest(ServerMessage trigger, Bucket bucket) { var notificationType = FromGrpcBucketNotificationType(trigger.BlobEventRequest.BlobEvent.Type); - return new BucketNotificationContext( + return new BlobEventContext( trigger.Id, - new BucketNotificationRequest( + new BlobEventRequest( trigger.BlobEventRequest.BlobEvent.Key, - notificationType + notificationType, + bucket ), - new BucketNotificationResponse(true)); + new BlobEventResponse(true)); } @@ -126,7 +129,7 @@ private static BucketNotificationType FromGrpcBucketNotificationType( /// the new trigger response public ClientMessage ToResponse() { - return new ClientMessage { Id = Id, BlobEventResponse = new BlobEventResponse { Success = this.Res.Success } }; + return new ClientMessage { Id = Id, BlobEventResponse = new ProtoBlobEventResponse { Success = this.Res.Success } }; } } } diff --git a/src/Nitric.Sdk/Service/HttpContext.cs b/src/Nitric.Sdk/Service/HttpContext.cs index 26f51c5..8d80697 100644 --- a/src/Nitric.Sdk/Service/HttpContext.cs +++ b/src/Nitric.Sdk/Service/HttpContext.cs @@ -157,7 +157,7 @@ public HttpContext(string id, HttpRequest req, HttpResponse res) : base(id, req, /// /// /// - public static HttpContext FromRequest(ServerMessage trigger) + internal static HttpContext FromRequest(ServerMessage trigger) { var headers = new Dictionary>(); foreach (var kv in trigger.HttpRequest.Headers) @@ -187,7 +187,7 @@ public static HttpContext FromRequest(ServerMessage trigger) /// Create a gRPC trigger response from this context. /// /// - public ClientMessage ToResponse() + internal ClientMessage ToResponse() { var responseHeaders = new MapField { diff --git a/src/Nitric.Sdk/Service/IntervalContext.cs b/src/Nitric.Sdk/Service/IntervalContext.cs index 963a935..3152553 100644 --- a/src/Nitric.Sdk/Service/IntervalContext.cs +++ b/src/Nitric.Sdk/Service/IntervalContext.cs @@ -60,7 +60,7 @@ public IntervalContext(string id, IntervalRequest req, IntervalResponse res) : b /// /// The trigger to convert into an EventContext. /// the new event context - public static IntervalContext FromRequest(ServerMessage trigger) + internal static IntervalContext FromRequest(ServerMessage trigger) { return new IntervalContext(trigger.Id, new IntervalRequest(trigger.IntervalRequest.ScheduleName), new IntervalResponse()); @@ -70,7 +70,7 @@ public static IntervalContext FromRequest(ServerMessage trigger) /// Create a gRPC trigger response from this context. /// /// - public ClientMessage ToRequest() + internal ClientMessage ToResponse() { return new ClientMessage { Id = Id, IntervalResponse = new Proto.Schedules.v1.IntervalResponse() }; } diff --git a/src/Nitric.Sdk/Service/MessageContext.cs b/src/Nitric.Sdk/Service/MessageContext.cs index bf3b53e..571097c 100644 --- a/src/Nitric.Sdk/Service/MessageContext.cs +++ b/src/Nitric.Sdk/Service/MessageContext.cs @@ -15,31 +15,30 @@ using Nitric.Sdk.Common; using Nitric.Proto.Topics.v1; using ProtoMessageResponse = Nitric.Proto.Topics.v1.MessageResponse; -using System.Collections.Generic; namespace Nitric.Sdk.Service { /// /// Represents a message pushed to a subscriber via a topic. /// - public class MessageRequest : TriggerRequest + public class MessageRequest : TriggerRequest { /// /// The name of the topic that triggered this request /// public string TopicName { get; private set; } - public Dictionary Payload { get; private set; } + public T Payload { get; private set; } /// /// Construct an event request /// /// the source topic /// the message payload - public MessageRequest(string topicName, Message message) : base() + public MessageRequest(string topicName, TopicMessage message) : base() { this.TopicName = topicName; - this.Payload = Struct.ToDictionary(message.StructPayload); + this.Payload = Struct.ToJsonSerializable(message.StructPayload); } } @@ -68,14 +67,14 @@ public MessageResponse(bool success) /// /// Represents the request/response context for an event. /// - public class MessageContext : TriggerContext + public class MessageContext : TriggerContext, MessageResponse> { /// /// Construct a new EventContext. /// /// The request object /// The response object - public MessageContext(string id, MessageRequest req, MessageResponse res) : base(id, req, res) + public MessageContext(string id, MessageRequest req, MessageResponse res) : base(id, req, res) { } @@ -84,9 +83,9 @@ public MessageContext(string id, MessageRequest req, MessageResponse res) : base /// /// The trigger to convert into an EventContext. /// the new event context - protected static MessageContext FromRequest(ServerMessage trigger) + internal static MessageContext FromRequest(ServerMessage trigger) { - return new MessageContext(trigger.Id, new MessageRequest(trigger.MessageRequest.TopicName, trigger.MessageRequest.Message), + return new MessageContext(trigger.Id, new MessageRequest(trigger.MessageRequest.TopicName, trigger.MessageRequest.Message), new MessageResponse(true)); } @@ -94,7 +93,7 @@ protected static MessageContext FromRequest(ServerMessage trigger) /// Create a gRPC trigger response from this context. /// /// - protected ClientMessage ToResponse() + internal ClientMessage ToResponse() { return new ClientMessage { diff --git a/src/Nitric.Sdk/Storage/Bucket.cs b/src/Nitric.Sdk/Storage/Bucket.cs index 07c1a9f..015ad80 100644 --- a/src/Nitric.Sdk/Storage/Bucket.cs +++ b/src/Nitric.Sdk/Storage/Bucket.cs @@ -1,124 +1,124 @@ -//// Copyright 2021, Nitric Technologies Pty Ltd. -//// -//// 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. -//using System; -//using System.Collections.Generic; -//using Nitric.Proto.Storage.v1; -//using Nitric.Sdk.Service; -//using ProtoFile = Nitric.Proto.Storage.v1.Object; - - -//namespace Nitric.Sdk.Storage -//{ -// /// -// /// A reference to a bucket in the storage service. -// /// -// public class Bucket -// { -// private readonly Storage storage; - -// /// -// /// The name of the bucket. -// /// -// public string Name { get; private set; } - -// internal Bucket(Storage storage, string name) -// { -// this.storage = storage; -// this.Name = name; -// } - -// /// -// /// Create a reference to a file in the bucket. -// /// -// /// The files name/path -// /// The file reference. -// /// -// public File File(string key) -// { -// if (string.IsNullOrEmpty(key)) -// { -// throw new ArgumentNullException(nameof(key)); -// } - -// return new File(storage, this, key); -// } - -// /// -// /// Get a list of files in a bucket. -// /// -// /// All the files in the bucket as Nitric file references. -// public List Files() -// { -// var request = new StorageListFilesRequest -// { -// BucketName = this.Name, -// }; - -// var resp = this.storage.Client.ListFiles(request); - -// List files = new List(); - -// foreach (ProtoFile file in resp.Files) -// { -// files.Add(new File(this.storage, this, file.Key)); -// } - -// return files; -// } - -// /// -// /// Registers handlers to be called whenever a file triggers an event in the bucket -// /// -// /// The type of events that should trigger events, Write or Delete -// /// The prefix of file names that should trigger events -// /// The handlers to call to process notification events -// public void On( -// BucketNotificationType notificationType, -// string notificationPrefixFilter, -// params Middleware[] middleware) -// { -// var notificationWorker = new Faas(new FileNotificationWorkerOptions( -// this, -// notificationType, -// notificationPrefixFilter -// )); - -// notificationWorker.FileNotification(middleware); - -// Nitric.RegisterWorker(notificationWorker); -// } - -// /// -// /// Registers a handler to be called whenever a file triggers an event in the bucket -// /// -// /// The type of events that should trigger events, Write or Delete -// /// The prefix of file names that should trigger events -// /// The handler to call to process notification events -// public void On( -// BucketNotificationType notificationType, -// string notificationPrefixFilter, -// Func handler) -// { -// var notificationWorker = new Faas(new FileNotificationWorkerOptions( -// this, -// notificationType, -// notificationPrefixFilter -// )); - -// notificationWorker.FileNotification(handler); - -// Nitric.RegisterWorker(notificationWorker); -// } -// } -//} +// Copyright 2021, Nitric Technologies Pty Ltd. +// +// 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. +using System; +using System.Collections.Generic; +using Nitric.Proto.Storage.v1; +using Nitric.Sdk.Service; +using ProtoFile = Nitric.Proto.Storage.v1.Object; + + +namespace Nitric.Sdk.Storage +{ + /// + /// A reference to a bucket in the storage service. + /// + public class Bucket + { + private readonly Storage storage; + + /// + /// The name of the bucket. + /// + public string Name { get; private set; } + + internal Bucket(Storage storage, string name) + { + this.storage = storage; + this.Name = name; + } + + /// + /// Create a reference to a file in the bucket. + /// + /// The files name/path + /// The file reference. + /// + public File File(string key) + { + if (string.IsNullOrEmpty(key)) + { + throw new ArgumentNullException(nameof(key)); + } + + return new File(storage, this, key); + } + + /// + /// Get a list of files in a bucket. + /// + /// All the files in the bucket as Nitric file references. + public List Files() + { + var request = new StorageListFilesRequest + { + BucketName = this.Name, + }; + + var resp = this.storage.Client.ListFiles(request); + + List files = new List(); + + foreach (ProtoFile file in resp.Files) + { + files.Add(new File(this.storage, this, file.Key)); + } + + return files; + } + + /// + /// Registers handlers to be called whenever a file triggers an event in the bucket + /// + /// The type of events that should trigger events, Write or Delete + /// The prefix of file names that should trigger events + /// The handlers to call to process notification events + public void On( + BucketNotificationType notificationType, + string notificationPrefixFilter, + params Middleware[] middleware) + { + var notificationWorker = new Faas(new FileNotificationWorkerOptions( + this, + notificationType, + notificationPrefixFilter + )); + + notificationWorker.FileNotification(middleware); + + Nitric.RegisterWorker(notificationWorker); + } + + /// + /// Registers a handler to be called whenever a file triggers an event in the bucket + /// + /// The type of events that should trigger events, Write or Delete + /// The prefix of file names that should trigger events + /// The handler to call to process notification events + public void On( + BucketNotificationType notificationType, + string notificationPrefixFilter, + Func handler) + { + var notificationWorker = new Faas(new FileNotificationWorkerOptions( + this, + notificationType, + notificationPrefixFilter + )); + + notificationWorker.FileNotification(handler); + + Nitric.RegisterWorker(notificationWorker); + } + } +} diff --git a/src/Nitric.Sdk/Storage/File.cs b/src/Nitric.Sdk/Storage/File.cs index 375c521..ab13f33 100644 --- a/src/Nitric.Sdk/Storage/File.cs +++ b/src/Nitric.Sdk/Storage/File.cs @@ -1,203 +1,204 @@ -//// Copyright 2021, Nitric Technologies Pty Ltd. -//// -//// 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. +// Copyright 2021, Nitric Technologies Pty Ltd. +// +// 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. -//using System; -//using System.Text; -//using Google.Protobuf; -//using Nitric.Proto.Storage.v1; -//using Nitric.Sdk.Common; -//using Nitric.Sdk.Function; -//using ProtoFile = Nitric.Proto.Storage.v1.Object; +using System; +using System.Text; +using Google.Protobuf; +using Nitric.Proto.Storage.v1; +using Nitric.Sdk.Common; +using Nitric.Sdk.Function; +using ProtoFile = Nitric.Proto.Storage.v1.Object; -//namespace Nitric.Sdk.Storage -//{ -// /// -// /// Available operations for signing a url. -// /// -// public enum FileMode -// { -// /// -// /// Download a file from a bucket. -// /// -// Read, -// /// -// /// Upload a file to a bucket. -// /// -// Write, -// } +namespace Nitric.Sdk.Storage +{ + /// + /// Available operations for signing a url. + /// + public enum FileMode + { + /// + /// Download a file from a bucket. + /// + Read, + /// + /// Upload a file to a bucket. + /// + Write, + } -// /// -// /// A reference to a specific file in a bucket. -// /// -// public class File -// { -// private readonly Storage storage; -// private readonly Bucket bucket; -// public string Name { get; private set; } + /// + /// A reference to a specific file in a bucket. + /// + public class File + { + private readonly Storage storage; + private readonly Bucket bucket; + public string Name { get; private set; } -// internal File(Storage storage, Bucket bucket, string key) -// { -// this.storage = storage; -// this.bucket = bucket; -// this.Name = key; -// } + internal File(Storage storage, Bucket bucket, string key) + { + this.storage = storage; + this.bucket = bucket; + this.Name = key; + } -// /// -// /// Create or update the contents of the file. -// /// -// /// The contents to write. -// /// -// public void Write(byte[] body) -// { -// var request = new StorageWriteRequest -// { -// BucketName = bucket.Name, -// Key = this.Name, -// Body = ByteString.CopyFrom(body) -// }; -// try -// { -// storage.Client.Write(request); -// } -// catch (Grpc.Core.RpcException re) -// { -// throw NitricException.FromRpcException(re); -// } -// } + /// + /// Create or update the contents of the file. + /// + /// The contents to write. + /// + public void Write(byte[] body) + { + var request = new StorageWriteRequest + { + BucketName = bucket.Name, + Key = this.Name, + Body = ByteString.CopyFrom(body) + }; + try + { + storage.Client.Write(request); + } + catch (Grpc.Core.RpcException re) + { + throw NitricException.FromRpcException(re); + } + } -// /// -// /// Create or update the contents of the file. -// /// -// /// The contents to write. -// /// -// public void Write(string body) -// { -// var request = new StorageWriteRequest -// { -// BucketName = bucket.Name, -// Key = this.Name, -// Body = ByteString.CopyFromUtf8(body) -// }; -// try -// { -// storage.Client.Write(request); -// } -// catch (Grpc.Core.RpcException re) -// { -// throw NitricException.FromRpcException(re); -// } -// } + /// + /// Create or update the contents of the file. + /// + /// The contents to write. + /// + public void Write(string body) + { + var request = new StorageWriteRequest + { + BucketName = bucket.Name, + Key = this.Name, + Body = ByteString.CopyFromUtf8(body) + }; + try + { + storage.Client.Write(request); + } + catch (Grpc.Core.RpcException re) + { + throw NitricException.FromRpcException(re); + } + } -// /// -// /// Retrieve the contents of a file. -// /// -// /// The file contents. -// /// -// public byte[] Read() -// { -// var request = new StorageReadRequest -// { -// BucketName = bucket.Name, -// Key = this.Name -// }; -// try -// { -// var response = storage.Client.Read(request); -// return response.Body.ToByteArray(); -// } -// catch (Grpc.Core.RpcException re) -// { -// throw NitricException.FromRpcException(re); -// } -// } + /// + /// Retrieve the contents of a file. + /// + /// The file contents. + /// + public byte[] Read() + { + var request = new StorageReadRequest + { + BucketName = bucket.Name, + Key = this.Name + }; + try + { + var response = storage.Client.Read(request); + return response.Body.ToByteArray(); + } + catch (Grpc.Core.RpcException re) + { + throw NitricException.FromRpcException(re); + } + } -// /// -// /// Delete the file. -// /// -// /// -// public void Delete() -// { -// var request = new StorageDeleteRequest -// { -// BucketName = bucket.Name, -// Key = this.Name -// }; -// try -// { -// storage.Client.Delete(request); -// } -// catch (Grpc.Core.RpcException re) -// { -// throw NitricException.FromRpcException(re); -// } -// } + /// + /// Delete the file. + /// + /// + public void Delete() + { + var request = new StorageDeleteRequest + { + BucketName = bucket.Name, + Key = this.Name + }; + try + { + storage.Client.Delete(request); + } + catch (Grpc.Core.RpcException re) + { + throw NitricException.FromRpcException(re); + } + } -// /// -// /// Create a presigned URL for reading or writing for the given file reference. -// /// -// /// The mode the URL will access the file with. E.g. reading or writing. -// /// How long the URL should be valid for in seconds. -// /// The signed URL for reading or writing -// internal string PreSignUrl(FileMode mode, int expiry) -// { -// var request = new StoragePreSignUrlRequest -// { -// BucketName = this.bucket.Name, -// Key = this.Name, -// Operation = mode == FileMode.Read ? StoragePreSignUrlRequest.Types.Operation.Read : StoragePreSignUrlRequest.Types.Operation.Write, -// Expiry = expiry < 0 ? 0 : (uint)expiry, + /// + /// Create a presigned URL for reading or writing for the given file reference. + /// + /// The mode the URL will access the file with. E.g. reading or writing. + /// How long the URL should be valid for in seconds. + /// The signed URL for reading or writing + internal string PreSignUrl(FileMode mode, int expiry) + { + var request = new StoragePreSignUrlRequest + { + BucketName = this.bucket.Name, + Key = this.Name, + Operation = mode == FileMode.Read ? StoragePreSignUrlRequest.Types.Operation.Read : StoragePreSignUrlRequest.Types.Operation.Write, + Expiry = expiry < 0 ? 0 : (uint)expiry, -// }; + }; -// try -// { -// var resp = storage.Client.PreSignUrl(request); -// return resp.Url; -// } catch (Grpc.Core.RpcException re) -// { -// throw NitricException.FromRpcException(re); -// } -// } + try + { + var resp = storage.Client.PreSignUrl(request); + return resp.Url; + } + catch (Grpc.Core.RpcException re) + { + throw NitricException.FromRpcException(re); + } + } -// /// -// /// Create a presigned URL for reading a given file reference. -// /// -// /// How long the URL should be valid for in seconds. Defaults to 600 seconds (10 minutes). -// /// The signed URL for reading. -// public string GetDownloadUrl(int expiry = 600) -// { -// return this.PreSignUrl(FileMode.Write, expiry); -// } + /// + /// Create a presigned URL for reading a given file reference. + /// + /// How long the URL should be valid for in seconds. Defaults to 600 seconds (10 minutes). + /// The signed URL for reading. + public string GetDownloadUrl(int expiry = 600) + { + return this.PreSignUrl(FileMode.Write, expiry); + } -// /// -// /// Create a presigned URL for writing to a given file reference. -// /// -// /// How long the URL should be valid for in seconds. Defaults to 600 seconds (10 minutes). -// /// The signed URL for writing. -// public string GetUploadUrl(int expiry = 600) -// { -// return this.PreSignUrl(FileMode.Read, expiry); -// } + /// + /// Create a presigned URL for writing to a given file reference. + /// + /// How long the URL should be valid for in seconds. Defaults to 600 seconds (10 minutes). + /// The signed URL for writing. + public string GetUploadUrl(int expiry = 600) + { + return this.PreSignUrl(FileMode.Read, expiry); + } -// /// -// /// Return a string representation of the file. Will not contain the file contents. -// /// -// /// -// public override string ToString() -// { -// return GetType().Name + "[name=" + Name + "\nbucket=" + bucket.Name + "]"; -// } -// } -//} + /// + /// Return a string representation of the file. Will not contain the file contents. + /// + /// + public override string ToString() + { + return GetType().Name + "[name=" + Name + "\nbucket=" + bucket.Name + "]"; + } + } +} diff --git a/src/Nitric.Sdk/Storage/StorageClient.cs b/src/Nitric.Sdk/Storage/StorageClient.cs index 2f48f35..0203a23 100644 --- a/src/Nitric.Sdk/Storage/StorageClient.cs +++ b/src/Nitric.Sdk/Storage/StorageClient.cs @@ -1,53 +1,53 @@ -//// Copyright 2021, Nitric Technologies Pty Ltd. -//// -//// 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. +// Copyright 2021, Nitric Technologies Pty Ltd. +// +// 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. -//using System; -//using Nitric.Sdk.Common; -//using GrpcClient = Nitric.Proto.Storage.v1.StorageService.StorageServiceClient; +using System; +using Nitric.Sdk.Common; +using GrpcClient = Nitric.Proto.Storage.v1.StorageService.StorageServiceClient; -//namespace Nitric.Sdk.Storage -//{ -// /// -// /// A storage client. -// /// -// public class Storage -// { -// internal readonly GrpcClient Client; +namespace Nitric.Sdk.Storage +{ + /// + /// A storage client. + /// + public class Storage + { + internal readonly GrpcClient Client; -// /// -// /// Create a new storage client. -// /// -// /// Optional internal gRPC client to reuse. -// public Storage(GrpcClient client = null) -// { -// this.Client = client ?? new GrpcClient(GrpcChannelProvider.GetChannel()); -// } + /// + /// Create a new storage client. + /// + /// Optional internal gRPC client to reuse. + public Storage(GrpcClient client = null) + { + this.Client = client ?? new GrpcClient(GrpcChannelProvider.GetChannel()); + } -// /// -// /// Create a reference to a bucket in the storage service. -// /// -// /// The name of the bucket. -// /// The new bucket reference. -// /// -// public Bucket Bucket(string bucketName) -// { -// if (string.IsNullOrEmpty(bucketName)) -// { -// throw new ArgumentNullException(nameof(bucketName)); -// } + /// + /// Create a reference to a bucket in the storage service. + /// + /// The name of the bucket. + /// The new bucket reference. + /// + public Bucket Bucket(string bucketName) + { + if (string.IsNullOrEmpty(bucketName)) + { + throw new ArgumentNullException(nameof(bucketName)); + } -// return new Bucket(this, bucketName); -// } -// } -//} + return new Bucket(this, bucketName); + } + } +} diff --git a/src/Nitric.Sdk/Topic/Topic.cs b/src/Nitric.Sdk/Topic/Topic.cs index c4c2d70..af92e57 100644 --- a/src/Nitric.Sdk/Topic/Topic.cs +++ b/src/Nitric.Sdk/Topic/Topic.cs @@ -1,66 +1,58 @@ -//// Copyright 2021, Nitric Technologies Pty Ltd. -//// -//// 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. +// Copyright 2021, Nitric Technologies Pty Ltd. +// +// 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. -//using Google.Protobuf; -//using Google.Protobuf.WellKnownTypes; -//using Newtonsoft.Json; -//using Nitric.Proto.Topics.v1; -//using Nitric.Sdk.Common; +using Nitric.Proto.Topics.v1; +using Nitric.Sdk.Common; -//namespace Nitric.Sdk.Topic -//{ -// /// -// /// Represents a reference to a topic. -// /// -// public class Topic -// { -// private readonly TopicsClient TopicsClient; -// /// -// /// The name of topic. -// /// -// public string Name { get; private set; } +namespace Nitric.Sdk.Topic +{ + /// + /// Represents a reference to a topic. + /// + public class Topic + { + private readonly TopicsClient TopicsClient; + /// + /// The name of topic. + /// + public string Name { get; private set; } -// internal Topic(TopicsClient TopicsClient, string name) -// { -// this.TopicsClient = TopicsClient; -// this.Name = name; -// } + internal Topic(TopicsClient TopicsClient, string name) + { + this.TopicsClient = TopicsClient; + this.Name = name; + } -// /// -// /// Publish a new message to this topic. -// /// -// /// The message to publish -// /// -// public void Publish(T message) -// { -// Struct structPayload = null; -// if (message != null) -// { -// var jsonPayload = JsonConvert.SerializeObject(message); -// structPayload = JsonParser.Default.Parse(jsonPayload); -// } + /// + /// Publish a new message to this topic. + /// + /// The message to publish + /// + public void Publish(T message) + { + var structPayload = Struct.FromJsonSerializable(message); -// var request = new TopicPublishRequest { TopicName = this.Name, Message = new Message { StructPayload = structPayload } }; + var request = new TopicPublishRequest { TopicName = this.Name, Message = new TopicMessage { StructPayload = structPayload } }; -// try -// { -// this.TopicsClient.TopicClient.Publish(request); -// } -// catch (Grpc.Core.RpcException re) -// { -// throw NitricException.FromRpcException(re); -// } -// } -// } -//} + try + { + this.TopicsClient.Client.Publish(request); + } + catch (Grpc.Core.RpcException re) + { + throw NitricException.FromRpcException(re); + } + } + } +} diff --git a/src/Nitric.Sdk/Topic/TopicsClient.cs b/src/Nitric.Sdk/Topic/TopicsClient.cs index af90875..721da85 100644 --- a/src/Nitric.Sdk/Topic/TopicsClient.cs +++ b/src/Nitric.Sdk/Topic/TopicsClient.cs @@ -1,78 +1,55 @@ -//// Copyright 2021, Nitric Technologies Pty Ltd. -//// -//// 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. +// Copyright 2021, Nitric Technologies Pty Ltd. +// +// 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. -//using System; -//using System.Collections.Generic; -//using System.Linq; -//using Nitric.Sdk.Common; -//using Nitric.Proto.Topics.v1; +using System; +using System.Collections.Generic; +using System.Linq; +using Nitric.Sdk.Common; +using TopicsGrpcClient = Nitric.Proto.Topics.v1.Topics.TopicsClient; -//namespace Nitric.Sdk.Topic -//{ -// /// -// /// Events service client. -// /// -// public class TopicsClient -// { -// internal readonly Topics.TopicsClient TopicClient; -// private readonly Subscriber.SubscriberClient subscriberClient; +namespace Nitric.Sdk.Topic +{ + /// + /// Events service client. + /// + public class TopicsClient + { + internal readonly TopicsGrpcClient Client; -// /// -// /// Create a new events service client. -// /// -// /// The events gRPC client. -// /// The topics gRPC client. -// public TopicsClient(GrpcClient client = null, TopicClient topic = null) -// { -// this.EventClient = client ?? new GrpcClient(GrpcChannelProvider.GetChannel()); -// this.topicClient = topic ?? new TopicClient(GrpcChannelProvider.GetChannel()); -// } + /// + /// Create a new events service client. + /// + /// The topics gRPC client. + public TopicsClient(TopicsGrpcClient topic = null) + { + this.Client = topic ?? new TopicsGrpcClient(GrpcChannelProvider.GetChannel()); + } -// /// -// /// Create a reference to a topic. -// /// -// /// The name of the topic. -// /// The topic reference. -// /// -// public Topic Topic(string topicName) -// { -// if (string.IsNullOrEmpty(topicName)) -// { -// throw new ArgumentNullException(nameof(topicName)); -// } + /// + /// Create a reference to a topic. + /// + /// The name of the topic. + /// The topic reference. + /// + public Topic Topic(string topicName) + { + if (string.IsNullOrEmpty(topicName)) + { + throw new ArgumentNullException(nameof(topicName)); + } -// return new Topic(this, topicName); -// } - -// /// -// /// Return a list of all accessible topics. -// /// -// /// A list of accessible topics. -// /// -// public List> List() -// { -// var request = new TopicListRequest { }; - -// try -// { -// var response = topicClient.List(request); -// return response.Topics.Select(topic => new Topic(this, topic.Name)).ToList(); -// } -// catch (Grpc.Core.RpcException re) -// { -// throw NitricException.FromRpcException(re); -// } -// } -// } -//} + return new Topic(this, topicName); + } + } +} diff --git a/src/Nitric.Sdk/Worker/ApiWorker.cs b/src/Nitric.Sdk/Worker/ApiWorker.cs new file mode 100644 index 0000000..53a3370 --- /dev/null +++ b/src/Nitric.Sdk/Worker/ApiWorker.cs @@ -0,0 +1,55 @@ +using System.Threading; +using System.Threading.Tasks; +using Nitric.Sdk.Common; +using Nitric.Proto.Apis.v1; +using GrpcClient = Nitric.Proto.Apis.v1.Api.ApiClient; +using Nitric.Sdk.Service; +using System; + +namespace Nitric.Sdk.Worker +{ + public class ApiWorker : AbstractWorker + { + readonly private RegistrationRequest RegistrationRequest; + + public ApiWorker(RegistrationRequest request, Func middleware) : base(middleware) + { + this.RegistrationRequest = request; + } + + public ApiWorker(RegistrationRequest request, params Middleware[] middlewares) : base(middlewares) + { + this.RegistrationRequest = request; + } + + public override async Task Start() + { + var client = new GrpcClient(GrpcChannelProvider.GetChannel()); + + var stream = client.Serve(); + + await stream.RequestStream.WriteAsync(new ClientMessage { RegistrationRequest = RegistrationRequest }); + + while (await stream.ResponseStream.MoveNext(CancellationToken.None)) + { + var req = stream.ResponseStream.Current; + + if (req.RegistrationResponse != null) + { + // Schedule connected with Nitric server. + } + else if (req.HttpRequest != null) + { + var ctx = HttpContext.FromRequest(req); + + ctx = this.Middleware(ctx); + + await stream.RequestStream.WriteAsync(ctx.ToResponse()); + } + } + + await stream.RequestStream.CompleteAsync(); + } + } +} + diff --git a/src/Nitric.Sdk/Worker/BlobEventWorker.cs b/src/Nitric.Sdk/Worker/BlobEventWorker.cs new file mode 100644 index 0000000..747bf47 --- /dev/null +++ b/src/Nitric.Sdk/Worker/BlobEventWorker.cs @@ -0,0 +1,57 @@ +using System.Threading; +using System.Threading.Tasks; +using Nitric.Sdk.Common; +using Nitric.Proto.Storage.v1; +using GrpcClient = Nitric.Proto.Storage.v1.StorageListener.StorageListenerClient; +using Nitric.Sdk.Service; +using Nitric.Sdk.Storage; +using System; + +namespace Nitric.Sdk.Worker +{ + public class StorageWorker : AbstractWorker + { + readonly private RegistrationRequest RegistrationRequest; + readonly private Bucket bucket; + + public StorageWorker(RegistrationRequest request, Func middleware) : base(middleware) + { + this.RegistrationRequest = request; + } + + public StorageWorker(RegistrationRequest request, params Middleware[] middlewares) : base(middlewares) + { + this.RegistrationRequest = request; + } + + public override async Task Start() + { + var client = new GrpcClient(GrpcChannelProvider.GetChannel()); + + var stream = client.Listen(); + + await stream.RequestStream.WriteAsync(new ClientMessage { RegistrationRequest = RegistrationRequest }); + + while (await stream.ResponseStream.MoveNext(CancellationToken.None)) + { + var req = stream.ResponseStream.Current; + + if (req.RegistrationResponse != null) + { + // Bucket listener connected with Nitric server. + } + else if (req.BlobEventRequest != null) + { + var ctx = BlobEventContext.FromRequest(req, bucket); + + ctx = this.Middleware(ctx); + + await stream.RequestStream.WriteAsync(ctx.ToResponse()); + } + } + + await stream.RequestStream.CompleteAsync(); + } + } +} + diff --git a/src/Nitric.Sdk/Worker/ScheduleWorker.cs b/src/Nitric.Sdk/Worker/ScheduleWorker.cs index 9623e2b..e5b0d08 100644 --- a/src/Nitric.Sdk/Worker/ScheduleWorker.cs +++ b/src/Nitric.Sdk/Worker/ScheduleWorker.cs @@ -30,15 +30,13 @@ public override async Task Start() await stream.RequestStream.WriteAsync(new ClientMessage { RegistrationRequest = RegistrationRequest }); - Console.WriteLine(RegistrationRequest); - while (await stream.ResponseStream.MoveNext(CancellationToken.None)) { var req = stream.ResponseStream.Current; if (req.RegistrationResponse != null) { - Console.WriteLine("Schedule connected with Nitric server."); + // Schedule connected with Nitric server. } else if (req.IntervalRequest != null) { @@ -46,7 +44,7 @@ public override async Task Start() ctx = this.Middleware(ctx); - await stream.RequestStream.WriteAsync(ctx.ToRequest()); + await stream.RequestStream.WriteAsync(ctx.ToResponse()); } } diff --git a/src/Nitric.Sdk/Worker/SubscriptionWorker.cs b/src/Nitric.Sdk/Worker/SubscriptionWorker.cs new file mode 100644 index 0000000..181a46b --- /dev/null +++ b/src/Nitric.Sdk/Worker/SubscriptionWorker.cs @@ -0,0 +1,57 @@ +using System.Threading; +using System.Threading.Tasks; +using Nitric.Sdk.Common; +using Nitric.Proto.Topics.v1; +using GrpcClient = Nitric.Proto.Topics.v1.Subscriber.SubscriberClient; +using Nitric.Sdk.Service; +using System; + +namespace Nitric.Sdk.Worker +{ + public class SubscriptionWorker : AbstractWorker> + { + readonly private RegistrationRequest RegistrationRequest; + + public SubscriptionWorker(RegistrationRequest request, Func, MessageContext> middleware) : base(middleware) + { + this.RegistrationRequest = request; + } + + public SubscriptionWorker(RegistrationRequest request, params Middleware>[] middlewares) : base(middlewares) + { + this.RegistrationRequest = request; + } + + public override async Task Start() + { + var client = new GrpcClient(GrpcChannelProvider.GetChannel()); + + var stream = client.Subscribe(); + + await stream.RequestStream.WriteAsync(new ClientMessage { RegistrationRequest = RegistrationRequest }); + + Console.WriteLine(RegistrationRequest); + + while (await stream.ResponseStream.MoveNext(CancellationToken.None)) + { + var req = stream.ResponseStream.Current; + + if (req.RegistrationResponse != null) + { + // Topic connected with Nitric Server. + } + else if (req.MessageRequest != null) + { + var ctx = MessageContext.FromRequest(req); + + ctx = this.Middleware(ctx); + + await stream.RequestStream.WriteAsync(ctx.ToResponse()); + } + } + + await stream.RequestStream.CompleteAsync(); + } + } +} + From c98749ccfbfb37301520b1fad3902747167bfdc2 Mon Sep 17 00:00:00 2001 From: Ryan Cartwright Date: Mon, 19 Feb 2024 18:17:19 +1100 Subject: [PATCH 08/34] add kv stores, update topics, secrets, storage, and queues. Update tests --- src/Nitric.Sdk/Document/Document.cs.old | 40 - src/Nitric.Sdk/Document/DocumentRef.cs.old | 228 ----- .../Document/DocumentsClient.cs.old | 54 -- src/Nitric.Sdk/Document/Key.cs.old | 66 -- src/Nitric.Sdk/Document/Query.cs.old | 346 -------- src/Nitric.Sdk/KeyValueStore/KeyValueStore.cs | 179 ++++ .../KeyValueStore/KeyValueStoreClient.cs | 38 + src/Nitric.Sdk/Nitric.Sdk.csproj | 6 + src/Nitric.Sdk/Nitric.cs | 24 +- src/Nitric.Sdk/Queue/FailedTask.cs | 41 - src/Nitric.Sdk/Queue/Queue.cs | 408 +++++---- src/Nitric.Sdk/Queue/QueuesClient.cs | 96 +- src/Nitric.Sdk/Queue/Task.cs | 186 ++-- src/Nitric.Sdk/Resource/BucketResource.cs | 255 +++--- src/Nitric.Sdk/Resource/CollectionResource.cs | 86 -- .../Resource/KeyValueStoreResource.cs | 87 ++ src/Nitric.Sdk/Resource/QueueResource.cs | 152 ++-- src/Nitric.Sdk/Resource/TopicResource.cs | 2 +- src/Nitric.Sdk/Resource/WebsocketResource.cs | 189 ++-- src/Nitric.Sdk/Secret/Secret.cs | 53 +- src/Nitric.Sdk/Secret/SecretVersion.cs | 37 +- src/Nitric.Sdk/Secret/SecretsClient.cs | 6 +- src/Nitric.Sdk/Service/BlobEventContext.cs | 62 +- src/Nitric.Sdk/Service/WebsocketContext.cs | 27 +- src/Nitric.Sdk/Storage/Bucket.cs | 90 +- src/Nitric.Sdk/Storage/File.cs | 223 ++++- src/Nitric.Sdk/Storage/StorageClient.cs | 6 +- src/Nitric.Sdk/Topic/Event.cs.old | 103 --- src/Nitric.Sdk/{Topic => Topics}/Topic.cs | 34 +- .../{Topic => Topics}/TopicsClient.cs | 4 +- src/Nitric.Sdk/Websocket/Connection.cs | 188 ++-- src/Nitric.Sdk/Websocket/WebsocketClient.cs | 79 +- src/Nitric.Sdk/Worker/BlobEventWorker.cs | 6 +- src/Nitric.Sdk/Worker/WebsocketWorker.cs | 55 ++ .../Api/Document/DocumentToGenericTest.cs | 151 ---- .../Api/Document/DocumentsTest.cs | 832 ------------------ .../Api/Event/EventClientTest.cs | 132 --- test/Nitric.Sdk.Test/Api/Event/EventTest.cs | 51 -- .../Api/Queue/FailedTaskTest.cs | 19 +- .../Api/Queue/QueueClientTest.cs | 144 ++- test/Nitric.Sdk.Test/Api/Queue/TaskTest.cs | 33 +- test/Nitric.Sdk.Test/Api/Secret/SecretTest.cs | 59 +- .../Api/Storage/StorageClientTest.cs | 292 +++--- .../Api/Topics/TopicsClientTest.cs | 104 +++ .../Api/Websocket/WebsocketTest.cs | 56 +- test/Nitric.Sdk.Test/Faas/FaasTest.cs | 49 -- test/Nitric.Sdk.Test/Faas/ResponseTest.cs | 56 -- test/Nitric.Sdk.Test/Faas/TriggerTest.cs | 60 -- test/Nitric.Sdk.Test/Nitric.Sdk.Test.csproj | 5 +- 49 files changed, 1999 insertions(+), 3500 deletions(-) delete mode 100644 src/Nitric.Sdk/Document/Document.cs.old delete mode 100644 src/Nitric.Sdk/Document/DocumentRef.cs.old delete mode 100644 src/Nitric.Sdk/Document/DocumentsClient.cs.old delete mode 100644 src/Nitric.Sdk/Document/Key.cs.old delete mode 100644 src/Nitric.Sdk/Document/Query.cs.old create mode 100644 src/Nitric.Sdk/KeyValueStore/KeyValueStore.cs create mode 100644 src/Nitric.Sdk/KeyValueStore/KeyValueStoreClient.cs delete mode 100644 src/Nitric.Sdk/Queue/FailedTask.cs delete mode 100644 src/Nitric.Sdk/Resource/CollectionResource.cs create mode 100644 src/Nitric.Sdk/Resource/KeyValueStoreResource.cs delete mode 100644 src/Nitric.Sdk/Topic/Event.cs.old rename src/Nitric.Sdk/{Topic => Topics}/Topic.cs (61%) rename src/Nitric.Sdk/{Topic => Topics}/TopicsClient.cs (95%) create mode 100644 src/Nitric.Sdk/Worker/WebsocketWorker.cs delete mode 100644 test/Nitric.Sdk.Test/Api/Document/DocumentToGenericTest.cs delete mode 100644 test/Nitric.Sdk.Test/Api/Document/DocumentsTest.cs delete mode 100644 test/Nitric.Sdk.Test/Api/Event/EventClientTest.cs delete mode 100644 test/Nitric.Sdk.Test/Api/Event/EventTest.cs create mode 100644 test/Nitric.Sdk.Test/Api/Topics/TopicsClientTest.cs delete mode 100644 test/Nitric.Sdk.Test/Faas/FaasTest.cs delete mode 100644 test/Nitric.Sdk.Test/Faas/ResponseTest.cs delete mode 100644 test/Nitric.Sdk.Test/Faas/TriggerTest.cs diff --git a/src/Nitric.Sdk/Document/Document.cs.old b/src/Nitric.Sdk/Document/Document.cs.old deleted file mode 100644 index a65402e..0000000 --- a/src/Nitric.Sdk/Document/Document.cs.old +++ /dev/null @@ -1,40 +0,0 @@ -// Copyright 2021, Nitric Technologies Pty Ltd. -// -// 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. - -using System.Collections.Generic; - -namespace Nitric.Sdk.Document -{ - /// - /// Represents a point-in-time version of a document, including the contents. - /// - /// The type of the contents of this document - public class Document - { - /// - /// The reference to the document in the document database. - /// - public DocumentRef Ref { get; private set; } - /// - /// The document contents. - /// - public T Content { get; private set; } - - internal Document(DocumentRef documentRef, T content) - { - this.Ref = documentRef; - this.Content = content; - } - } -} diff --git a/src/Nitric.Sdk/Document/DocumentRef.cs.old b/src/Nitric.Sdk/Document/DocumentRef.cs.old deleted file mode 100644 index 3e6739f..0000000 --- a/src/Nitric.Sdk/Document/DocumentRef.cs.old +++ /dev/null @@ -1,228 +0,0 @@ -// Copyright 2021, Nitric Technologies Pty Ltd. -// -// 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. - -using System; -using System.Linq; -using Google.Protobuf; -using DocumentServiceClient = Nitric.Proto.Document.v1.DocumentService.DocumentServiceClient; -using GrpcKey = Nitric.Proto.Document.v1.Key; -using Nitric.Proto.Document.v1; -using Google.Protobuf.WellKnownTypes; -using Newtonsoft.Json; -using RpcException = Grpc.Core.RpcException; -using NitricException = Nitric.Sdk.Common.NitricException; -using Constants = Nitric.Sdk.Common.Constants; - -namespace Nitric.Sdk.Document -{ - /// - /// A reference to a specific document in a collection. - /// - /// The expected type of the document's contents - public class DocumentRef - { - private readonly DocumentServiceClient documentClient; - - /// - /// The unique key of the document. - /// - public readonly Key Key; - - private readonly AbstractCollection collection; - - /// - /// Construct a new document reference. - /// - protected DocumentRef() - { - } - - internal DocumentRef( - DocumentServiceClient documentClient, - AbstractCollection collection, - string documentId) - { - this.documentClient = documentClient; - this.Key = new Key { Collection = collection, Id = documentId }; - this.collection = collection; - } - - /// - /// Retrieve a document, including its contents - /// - /// The document - /// - public Document Get() - { - var request = new DocumentGetRequest - { - Key = this.Key.ToKey() - }; - - try - { - var response = this.documentClient.Get(request); - return new Document( - this, - DocumentToGeneric(response.Document.Content) - ); - } - catch (RpcException re) - { - throw NitricException.FromRpcException(re); - } - } - - /// - /// Persist the document with updated contents. - /// - /// The contents to store in the document. - /// - /// - public void Set(TDocument value) - { - if (value == null) - { - throw new ArgumentNullException(nameof(value)); - } - - var json = JsonConvert.SerializeObject(value); - var content = JsonParser.Default.Parse(json); - - var request = new DocumentSetRequest - { - Key = this.Key.ToKey(), - Content = content - }; - try - { - this.documentClient.Set(request); - } - catch (RpcException re) - { - throw NitricException.FromRpcException(re); - } - } - - /// - /// Delete the document from the collection. - /// - /// - public void Delete() - { - var request = new DocumentDeleteRequest - { - Key = this.Key.ToKey(), - }; - try - { - this.documentClient.Delete(request); - } - catch (RpcException re) - { - throw NitricException.FromRpcException(re); - } - } - - /// - /// Create a reference to a sub-collection within this document. - /// - /// The name of the sub-collection. - /// The reference to the sub-collection. - /// - /// - public CollectionRef Collection(string name) - { - if (string.IsNullOrEmpty(name)) - { - throw new ArgumentNullException(nameof(name)); - } - - var collectionDepth = this.Key.Collection.Depth(); - if (collectionDepth > Constants.DepthLimit) - { - throw new NotSupportedException("Currently sub-collections are only able to be nested to a depth of " + - Constants.DepthLimit + ", found depth " + collectionDepth); - } - - return new CollectionRef(this.documentClient, name, this.Key); - } - - /// - /// Create a new query builder to find documents in sub-collections of this document. - /// - /// The sub-collection name - /// The query builder. - /// - public Query Query(string name) - { - if (string.IsNullOrEmpty(name)) - { - throw new ArgumentNullException(nameof(name)); - } - - var collectionGroup = new CollectionGroup( - this.documentClient, - this.collection.Name, - this.Key); - return new Query(this.documentClient, collectionGroup); - } - - /// - /// Utility function to convert a struct document to its generic counterpart - /// - /// The struct to convert. - /// - protected TDocument DocumentToGeneric(Struct content) - { - var doc = content.Fields.ToDictionary( - kv => kv.Key, kv => UnwrapValue(kv.Value)); - - var dictInJson = JsonConvert.SerializeObject(doc, new JsonSerializerSettings - { - NullValueHandling = NullValueHandling.Ignore, - FloatFormatHandling = FloatFormatHandling.DefaultValue, - }); - - return JsonConvert.DeserializeObject(dictInJson); - } - - internal static object UnwrapValue(Value value) - { - switch (value.KindCase) - { - case Value.KindOneofCase.StringValue: - return value.StringValue; - case Value.KindOneofCase.BoolValue: - return value.BoolValue; - case Value.KindOneofCase.NumberValue: - return value.NumberValue; - case Value.KindOneofCase.NullValue: - return null; - case Value.KindOneofCase.StructValue: - var unwrappedStruct = - value.StructValue.Fields.ToDictionary(kv => kv.Key, kv => UnwrapValue(kv.Value)); - - return unwrappedStruct; - case Value.KindOneofCase.ListValue: - var unwrappedList = value.ListValue.Values.Select(UnwrapValue).ToList(); - - return unwrappedList; - case Value.KindOneofCase.None: - default: - throw new ArgumentException("Provide proto-value"); - } - } - } -} diff --git a/src/Nitric.Sdk/Document/DocumentsClient.cs.old b/src/Nitric.Sdk/Document/DocumentsClient.cs.old deleted file mode 100644 index e5a5fcb..0000000 --- a/src/Nitric.Sdk/Document/DocumentsClient.cs.old +++ /dev/null @@ -1,54 +0,0 @@ -// Copyright 2021, Nitric Technologies Pty Ltd. -// -// 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. - -using System; -using Nitric.Sdk.Common; -using DocumentServiceClient = Nitric.Proto.Document.v1.DocumentService.DocumentServiceClient; - -namespace Nitric.Sdk.Document -{ - /// - /// A documents service reference. - /// - public class DocumentsClient - { - private readonly DocumentServiceClient documentClient; - - /// - /// Construct a new documents client. - /// - /// Optional gRPC client to reuse. - public DocumentsClient(DocumentServiceClient client = null) - { - this.documentClient = client ?? new DocumentServiceClient(GrpcChannelProvider.GetChannel()); - } - - /// - /// Create a reference to collection from the documents service. - /// - /// The collection name - /// The expected type for documents in the collection. - /// The collection reference. - /// - public CollectionRef Collection(string name) - { - if (string.IsNullOrEmpty(name)) - { - throw new ArgumentNullException(nameof(name)); - } - - return new CollectionRef(this.documentClient, name); - } - } -} diff --git a/src/Nitric.Sdk/Document/Key.cs.old b/src/Nitric.Sdk/Document/Key.cs.old deleted file mode 100644 index e6e2778..0000000 --- a/src/Nitric.Sdk/Document/Key.cs.old +++ /dev/null @@ -1,66 +0,0 @@ -// Copyright 2021, Nitric Technologies Pty Ltd. -// -// 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. - -using GrpcKey = Nitric.Proto.Document.v1.Key; - -namespace Nitric.Sdk.Document -{ - /// - /// A fully qualified reference to a specific document in the document service. - /// - /// Includes the unique ID of the document and a reference to the collection that contains it. - /// - /// The expected type for the contents of the document. - public class Key - { - /// - /// The collection containing this document. - /// - public AbstractCollection Collection { get; set; } - - /// - /// The unique ID of this document within its collection. - /// - public string Id { get; set; } - - internal Key() - { - // Internal construct to avoid external key creation. - } - - /// - /// Convert this key to a string. - /// - /// Useful for logging, should not be used for serialization of the key. - /// - /// A string with details of this key. - public override string ToString() - { - return this.GetType().Name + "[collection=" + Collection + ", id=" + Id + "]"; - } - - /// - /// Convert this key to its gRPC representation. - /// - /// - internal GrpcKey ToKey() - { - return new GrpcKey - { - Collection = this.Collection.ToGrpcCollection(), - Id = this.Id ?? "", - }; - } - } -} diff --git a/src/Nitric.Sdk/Document/Query.cs.old b/src/Nitric.Sdk/Document/Query.cs.old deleted file mode 100644 index 29011f8..0000000 --- a/src/Nitric.Sdk/Document/Query.cs.old +++ /dev/null @@ -1,346 +0,0 @@ -// Copyright 2021, Nitric Technologies Pty Ltd. -// -// 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. - -using System; -using System.Collections.Generic; -using System.Linq; -using Newtonsoft.Json; -using GrpcExpression = Nitric.Proto.Document.v1.Expression; -using ExpressionValue = Nitric.Proto.Document.v1.ExpressionValue; -using DocumentServiceClient = Nitric.Proto.Document.v1.DocumentService.DocumentServiceClient; -using Nitric.Proto.Document.v1; - -namespace Nitric.Sdk.Document -{ - /// - /// A query object used to construct document queries. - /// - /// The expected type of the found documents. - public class Query - { - internal readonly DocumentServiceClient DocumentClient; - internal readonly AbstractCollection Collection; - internal readonly List Expressions; - internal object PagingToken; - internal int ResultsLimit; - - internal Query(DocumentServiceClient documentClient, AbstractCollection collection) - { - this.DocumentClient = documentClient; - this.Collection = collection; - this.Expressions = new List(); - this.PagingToken = new Dictionary(); - this.ResultsLimit = 0; - } - - /// - /// Add a 'where' clause to this query. - /// - /// The key of the document to compare with. - /// The comparison type. - /// The value to compare with. - /// The query with the 'where' claus added. - /// - public Query Where(string operand, string op, string value) - { - if (string.IsNullOrEmpty(operand)) - { - throw new ArgumentNullException(nameof(operand)); - } - - if (string.IsNullOrEmpty(op)) - { - throw new ArgumentNullException(nameof(op)); - } - - if (string.IsNullOrEmpty(value)) - { - throw new ArgumentNullException(nameof(value)); - } - - this.Expressions.Add(new Expression(operand, op, value)); - return this; - } - - /// - /// Add a 'where' clause to this query. - /// - /// The key of the document to compare with. - /// The comparison type. - /// The value to compare with. - /// The query with the 'where' claus added. - /// - public Query Where(string operand, string op, double value) - { - if (string.IsNullOrEmpty(operand)) - { - throw new ArgumentNullException(nameof(operand)); - } - - if (string.IsNullOrEmpty(op)) - { - throw new ArgumentNullException(nameof(op)); - } - - this.Expressions.Add(new Expression(operand, op, value)); - return this; - } - - /// - /// Add a 'where' clause to this query. - /// - /// The key of the document to compare with. - /// The comparison type. - /// The value to compare with. - /// The query with the 'where' claus added. - /// - public Query Where(string operand, string op, int value) - { - if (string.IsNullOrEmpty(operand)) - { - throw new ArgumentNullException(nameof(operand)); - } - - if (string.IsNullOrEmpty(op)) - { - throw new ArgumentNullException(nameof(op)); - } - - this.Expressions.Add(new Expression(operand, op, value)); - return this; - } - - /// - /// Add a 'where' clause to this query. - /// - /// The key of the document to compare with. - /// The comparison type. - /// The value to compare with. - /// The query with the 'where' claus added. - /// - public Query Where(string operand, string op, bool value) - { - if (string.IsNullOrEmpty(operand)) - { - throw new ArgumentNullException(nameof(operand)); - } - - if (string.IsNullOrEmpty(op)) - { - throw new ArgumentNullException(nameof(op)); - } - - this.Expressions.Add(new Expression(operand, op, value)); - return this; - } - - /// - /// Query results starting from an existing paging token. - /// - /// Used when paging the results of a query for requesting subsequent pages. - /// - /// A paging token returned from a previous query. - /// The query with the paging token added. - public Query PagingFrom(object pagingToken) - { - this.PagingToken = pagingToken; - return this; - } - - /// - /// Limit the number of results returned by this query. - /// - /// A positive integer represent the maximum number of results to return. - /// - public Query Limit(int limit) - { - this.ResultsLimit = Math.Max(0, limit); - return this; - } - - /// - /// Retrieve a page of query results. - /// - /// Results - public QueryResult Fetch() - { - return new QueryResult(this, false); - } - - /// - /// Returns a string with details about this query. - /// - /// - public override string ToString() - { - return this.GetType().Name - + "[collection=" + Collection - + ", expressions=" + Expressions - + ", limit=" + ResultsLimit - + ", pagingToken=" + PagingToken - + "]"; - } - } - - /// - /// Represents the results of an executed query. - /// - /// The expected type of the found documents. - public class QueryResult - { - private readonly Query query; - private readonly bool paginateAll; - - /// - /// An optional token from a previous query, indicates where to start when retrieving additional results. - /// - public object PagingToken { get; private set; } - - /// - /// The results returned from the query. - /// - public List> Documents { get; private set; } - - internal QueryResult(Query query, bool paginateAll) - { - this.query = query; - this.paginateAll = paginateAll; - this.PagingToken = query.PagingToken; - - var request = BuildDocQueryRequest(this.query.Expressions); - - try - { - var response = this.query.DocumentClient.Query(request); - LoadPageData(response); - } - catch (Grpc.Core.RpcException re) - { - throw Common.NitricException.FromRpcException(re); - } - } - - private DocumentQueryRequest BuildDocQueryRequest(List expressions) - { - var request = new DocumentQueryRequest - { - Collection = this.query.Collection.ToGrpcCollection(), - Limit = this.query.ResultsLimit, - }; - - request.Expressions.AddRange(expressions.Select(exp => exp.ToGrpcExpression())); - - if (this.PagingToken == null) return request; - - if (!(this.PagingToken is IDictionary token)) - { - throw new ArgumentException("Invalid paging token provided!"); - } - - foreach (var kv in token) - { - request.PagingToken.Add(kv.Key, kv.Value); - } - - return request; - } - - private void LoadPageData(DocumentQueryResponse response) - { - this.Documents = new List>(response.Documents.Count); - foreach (var doc in response.Documents) - { - var dict = doc.Content.Fields.ToDictionary( - kv => kv.Key, - kv => DocumentRef.UnwrapValue(kv.Value)); - - var dictInJson = JsonConvert.SerializeObject(dict, new JsonSerializerSettings - { - NullValueHandling = NullValueHandling.Ignore, - FloatFormatHandling = FloatFormatHandling.DefaultValue, - }); - - var content = JsonConvert.DeserializeObject(dictInJson); - - Documents.Add(new Document( - new DocumentRef( - this.query.DocumentClient, - this.query.Collection, - doc.Key.Id - ), - content - )); - } - - this.PagingToken = response.PagingToken.Clone(); - } - } - - class Expression - { - readonly string operand; - readonly string op; - readonly object value; - - internal Expression(string operand, string op, object value) - { - this.operand = operand; - this.op = op; - this.value = value; - } - - internal GrpcExpression ToGrpcExpression() - { - var expression = new GrpcExpression(); - var expressionValue = new ExpressionValue(); - - expression.Operand = operand; - expression.Operator = op; - - switch (value) - { - case string s: - expressionValue.StringValue = s; - break; - case double d: - expressionValue.DoubleValue = d; - break; - case int i: - expressionValue.IntValue = i; - break; - case bool b: - expressionValue.BoolValue = b; - break; - default: - { - var msg = value.GetType().Name - + "type is not supported. Please use: string, double, integer, boolean"; - throw new ArgumentException(msg); - } - } - - expression.Value = expressionValue; - return expression; - } - - public override string ToString() - { - return this.GetType().Name - + "[operand=" + this.operand - + ", operator=" + this.op - + ", value=" + this.value - + "]"; - } - } -} diff --git a/src/Nitric.Sdk/KeyValueStore/KeyValueStore.cs b/src/Nitric.Sdk/KeyValueStore/KeyValueStore.cs new file mode 100644 index 0000000..1f19a9e --- /dev/null +++ b/src/Nitric.Sdk/KeyValueStore/KeyValueStore.cs @@ -0,0 +1,179 @@ +using System.Threading.Tasks; +using Nitric.Proto.KeyValue.v1; +using Nitric.Sdk.Common; + +namespace Nitric.Sdk.KeyValueStore +{ + public class KeyValueStore + { + public string Name; + private readonly KeyValueStoreClient KeyValueClient; + + public KeyValueStore(KeyValueStoreClient client, string name) + { + this.KeyValueClient = client; + this.Name = name; + } + + /// + /// Get a value from the key value store by referencing the key. + /// + /// The unique key that references the value. + /// The value that was referenced by the key. + public T Get(string key) + { + var request = new KeyValueGetRequest + { + Ref = new ValueRef + { + Store = Name, + Key = key, + } + }; + + try + { + var resp = KeyValueClient.Client.Get(request); + + return Struct.ToJsonSerializable(resp.Value.Content); + } + catch (Grpc.Core.RpcException re) + { + throw NitricException.FromRpcException(re); + } + } + + /// + /// Get a value from the key value store by referencing the key. + /// + /// The unique key that references the value. + /// The value that was referenced by the key. + public async Task GetAsync(string key) + { + var request = new KeyValueGetRequest + { + Ref = new ValueRef + { + Store = Name, + Key = key, + } + }; + + try + { + var resp = await KeyValueClient.Client.GetAsync(request); + + return Struct.ToJsonSerializable(resp.Value.Content); + } + catch (Grpc.Core.RpcException re) + { + throw NitricException.FromRpcException(re); + } + } + + /// + /// Set a key value pair in the key value store. + /// + /// A unique key that will reference the value. + /// The value to store. + public void Set(string key, T value) + { + var request = new KeyValueSetRequest + { + Content = Struct.FromJsonSerializable(value), + Ref = new ValueRef + { + Store = Name, + Key = key, + } + }; + + try + { + KeyValueClient.Client.Set(request); + } + catch (Grpc.Core.RpcException re) + { + throw NitricException.FromRpcException(re); + } + } + + /// + /// Set a key value pair in the key value store. + /// + /// A unique key that will reference the value. + /// The value to store. + public async Task SetAsync(string key, T value) + { + var request = new KeyValueSetRequest + { + Content = Struct.FromJsonSerializable(value), + Ref = new ValueRef + { + Store = Name, + Key = key, + } + }; + + try + { + await KeyValueClient.Client.SetAsync(request); + } + catch (Grpc.Core.RpcException re) + { + throw NitricException.FromRpcException(re); + } + } + + /// + /// Delete a value from the key value store. + /// + /// The unique key that references the value. + public void Delete(string key) + { + var request = new KeyValueDeleteRequest + { + Ref = new ValueRef + { + Store = Name, + Key = key, + } + }; + + try + { + KeyValueClient.Client.Delete(request); + } + catch (Grpc.Core.RpcException re) + { + throw NitricException.FromRpcException(re); + } + } + + /// + /// Delete a value from the key value store. + /// + /// The unique key that references the value. + public async Task DeleteAsync(string key) + { + var request = new KeyValueDeleteRequest + { + Ref = new ValueRef + { + Store = Name, + Key = key, + } + }; + + try + { + await KeyValueClient.Client.DeleteAsync(request); + } + catch (Grpc.Core.RpcException re) + { + throw NitricException.FromRpcException(re); + } + } + } +} + diff --git a/src/Nitric.Sdk/KeyValueStore/KeyValueStoreClient.cs b/src/Nitric.Sdk/KeyValueStore/KeyValueStoreClient.cs new file mode 100644 index 0000000..6cb1107 --- /dev/null +++ b/src/Nitric.Sdk/KeyValueStore/KeyValueStoreClient.cs @@ -0,0 +1,38 @@ +using System; +using Nitric.Sdk.Common; +using GrpcClient = Nitric.Proto.KeyValue.v1.KeyValue.KeyValueClient; + +namespace Nitric.Sdk.KeyValueStore +{ + public class KeyValueStoreClient + { + /// + /// Construct a new key value client. + /// + /// Optional gRPC client to reuse. + internal readonly GrpcClient Client; + + internal KeyValueStoreClient(GrpcClient client = null) + { + this.Client = client ?? new GrpcClient(GrpcChannelProvider.GetChannel()); + } + + /// + /// Create a reference to the key value store from the key value service. + /// + /// The key value store name + /// The expected type for values in the key value store. + /// The collection reference. + /// + public KeyValueStore Store(string name) + { + if (string.IsNullOrEmpty(name)) + { + throw new ArgumentNullException(nameof(name)); + } + + return new KeyValueStore(this, name); + } + } +} + diff --git a/src/Nitric.Sdk/Nitric.Sdk.csproj b/src/Nitric.Sdk/Nitric.Sdk.csproj index d2a784d..75447f5 100644 --- a/src/Nitric.Sdk/Nitric.Sdk.csproj +++ b/src/Nitric.Sdk/Nitric.Sdk.csproj @@ -26,7 +26,13 @@ + + + + + + diff --git a/src/Nitric.Sdk/Nitric.cs b/src/Nitric.Sdk/Nitric.cs index edc4f00..90db2ce 100644 --- a/src/Nitric.Sdk/Nitric.cs +++ b/src/Nitric.Sdk/Nitric.cs @@ -37,7 +37,7 @@ internal static void RegisterWorker(IWorker worker) throw new ArgumentNullException("Cannot register a null worker."); } - Nitric.Workers.Add(worker); + Workers.Add(worker); } /// @@ -97,17 +97,17 @@ private static T Cached(string name, Func make) where T : BaseReso /// /// The unique name of the bucket within this application. /// A bucket resource, if the name has already been declared the same resource will be returned. - //public static BucketResource Bucket(string name) => Cached(name, t => new BucketResource(t)); + public static BucketResource Bucket(string name) => Cached(name, t => new BucketResource(t)); /// - /// Declare a collection resource for document storage. + /// Declare a key value store resource for storing key value pairs. /// - /// The unique name of the collection within this application. - /// The type of documents to be stored in the collection. - /// A collection resource, if the name has already been declared the same resource will be returned. - //public static CollectionResource Collection(string name) => - // Cached(name, t => new CollectionResource(t)); + /// The unique name of the key value store within this application. + /// The type of values to be stored. + /// A key value resource, if the name has already been declared the same resource will be returned. + public static KeyValueStoreResource KeyValue(string name) => + Cached(name, t => new KeyValueStoreResource(t)); /// /// Declare a secret resource for accessing and putting secret values. @@ -121,20 +121,20 @@ private static T Cached(string name, Func make) where T : BaseReso /// /// The unique name of the queue within this application. /// A queue resource, if the name has already been declared the same resource will be returned. - //public static QueueResource Queue(string name) => Cached(name, n => new QueueResource(n)); + public static QueueResource Queue(string name) => Cached(name, n => new QueueResource(n)); /// /// Declare a topic resource for push-based events and messaging. /// /// The unique name of the topic within this application. /// A topic resource, if the name has already been declared the same resource will be returned. - //public static TopicResource Topic(string name) => Cached(name, t => new TopicResource(t)); + public static TopicResource Topic(string name) => Cached(name, t => new TopicResource(t)); /// - /// Declare a websocket resource for bidirectional HxwTTP communication. + /// Declare a websocket resource for bidirectional HTTP communication. /// /// The unique name of the websocket within this application. /// A websocket resource, if the name has already been declared the same resource will be returned. - //public static WebsocketResource Websocket(string name) => Cached(name, t => new WebsocketResource(t)); + public static WebsocketResource Websocket(string name) => Cached(name, t => new WebsocketResource(t)); } } diff --git a/src/Nitric.Sdk/Queue/FailedTask.cs b/src/Nitric.Sdk/Queue/FailedTask.cs deleted file mode 100644 index d8f8831..0000000 --- a/src/Nitric.Sdk/Queue/FailedTask.cs +++ /dev/null @@ -1,41 +0,0 @@ -//// Copyright 2021, Nitric Technologies Pty Ltd. -//// -//// 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. - -//namespace Nitric.Sdk.Queue -//{ -// /// -// /// Represents a task that was unable to be sent to a queue. -// /// -// public class FailedTask -// { -// /// -// /// The error message. -// /// -// public string Message { get; set; } - -// /// -// /// The task that failed to be sent. -// /// -// public Task Task { get; set; } - -// /// -// /// Return a string representation of the failed task. -// /// -// /// -// public override string ToString() -// { -// return GetType().Name + "[task=" + Task + ", message=" + Message + "]"; -// } -// } -//} diff --git a/src/Nitric.Sdk/Queue/Queue.cs b/src/Nitric.Sdk/Queue/Queue.cs index 953dce8..09c40c8 100644 --- a/src/Nitric.Sdk/Queue/Queue.cs +++ b/src/Nitric.Sdk/Queue/Queue.cs @@ -1,209 +1,199 @@ -//// Copyright 2021, Nitric Technologies Pty Ltd. -//// -//// 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. -//using System; -//using System.Collections.Generic; -//using System.Linq; -//using Google.Protobuf.Collections; -//using Newtonsoft.Json; -//using Nitric.Sdk.Common; -//using Nitric.Proto.Queues.v1; - -//namespace Nitric.Sdk.Queue -//{ -// /// -// /// A reference to a queue in the queues service. -// /// -// public class Queue -// { -// /// -// /// The name of the queue. -// /// -// public string Name { get; internal set; } - -// internal readonly QueuesClient QueuesClient; - -// internal Queue(QueuesClient client, string name) -// { -// this.Name = name; -// this.QueuesClient = client; -// } - -// /// -// /// Send a task to this queue. -// /// -// /// The task to send. -// /// -// /// -// public void Send(Task task) -// { -// if (task == null) -// { -// throw new ArgumentNullException(nameof(task)); -// } - -// var request = new QueueSendRequest -// { -// Payload = task.Payload; -// }; -// try -// { -// QueuesClient.Client.Send(request); -// } -// catch (Grpc.Core.RpcException re) -// { -// throw NitricException.FromRpcException(re); -// } -// } - -// /// -// /// Send a task to this queue. -// /// -// /// The payload of the task to send. -// /// -// /// -// public void Send(T payload) -// { -// var task = new Task { Payload = payload }; - -// var request = new QueueSendRequest -// { -// Queue = this.Name, -// Task = task.ToWire() -// }; -// try -// { -// QueuesClient.Client.Send(request); -// } -// catch (Grpc.Core.RpcException re) -// { -// throw NitricException.FromRpcException(re); -// } -// } - -// /// -// /// Send multiple tasks to this queue. -// /// -// /// The tasks to send. -// /// Results of sending tasks to the queue, including any tasks that failed to be sent. -// /// -// public List> Send(params Task[] tasks) -// { -// var wireEvents = new RepeatedField(); -// foreach (var task in tasks) -// { -// wireEvents.Add(task.ToWire()); -// } - -// var request = new QueueSendBatchRequest { Queue = this.Name }; -// request.Tasks.AddRange(wireEvents); -// try -// { -// var response = QueuesClient.Client.SendBatch(request); -// var failedTasks = response.FailedTasks.Select(WireToFailedTask).ToList(); -// return failedTasks; -// } -// catch (Grpc.Core.RpcException re) -// { -// throw NitricException.FromRpcException(re); -// } -// } - -// /// -// /// Send multiple tasks to this queue. -// /// -// /// The tasks to send. -// /// Results of sending tasks to the queue, including any tasks that failed to be sent. -// /// -// public List> Send(params T[] payloads) -// { -// var wireEvents = new RepeatedField(); -// foreach (var payload in payloads) -// { -// var task = new Task { Payload = payload }; -// wireEvents.Add(task.ToWire()); -// } - -// var request = new QueueSendBatchRequest { Queue = this.Name }; -// request.Tasks.AddRange(wireEvents); -// try -// { -// var response = QueuesClient.Client.SendBatch(request); -// var failedTasks = response.FailedTasks.Select(WireToFailedTask).ToList(); -// return failedTasks; -// } -// catch (Grpc.Core.RpcException re) -// { -// throw NitricException.FromRpcException(re); -// } -// } - -// /// -// /// Request tasks from the queue to process. -// /// -// /// The number of tasks returned will be the same or less than the requested depth, based on the number of tasks -// /// available on the queue. -// /// -// /// The maximum number of tasks to receive. -// /// Tasks received from the queue. -// /// -// public List> Receive(int depth = 1) -// { -// if (depth < 1) -// { -// depth = 1; -// } - -// var request = new QueueReceiveRequest { Queue = this.Name, Depth = depth }; -// try -// { -// var response = this.QueuesClient.Client.Receive(request); -// return response.Tasks.Select(WireToQueueItem).ToList(); -// } -// catch (Grpc.Core.RpcException re) -// { -// throw NitricException.FromRpcException(re); -// } -// } - -// private ReceivedTask WireToQueueItem(NitricTask nitricTask) -// { -// var protoPayload = JsonConvert.SerializeObject(nitricTask.Payload); - -// return new ReceivedTask -// { -// Id = nitricTask.Id, -// PayloadType = nitricTask.PayloadType, -// Payload = JsonConvert.DeserializeObject(protoPayload), -// LeaseId = nitricTask.LeaseId, -// Queue = this, -// }; -// } - -// private static FailedTask WireToFailedTask(Proto.Queue.v1.FailedTask protoFailedEvent) -// { -// var protoPayload = JsonConvert.SerializeObject(protoFailedEvent.Task.Payload); - -// return new FailedTask -// { -// Message = protoFailedEvent.Message, -// Task = new Task -// { -// Id = protoFailedEvent.Task.Id, -// PayloadType = protoFailedEvent.Task.PayloadType, -// Payload = JsonConvert.DeserializeObject(protoPayload), -// } -// }; -// } -// } -//} +// Copyright 2021, Nitric Technologies Pty Ltd. +// +// 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. +using System; +using System.Collections.Generic; +using System.Linq; +using Nitric.Sdk.Common; +using Nitric.Proto.Queues.v1; +using System.Threading.Tasks; + +namespace Nitric.Sdk.Queue +{ + /// + /// A reference to a queue in the queues service. + /// + public class Queue + { + /// + /// The name of the queue. + /// + public string Name { get; internal set; } + + internal readonly QueuesClient Queues; + + internal Queue(QueuesClient client, string name) + { + this.Name = name; + this.Queues = client; + } + + /// + /// Send a task to this queue. + /// + /// The tasks to push to the queue. + /// + /// + public List> Enqueue(T task, params T[] tasks) + { + if (task == null) + { + throw new ArgumentNullException(nameof(task)); + } + var taskList = new List() { task }; + + taskList.AddRange(tasks); + + var request = new QueueEnqueueRequest + { + QueueName = Name, + }; + + var messages = taskList.Select(task => new QueueMessage + { + StructPayload = Struct.FromJsonSerializable(task) + }); + + request.Messages.AddRange(messages); + + try + { + var response = Queues.Client.Enqueue(request); + + return response.FailedMessages.Select(failedMessage => new FailedMessage + { + Details = failedMessage.Details, + Message = Struct.ToJsonSerializable(failedMessage.Message.StructPayload), + }).ToList(); + } + catch (Grpc.Core.RpcException re) + { + throw NitricException.FromRpcException(re); + } + } + + /// + /// Send a task to this queue. + /// + /// The tasks to push to the queue. + /// + /// + public async Task>> EnqueueAsync(T task, params T[] tasks) + { + if (task == null) + { + throw new ArgumentNullException(nameof(task)); + } + var taskList = new List() { task }; + + taskList.AddRange(tasks); + + var request = new QueueEnqueueRequest + { + QueueName = Name, + }; + + var messages = taskList.Select(task => new QueueMessage + { + StructPayload = Struct.FromJsonSerializable(task) + }); + + request.Messages.AddRange(messages); + + try + { + var response = await Queues.Client.EnqueueAsync(request); + + return response.FailedMessages.Select(failedMessage => new FailedMessage + { + Details = failedMessage.Details, + Message = Struct.ToJsonSerializable(failedMessage.Message.StructPayload), + }).ToList(); + } + catch (Grpc.Core.RpcException re) + { + throw NitricException.FromRpcException(re); + } + } + + /// + /// Dequeue tasks from the queue to process. + /// + /// The number of tasks returned will be the same or less than the requested depth, based on the number of tasks + /// available on the queue. + /// + /// The maximum number of tasks to dequeue. + /// Tasks dequeued from the queue. + /// + public List> Dequeue(int depth = 1) + { + var request = new QueueDequeueRequest + { + QueueName = this.Name, + Depth = Math.Max(depth, 1) + }; + + try + { + var response = this.Queues.Client.Dequeue(request); + + return response.Messages.Select(message => new ReceivedMessage + { + Queue = this, + LeaseId = message.LeaseId, + Message = Struct.ToJsonSerializable(message.Message.StructPayload) + }).ToList(); + } + catch (Grpc.Core.RpcException re) + { + throw NitricException.FromRpcException(re); + } + } + + /// + /// Dequeue tasks from the queue to process. + /// + /// The number of tasks returned will be the same or less than the requested depth, based on the number of tasks + /// available on the queue. + /// + /// The maximum number of tasks to dequeue. + /// Tasks dequeued from the queue. + /// + public async Task>> DequeueAsync(int depth = 1) + { + var request = new QueueDequeueRequest + { + QueueName = this.Name, + Depth = Math.Max(depth, 1) + }; + + try + { + var response = await this.Queues.Client.DequeueAsync(request); + + return response.Messages.Select(message => new ReceivedMessage + { + Queue = this, + LeaseId = message.LeaseId, + Message = Struct.ToJsonSerializable(message.Message.StructPayload) + }).ToList(); + } + catch (Grpc.Core.RpcException re) + { + throw NitricException.FromRpcException(re); + } + } + } +} + + diff --git a/src/Nitric.Sdk/Queue/QueuesClient.cs b/src/Nitric.Sdk/Queue/QueuesClient.cs index edac0ad..3903b13 100644 --- a/src/Nitric.Sdk/Queue/QueuesClient.cs +++ b/src/Nitric.Sdk/Queue/QueuesClient.cs @@ -1,53 +1,53 @@ -//// Copyright 2021, Nitric Technologies Pty Ltd. -//// -//// 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. +// Copyright 2021, Nitric Technologies Pty Ltd. +// +// 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. -//using GrpcClient = Nitric.Proto.Queues.v1.Queues.QueuesClient; -//using Nitric.Sdk.Common; -//using System; +using GrpcClient = Nitric.Proto.Queues.v1.Queues.QueuesClient; +using Nitric.Sdk.Common; +using System; -//namespace Nitric.Sdk.Queue -//{ -// /// -// /// A queues service client. -// /// -// public class QueuesClient -// { -// internal GrpcClient Client { get; private set; } +namespace Nitric.Sdk.Queue +{ + /// + /// A queues service client. + /// + public class QueuesClient + { + internal GrpcClient Client { get; private set; } -// /// -// /// Create a new queues service client. -// /// -// /// -// public QueuesClient(GrpcClient client = null) -// { -// this.Client = client ?? new GrpcClient(GrpcChannelProvider.GetChannel()); -// } + /// + /// Create a new queues service client. + /// + /// + public QueuesClient(GrpcClient client = null) + { + this.Client = client ?? new GrpcClient(GrpcChannelProvider.GetChannel()); + } -// /// -// /// Create a reference to the queue in the queues service. -// /// -// /// The queue's name -// /// A new queue reference for sending or receiving tasks. -// /// -// public Queue Queue(string queueName) -// { -// if (string.IsNullOrEmpty(queueName)) -// { -// throw new ArgumentNullException(nameof(queueName)); -// } + /// + /// Create a reference to the queue in the queues service. + /// + /// The queue's name + /// A new queue reference for sending or receiving tasks. + /// + public Queue Queue(string queueName) + { + if (string.IsNullOrEmpty(queueName)) + { + throw new ArgumentNullException(nameof(queueName)); + } -// return new Queue(this, queueName); -// } -// } -//} + return new Queue(this, queueName); + } + } +} diff --git a/src/Nitric.Sdk/Queue/Task.cs b/src/Nitric.Sdk/Queue/Task.cs index 792dd0b..37c955c 100644 --- a/src/Nitric.Sdk/Queue/Task.cs +++ b/src/Nitric.Sdk/Queue/Task.cs @@ -1,109 +1,97 @@ -//// Copyright 2021, Nitric Technologies Pty Ltd. -//// -//// 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. +// Copyright 2021, Nitric Technologies Pty Ltd. +// +// 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. -//using System; -//using Google.Protobuf; -//using Google.Protobuf.WellKnownTypes; -//using Newtonsoft.Json; -//using Nitric.Proto.Queue.v1; -//using Nitric.Sdk.Common; +using System; +using Nitric.Sdk.Common; +using Nitric.Proto.Queues.v1; -//namespace Nitric.Sdk.Queue -//{ -// /// -// /// Represents a Message to be delivered via a Queue. -// /// -// public class Task -// { -// public string Id { get; set; } -// public string PayloadType { get; set; } -// public T Payload { get; set; } +namespace Nitric.Sdk.Queue +{ + /// + /// Represents a message received locally for processing. + /// + /// Since received messages are on a limited time lease they include a lease ID. + /// Received tasks must be completed to be removed from the queue and avoid reprocessing + /// + public class ReceivedMessage + { + /// + /// The queue that was the source of this task. + /// + internal Queue Queue { get; set; } -// public Task() -// { -// } + /// + /// The message that was on the queue. + /// + public T Message { get; set; } -// /// -// /// Return a string representation of the task. -// /// -// /// A string -// public override string ToString() -// { -// return GetType().Name + "[ID=" + this.Id + "]"; -// } + /// + /// The unique lease id for this task lease. + /// + public string LeaseId { get; set; } -// internal NitricTask ToWire() -// { -// Struct payload = null; -// if (this.Payload != null) -// { -// var jsonPayload = JsonConvert.SerializeObject(this.Payload); -// payload = JsonParser.Default.Parse(jsonPayload); -// } + /// + /// Complete this task and remove it from the source queue. + /// + /// + /// + public void Complete() + { + if (string.IsNullOrEmpty(this.LeaseId)) + { + throw new ArgumentNullException(nameof(this.LeaseId)); + } -// return new NitricTask -// { -// Id = this.Id ?? "", -// PayloadType = this.PayloadType ?? "", -// Payload = payload -// }; -// } -// } + var request = new QueueCompleteRequest + { + QueueName = this.Queue.Name, + LeaseId = this.LeaseId, + }; -// /// -// /// Represents a task received locally for processing. -// /// -// /// Since received tasks are on a limited time lease they include a lease ID. -// /// Received tasks must be completed to be removed from the queue and avoid reprocessing -// /// -// public class ReceivedTask : Task -// { -// /// -// /// The queue that was the source of this task. -// /// -// public Queue Queue { get; set; } + try + { + Queue.Queues.Client.Complete(request); + } + catch (Grpc.Core.RpcException re) + { + throw NitricException.FromRpcException(re); + } + } + } -// /// -// /// The unique lease id for this task lease. -// /// -// public string LeaseId { get; set; } + /// + /// Represents a task that was unable to be sent to a queue. + /// + public class FailedMessage + { + /// + /// The error message. + /// + public string Details { get; set; } -// /// -// /// Complete this task and remove it from the source queue. -// /// -// /// -// /// -// public void Complete() -// { -// if (string.IsNullOrEmpty(this.LeaseId)) -// { -// throw new ArgumentNullException(nameof(this.LeaseId)); -// } + /// + /// The message that failed to be sent. + /// + public T Message { get; set; } -// var request = new QueueCompleteRequest -// { -// Queue = this.Queue.Name, -// LeaseId = this.LeaseId, -// }; -// try -// { -// Queue.QueuesClient.Client.Complete(request); -// } -// catch (Grpc.Core.RpcException re) -// { -// throw NitricException.FromRpcException(re); -// } -// } -// } -//} + /// + /// Return a string representation of the failed task. + /// + /// + public override string ToString() + { + return "FailedMessage[details=" + Details + "]"; + } + } +} diff --git a/src/Nitric.Sdk/Resource/BucketResource.cs b/src/Nitric.Sdk/Resource/BucketResource.cs index 340d31e..2a076c6 100644 --- a/src/Nitric.Sdk/Resource/BucketResource.cs +++ b/src/Nitric.Sdk/Resource/BucketResource.cs @@ -1,137 +1,140 @@ -//// Copyright 2021, Nitric Technologies Pty Ltd. -//// -//// 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. +// Copyright 2021, Nitric Technologies Pty Ltd. +// +// 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. -//using System; -//using System.Collections.Generic; -//using System.Linq; -//using Nitric.Proto.Resources.v1; -//using Nitric.Sdk.Function; -//using Nitric.Sdk.Storage; -//using Action = Nitric.Proto.Resources.v1.Action; -//using NitricResource = Nitric.Proto.Resources.v1.ResourceIdentifier; +using System; +using System.Collections.Generic; +using System.Linq; +using Nitric.Proto.Resources.v1; +using Nitric.Sdk.Service; +using Nitric.Sdk.Storage; +using Nitric.Sdk.Worker; +using Nitric.Proto.Storage.v1; +using Action = Nitric.Proto.Resources.v1.Action; +using NitricResource = Nitric.Proto.Resources.v1.ResourceIdentifier; +using System.Runtime.InteropServices; -//namespace Nitric.Sdk.Resource -//{ -// /// -// /// Available permissions for bucket resources. -// /// -// public enum BucketPermission -// { -// /// -// /// Enables listing and reading files in the bucket. -// /// -// Reading, -// /// -// /// Enables adding or updating files in the bucket. -// /// -// Writing, -// /// -// /// Enables deleting files from the bucket. -// /// -// Deleting -// } +namespace Nitric.Sdk.Resource +{ + /// + /// Available permissions for bucket resources. + /// + public enum BucketPermission + { + /// + /// Enables listing and reading files in the bucket. + /// + Reading, + /// + /// Enables adding or updating files in the bucket. + /// + Writing, + /// + /// Enables deleting files from the bucket. + /// + Deleting + } -// public class BucketResource : SecureResource -// { -// internal BucketResource(string name) : base(name, ResourceType.Bucket) -// { -// } + public class BucketResource : SecureResource + { + internal BucketResource(string name) : base(name, ResourceType.Bucket) + { + } -// internal override BaseResource Register() -// { -// var resource = new NitricResource { Name = this.Name, Type = ResourceType.Bucket }; -// var request = new ResourceDeclareRequest { Id = resource }; -// BaseResource.client.Declare(request); -// return this; -// } + internal override BaseResource Register() + { + var resource = new NitricResource { Name = this.Name, Type = ResourceType.Bucket }; + var request = new ResourceDeclareRequest { Id = resource }; + BaseResource.client.Declare(request); + return this; + } -// protected override IEnumerable PermissionsToActions(IEnumerable permissions) -// { -// var actionMap = new Dictionary> -// { -// { -// BucketPermission.Reading, -// new List { Action.BucketFileList, Action.BucketFileGet } -// }, -// { -// BucketPermission.Writing, -// new List { Action.BucketFilePut } -// }, -// { -// BucketPermission.Deleting, -// new List { Action.BucketFileDelete } -// } -// }; -// return permissions.Aggregate((IEnumerable)new List(), (acc, x) => acc.Concat(actionMap[x])).Distinct(); -// } + protected override IEnumerable PermissionsToActions(IEnumerable permissions) + { + var actionMap = new Dictionary> + { + { + BucketPermission.Reading, + new List { Action.BucketFileList, Action.BucketFileGet } + }, + { + BucketPermission.Writing, + new List { Action.BucketFilePut } + }, + { + BucketPermission.Deleting, + new List { Action.BucketFileDelete } + } + }; + return permissions.Aggregate((IEnumerable)new List(), (acc, x) => acc.Concat(actionMap[x])).Distinct(); + } -// /// -// /// Registers handlers to be called whenever a file triggers an event in the bucket -// /// -// /// The type of events that should trigger events, Write or Delete -// /// The prefix of file names that should trigger events -// /// The handlers to call to process notification events -// public void On( -// BucketNotificationType notificationType, -// string notificationPrefixFilter, -// params Middleware[] middleware) -// { -// var notificationWorker = new Faas(new BucketNotificationWorkerOptions( -// this.Name, -// notificationType, -// notificationPrefixFilter -// )); + /// + /// Registers handlers to be called whenever a file triggers an event in the bucket + /// + /// The type of events that should trigger events, Write or Delete + /// The prefix of file names that should trigger events + /// The handlers to call to process notification events + public void On( + Service.BlobEventType blobEventType, + string keyPrefixFilter, + params Middleware[] middlewares) + { + var request = new RegistrationRequest + { + BucketName = this.Name, + KeyPrefixFilter = keyPrefixFilter, + BlobEventType = blobEventType.ToGrpc(), + }; + var notificationWorker = new BlobEventWorker(request, middlewares); -// notificationWorker.BucketNotification(middleware); + Nitric.RegisterWorker(notificationWorker); + } -// Nitric.RegisterWorker(notificationWorker); -// } + /// + /// Registers a handler to be called whenever a file triggers an event in the bucket + /// + /// The type of events that should trigger events, Write or Delete + /// The prefix of file names that should trigger events + /// The handler to call to process notification events + public void On( + Service.BlobEventType blobEventType, + string keyPrefixFilter, + Func handler) + { + var request = new RegistrationRequest + { + BucketName = this.Name, + KeyPrefixFilter = keyPrefixFilter, + BlobEventType = blobEventType.ToGrpc(), + }; + var notificationWorker = new BlobEventWorker(request, handler); -// /// -// /// Registers a handler to be called whenever a file triggers an event in the bucket -// /// -// /// The type of events that should trigger events, Write or Delete -// /// The prefix of file names that should trigger events -// /// The handler to call to process notification events -// public void On( -// BucketNotificationType notificationType, -// string notificationPrefixFilter, -// Func handler) -// { -// var notificationWorker = new Faas(new BucketNotificationWorkerOptions( -// this.Name, -// notificationType, -// notificationPrefixFilter -// )); + Nitric.RegisterWorker(notificationWorker); + } -// notificationWorker.BucketNotification(handler); + /// + /// Request specific access to this bucket. + /// + /// The permissions that the function has to access the bucket. + /// A reference to the bucket. + public Bucket With(BucketPermission permission, params BucketPermission[] permissions) + { + var allPerms = new List { permission }; + allPerms.AddRange(permissions); -// Nitric.RegisterWorker(notificationWorker); -// } - -// /// -// /// Request specific access to this bucket. -// /// -// /// The permissions that the function has to access the bucket. -// /// A reference to the bucket. -// public Bucket With(BucketPermission permission, params BucketPermission[] permissions) -// { -// var allPerms = new List { permission }; -// allPerms.AddRange(permissions); - -// this.RegisterPolicy(allPerms); -// return new Storage.Storage().Bucket(this.Name); -// } -// } -//} + this.RegisterPolicy(allPerms); + return new StorageClient().Bucket(this.Name); + } + } +} diff --git a/src/Nitric.Sdk/Resource/CollectionResource.cs b/src/Nitric.Sdk/Resource/CollectionResource.cs deleted file mode 100644 index fe30150..0000000 --- a/src/Nitric.Sdk/Resource/CollectionResource.cs +++ /dev/null @@ -1,86 +0,0 @@ -//// Copyright 2021, Nitric Technologies Pty Ltd. -//// -//// 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. -//using System.Collections.Generic; -//using System.Linq; -//using Nitric.Proto.Resources.v1; -//using Action = Nitric.Proto.Resources.v1.Action; -//using NitricResource = Nitric.Proto.Resources.v1.ResourceIdentifier; -//using ResourceType = Nitric.Proto.Resources.v1.ResourceType; - -//namespace Nitric.Sdk.Resource -//{ -// /// -// /// Available permissions for collection resources. -// /// -// public enum CollectionPermission -// { -// /// -// /// Enables writing documents to the collection,. -// /// -// Writing, -// /// -// /// Enables reading documents from the collection. -// /// -// Reading, -// /// -// /// Enables deleting documents from the collection. -// /// -// Deleting, -// } - -// public class CollectionResource : SecureResource -// { -// internal CollectionResource(string name) : base(name, ResourceType.KeyValueStore) -// { -// } - -// internal override BaseResource Register() -// { -// var resource = new NitricResource { Name = this.Name, Type = ResourceType.Collection }; -// var request = new ResourceDeclareRequest { Resource = resource }; -// client.Declare(request); -// return this; -// } - -// protected override IEnumerable PermissionsToActions(IEnumerable permissions) -// { -// var actionMap = new Dictionary> -// { -// { -// CollectionPermission.Writing, -// new List { Action.CollectionDocumentWrite } -// }, -// { -// CollectionPermission.Reading, -// new List { Action.CollectionList, Action.CollectionQuery, Action.CollectionDocumentRead } -// }, -// { -// CollectionPermission.Deleting, -// new List { Action.CollectionDocumentDelete } -// } -// }; -// return permissions.Aggregate((IEnumerable)new List(), (acc, x) => acc.Concat(actionMap[x])) -// .Distinct(); -// } - -// public CollectionRef With(CollectionPermission permission, params CollectionPermission[] permissions) -// { -// var allPerms = new List { permission }; -// allPerms.AddRange(permissions); - -// this.RegisterPolicy(allPerms); -// return new DocumentsClient().Collection(this.Name); -// } -// } -//} diff --git a/src/Nitric.Sdk/Resource/KeyValueStoreResource.cs b/src/Nitric.Sdk/Resource/KeyValueStoreResource.cs new file mode 100644 index 0000000..3d54b7f --- /dev/null +++ b/src/Nitric.Sdk/Resource/KeyValueStoreResource.cs @@ -0,0 +1,87 @@ +// Copyright 2021, Nitric Technologies Pty Ltd. +// +// 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. +using System.Collections.Generic; +using System.Linq; +using Nitric.Proto.Resources.v1; +using Nitric.Sdk.KeyValueStore; +using Action = Nitric.Proto.Resources.v1.Action; +using NitricResource = Nitric.Proto.Resources.v1.ResourceIdentifier; +using ResourceType = Nitric.Proto.Resources.v1.ResourceType; + +namespace Nitric.Sdk.Resource +{ + /// + /// Available permissions for collection resources. + /// + public enum KeyValueStorePermission + { + /// + /// Enables setting values to the key value store,. + /// + Setting, + /// + /// Enables getting values from the key value store. + /// + Getting, + /// + /// Enables deleting values from the key value store. + /// + Deleting, + } + + public class KeyValueStoreResource : SecureResource + { + internal KeyValueStoreResource(string name) : base(name, ResourceType.KeyValueStore) + { + } + + internal override BaseResource Register() + { + var resource = new NitricResource { Name = this.Name, Type = ResourceType.KeyValueStore }; + var request = new ResourceDeclareRequest { Id = resource }; + client.Declare(request); + return this; + } + + protected override IEnumerable PermissionsToActions(IEnumerable permissions) + { + var actionMap = new Dictionary> + { + { + KeyValueStorePermission.Setting, + new List { Action.KeyValueStoreWrite } + }, + { + KeyValueStorePermission.Getting, + new List { Action.KeyValueStoreRead } + }, + { + KeyValueStorePermission.Deleting, + new List { Action.KeyValueStoreDelete } + } + }; + return permissions.Aggregate((IEnumerable)new List(), (acc, x) => acc.Concat(actionMap[x])) + .Distinct(); + } + + public KeyValueStore With(KeyValueStorePermission permission, params KeyValueStorePermission[] permissions) + { + var allPerms = new List { permission }; + allPerms.AddRange(permissions); + + this.RegisterPolicy(allPerms); + return new KeyValueStoreClient().Store(this.Name); + } + } +} diff --git a/src/Nitric.Sdk/Resource/QueueResource.cs b/src/Nitric.Sdk/Resource/QueueResource.cs index d0a7c30..0da715f 100644 --- a/src/Nitric.Sdk/Resource/QueueResource.cs +++ b/src/Nitric.Sdk/Resource/QueueResource.cs @@ -1,82 +1,82 @@ -//// Copyright 2021, Nitric Technologies Pty Ltd. -//// -//// 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. -//using System.Collections.Generic; -//using System.Linq; -//using Nitric.Proto.Resources.v1; -//using Nitric.Sdk.Queue; -//using Action = Nitric.Proto.Resources.v1.Action; -//using NitricResource = Nitric.Proto.Resources.v1.ResourceIdentifier; +// Copyright 2021, Nitric Technologies Pty Ltd. +// +// 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. +using System.Collections.Generic; +using System.Linq; +using Nitric.Proto.Resources.v1; +using Nitric.Sdk.Queue; +using Action = Nitric.Proto.Resources.v1.Action; +using NitricResource = Nitric.Proto.Resources.v1.ResourceIdentifier; -//namespace Nitric.Sdk.Resource -//{ -// /// -// /// Available permissions for queue resources. -// /// -// public enum QueuePermission -// { -// /// -// /// Enables pushing new tasks to the queue. -// /// -// Sending, -// /// -// /// Enables pulling and completing tasks on the queue. -// /// -// Receiving -// } +namespace Nitric.Sdk.Resource +{ + /// + /// Available permissions for queue resources. + /// + public enum QueuePermission + { + /// + /// Enables pushing new tasks to the queue. + /// + Enqueue, + /// + /// Enables pulling and completing tasks on the queue. + /// + Dequeue + } -// public class QueueResource : SecureResource -// { -// internal QueueResource(string name) : base(name, ResourceType.Queue) -// { -// } + public class QueueResource : SecureResource + { + internal QueueResource(string name) : base(name, ResourceType.Queue) + { + } -// internal override BaseResource Register() -// { -// var resource = new NitricResource { Name = this.Name, Type = ResourceType.Queue }; -// var request = new ResourceDeclareRequest { Id = resource }; -// client.Declare(request); -// return this; -// } + internal override BaseResource Register() + { + var resource = new NitricResource { Name = this.Name, Type = ResourceType.Queue }; + var request = new ResourceDeclareRequest { Id = resource }; + client.Declare(request); + return this; + } -// protected override IEnumerable PermissionsToActions(IEnumerable permissions) -// { -// var actionMap = new Dictionary> -// { -// { -// QueuePermission.Sending, -// new List { Action.QueueSend, Action.QueueDetail, Action.QueueList } -// }, -// { -// QueuePermission.Receiving, -// new List { Action.QueueReceive, Action.QueueDetail, Action.QueueList } -// } -// }; -// return permissions.Aggregate((IEnumerable)new List(), (acc, x) => acc.Concat(actionMap[x])).Distinct(); -// } + protected override IEnumerable PermissionsToActions(IEnumerable permissions) + { + var actionMap = new Dictionary> + { + { + QueuePermission.Enqueue, + new List { Action.QueueEnqueue } + }, + { + QueuePermission.Dequeue, + new List { Action.QueueDequeue } + } + }; + return permissions.Aggregate((IEnumerable)new List(), (acc, x) => acc.Concat(actionMap[x])).Distinct(); + } -// /// -// /// Request specific access to this queue. -// /// -// /// The permissions that the function has to access the queue. -// /// A reference to the queue. -// public Queue.Queue With(QueuePermission permission, params QueuePermission[] permissions) -// { -// var allPerms = new List { permission }; -// allPerms.AddRange(permissions); + /// + /// Request specific access to this queue. + /// + /// The permissions that the function has to access the queue. + /// A reference to the queue. + public Queue.Queue With(QueuePermission permission, params QueuePermission[] permissions) + { + var allPerms = new List { permission }; + allPerms.AddRange(permissions); -// this.RegisterPolicy(allPerms); -// return new QueuesClient().Queue(this.Name); -// } -// } -//} + this.RegisterPolicy(allPerms); + return new QueuesClient().Queue(this.Name); + } + } +} diff --git a/src/Nitric.Sdk/Resource/TopicResource.cs b/src/Nitric.Sdk/Resource/TopicResource.cs index 3a3b551..2c8c307 100644 --- a/src/Nitric.Sdk/Resource/TopicResource.cs +++ b/src/Nitric.Sdk/Resource/TopicResource.cs @@ -17,7 +17,7 @@ using Nitric.Proto.Resources.v1; using Nitric.Proto.Topics.v1; using Nitric.Sdk.Service; -using Nitric.Sdk.Topic; +using Nitric.Sdk.Topics; using Nitric.Sdk.Worker; using Action = Nitric.Proto.Resources.v1.Action; using NitricResource = Nitric.Proto.Resources.v1.ResourceIdentifier; diff --git a/src/Nitric.Sdk/Resource/WebsocketResource.cs b/src/Nitric.Sdk/Resource/WebsocketResource.cs index bed6635..d9b7e0d 100644 --- a/src/Nitric.Sdk/Resource/WebsocketResource.cs +++ b/src/Nitric.Sdk/Resource/WebsocketResource.cs @@ -1,103 +1,112 @@ -//// Copyright 2021, Nitric Technologies Pty Ltd. -//// -//// 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. +// Copyright 2021, Nitric Technologies Pty Ltd. +// +// 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. -//using System; -//using System.Collections.Generic; -//using System.Linq; -//using System.Runtime.CompilerServices; -//using Nitric.Proto.Resources.v1; -//using Nitric.Sdk.Common; -//using Nitric.Sdk.Function; -//using Nitric.Sdk.Websocket; -//using Action = Nitric.Proto.Resources.v1.Action; -//using NitricResource = Nitric.Proto.Resources.v1.ResourceIdentifier; -//using GrpcClient = Nitric.Proto.Websockets.v1.Websocket.WebsocketClient; +using System; +using System.Collections.Generic; +using System.Linq; +using Nitric.Proto.Resources.v1; +using Nitric.Sdk.Common; +using Nitric.Sdk.Service; +using Nitric.Sdk.Websocket; +using Action = Nitric.Proto.Resources.v1.Action; +using NitricResource = Nitric.Proto.Resources.v1.ResourceIdentifier; +using GrpcClient = Nitric.Proto.Websockets.v1.Websocket.WebsocketClient; +using Nitric.Sdk.Worker; +using Nitric.Proto.Websockets.v1; -//namespace Nitric.Sdk.Resource -//{ -// /// -// /// Available permissions for websocket resources. -// /// -// public enum WebsocketPermission -// { -// /// -// /// Enables pushing new events to the websocket. -// /// -// Manage -// } +namespace Nitric.Sdk.Resource +{ + /// + /// Available permissions for websocket resources. + /// + public enum WebsocketPermission + { + /// + /// Enables pushing new events to the websocket. + /// + Manage + } -// public class WebsocketResource : SecureResource -// { -// private readonly WebsocketClient wsClient; + public class WebsocketResource : SecureResource + { + private readonly WebsocketClient wsClient; -// internal WebsocketResource(string name) : base(name, ResourceType.Websocket) -// { -// this.wsClient = new WebsocketClient(new GrpcClient(GrpcChannelProvider.GetChannel())); -// } + internal WebsocketResource(string name) : base(name, ResourceType.Websocket) + { + this.wsClient = new WebsocketClient(new GrpcClient(GrpcChannelProvider.GetChannel())); + } -// internal override BaseResource Register() -// { -// var resource = new NitricResource { Name = this.Name, Type = ResourceType.Websocket }; -// var request = new ResourceDeclareRequest { Id = resource }; -// BaseResource.client.Declare(request); -// return this; -// } + internal override BaseResource Register() + { + var resource = new NitricResource { Name = this.Name, Type = ResourceType.Websocket }; + var request = new ResourceDeclareRequest { Id = resource }; + BaseResource.client.Declare(request); + return this; + } -// protected override IEnumerable PermissionsToActions(IEnumerable permissions) -// { -// var actionMap = new Dictionary> -// { -// { -// WebsocketPermission.Manage, -// new List { Action.WebsocketManage } -// } -// }; -// return permissions.Aggregate((IEnumerable)new List(), (acc, x) => acc.Concat(actionMap[x])) -// .Distinct(); -// } + protected override IEnumerable PermissionsToActions(IEnumerable permissions) + { + var actionMap = new Dictionary> + { + { + WebsocketPermission.Manage, + new List { Action.WebsocketManage } + } + }; + return permissions.Aggregate((IEnumerable)new List(), (acc, x) => acc.Concat(actionMap[x])) + .Distinct(); + } -// /// -// /// Registers a chain of middleware to be called whenever a new event is published to this topic. -// /// -// /// The type of websocket event listener -// /// The middleware to call to process events -// public void On(WebsocketEventType notificationType, params Middleware[] middleware) -// { -// var websocketWorker = new Faas(new WebsocketWorkerOptions(this.Name, notificationType)); + /// + /// Registers a chain of middleware to be called whenever a new event is published to this topic. + /// + /// The type of websocket event listener + /// The middleware to call to process events + public void On(Service.WebsocketEventType eventType, params Middleware[] middlewares) + { + var registrationRequest = new RegistrationRequest + { + SocketName = Name, + EventType = eventType.ToGrpc() + }; -// websocketWorker.Websocket(middleware); + var websocketWorker = new WebsocketWorker(registrationRequest, middlewares); -// Nitric.RegisterWorker(websocketWorker); -// } + Nitric.RegisterWorker(websocketWorker); + } -// /// -// /// Registers a handler to be called whenever a new event is published to this websocket. -// /// -// /// The type of websocket event -// /// The handler to call to process websocket events -// public void On(WebsocketEventType notificationType, Func handler) -// { -// var websocketWorker = new Faas(new WebsocketWorkerOptions(this.Name, notificationType)); + /// + /// Registers a handler to be called whenever a new event is published to this websocket. + /// + /// The type of websocket event + /// The handler to call to process websocket events + public void On(Service.WebsocketEventType eventType, Func handler) + { + var registrationRequest = new RegistrationRequest + { + SocketName = Name, + EventType = eventType.ToGrpc() + }; -// websocketWorker.Websocket(handler); + var websocketWorker = new WebsocketWorker(registrationRequest, handler); -// Nitric.RegisterWorker(websocketWorker); -// } + Nitric.RegisterWorker(websocketWorker); + } -// public Connection Connection(string connectionId) -// { -// return this.wsClient.Connection(this.Name, connectionId); -// } -// } -//} + public Connection Connection(string connectionId) + { + return this.wsClient.Connection(this.Name, connectionId); + } + } +} diff --git a/src/Nitric.Sdk/Secret/Secret.cs b/src/Nitric.Sdk/Secret/Secret.cs index 244a457..7d0a124 100644 --- a/src/Nitric.Sdk/Secret/Secret.cs +++ b/src/Nitric.Sdk/Secret/Secret.cs @@ -14,9 +14,9 @@ using System; using System.Text; +using System.Threading.Tasks; using Nitric.Proto.Secrets.v1; using Nitric.Sdk.Common; -using GrpcClient = Nitric.Proto.Secrets.v1.SecretManager.SecretManagerClient; namespace Nitric.Sdk.Secret { @@ -27,16 +27,16 @@ public class Secret { private const string LATEST = "latest"; - internal readonly GrpcClient Client; + internal readonly SecretsClient Secrets; /// /// The name of the secret. /// public readonly string Name; - internal Secret(GrpcClient client, string name) + internal Secret(SecretsClient client, string name) { - this.Client = client; + this.Secrets = client; this.Name = name; } @@ -68,12 +68,17 @@ public SecretVersion Latest() /// /// Create a new version of this secret containing the provided value and set it as the latest version. /// - /// The secret value to store from an array of bytes. + /// The secret value to store from a string. /// A reference to the specific version of the secret containing the provided value. /// /// - public SecretVersion Put(byte[] value) + public SecretVersion Put(string value) { + if (string.IsNullOrEmpty(value)) + { + throw new ArgumentNullException("value"); + } + if (value == null || value.Length == 0) { throw new ArgumentNullException(nameof(value)); @@ -82,14 +87,14 @@ public SecretVersion Put(byte[] value) var request = new SecretPutRequest { Secret = new Proto.Secrets.v1.Secret { Name = this.Name }, - Value = Google.Protobuf.ByteString.CopyFrom(value), + Value = Google.Protobuf.ByteString.CopyFrom(Encoding.UTF8.GetBytes(value)), }; try { - var secretResponse = Client.Put(request); + var secretResponse = Secrets.Client.Put(request); return new SecretVersion( new Secret( - this.Client, + this.Secrets, secretResponse.SecretVersion.Secret.Name ), secretResponse.SecretVersion.Version @@ -97,7 +102,7 @@ public SecretVersion Put(byte[] value) } catch (Grpc.Core.RpcException re) { - throw Common.NitricException.FromRpcException(re); + throw NitricException.FromRpcException(re); } } @@ -108,14 +113,38 @@ public SecretVersion Put(byte[] value) /// A reference to the specific version of the secret containing the provided value. /// /// - public SecretVersion Put(string value) + public async Task PutAsync(string value) { if (string.IsNullOrEmpty(value)) { throw new ArgumentNullException("value"); } - return Put(Encoding.UTF8.GetBytes(value)); + if (value == null || value.Length == 0) + { + throw new ArgumentNullException(nameof(value)); + } + + var request = new SecretPutRequest + { + Secret = new Proto.Secrets.v1.Secret { Name = this.Name }, + Value = Google.Protobuf.ByteString.CopyFrom(Encoding.UTF8.GetBytes(value)), + }; + try + { + var secretResponse = await Secrets.Client.PutAsync(request); + return new SecretVersion( + new Secret( + this.Secrets, + secretResponse.SecretVersion.Secret.Name + ), + secretResponse.SecretVersion.Version + ); + } + catch (Grpc.Core.RpcException re) + { + throw NitricException.FromRpcException(re); + } } /// diff --git a/src/Nitric.Sdk/Secret/SecretVersion.cs b/src/Nitric.Sdk/Secret/SecretVersion.cs index 8c06514..4994702 100644 --- a/src/Nitric.Sdk/Secret/SecretVersion.cs +++ b/src/Nitric.Sdk/Secret/SecretVersion.cs @@ -13,6 +13,7 @@ // limitations under the License. using System; +using System.Threading.Tasks; using Nitric.Proto.Secrets.v1; using Nitric.Sdk.Common; @@ -64,9 +65,43 @@ public SecretValue Access() Version = this.Id, } }; + + try + { + var response = this.Secret.Secrets.Client.Access(secret); + var value = response.Value.ToByteArray(); + //Return a new secret value with a reference to this secret version + return new SecretValue( + this, + value.Length > 0 ? value : Array.Empty() + ); + } + catch (Grpc.Core.RpcException re) + { + throw Common.NitricException.FromRpcException(re); + } + } + + /// + /// Retrieve the value stored in this version. + /// + /// The secret value from the secrets store. + /// + public async Task AccessAsync() + { + var secret = new SecretAccessRequest + { + SecretVersion = new Proto.Secrets.v1.SecretVersion + { + Secret = new Proto.Secrets.v1.Secret { Name = this.Secret.Name }, + Version = this.Id, + } + }; + try { - var response = this.Secret.Client.Access(secret); + var response = await this.Secret.Secrets.Client.AccessAsync(secret); + var value = response.Value.ToByteArray(); //Return a new secret value with a reference to this secret version return new SecretValue( diff --git a/src/Nitric.Sdk/Secret/SecretsClient.cs b/src/Nitric.Sdk/Secret/SecretsClient.cs index 5572dba..80e3c9c 100644 --- a/src/Nitric.Sdk/Secret/SecretsClient.cs +++ b/src/Nitric.Sdk/Secret/SecretsClient.cs @@ -23,7 +23,7 @@ namespace Nitric.Sdk.Secret /// public class SecretsClient { - private readonly GrpcClient secretServiceClient; + internal readonly GrpcClient Client; /// /// Create a new secrets service client. @@ -31,7 +31,7 @@ public class SecretsClient /// public SecretsClient(GrpcClient client = null) { - this.secretServiceClient = client ?? new GrpcClient(GrpcChannelProvider.GetChannel()); + this.Client = client ?? new GrpcClient(GrpcChannelProvider.GetChannel()); } /// @@ -47,7 +47,7 @@ public Secret Secret(string name) throw new ArgumentNullException(nameof(name)); } - return new Secret(this.secretServiceClient, name); + return new Secret(this, name); } } } diff --git a/src/Nitric.Sdk/Service/BlobEventContext.cs b/src/Nitric.Sdk/Service/BlobEventContext.cs index a563cea..b7d4cf0 100644 --- a/src/Nitric.Sdk/Service/BlobEventContext.cs +++ b/src/Nitric.Sdk/Service/BlobEventContext.cs @@ -16,12 +16,45 @@ using Nitric.Proto.Storage.v1; using Nitric.Sdk.Storage; using ProtoBlobEventResponse = Nitric.Proto.Storage.v1.BlobEventResponse; +using ProtoBlobEventType = Nitric.Proto.Storage.v1.BlobEventType; namespace Nitric.Sdk.Service { - public enum BucketNotificationType + /// + /// Extension class for methods converting blob event types to and from gRPC calls. + /// + internal static class BlobEventTypeExtension + { + /// + /// Convert a SDK blob event type into a gRPC blob event type. + /// + /// + /// + /// + internal static ProtoBlobEventType ToGrpc( + this BlobEventType blobEventType) + { + return blobEventType switch + { + BlobEventType.Write => ProtoBlobEventType.Created, + BlobEventType.Delete => ProtoBlobEventType.Deleted, + _ => throw new ArgumentException("Unsupported blob event type") + }; + } + } + + /// + /// Available blob event trigger types. + /// + public enum BlobEventType { + /// + /// Trigger a blob event on a write event. + /// Write, + /// + /// Trigger a blob event on a delete event. + /// Delete } @@ -33,13 +66,13 @@ public class BlobEventRequest : TriggerRequest /// /// A reference to the file that triggered this request /// - public File File { get; private set; } + public Storage.Blob File { get; private set; } /// /// The type of event that triggered this request /// /// - public BucketNotificationType NotificationType { get; private set; } + public BlobEventType NotificationType { get; private set; } /// /// Construct a bucket notification request @@ -48,7 +81,7 @@ public class BlobEventRequest : TriggerRequest /// the file that triggered the notification /// the type of bucket notification /// the bucket that triggered the notification - public BlobEventRequest(string key, BucketNotificationType notificationType, Bucket bucket) : base() + public BlobEventRequest(string key, BlobEventType notificationType, Bucket bucket) : base() { this.File = bucket.File(key); this.NotificationType = notificationType; @@ -99,7 +132,7 @@ public BlobEventContext(string id, BlobEventRequest req, BlobEventResponse res) /// the new bucket notification context public static BlobEventContext FromRequest(ServerMessage trigger, Bucket bucket) { - var notificationType = FromGrpcBucketNotificationType(trigger.BlobEventRequest.BlobEvent.Type); + var notificationType = FromGrpcBlobEventType(trigger.BlobEventRequest.BlobEvent.Type); return new BlobEventContext( trigger.Id, @@ -111,15 +144,20 @@ public static BlobEventContext FromRequest(ServerMessage trigger, Bucket bucket) new BlobEventResponse(true)); } - - private static BucketNotificationType FromGrpcBucketNotificationType( - BlobEventType notificationType) + /// + /// Convert a gRPC blob event type into a SDK blob event type. + /// + /// + /// + /// + private static BlobEventType FromGrpcBlobEventType( + ProtoBlobEventType blobEventType) { - return notificationType switch + return blobEventType switch { - BlobEventType.Created => BucketNotificationType.Write, - BlobEventType.Deleted => BucketNotificationType.Delete, - _ => throw new ArgumentException("Unsupported bucket notification type") + ProtoBlobEventType.Created => BlobEventType.Write, + ProtoBlobEventType.Deleted => BlobEventType.Delete, + _ => throw new ArgumentException("Unsupported blob event type") }; } diff --git a/src/Nitric.Sdk/Service/WebsocketContext.cs b/src/Nitric.Sdk/Service/WebsocketContext.cs index fd5f227..17a65eb 100644 --- a/src/Nitric.Sdk/Service/WebsocketContext.cs +++ b/src/Nitric.Sdk/Service/WebsocketContext.cs @@ -19,9 +19,34 @@ using Nitric.Proto.Websockets.v1; using WebsocketEventTypeProto = Nitric.Proto.Websockets.v1.WebsocketEventRequest.WebsocketEventOneofCase; using Google.Protobuf.Collections; +using ProtoWebsocketEventType = Nitric.Proto.Websockets.v1.WebsocketEventType; namespace Nitric.Sdk.Service { + /// + /// Extension class for methods converting blob event types to and from gRPC calls. + /// + internal static class WebsocketEventTypeExtension + { + /// + /// Convert a SDK websocket event type into a gRPC blob event type. + /// + /// + /// + /// + internal static ProtoWebsocketEventType ToGrpc( + this WebsocketEventType websocketEventType) + { + return websocketEventType switch + { + WebsocketEventType.Connected => ProtoWebsocketEventType.Connect, + WebsocketEventType.Disconnected => ProtoWebsocketEventType.Disconnect, + WebsocketEventType.Message => ProtoWebsocketEventType.Message, + _ => throw new ArgumentException("Unsupported websocket event type") + }; + } + } + public enum WebsocketEventType { Connected, @@ -112,7 +137,7 @@ public WebsocketContext(string id, WebsocketRequest req, WebsocketResponse res) /// /// The trigger to convert into an EventContext. /// the new event context - public static WebsocketContext ToRequest(ServerMessage trigger) + public static WebsocketContext FromRequest(ServerMessage trigger) { var type = FromGrpcWebsocketNotificationType(trigger.WebsocketEventRequest.WebsocketEventCase); var queryParams = GetQueryParams(trigger.WebsocketEventRequest.Connection.QueryParams); diff --git a/src/Nitric.Sdk/Storage/Bucket.cs b/src/Nitric.Sdk/Storage/Bucket.cs index 015ad80..bd7b951 100644 --- a/src/Nitric.Sdk/Storage/Bucket.cs +++ b/src/Nitric.Sdk/Storage/Bucket.cs @@ -11,11 +11,13 @@ // 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. + using System; using System.Collections.Generic; using Nitric.Proto.Storage.v1; using Nitric.Sdk.Service; -using ProtoFile = Nitric.Proto.Storage.v1.Object; +using Nitric.Sdk.Worker; +using ProtoBlob = Nitric.Proto.Storage.v1.Blob; namespace Nitric.Sdk.Storage @@ -25,98 +27,98 @@ namespace Nitric.Sdk.Storage /// public class Bucket { - private readonly Storage storage; + internal readonly StorageClient Storage; /// /// The name of the bucket. /// public string Name { get; private set; } - internal Bucket(Storage storage, string name) + internal Bucket(StorageClient storage, string name) { - this.storage = storage; + this.Storage = storage; this.Name = name; } /// - /// Create a reference to a file in the bucket. + /// Create a reference to a blob in the bucket. /// - /// The files name/path - /// The file reference. + /// The blobs name/path + /// The blob reference. /// - public File File(string key) + public Blob File(string key) { if (string.IsNullOrEmpty(key)) { throw new ArgumentNullException(nameof(key)); } - return new File(storage, this, key); + return new Blob(this, key); } /// - /// Get a list of files in a bucket. + /// Get a list of blobs in a bucket. /// - /// All the files in the bucket as Nitric file references. - public List Files() + /// All the files in the bucket as Nitric blob references. + public List Files() { - var request = new StorageListFilesRequest + var request = new StorageListBlobsRequest { BucketName = this.Name, }; - var resp = this.storage.Client.ListFiles(request); + var resp = this.Storage.Client.ListBlobs(request); - List files = new List(); + List files = new List(); - foreach (ProtoFile file in resp.Files) + foreach (ProtoBlob file in resp.Blobs) { - files.Add(new File(this.storage, this, file.Key)); + files.Add(new Blob(this, file.Key)); } return files; } /// - /// Registers handlers to be called whenever a file triggers an event in the bucket + /// Registers handlers to be called whenever a blob triggers an event in the bucket /// - /// The type of events that should trigger events, Write or Delete - /// The prefix of file names that should trigger events - /// The handlers to call to process notification events + /// The type of events that should trigger events, Write or Delete + /// The prefix of blob names that should trigger events + /// The handlers to call to process notification events public void On( - BucketNotificationType notificationType, - string notificationPrefixFilter, - params Middleware[] middleware) + Service.BlobEventType blobEventType, + string keyPrefixFilter, + params Middleware[] middlewares) { - var notificationWorker = new Faas(new FileNotificationWorkerOptions( - this, - notificationType, - notificationPrefixFilter - )); - - notificationWorker.FileNotification(middleware); + var request = new RegistrationRequest + { + BucketName = this.Name, + KeyPrefixFilter = keyPrefixFilter, + BlobEventType = blobEventType.ToGrpc(), + }; + var notificationWorker = new BlobEventWorker(request, middlewares); Nitric.RegisterWorker(notificationWorker); } /// - /// Registers a handler to be called whenever a file triggers an event in the bucket + /// Registers a handler to be called whenever a blob triggers an event in the bucket /// - /// The type of events that should trigger events, Write or Delete - /// The prefix of file names that should trigger events + /// The type of events that should trigger events, Write or Delete + /// The prefix of blob names that should trigger events /// The handler to call to process notification events public void On( - BucketNotificationType notificationType, - string notificationPrefixFilter, - Func handler) + Service.BlobEventType blobEventType, + string keyPrefixFilter, + Func handler) { - var notificationWorker = new Faas(new FileNotificationWorkerOptions( - this, - notificationType, - notificationPrefixFilter - )); - - notificationWorker.FileNotification(handler); + var request = new RegistrationRequest + { + BucketName = this.Name, + KeyPrefixFilter = keyPrefixFilter, + BlobEventType = blobEventType.ToGrpc(), + }; + var notificationWorker = new BlobEventWorker(request, handler); Nitric.RegisterWorker(notificationWorker); } diff --git a/src/Nitric.Sdk/Storage/File.cs b/src/Nitric.Sdk/Storage/File.cs index ab13f33..809b639 100644 --- a/src/Nitric.Sdk/Storage/File.cs +++ b/src/Nitric.Sdk/Storage/File.cs @@ -12,50 +12,47 @@ // See the License for the specific language governing permissions and // limitations under the License. -using System; -using System.Text; +using System; +using System.Threading.Tasks; using Google.Protobuf; +using Google.Protobuf.WellKnownTypes; using Nitric.Proto.Storage.v1; using Nitric.Sdk.Common; -using Nitric.Sdk.Function; -using ProtoFile = Nitric.Proto.Storage.v1.Object; namespace Nitric.Sdk.Storage { /// /// Available operations for signing a url. /// - public enum FileMode + public enum SignedMode { /// - /// Download a file from a bucket. + /// Download a blob from a bucket. /// Read, /// - /// Upload a file to a bucket. + /// Upload a blob to a bucket. /// Write, } /// - /// A reference to a specific file in a bucket. + /// A reference to a specific blob in a bucket. /// - public class File + public class Blob { - private readonly Storage storage; - private readonly Bucket bucket; + private readonly Bucket Bucket; public string Name { get; private set; } - internal File(Storage storage, Bucket bucket, string key) + internal Blob(Bucket bucket, string key) { - this.storage = storage; - this.bucket = bucket; + this.Bucket = bucket; this.Name = key; } /// - /// Create or update the contents of the file. + /// Create or update the contents of the blob. /// /// The contents to write. /// @@ -63,13 +60,13 @@ public void Write(byte[] body) { var request = new StorageWriteRequest { - BucketName = bucket.Name, + BucketName = Bucket.Name, Key = this.Name, Body = ByteString.CopyFrom(body) }; try { - storage.Client.Write(request); + this.Bucket.Storage.Client.Write(request); } catch (Grpc.Core.RpcException re) { @@ -78,7 +75,7 @@ public void Write(byte[] body) } /// - /// Create or update the contents of the file. + /// Create or update the contents of the blob. /// /// The contents to write. /// @@ -86,13 +83,13 @@ public void Write(string body) { var request = new StorageWriteRequest { - BucketName = bucket.Name, + BucketName = Bucket.Name, Key = this.Name, Body = ByteString.CopyFromUtf8(body) }; try { - storage.Client.Write(request); + this.Bucket.Storage.Client.Write(request); } catch (Grpc.Core.RpcException re) { @@ -101,20 +98,66 @@ public void Write(string body) } /// - /// Retrieve the contents of a file. + /// Create or update the contents of the blob. /// - /// The file contents. + /// The contents to write. + /// + public async Task WriteAsync(byte[] body) + { + var request = new StorageWriteRequest + { + BucketName = Bucket.Name, + Key = this.Name, + Body = ByteString.CopyFrom(body) + }; + try + { + await this.Bucket.Storage.Client.WriteAsync(request); + } + catch (Grpc.Core.RpcException re) + { + throw NitricException.FromRpcException(re); + } + } + + /// + /// Create or update the contents of the blob. + /// + /// The contents to write. + /// + public async Task WriteAsync(string body) + { + var request = new StorageWriteRequest + { + BucketName = Bucket.Name, + Key = this.Name, + Body = ByteString.CopyFromUtf8(body) + }; + try + { + await this.Bucket.Storage.Client.WriteAsync(request); + } + catch (Grpc.Core.RpcException re) + { + throw NitricException.FromRpcException(re); + } + } + + /// + /// Retrieve the contents of a blob. + /// + /// The blob contents. /// public byte[] Read() { var request = new StorageReadRequest { - BucketName = bucket.Name, + BucketName = Bucket.Name, Key = this.Name }; try { - var response = storage.Client.Read(request); + var response = this.Bucket.Storage.Client.Read(request); return response.Body.ToByteArray(); } catch (Grpc.Core.RpcException re) @@ -124,19 +167,42 @@ public byte[] Read() } /// - /// Delete the file. + /// Retrieve the contents of a blob. + /// + /// The blob contents. + /// + public async Task ReadAsync() + { + var request = new StorageReadRequest + { + BucketName = Bucket.Name, + Key = this.Name + }; + try + { + var response = await this.Bucket.Storage.Client.ReadAsync(request); + return response.Body.ToByteArray(); + } + catch (Grpc.Core.RpcException re) + { + throw NitricException.FromRpcException(re); + } + } + + /// + /// Delete the blob. /// /// public void Delete() { var request = new StorageDeleteRequest { - BucketName = bucket.Name, + BucketName = Bucket.Name, Key = this.Name }; try { - storage.Client.Delete(request); + this.Bucket.Storage.Client.Delete(request); } catch (Grpc.Core.RpcException re) { @@ -145,25 +211,48 @@ public void Delete() } /// - /// Create a presigned URL for reading or writing for the given file reference. + /// Delete the blob. /// - /// The mode the URL will access the file with. E.g. reading or writing. - /// How long the URL should be valid for in seconds. + /// + public async Task DeleteAsync() + { + var request = new StorageDeleteRequest + { + BucketName = Bucket.Name, + Key = this.Name + }; + try + { + await this.Bucket.Storage.Client.DeleteAsync(request); + } + catch (Grpc.Core.RpcException re) + { + throw NitricException.FromRpcException(re); + } + } + + /// + /// Create a presigned URL for reading or writing for the given blob reference. + /// + /// The mode the URL will access the blob with. E.g. reading or writing. + /// How long the URL should be valid for in seconds (max of 604800). /// The signed URL for reading or writing - internal string PreSignUrl(FileMode mode, int expiry) + internal string PreSignUrl(SignedMode mode, int expiry) { var request = new StoragePreSignUrlRequest { - BucketName = this.bucket.Name, + BucketName = this.Bucket.Name, Key = this.Name, - Operation = mode == FileMode.Read ? StoragePreSignUrlRequest.Types.Operation.Read : StoragePreSignUrlRequest.Types.Operation.Write, - Expiry = expiry < 0 ? 0 : (uint)expiry, - + Operation = mode == SignedMode.Read ? StoragePreSignUrlRequest.Types.Operation.Read : StoragePreSignUrlRequest.Types.Operation.Write, + Expiry = new Duration + { + Seconds = Math.Clamp(expiry, 0, 604800), + } }; try { - var resp = storage.Client.PreSignUrl(request); + var resp = this.Bucket.Storage.Client.PreSignUrl(request); return resp.Url; } catch (Grpc.Core.RpcException re) @@ -173,32 +262,82 @@ internal string PreSignUrl(FileMode mode, int expiry) } /// - /// Create a presigned URL for reading a given file reference. + /// Create a presigned URL for reading a given blob reference. /// /// How long the URL should be valid for in seconds. Defaults to 600 seconds (10 minutes). /// The signed URL for reading. public string GetDownloadUrl(int expiry = 600) { - return this.PreSignUrl(FileMode.Write, expiry); + return this.PreSignUrl(SignedMode.Write, expiry); } /// - /// Create a presigned URL for writing to a given file reference. + /// Create a presigned URL for writing to a given blob reference. /// /// How long the URL should be valid for in seconds. Defaults to 600 seconds (10 minutes). /// The signed URL for writing. public string GetUploadUrl(int expiry = 600) { - return this.PreSignUrl(FileMode.Read, expiry); + return this.PreSignUrl(SignedMode.Read, expiry); + } + + /// + /// Create a presigned URL for reading or writing for the given blob reference. + /// + /// The mode the URL will access the blob with. E.g. reading or writing. + /// How long the URL should be valid for in seconds (max of 604800). + /// The signed URL for reading or writing + internal async Task PreSignUrlAsync(SignedMode mode, int expiry) + { + var request = new StoragePreSignUrlRequest + { + BucketName = this.Bucket.Name, + Key = this.Name, + Operation = mode == SignedMode.Read ? StoragePreSignUrlRequest.Types.Operation.Read : StoragePreSignUrlRequest.Types.Operation.Write, + Expiry = new Duration + { + Seconds = Math.Clamp(expiry, 0, 604800), + } + }; + + try + { + var resp = await this.Bucket.Storage.Client.PreSignUrlAsync(request); + return resp.Url; + } + catch (Grpc.Core.RpcException re) + { + throw NitricException.FromRpcException(re); + } + } + + /// + /// Create a presigned URL for reading a given blob reference. + /// + /// How long the URL should be valid for in seconds. Defaults to 600 seconds (10 minutes). + /// The signed URL for reading. + public async Task GetDownloadUrlAsync(int expiry = 600) + { + return await this.PreSignUrlAsync(SignedMode.Write, expiry); + } + + /// + /// Create a presigned URL for writing to a given blob reference. + /// + /// How long the URL should be valid for in seconds. Defaults to 600 seconds (10 minutes). + /// The signed URL for writing. + public async Task GetUploadUrlAsync(int expiry = 600) + { + return await this.PreSignUrlAsync(SignedMode.Read, expiry); } /// - /// Return a string representation of the file. Will not contain the file contents. + /// Return a string representation of the blob. Will not contain the blob contents. /// /// public override string ToString() { - return GetType().Name + "[name=" + Name + "\nbucket=" + bucket.Name + "]"; + return GetType().Name + "[name=" + Name + "\nbucket=" + Bucket.Name + "]"; } } } diff --git a/src/Nitric.Sdk/Storage/StorageClient.cs b/src/Nitric.Sdk/Storage/StorageClient.cs index 0203a23..541ce7b 100644 --- a/src/Nitric.Sdk/Storage/StorageClient.cs +++ b/src/Nitric.Sdk/Storage/StorageClient.cs @@ -14,14 +14,14 @@ using System; using Nitric.Sdk.Common; -using GrpcClient = Nitric.Proto.Storage.v1.StorageService.StorageServiceClient; +using GrpcClient = Nitric.Proto.Storage.v1.Storage.StorageClient; namespace Nitric.Sdk.Storage { /// /// A storage client. /// - public class Storage + public class StorageClient { internal readonly GrpcClient Client; @@ -29,7 +29,7 @@ public class Storage /// Create a new storage client. /// /// Optional internal gRPC client to reuse. - public Storage(GrpcClient client = null) + public StorageClient(GrpcClient client = null) { this.Client = client ?? new GrpcClient(GrpcChannelProvider.GetChannel()); } diff --git a/src/Nitric.Sdk/Topic/Event.cs.old b/src/Nitric.Sdk/Topic/Event.cs.old deleted file mode 100644 index 9c94cfc..0000000 --- a/src/Nitric.Sdk/Topic/Event.cs.old +++ /dev/null @@ -1,103 +0,0 @@ -// Copyright 2021, Nitric Technologies Pty Ltd. -// -// 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. - -using System; -using System.Runtime.CompilerServices; -using System.Text; -using Google.Protobuf; -using Google.Protobuf.WellKnownTypes; -using Newtonsoft.Json; -using Nitric.Proto.Event.v1; - -namespace Nitric.Sdk.Event -{ - /// - /// Events represent a Message delivered via Publish/Subscribe. - /// - public class Event - { - /// - /// The unique ID of this event. - /// - /// Used to every reprocessing. - /// - public string Id { get; set; } - - /// - /// The expected type of the event's payload. - /// - public string PayloadType { get; set; } - - /// - /// The payload (contents) of the event. - /// - public T Payload { get; set; } - - /// - /// Create a new event. - /// - public Event() - { - } - - /// - /// Create a new event object. - /// - /// The unique id for this event. - /// The type of this event's payload. - /// The contents of the event message. - public Event(string id, string payloadType, T payload) - { - this.Payload = payload; - this.Id = id ?? Guid.NewGuid().ToString(); - this.PayloadType = payloadType ?? "none"; - } - - public static Event FromPayload(byte[] data) - { - var eventData = Encoding.Default.GetString(data); - return JsonConvert.DeserializeObject>(eventData); - } - - /// - /// Return a string representing the details of the event. - /// - /// A string - public override string ToString() - { - var jsonPayload = JsonConvert.SerializeObject(Payload); - return "Event[id=" + Id - + ", payloadType=" + PayloadType - + ", payload=" + jsonPayload - + "]"; - } - - internal NitricEvent ToWire() - { - Struct payload = null; - if (this.Payload != null) - { - var jsonPayload = JsonConvert.SerializeObject(this.Payload); - payload = JsonParser.Default.Parse(jsonPayload); - } - - return new NitricEvent - { - Id = this.Id ?? "", - PayloadType = this.PayloadType ?? "", - Payload = payload, - }; - } - } -} diff --git a/src/Nitric.Sdk/Topic/Topic.cs b/src/Nitric.Sdk/Topics/Topic.cs similarity index 61% rename from src/Nitric.Sdk/Topic/Topic.cs rename to src/Nitric.Sdk/Topics/Topic.cs index af92e57..d211e88 100644 --- a/src/Nitric.Sdk/Topic/Topic.cs +++ b/src/Nitric.Sdk/Topics/Topic.cs @@ -12,10 +12,11 @@ // See the License for the specific language governing permissions and // limitations under the License. +using System.Threading.Tasks; using Nitric.Proto.Topics.v1; using Nitric.Sdk.Common; -namespace Nitric.Sdk.Topic +namespace Nitric.Sdk.Topics { /// /// Represents a reference to a topic. @@ -43,7 +44,11 @@ public void Publish(T message) { var structPayload = Struct.FromJsonSerializable(message); - var request = new TopicPublishRequest { TopicName = this.Name, Message = new TopicMessage { StructPayload = structPayload } }; + var request = new TopicPublishRequest + { + TopicName = this.Name, + Message = new TopicMessage { StructPayload = structPayload } + }; try { @@ -54,5 +59,30 @@ public void Publish(T message) throw NitricException.FromRpcException(re); } } + + /// + /// Publish a new message to this topic. + /// + /// The message to publish + /// + public async Task PublishAsync(T message) + { + var structPayload = Struct.FromJsonSerializable(message); + + var request = new TopicPublishRequest + { + TopicName = this.Name, + Message = new TopicMessage { StructPayload = structPayload } + }; + + try + { + await this.TopicsClient.Client.PublishAsync(request); + } + catch (Grpc.Core.RpcException re) + { + throw NitricException.FromRpcException(re); + } + } } } diff --git a/src/Nitric.Sdk/Topic/TopicsClient.cs b/src/Nitric.Sdk/Topics/TopicsClient.cs similarity index 95% rename from src/Nitric.Sdk/Topic/TopicsClient.cs rename to src/Nitric.Sdk/Topics/TopicsClient.cs index 721da85..8965137 100644 --- a/src/Nitric.Sdk/Topic/TopicsClient.cs +++ b/src/Nitric.Sdk/Topics/TopicsClient.cs @@ -13,12 +13,10 @@ // limitations under the License. using System; -using System.Collections.Generic; -using System.Linq; using Nitric.Sdk.Common; using TopicsGrpcClient = Nitric.Proto.Topics.v1.Topics.TopicsClient; -namespace Nitric.Sdk.Topic +namespace Nitric.Sdk.Topics { /// /// Events service client. diff --git a/src/Nitric.Sdk/Websocket/Connection.cs b/src/Nitric.Sdk/Websocket/Connection.cs index 1ce92bf..b8b1e8c 100644 --- a/src/Nitric.Sdk/Websocket/Connection.cs +++ b/src/Nitric.Sdk/Websocket/Connection.cs @@ -1,76 +1,126 @@ -//// Copyright 2021, Nitric Technologies Pty Ltd. -//// -//// 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. -//using Google.Protobuf; -//using Grpc.Core; -//using Nitric.Proto.Websocket.v1; -//using Nitric.Sdk.Common; -//using Nitric.Sdk.Resource; +// Copyright 2021, Nitric Technologies Pty Ltd. +// +// 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. +using System.Threading.Tasks; +using Google.Protobuf; +using Grpc.Core; +using Nitric.Proto.Websockets.v1; +using Nitric.Sdk.Common; -//namespace Nitric.Sdk.Websocket -//{ -// public class Connection -// { -// /// -// /// The unique connection Id -// /// -// public string Id { get; set; } +namespace Nitric.Sdk.Websocket +{ + public class Connection + { + /// + /// The unique connection Id + /// + public string Id { get; set; } -// public string Socket { get; set; } + public string SocketName { get; set; } -// private readonly WebsocketClient websocket; + private readonly WebsocketClient Websocket; -// internal Connection(WebsocketClient websocket, string id, string socket) -// { -// this.websocket = websocket; -// this.Id = id; -// this.Socket = socket; -// } + internal Connection(WebsocketClient websocket, string connectionId, string socketName) + { + this.Websocket = websocket; + this.Id = connectionId; + this.SocketName = socketName; + } -// public void Send(string data) -// { -// var request = new WebsocketSendRequest -// { -// ConnectionId = this.Id, -// Socket = this.Socket, -// Data = ByteString.CopyFromUtf8(data) -// }; -// try -// { -// this.websocket.client.Send(request); -// } -// catch (RpcException e) -// { -// throw NitricException.FromRpcException(e); -// } -// } + /// + /// Send a message to the websocket. + /// + /// The message to be sent + public void SendMessage(string message) + { + var request = new WebsocketSendRequest + { + ConnectionId = this.Id, + SocketName = this.SocketName, + Data = ByteString.CopyFromUtf8(message) + }; + try + { + this.Websocket.Client.SendMessage(request); + } + catch (RpcException e) + { + throw NitricException.FromRpcException(e); + } + } -// public void Close() -// { -// var request = new WebsocketCloseRequest -// { -// ConnectionId = this.Id, -// Socket = this.Socket, -// }; + /// + /// Send a message to the websocket. + /// + /// The message to be sent + public async Task SendMessageAsync(string message) + { + var request = new WebsocketSendRequest + { + ConnectionId = this.Id, + SocketName = this.SocketName, + Data = ByteString.CopyFromUtf8(message) + }; + try + { + await this.Websocket.Client.SendMessageAsync(request); + } + catch (RpcException e) + { + throw NitricException.FromRpcException(e); + } + } -// try -// { -// this.websocket.client.Close(request); -// } -// catch (RpcException e) -// { -// throw NitricException.FromRpcException(e); -// } -// } -// } -//} + /// + /// Close the connection to the websocket. + /// + public void CloseConnection() + { + var request = new WebsocketCloseConnectionRequest + { + ConnectionId = this.Id, + SocketName = this.SocketName, + }; + + try + { + this.Websocket.Client.CloseConnection(request); + } + catch (RpcException e) + { + throw NitricException.FromRpcException(e); + } + } + + /// + /// Close the connection to the websocket. + /// + public async Task CloseConnectionAsync() + { + var request = new WebsocketCloseConnectionRequest + { + ConnectionId = this.Id, + SocketName = this.SocketName, + }; + + try + { + await this.Websocket.Client.CloseConnectionAsync(request); + } + catch (RpcException e) + { + throw NitricException.FromRpcException(e); + } + } + } +} diff --git a/src/Nitric.Sdk/Websocket/WebsocketClient.cs b/src/Nitric.Sdk/Websocket/WebsocketClient.cs index 0b5a834..8be6825 100644 --- a/src/Nitric.Sdk/Websocket/WebsocketClient.cs +++ b/src/Nitric.Sdk/Websocket/WebsocketClient.cs @@ -1,43 +1,44 @@ -//// Copyright 2021, Nitric Technologies Pty Ltd. -//// -//// 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. -//using System; -//using Nitric.Sdk.Common; -//using GrpcClient = Nitric.Proto.Websockets.v1.Websocket.WebsocketClient; +// Copyright 2021, Nitric Technologies Pty Ltd. +// +// 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. +using System; +using Nitric.Sdk.Common; +using GrpcClient = Nitric.Proto.Websockets.v1.Websocket.WebsocketClient; -//namespace Nitric.Sdk.Websocket -//{ -// public class WebsocketClient -// { -// internal readonly GrpcClient client; +namespace Nitric.Sdk.Websocket +{ + public class WebsocketClient + { + internal readonly GrpcClient Client; -// public WebsocketClient(GrpcClient client = null) -// { -// this.client = client ?? new GrpcClient(GrpcChannelProvider.GetChannel()); -// } + public WebsocketClient(GrpcClient client = null) + { + this.Client = client ?? new GrpcClient(GrpcChannelProvider.GetChannel()); + } -// public Connection Connection(string socket, string connectionId) -// { -// if (string.IsNullOrEmpty(socket)) -// { -// throw new ArgumentNullException(nameof(socket)); -// } + public Connection Connection(string socket, string connectionId) + { + if (string.IsNullOrEmpty(socket)) + { + throw new ArgumentNullException(nameof(socket)); + } -// if (string.IsNullOrEmpty(connectionId)) -// { -// throw new ArgumentNullException(nameof(connectionId)); -// } -// return new Connection(this, connectionId, socket); -// } -// } -//} + if (string.IsNullOrEmpty(connectionId)) + { + throw new ArgumentNullException(nameof(connectionId)); + } + + return new Connection(this, connectionId, socket); + } + } +} diff --git a/src/Nitric.Sdk/Worker/BlobEventWorker.cs b/src/Nitric.Sdk/Worker/BlobEventWorker.cs index 747bf47..ec503a8 100644 --- a/src/Nitric.Sdk/Worker/BlobEventWorker.cs +++ b/src/Nitric.Sdk/Worker/BlobEventWorker.cs @@ -9,17 +9,17 @@ namespace Nitric.Sdk.Worker { - public class StorageWorker : AbstractWorker + public class BlobEventWorker : AbstractWorker { readonly private RegistrationRequest RegistrationRequest; readonly private Bucket bucket; - public StorageWorker(RegistrationRequest request, Func middleware) : base(middleware) + public BlobEventWorker(RegistrationRequest request, Func middleware) : base(middleware) { this.RegistrationRequest = request; } - public StorageWorker(RegistrationRequest request, params Middleware[] middlewares) : base(middlewares) + public BlobEventWorker(RegistrationRequest request, params Middleware[] middlewares) : base(middlewares) { this.RegistrationRequest = request; } diff --git a/src/Nitric.Sdk/Worker/WebsocketWorker.cs b/src/Nitric.Sdk/Worker/WebsocketWorker.cs new file mode 100644 index 0000000..1ff0484 --- /dev/null +++ b/src/Nitric.Sdk/Worker/WebsocketWorker.cs @@ -0,0 +1,55 @@ +using System.Threading; +using System.Threading.Tasks; +using Nitric.Sdk.Common; +using Nitric.Proto.Websockets.v1; +using GrpcClient = Nitric.Proto.Websockets.v1.WebsocketHandler.WebsocketHandlerClient; +using Nitric.Sdk.Service; +using System; + +namespace Nitric.Sdk.Worker +{ + public class WebsocketWorker : AbstractWorker + { + readonly private RegistrationRequest RegistrationRequest; + + public WebsocketWorker(RegistrationRequest request, Func middleware) : base(middleware) + { + this.RegistrationRequest = request; + } + + public WebsocketWorker(RegistrationRequest request, params Middleware[] middlewares) : base(middlewares) + { + this.RegistrationRequest = request; + } + + public override async Task Start() + { + var client = new GrpcClient(GrpcChannelProvider.GetChannel()); + + var stream = client.HandleEvents(); + + await stream.RequestStream.WriteAsync(new ClientMessage { RegistrationRequest = RegistrationRequest }); + + while (await stream.ResponseStream.MoveNext(CancellationToken.None)) + { + var req = stream.ResponseStream.Current; + + if (req.RegistrationResponse != null) + { + // Websocket connected with Nitric server. + } + else if (req.WebsocketEventRequest != null) + { + var ctx = WebsocketContext.FromRequest(req); + + ctx = this.Middleware(ctx); + + await stream.RequestStream.WriteAsync(ctx.ToResponse()); + } + } + + await stream.RequestStream.CompleteAsync(); + } + } +} + diff --git a/test/Nitric.Sdk.Test/Api/Document/DocumentToGenericTest.cs b/test/Nitric.Sdk.Test/Api/Document/DocumentToGenericTest.cs deleted file mode 100644 index 3bf2d06..0000000 --- a/test/Nitric.Sdk.Test/Api/Document/DocumentToGenericTest.cs +++ /dev/null @@ -1,151 +0,0 @@ -// Copyright 2021, Nitric Technologies Pty Ltd. -// -// 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. - -using System; -using System.Collections.Generic; -using System.Linq; -using Google.Protobuf.WellKnownTypes; -using Newtonsoft.Json; -using Nitric.Sdk.Document; -using Xunit; -using Xunit.Abstractions; - -namespace Nitric.Sdk.Test.Api.Document -{ - public class TestProfile - { - public string Name { get; set; } - public float Age { get; set; } - public bool Employed { get; set; } - public List Hobbies { get; set; } - public float[][] Numbers { get; set; } - public TestAddress Address { get; set; } - } - - public class TestAddress - { - public string Street { get; set; } - } - - public class DocumentToGenericTest : DocumentRef - { - private readonly ITestOutputHelper _testOutputHelper; - - public DocumentToGenericTest(ITestOutputHelper testOutputHelper) - { - _testOutputHelper = testOutputHelper; - } - - public string ToAssertableString(IDictionary dictionary) - { - var pairStrings = dictionary.OrderBy(p => p.Key) - .Select(p => p.Key + ": " + string.Join(", ", p.Value)); - return string.Join("; ", pairStrings); - } - - [Fact] - public void TestStructWithScalars() - { - var genericStruct = new Struct(); - genericStruct.Fields.Add("name", Value.ForString("John Smith")); - genericStruct.Fields.Add("age", Value.ForNumber(21.0)); - genericStruct.Fields.Add("employed", Value.ForBool(true)); - - var actual = DocumentToGeneric(genericStruct); - - var expected = new TestProfile { - Name = "John Smith", - Age = 21, - Employed = true, - }; - - Assert.Equivalent(expected, actual); - } - - [Fact] - public void TestStructWithList() - { - var genericList = new List { Value.ForString("Reading"), Value.ForString("Writing"), Value.ForString("Deleting") }; - - var genericStruct = new Struct(); - genericStruct.Fields.Add("name", Value.ForString("John Smith")); - genericStruct.Fields.Add("age", Value.ForNumber(21)); - genericStruct.Fields.Add("employed", Value.ForBool(true)); - genericStruct.Fields.Add("hobbies", Value.ForList(genericList.ToArray())); - - var expectedList = new List { "Reading", "Writing", "Deleting" }; - - var expected = new TestProfile { - Name = "John Smith", - Age = 21, - Employed = true, - Hobbies = expectedList, - }; - - var actual = DocumentToGeneric(genericStruct); - - Assert.Equivalent(expected, actual); - } - - [Fact] - public void TestStructWithNestedLists() - { - var genericStruct = new Struct(); - genericStruct.Fields.Add("name", Value.ForString("John Smith")); - genericStruct.Fields.Add("age", Value.ForNumber(21)); - genericStruct.Fields.Add("employed", Value.ForBool(true)); - genericStruct.Fields.Add("numbers", Value.ForList(new[] { - Value.ForList(Value.ForNumber(0), Value.ForNumber(1)), - Value.ForList(Value.ForNumber(2), Value.ForNumber(3)), - })); - - var expected = new TestProfile { - Name = "John Smith", - Age = 21, - Employed = true, - Numbers = new float[][] { new float[] { 0, 1}, new float[] { 2, 3 }} - }; - - var actual = DocumentToGeneric(genericStruct); - - Assert.Equivalent(expected, actual); - } - - [Fact] - public void TestStructWithNestedStruct() - { - var nestedStruct = new Struct(); - nestedStruct.Fields.Add("street", Value.ForString("123 street st")); - - var genericStruct = new Struct(); - genericStruct.Fields.Add("name", Value.ForString("John Smith")); - genericStruct.Fields.Add("age", Value.ForNumber(21)); - genericStruct.Fields.Add("employed", Value.ForBool(true)); - genericStruct.Fields.Add("address", Value.ForStruct(nestedStruct)); - - var expected = new TestProfile { - Name = "John Smith", - Age = 21, - Employed = true, - Address = new TestAddress { - Street = "123 street st" - }, - }; - - var actual = DocumentToGeneric(genericStruct); - - Assert.Equivalent(expected, actual); - } - } -} diff --git a/test/Nitric.Sdk.Test/Api/Document/DocumentsTest.cs b/test/Nitric.Sdk.Test/Api/Document/DocumentsTest.cs deleted file mode 100644 index 9d40a62..0000000 --- a/test/Nitric.Sdk.Test/Api/Document/DocumentsTest.cs +++ /dev/null @@ -1,832 +0,0 @@ -// Copyright 2021, Nitric Technologies Pty Ltd. -// -// 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. - -using System; -using System.Collections.Generic; -using Google.Protobuf.WellKnownTypes; -using Grpc.Core; -using Moq; -using Nitric.Proto.Document.v1; -using Nitric.Sdk.Document; -using Xunit; -using Key = Nitric.Proto.Document.v1.Key; - -namespace Nitric.Sdk.Test.Api.Document -{ - class TestDocument - { - public String name { get; set; } - public float age { get; set; } - public List addresses { get; set; } - } - - class TestSubDocument - { - public String name { get; set; } - public float age { get; set; } - public List addresses { get; set; } - } - public class DocumentsTest - { - [Fact] - public void TestBuildDocuments() - { - var documents = new DocumentsClient(); - Assert.NotNull(documents); - } - - /* - * TESTING COLLECTIONS - */ - [Fact] - public void TestCollectionsMethodWithName() - { - var collection = new DocumentsClient().Collection("test-collection"); - Assert.NotNull(collection); - } - - [Fact] - public void TestCollectionsMethodWithoutName() - { - var documents = new DocumentsClient(); - Assert.Throws( - () => documents.Collection(null)); - Assert.Throws( - () => documents.Collection("")); - } - - [Fact] - public void TestCollectionSubCollectionWithName() - { - var collection = new DocumentsClient().Collection("test-collection"); - var subcollection = collection.Collection("test-subcollection"); - Assert.NotNull(subcollection); - Assert.Equal(collection.Name, subcollection.ParentKey.Collection.Name); - Assert.Null(subcollection.ParentKey.Id); - } - - [Fact] - public void TestCollectionSubCollectionWithoutName() - { - var collection = new DocumentsClient().Collection("test-collection"); - Assert.Throws( - () => collection.Collection(null)); - Assert.Throws( - () => collection.Collection("")); - } - - /* - * TESTING DOCS - */ - [Fact] - public void TestBuildDocsWithDocumentId() - { - var collection = new DocumentsClient().Collection("test-collection"); - var docs = collection.Doc("test-document"); - Assert.NotNull(docs); - } - - [Fact] - public void TestBuildDocWithoutDocumentId() - { - var collection = new DocumentsClient().Collection("test-collection"); - Assert.Throws( - () => collection.Doc("")); - Assert.Throws( - () => collection.Doc(null)); - } - - [Fact] - public void TestBuildQuery() - { - var collection = new DocumentsClient().Collection("test-collection"); - var query = collection.Query(); - Assert.NotNull(query); - } - - /* - * TESTING GET (DOCS) - */ - [Fact] - public void TestGet() - { - var content = new Struct(); - content.Fields.Add("name", Value.ForString("John Smith")); - content.Fields.Add("age", Value.ForNumber(21)); - content.Fields.Add("addresses", Value.ForList(Value.ForString("123 street st"))); - - var document = new Proto.Document.v1.Document - { - Content = content, - }; - var documentGetResponse = new DocumentGetResponse - { - Document = document, - }; - - Mock dc = new Mock(); - dc.Setup(e => e.Get(It.IsAny(), null, null, - It.IsAny())) - .Returns(documentGetResponse) - .Verifiable(); - - var documentRef = new DocumentsClient(dc.Object) - .Collection("test-collection") - .Doc("test-document"); - var response = documentRef.Get(); - - Assert.Equal("John Smith", response.Content.name); - Assert.Equal(21, response.Content.age); - Assert.Equal(new List { "123 street st" }, response.Content.addresses); - Assert.Equal(response.Ref, documentRef); - - dc.Verify( - t => t.Get(It.IsAny(), null, null, It.IsAny()), - Times.Once); - } - - [Fact] - public void TestGetWithSortedDictionary() - { - var value = new Value - { - StringValue = "document" - }; - - var content = new Struct(); - content.Fields.Add("test", value); - - var document = new Proto.Document.v1.Document - { - Content = content, - }; - var documentGetResponse = new DocumentGetResponse - { - Document = document, - }; - - Mock dc = new Mock(); - dc.Setup(e => e.Get(It.IsAny(), null, null, - It.IsAny())) - .Returns(documentGetResponse) - .Verifiable(); - - var documentRef = new DocumentsClient(dc.Object) - .Collection>("test-collection") - .Doc("test-document"); - var response = documentRef.Get(); - Assert.Equal("document", response.Content["test"]); - Assert.Equal(response.Ref, documentRef); - - dc.Verify( - t => t.Get(It.IsAny(), null, null, It.IsAny()), - Times.Once); - } - - [Fact] - public void TestGetToNonExistentDocument() - { - Mock dc = new Mock(); - dc.Setup(e => e.Get(It.IsAny(), null, null, - It.IsAny())) - .Throws(new RpcException(new Status(StatusCode.NotFound, "The specified document does not exist"))) - .Verifiable(); - - var documentRef = new DocumentsClient(dc.Object) - .Collection>("test-collection") - .Doc("test-document"); - try - { - var response = documentRef.Get(); - } - catch (Common.NitricException ne) - { - Assert.Equal("Status(StatusCode=\"NotFound\", Detail=\"The specified document does not exist\")", - ne.Message); - } - - dc.Verify( - t => t.Get(It.IsAny(), null, null, It.IsAny()), - Times.Once); - } - - /* - * TESTING SET (DOCS) - */ - [Fact] - public void TestSetWithSingleEntryDictionary() - { - var document = new TestDocument { name = "document", age = 21, addresses = new List { "123 street st" } }; - - Mock dc = new Mock(); - dc.Setup(e => e.Set(It.IsAny(), null, null, - It.IsAny())) - .Returns(new DocumentSetResponse()) - .Verifiable(); - - var documentRef = new DocumentsClient(dc.Object) - .Collection("test-collection") - .Doc("test-document"); - - documentRef.Set(document); - - dc.Verify( - t => t.Set(It.IsAny(), null, null, It.IsAny()), - Times.Once); - } - - [Fact] - public void TestSetWithMultipleEntryDictionary() - { - var document = new Dictionary(); - for (int i = 0; i < 100; i++) - { - document.Add(i.ToString(), "document"); - } - - Mock dc = new Mock(); - dc.Setup(e => e.Set(It.IsAny(), null, null, - It.IsAny())) - .Returns(new DocumentSetResponse()) - .Verifiable(); - - var documentRef = new DocumentsClient(dc.Object) - .Collection>("test-collection") - .Doc("test-document"); - - documentRef.Set(document); - - dc.Verify( - t => t.Set(It.IsAny(), null, null, It.IsAny()), - Times.Once); - } - - [Fact] - public void TestSetWithEmptyDictionary() - { - var document = new Dictionary(); - - Mock dc = new Mock(); - dc.Setup(e => e.Set(It.IsAny(), null, null, - It.IsAny())) - .Returns(new DocumentSetResponse()) - .Verifiable(); - - var documentRef = new DocumentsClient(dc.Object) - .Collection>("test-collection") - .Doc("test-document"); - - documentRef.Set(document); - - dc.Verify( - t => t.Set(It.IsAny(), null, null, It.IsAny()), - Times.Once); - } - - [Fact] - public void TestSetWithNullDocumentThrows() - { - Mock dc = new Mock(); - dc.Setup(e => e.Set(It.IsAny(), null, null, - It.IsAny())) - .Returns(new DocumentSetResponse()) - .Verifiable(); - - var documentRef = new DocumentsClient(dc.Object) - .Collection("test-collection") - .Doc("test-document"); - - Assert.Throws( - () => documentRef.Set(null)); - - dc.Verify( - t => t.Set(It.IsAny(), null, null, It.IsAny()), - Times.Never); - } - - [Fact] - public void TestSetToDocumentWithoutPermissions() - { - Mock dc = new Mock(); - dc.Setup(e => e.Set(It.IsAny(), null, null, - It.IsAny())) - .Throws(new RpcException(new Status(StatusCode.PermissionDenied, - "You do not have permission to modify this document"))) - .Verifiable(); - - var document = new TestDocument { name = "document" }; - - var documentRef = new DocumentsClient(dc.Object) - .Collection("test-collection") - .Doc("test-document"); - try - { - documentRef.Set(document); - } - catch (Common.NitricException ne) - { - Assert.Equal( - "Status(StatusCode=\"PermissionDenied\", Detail=\"You do not have permission to modify this document\")", - ne.Message); - } - - dc.Verify( - t => t.Set(It.IsAny(), null, null, It.IsAny()), - Times.Once); - } - - /* - * TESTING DELETE (DOCS) - */ - [Fact] - public void TestDelete() - { - Mock dc = new Mock(); - dc.Setup(e => e.Delete(It.IsAny(), null, null, - It.IsAny())) - .Returns(new DocumentDeleteResponse()) - .Verifiable(); - - var documentRef = new DocumentsClient(dc.Object) - .Collection("test-collection") - .Doc("test-document"); - - documentRef.Delete(); - - dc.Verify( - t => t.Delete(It.IsAny(), null, null, - It.IsAny()), Times.Once); - } - - /* - * TESTING DOC COLLECTION (DOCS) - */ - [Fact] - public void TestDocCollectionWithName() - { - var docCollection = new DocumentsClient() - .Collection("test-collection") - .Doc("test-document") - .Collection("test-collection-2"); - - Assert.NotNull(docCollection); - } - - [Fact] - public void TestDocCollectionWithoutName() - { - var document = new DocumentsClient() - .Collection("test-collection") - .Doc("test-document"); - - Assert.Throws( - () => document.Collection(null)); - Assert.Throws( - () => document.Collection("")); - } - - [Fact] - public void TestMultipleDocCollectionsThrows() - { - var doc = new DocumentsClient().Collection("test-collection") - .Doc("test-document") - .Collection("test-collection-2") - .Doc("test-document-2"); - - Assert.Throws( - () => - doc.Collection("this-collection-throws-error") - ); - } - - /* - * TEST COLLECTION GROUP - */ - [Fact] - public void TestCollectionGroupBuildWithName() - { - var collection = new DocumentsClient() - .Collection("test-collection"); - var collectionGroup = collection.Collection("test-subcollection"); - Assert.NotNull(collectionGroup); - Assert.Equal("test-subcollection", collectionGroup.Name); - Assert.Null(collectionGroup.ParentKey.Id); - } - - [Fact] - public void TestCollectionGroupBuildWithoutName() - { - var collection = new DocumentsClient() - .Collection("test-collection"); - - Assert.Throws( - () => collection.Collection(null)); - Assert.Throws( - () => collection.Collection("")); - } - - /* - * TEST QUERY - */ - [Fact] - public void TestWhereExpression() - { - var query = new DocumentsClient() - .Collection("test-collection") - .Query(); - - try - { - query - .Where("first_name", "==", "john") - .Where("last_name", ">=", "smith") - .Where("postcode", "<=", "1234") - .Where("address", "startsWith", "B") - .Where("id", ">", "0") - .Where("id", "<", "5"); - Assert.True(true); - } - catch (Exception) - { - Assert.False(false); - } - } - - [Fact] - public void TestChangingLimit() - { - var query = new DocumentsClient() - .Collection("test-collection") - .Query(); - - try - { - query.Limit(100); - Assert.True(true); - } - catch (Exception) - { - Assert.False(false); - } - } - - [Fact] - public void TestHandlingNegativeLimits() - { - var query = new DocumentsClient() - .Collection>("test-collection") - .Query(); - - try - { - query.Limit(-100); - Assert.True(true); - } - catch (Exception) - { - Assert.False(false); - } - } - - [Fact] - public void TestChangingPagingToken() - { - var query = new DocumentsClient() - .Collection("test-collection") - .Query(); - - var pagingToken = new Dictionary(); - pagingToken.Add("test", "entry"); - - try - { - query.PagingFrom(pagingToken); - Assert.True(true); - } - catch (Exception) - { - Assert.False(false); - } - } - - [Fact] - public void TestChangingWithNullPagingToken() - { - var query = new DocumentsClient() - .Collection("test-collection") - .Query(); - - try - { - query.PagingFrom(null); - Assert.True(true); - } - catch (Exception) - { - Assert.False(false); - } - } - - [Fact] - public void TestChangingWithEmptyPagingToken() - { - var query = new DocumentsClient() - .Collection("test-collection") - .Query(); - - try - { - query.PagingFrom(new Dictionary()); - Assert.True(true); - } - catch (Exception) - { - Assert.False(false); - } - } - - [Fact] - public void TestFetch() - { - var pagingToken = new Dictionary { { "page-from", "line 10" } }; - - var content = new Struct(); - content.Fields.Add("name", Value.ForString("document")); - content.Fields.Add("age", Value.ForNumber(21)); - content.Fields.Add("addresses", Value.ForList(new [] { Value.ForString("123 street st")})); - var testDocument = new Proto.Document.v1.Document - { - Content = content, - }; - var documents = new Google.Protobuf.Collections.RepeatedField { testDocument }; - - var queryResponse = new DocumentQueryResponse(); - queryResponse.Documents.Add(documents); - queryResponse.PagingToken.Add(pagingToken); - - Mock dc = new Mock(); - dc.Setup(e => e.Query(It.IsAny(), null, null, - It.IsAny())) - .Returns(queryResponse) - .Verifiable(); - - var query = new DocumentsClient(dc.Object) - .Collection("test-collection") - .Query(); - - try - { - var response = query.Fetch(); - Assert.Single(response.Documents); - Assert.Equal("document", response.Documents[0].Content.name); - Assert.Equal(21, response.Documents[0].Content.age); - Assert.Equal(new List { "123 street st" }, response.Documents[0].Content.addresses); - Assert.Equal(response.PagingToken, pagingToken); - } - catch (Exception) - { - Assert.False(false); - } - - dc.Verify( - t => t.Query(It.IsAny(), null, null, - It.IsAny()), Times.Once); - } - - [Fact] - public void TestFetchConformsToLimitOfOne() - { - var pagingToken = new Dictionary { { "page-from", "line 10" } }; - - var content = new Struct(); - content.Fields.Add("name", Value.ForString("document")); - content.Fields.Add("age", Value.ForNumber(21)); - content.Fields.Add("addresses", Value.ForList(new [] { Value.ForString("123 street st")})); - var testDocument = new Proto.Document.v1.Document - { - Content = content, - }; - var documents = new Google.Protobuf.Collections.RepeatedField { testDocument }; - - var queryResponse = new DocumentQueryResponse(); - queryResponse.Documents.Add(documents); - queryResponse.PagingToken.Add(pagingToken); - - Mock dc = new Mock(); - dc.Setup(e => e.Query(It.IsAny(), null, null, - It.IsAny())) - .Returns(queryResponse) - .Verifiable(); - - var query = new DocumentsClient(dc.Object) - .Collection("test-collection") - .Query(); - - try - { - var response = query - .Limit(1) - .Fetch(); - Assert.Single(response.Documents); - Assert.Equal("document", response.Documents[0].Content.name); - Assert.Equal(21, response.Documents[0].Content.age); - Assert.Equal(new List { "123 street st" }, response.Documents[0].Content.addresses); - Assert.Equal(response.PagingToken, pagingToken); - } - catch (Exception) - { - Assert.False(false); - } - - dc.Verify( - t => t.Query(It.IsAny(), null, null, - It.IsAny()), Times.Once); - } - - [Fact] - public void TestFetchWithExpressions() - { - var pagingToken = new Dictionary { { "page-from", "line 10" } }; - - var content = new Struct(); - content.Fields.Add("name", Value.ForString("John Smith")); - content.Fields.Add("age", Value.ForNumber(21)); - content.Fields.Add("addresses", Value.ForList(new []{ Value.ForString("123 street st")})); - var testDocument = new Proto.Document.v1.Document - { - Content = content, - }; - var documents = new Google.Protobuf.Collections.RepeatedField { testDocument }; - - var queryResponse = new DocumentQueryResponse(); - queryResponse.Documents.Add(documents); - queryResponse.PagingToken.Add(pagingToken); - - Mock dc = new Mock(); - dc.Setup(e => e.Query(It.IsAny(), null, null, - It.IsAny())) - .Returns(queryResponse) - .Verifiable(); - - var query = new DocumentsClient(dc.Object) - .Collection("test-collection") - .Query(); - - try - { - var response = query - .Where("name", "startsWith", "John") - .Where("name", "!=", "John Baker") - .Fetch(); - Assert.Single(response.Documents); - Assert.Equal("John Smith", response.Documents[0].Content.name); - Assert.Equal(21, response.Documents[0].Content.age); - Assert.Equal(new List { "123 street st"}, response.Documents[0].Content.addresses); - Assert.Equal(response.PagingToken, pagingToken); - } - catch (Exception) - { - Assert.False(false); - } - - dc.Verify( - t => t.Query(It.IsAny(), null, null, - It.IsAny()), Times.Once); - } - - [Fact] - public void TestFetchWithPagingToken() - { - var pagingToken = new Dictionary { { "page-from", "line 10" } }; - - var updatedPagingToken = new Dictionary { { "page-from", "line 11" } }; - - var content = new Struct(); - content.Fields.Add("name", Value.ForString("John Smith")); - content.Fields.Add("age", Value.ForNumber(21)); - content.Fields.Add("addresses", Value.ForList(new []{ Value.ForString("123 street st")})); - - var testDocument = new Proto.Document.v1.Document - { - Content = content, - }; - var documents = new Google.Protobuf.Collections.RepeatedField { testDocument }; - - var queryResponse = new DocumentQueryResponse(); - queryResponse.Documents.Add(documents); - queryResponse.PagingToken.Add(updatedPagingToken); - - Mock dc = new Mock(); - dc.Setup(e => e.Query(It.IsAny(), null, null, - It.IsAny())) - .Returns(queryResponse) - .Verifiable(); - - var query = new DocumentsClient(dc.Object) - .Collection("test-collection") - .Query(); - - try - { - var response = query - .PagingFrom(pagingToken) - .Fetch(); - Assert.Single(response.Documents); - Assert.Equal("John Smith", response.Documents[0].Content.name); - Assert.Equal(21, response.Documents[0].Content.age); - Assert.Equal(new List { "123 street st"}, response.Documents[0].Content.addresses); - Assert.Equal(response.PagingToken, updatedPagingToken); - } - catch (Exception) - { - Assert.False(false); - } - - dc.Verify( - t => t.Query(It.IsAny(), null, null, - It.IsAny()), Times.Once); - } - - [Fact] - public void TestFetchNonExistentDocument() - { - Mock dc = new Mock(); - dc.Setup(e => e.Query(It.IsAny(), null, null, - It.IsAny())) - .Throws(new RpcException(new Status(StatusCode.NotFound, "The specified document does not exist"))) - .Verifiable(); - - var query = new DocumentsClient(dc.Object) - .Collection("test-collection") - .Query(); - try - { - var response = query.Fetch(); - } - catch (global::Nitric.Sdk.Common.NitricException ne) - { - Assert.Equal("Status(StatusCode=\"NotFound\", Detail=\"The specified document does not exist\")", - ne.Message); - } - - dc.Verify( - t => t.Query(It.IsAny(), null, null, - It.IsAny()), Times.Once); - } - - [Fact] - public void TestFetchFromSubcollection() - { - var pagingToken = new Dictionary { { "page-from", "line 10" } }; - - var content = new Struct(); - content.Fields.Add("name", Value.ForString("John Smith")); - content.Fields.Add("age", Value.ForNumber(21)); - content.Fields.Add("addresses", Value.ForList(new []{ Value.ForString("123 street st")})); - var testDocument = new Proto.Document.v1.Document - { - Key = new Key { Id = "1234" }, - Content = content, - }; - var documents = new Google.Protobuf.Collections.RepeatedField { testDocument }; - - var queryResponse = new DocumentQueryResponse(); - queryResponse.Documents.Add(documents); - queryResponse.PagingToken.Add(pagingToken); - - Mock dc = new Mock(); - dc.Setup(e => e.Query(It.IsAny(), null, null, - It.IsAny())) - .Returns(queryResponse) - .Verifiable(); - - var query = new DocumentsClient(dc.Object) - .Collection("test-collection") - .Collection("test-subcollection") - .Query(); - - var response = query.Fetch(); - Assert.Single(response.Documents); - Assert.Equal("John Smith", response.Documents[0].Content.name); - Assert.Equal(21, response.Documents[0].Content.age); - Assert.Equal(new List { "123 street st"}, response.Documents[0].Content.addresses); - Assert.Equal(response.PagingToken, pagingToken); - - - dc.Verify( - t => t.Query(It.IsAny(), null, null, - It.IsAny()), Times.Once); - } - } -} diff --git a/test/Nitric.Sdk.Test/Api/Event/EventClientTest.cs b/test/Nitric.Sdk.Test/Api/Event/EventClientTest.cs deleted file mode 100644 index 2228fd9..0000000 --- a/test/Nitric.Sdk.Test/Api/Event/EventClientTest.cs +++ /dev/null @@ -1,132 +0,0 @@ -// Copyright 2021, Nitric Technologies Pty Ltd. -// -// 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. - -using System; -using System.Collections.Generic; -using Google.Protobuf.WellKnownTypes; -using Grpc.Core; -using Moq; -using Nitric.Proto.Event.v1; -using Nitric.Sdk.Event; -using Xunit; - -namespace Nitric.Sdk.Test.Api.Event -{ - public class TestProfile - { - public string Name; - public double Age; - public List Addresses; - } - - public class EventClientTest - { - [Fact] - public void TestBuildEvents() - { - var evt = new EventsClient(); - Assert.NotNull(evt); - } - [Fact] - public void TestBuildTopicWithName() - { - var topic = new EventsClient().Topic("test-topic"); - Assert.NotNull(topic); - Assert.Equal("test-topic", topic.Name); - } - - [Fact] - public void TestBuildTopicWithoutName() - { - Assert.Throws( - () => new EventsClient().Topic("") - ); - Assert.Throws( - () => new EventsClient().Topic(null) - ); - } - - [Fact] - public void TestPublish() - { - Mock ec = new Mock(); - - ec.Setup(e => e.Publish(It.IsAny(), null, null, It.IsAny())) - .Returns(new EventPublishResponse { Id = "1234" }) - .Verifiable(); - - var topic = new EventsClient(ec.Object).Topic("test-topic"); - - var payload = new TestProfile - { Name = "John Smith", Age = 30, Addresses = new List { "123 street st" } }; - - var evtToSend = new Sdk.Event.Event { Id = "1234", Payload = payload, PayloadType = "payloadType"}; - - var response = topic.Publish(evtToSend); - - Assert.Equal("1234", response); - - ec.Verify(t => t.Publish(It.IsAny(), null, null, It.IsAny()), Times.Once); - } - - [Fact] - public void TestPublishOnlyPayload() - { - Mock ec = new Mock(); - - ec.Setup(e => e.Publish(It.IsAny(), null, null, It.IsAny())) - .Returns(new EventPublishResponse { Id = "1234" }) - .Verifiable(); - - var topic = new EventsClient(ec.Object).Topic("test-topic"); - - var payload = new TestProfile - { Name = "John Smith", Age = 30, Addresses = new List { "123 street st" } }; - - var response = topic.Publish(payload); - - Assert.Equal("1234", response); - - ec.Verify(t => t.Publish(It.IsAny(), null, null, It.IsAny()), Times.Once); - } - - [Fact] - public void TestPublishToNonExistentTopic() - { - Mock ec = new Mock(); - - ec.Setup(e => e.Publish(It.IsAny(), null, null, It.IsAny())) - .Throws(new RpcException(new Status(StatusCode.NotFound, "The specified topic does not exist"))) - .Verifiable(); - - var topic = new EventsClient(ec.Object).Topic("test-topic"); - - var payload = new TestProfile - { Name = "John Smith", Age = 30, Addresses = new List { "123 street st" } }; - - var evtToSend = new Sdk.Event.Event { Id = "1", Payload = payload, PayloadType = "payloadType"}; - - try - { - var response = topic.Publish(evtToSend); - } - catch (global::Nitric.Sdk.Common.NitricException ne) - { - Assert.Equal("Status(StatusCode=\"NotFound\", Detail=\"The specified topic does not exist\")", ne.Message); - } - - ec.Verify(t => t.Publish(It.IsAny(), null, null, It.IsAny()), Times.Once); - } - }; -} diff --git a/test/Nitric.Sdk.Test/Api/Event/EventTest.cs b/test/Nitric.Sdk.Test/Api/Event/EventTest.cs deleted file mode 100644 index 05a9bb8..0000000 --- a/test/Nitric.Sdk.Test/Api/Event/EventTest.cs +++ /dev/null @@ -1,51 +0,0 @@ -// Copyright 2021, Nitric Technologies Pty Ltd. -// -// 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. - -using System.Collections.Generic; -using Xunit; - - -namespace Nitric.Sdk.Test.Api.Event -{ - public class EventTest - { - [Fact] - public void TestBuild() - { - var payload = new TestProfile - { Name = "John Smith", Age = 30, Addresses = new List { "123 street st" } }; - - var eventTest = new global::Nitric.Sdk.Event.Event - { Id = "id", Payload = payload, PayloadType = "payloadType" }; - - Assert.NotNull(eventTest); - Assert.Equal("id", eventTest.Id); - Assert.Equal("payloadType", eventTest.PayloadType); - Assert.Equal(payload, eventTest.Payload); - } - - [Fact] - public void TestToString() - { - var payload = new TestProfile - { Name = "John Smith", Age = 30, Addresses = new List { "123 street st" } }; - - var eventTest = new global::Nitric.Sdk.Event.Event - { Id = "id", Payload = payload, PayloadType = "payloadType" }; - - Assert.Equal("Event[id=id, payloadType=payloadType, payload={\"Name\":\"John Smith\",\"Age\":30.0,\"Addresses\":[\"123 street st\"]}]", - eventTest.ToString()); - } - } -} diff --git a/test/Nitric.Sdk.Test/Api/Queue/FailedTaskTest.cs b/test/Nitric.Sdk.Test/Api/Queue/FailedTaskTest.cs index 5eb055b..01c2ec1 100644 --- a/test/Nitric.Sdk.Test/Api/Queue/FailedTaskTest.cs +++ b/test/Nitric.Sdk.Test/Api/Queue/FailedTaskTest.cs @@ -32,23 +32,16 @@ public class FailedTaskTest public void TestBuild() { var payload = new TestProfile - { Name = "John Smith", Age = 30, Addresses = new List { "123 street st " } }; - var failedTask = new global::Nitric.Sdk.Queue.FailedTask + { Name = "John Smith", Age = 30, Addresses = new List { "123 street st " } }; + var failedTask = new FailedMessage { - Message = "message", - Task = new Task - { - Id = "1", - PayloadType = "payload type", - Payload = payload - } + Details = "message", + Message = payload, }; Assert.NotNull(failedTask); - Assert.Equal("1", failedTask.Task.Id); - Assert.Equal("payload type", failedTask.Task.PayloadType); - Assert.Equal(payload, failedTask.Task.Payload); - Assert.Equal("message", failedTask.Message); + Assert.Equal(payload, failedTask.Message); + Assert.Equal("message", failedTask.Details); } } } diff --git a/test/Nitric.Sdk.Test/Api/Queue/QueueClientTest.cs b/test/Nitric.Sdk.Test/Api/Queue/QueueClientTest.cs index 6dd9173..1559935 100644 --- a/test/Nitric.Sdk.Test/Api/Queue/QueueClientTest.cs +++ b/test/Nitric.Sdk.Test/Api/Queue/QueueClientTest.cs @@ -15,11 +15,11 @@ using System; using System.Collections.Generic; using System.Linq; -using Google.Protobuf.Collections; using Google.Protobuf.WellKnownTypes; using Grpc.Core; using Moq; -using Nitric.Proto.Queue.v1; +using Nitric.Proto.Queues.v1; +using GrpcClient = Nitric.Proto.Queues.v1.Queues.QueuesClient; using Nitric.Sdk.Queue; using Xunit; @@ -56,9 +56,9 @@ public void TestBuildQueueWithoutName() [Fact] public void TestSendToNonExistentQueue() { - Mock qc = new Mock(); + Mock qc = new Mock(); qc.Setup(e => - e.Send(It.IsAny(), null, null, It.IsAny())) + e.Enqueue(It.IsAny(), null, null, It.IsAny())) .Throws(new RpcException(new Status(StatusCode.NotFound, "The specified queue does not exist"))) .Verifiable(); @@ -66,187 +66,185 @@ public void TestSendToNonExistentQueue() try { - queue.Send(new Task()); + queue.Enqueue(new TestProfile()); } - catch (global::Nitric.Sdk.Common.NitricException ne) + catch (Common.NitricException ne) { Assert.Equal("Status(StatusCode=\"NotFound\", Detail=\"The specified queue does not exist\")", ne.Message); } qc.Verify( - t => t.Send(It.IsAny(), null, null, It.IsAny()), + t => t.Enqueue(It.IsAny(), null, null, It.IsAny()), Times.Once); } [Fact] public void TestSendBatchWithFailedTasks() { - //Setting up failed tasks to then return later - NitricTask failedTaskTask = new NitricTask(); - failedTaskTask.Id = "0"; - failedTaskTask.LeaseId = "1"; - failedTaskTask.Payload = new Struct(); - failedTaskTask.PayloadType = "Dictionary"; + FailedEnqueueMessage failedMessage = new FailedEnqueueMessage(); + failedMessage.Details = "I am a failed task... I failed my task"; + failedMessage.Message = new QueueMessage(); - Proto.Queue.v1.FailedTask failedTask = new Proto.Queue.v1.FailedTask(); - failedTask.Message = "I am a failed task... I failed my task"; - failedTask.Task = failedTaskTask; - - List failedTasks = new List(); - failedTasks.Add(failedTask); + List failedMessages = new List + { + failedMessage, + }; - var queueBatchResponse = new QueueSendBatchResponse(); - queueBatchResponse.FailedTasks.AddRange(failedTasks); + var queueBatchResponse = new QueueEnqueueResponse(); + queueBatchResponse.FailedMessages.AddRange(failedMessages); - Mock qc = new Mock(); - qc.Setup(e => e.SendBatch(It.IsAny(), null, null, + Mock qc = new Mock(); + qc.Setup(e => e.Enqueue(It.IsAny(), null, null, It.IsAny())) .Returns(queueBatchResponse) .Verifiable(); var queue = new QueuesClient(qc.Object).Queue("test-queue"); - var failedTasksResp = queue.Send(new TestProfile {}, new TestProfile {}); + var failedTasksResp = queue.Enqueue(new TestProfile { }, new TestProfile { }); - Assert.Equal("I am a failed task... I failed my task", failedTasksResp[0].Message); + Assert.Equal("I am a failed task... I failed my task", failedTasksResp[0].Details); qc.Verify( - t => t.SendBatch(It.IsAny(), null, null, + t => t.Enqueue(It.IsAny(), null, null, It.IsAny()), Times.Once); } [Fact] public void TestSendBatchWithNoFailedTasks() { - Mock qc = new Mock(); - qc.Setup(e => e.SendBatch(It.IsAny(), null, null, + Mock qc = new Mock(); + qc.Setup(e => e.Enqueue(It.IsAny(), null, null, It.IsAny())) - .Returns(new QueueSendBatchResponse()) + .Returns(new QueueEnqueueResponse()) .Verifiable(); var queue = new QueuesClient(qc.Object).Queue("test-queue"); - var failedTasks = queue.Send(new TestProfile {}, new TestProfile {}); + var failedTasks = queue.Enqueue(new TestProfile { }, new TestProfile { }); Assert.Empty(failedTasks); qc.Verify( - t => t.SendBatch(It.IsAny(), null, null, + t => t.Enqueue(It.IsAny(), null, null, It.IsAny()), Times.Once); } [Fact] public void TestReceiveTasks() { - NitricTask taskToReturn = new NitricTask(); - taskToReturn.Id = "32"; - taskToReturn.LeaseId = "1"; - taskToReturn.Payload = new Struct(); - taskToReturn.PayloadType = "Dictionary"; + var messagePayload = Common.Struct.FromJsonSerializable(new TestProfile { Name = "John Smith" }); + var message = new DequeuedMessage + { + LeaseId = "1234", + Message = new QueueMessage { StructPayload = messagePayload }, + }; - RepeatedField tasks = new RepeatedField(); - tasks.Add(taskToReturn); + var messages = new List() { message }; - var queueReceieveResponse = new QueueReceiveResponse(); - queueReceieveResponse.Tasks.AddRange(tasks); + var queueReceieveResponse = new QueueDequeueResponse(); + queueReceieveResponse.Messages.AddRange(messages); - Mock qc = new Mock(); - qc.Setup(e => e.Receive(It.IsAny(), null, null, + Mock qc = new Mock(); + qc.Setup(e => e.Dequeue(It.IsAny(), null, null, It.IsAny())) .Returns(queueReceieveResponse) .Verifiable(); var queue = new QueuesClient(qc.Object).Queue("test-queue"); - var response = queue.Receive(3); + var response = queue.Dequeue(3); - Assert.Equal("32", response.ToList()[0].Id); + Assert.Equal("1234", response[0].LeaseId); + Assert.Equal("John Smith", response[0].Message.Name); qc.Verify( - t => t.Receive(It.IsAny(), null, null, + t => t.Dequeue(It.IsAny(), null, null, It.IsAny()), Times.Once); } [Fact] public void TestReceiveNoTasks() { - Mock qc = new Mock(); - qc.Setup(e => e.Receive(It.IsAny(), null, null, + Mock qc = new Mock(); + qc.Setup(e => e.Dequeue(It.IsAny(), null, null, It.IsAny())) - .Returns(new QueueReceiveResponse()) + .Returns(new QueueDequeueResponse()) .Verifiable(); var queue = new QueuesClient(qc.Object).Queue("test-queue"); - var response = queue.Receive(3); + var response = queue.Dequeue(3); Assert.Empty(response); qc.Verify( - t => t.Receive(It.IsAny(), null, null, + t => t.Dequeue(It.IsAny(), null, null, It.IsAny()), Times.Once); } [Fact] public void TestSend() { - Mock qc = new Mock(); + Mock qc = new Mock(); qc.Setup(e => - e.Send(It.IsAny(), null, null, It.IsAny())) + e.Enqueue(It.IsAny(), null, null, It.IsAny())) + .Returns(new QueueEnqueueResponse()) .Verifiable(); var queue = new QueuesClient(qc.Object).Queue("test-queue"); - queue.Send(new Task { Id = "0", Payload = new TestProfile { Name = "John Smith", Age = 30, Addresses = new List { "123 street st" }}, PayloadType = "JSON" }); + queue.Enqueue(new TestProfile { Name = "John Smith", Age = 30, Addresses = new List { "123 street st" } }); qc.Verify( - t => t.Send(It.IsAny(), null, null, It.IsAny()), + t => t.Enqueue(It.IsAny(), null, null, It.IsAny()), Times.Once); } [Fact] public void TestComplete() { - var receivedTask = new ReceivedTask + var receivedTask = new ReceivedMessage { - Id = "32", LeaseId = "1", - PayloadType = "profile", - Payload = new TestProfile { Name = "John Smith", Age = 30, Addresses = new List { "123 street st" }} + Message = new TestProfile { Name = "John Smith", Age = 30, Addresses = new List { "123 street st" } } }; var payload = new Struct(); payload.Fields.Add("Name", Value.ForString("John Smith")); payload.Fields.Add("Age", Value.ForNumber(30.0)); - payload.Fields.Add("Addresses", Value.ForList(new []{ Value.ForString("123 street st") })); - - NitricTask taskToReturn = new NitricTask(); - taskToReturn.Id = "32"; - taskToReturn.LeaseId = "1"; - taskToReturn.Payload = payload; - taskToReturn.PayloadType = "profile"; + payload.Fields.Add("Addresses", Value.ForList(new[] { Value.ForString("123 street st") })); - RepeatedField tasks = new RepeatedField(); - tasks.Add(taskToReturn); + var tasks = new List() + { + new DequeuedMessage + { + Message = new QueueMessage + { + StructPayload = payload + }, + LeaseId = "1" + } + }; - var queueReceieveResponse = new QueueReceiveResponse(); - queueReceieveResponse.Tasks.AddRange(tasks); + var queueReceieveResponse = new QueueDequeueResponse(); + queueReceieveResponse.Messages.AddRange(tasks); - Mock qc = new Mock(); - qc.Setup(e => e.Receive(It.IsAny(), null, null, + Mock qc = new Mock(); + qc.Setup(e => e.Dequeue(It.IsAny(), null, null, It.IsAny())) .Returns(queueReceieveResponse) .Verifiable(); - Mock qcr = new Mock(); + Mock qcr = new Mock(); qc.Setup(e => e.Complete(It.IsAny(), null, null, It.IsAny())) .Verifiable(); var queue = new QueuesClient(qc.Object).Queue("test-queue"); - var response = queue.Receive(3); + var response = queue.Dequeue(3); response.ToList()[0].Complete(); diff --git a/test/Nitric.Sdk.Test/Api/Queue/TaskTest.cs b/test/Nitric.Sdk.Test/Api/Queue/TaskTest.cs index 7f5abd4..eba57be 100644 --- a/test/Nitric.Sdk.Test/Api/Queue/TaskTest.cs +++ b/test/Nitric.Sdk.Test/Api/Queue/TaskTest.cs @@ -14,26 +14,41 @@ using System.Collections.Generic; using Xunit; +using Nitric.Sdk.Queue; namespace Nitric.Sdk.Test.Api.Queue { public class QueueItemTest { [Fact] - public void TestBuild() + public void TestBuildReceivedMessage() { - var payload = new TestProfile { Name = "John Smith", Age = 30, Addresses = new List { "123 street st" }}; - var queueItem = new global::Nitric.Sdk.Queue.Task + var payload = new TestProfile { Name = "John Smith", Age = 30, Addresses = new List { "123 street st" } }; + var queueItem = new ReceivedMessage { - Id = "2", - PayloadType = "payload type", - Payload = payload + LeaseId = "1", + Message = payload, }; Assert.NotNull(queueItem); - Assert.Equal("2", queueItem.Id); - Assert.Equal("payload type", queueItem.PayloadType); - Assert.Equal(payload, queueItem.Payload); + Assert.Equal("1", queueItem.LeaseId); + Assert.Equal(payload, queueItem.Message); + } + + [Fact] + public void TestBuildFailedMessage() + { + var payload = new TestProfile { Name = "John Smith", Age = 30, Addresses = new List { "123 street st" } }; + var failedMessage = new FailedMessage + { + Details = "The failed task failed successfully", + Message = payload, + }; + + Assert.NotNull(failedMessage); + Assert.Equal("The failed task failed successfully", failedMessage.Details); + Assert.Equal(payload, failedMessage.Message); + Assert.Equal("FailedMessage[details=The failed task failed successfully]", failedMessage.ToString()); } } } diff --git a/test/Nitric.Sdk.Test/Api/Secret/SecretTest.cs b/test/Nitric.Sdk.Test/Api/Secret/SecretTest.cs index de43963..648a407 100644 --- a/test/Nitric.Sdk.Test/Api/Secret/SecretTest.cs +++ b/test/Nitric.Sdk.Test/Api/Secret/SecretTest.cs @@ -16,7 +16,8 @@ using System.Text; using Grpc.Core; using Moq; -using Nitric.Proto.Secret.v1; +using Nitric.Proto.Secrets.v1; +using GrpcClient = Nitric.Proto.Secrets.v1.SecretManager.SecretManagerClient; using Nitric.Sdk.Secret; using Xunit; @@ -62,25 +63,25 @@ public void TestPutSecretBytes() { var secretPutResponse = new SecretPutResponse { - SecretVersion = new Proto.Secret.v1.SecretVersion + SecretVersion = new Proto.Secrets.v1.SecretVersion { - Secret = new Proto.Secret.v1.Secret + Secret = new Proto.Secrets.v1.Secret { Name = "test-secret", }, Version = "test-version", } }; - Mock sc = new Mock(); + Mock sc = new Mock(); sc.Setup(e => e.Put(It.IsAny(), null, null, It.IsAny())) .Returns(secretPutResponse) .Verifiable(); - var testBytes = Encoding.UTF8.GetBytes("Super secret message"); var secret = new SecretsClient(sc.Object) .Secret("test-secret"); - var response = secret.Put(testBytes); + + var response = secret.Put("Super secret message"); Assert.Equal("test-version", response.Id); Assert.Equal(secret.Name, response.Secret.Name); @@ -95,16 +96,16 @@ public void TestPutSecretString() { var secretPutResponse = new SecretPutResponse { - SecretVersion = new Proto.Secret.v1.SecretVersion + SecretVersion = new Proto.Secrets.v1.SecretVersion { - Secret = new Proto.Secret.v1.Secret + Secret = new Proto.Secrets.v1.Secret { Name = "test-secret", }, Version = "test-version", } }; - Mock sc = new Mock(); + Mock sc = new Mock(); sc.Setup(e => e.Put(It.IsAny(), null, null, It.IsAny())) .Returns(secretPutResponse) @@ -123,22 +124,6 @@ public void TestPutSecretString() Times.Once); } - [Fact] - public void TestPutEmptySecretBytes() - { - var secret = new SecretsClient().Secret("test-secret"); - Assert.Throws( - () => secret.Put(new byte[] { })); - } - - [Fact] - public void TestPutNullSecretBytes() - { - var secret = new SecretsClient().Secret("test-secret"); - Assert.Throws( - () => secret.Put((byte[])null)); - } - [Fact] public void TestPutEmptySecretString() { @@ -148,17 +133,17 @@ public void TestPutEmptySecretString() } [Fact] - public void TestPutNullSecretString() + public void TestPutNullSecretBytes() { var secret = new SecretsClient().Secret("test-secret"); Assert.Throws( - () => secret.Put((string)null)); + () => secret.Put(null)); } [Fact] public void TestPutNonExistentSecret() { - Mock sc = new Mock(); + Mock sc = new Mock(); sc.Setup(e => e.Put(It.IsAny(), null, null, It.IsAny())) .Throws(new RpcException(new Status(StatusCode.NotFound, "The specified secret does not exist"))) @@ -171,7 +156,7 @@ public void TestPutNonExistentSecret() { var response = secret.Put(testString); } - catch (global::Nitric.Sdk.Common.NitricException ne) + catch (Common.NitricException ne) { Assert.Equal("Status(StatusCode=\"NotFound\", Detail=\"The specified secret does not exist\")", ne.Message); @@ -205,7 +190,7 @@ public void TestGetSecretVersionWithoutName() [Fact] public void TestAccessSecretWithoutPermission() { - Mock sc = new Mock(); + Mock sc = new Mock(); sc.Setup(e => e.Access(It.IsAny(), null, null, It.IsAny())) .Throws(new RpcException(new Status(StatusCode.PermissionDenied, @@ -218,7 +203,7 @@ public void TestAccessSecretWithoutPermission() { var response = secret.Version("test-secret").Access(); } - catch (global::Nitric.Sdk.Common.NitricException ne) + catch (Common.NitricException ne) { Assert.Equal( "Status(StatusCode=\"PermissionDenied\", Detail=\"You do not have permission to access this secret\")", @@ -255,9 +240,9 @@ public void TestAccess() { var secretPutResponse = new SecretAccessResponse { - SecretVersion = new Proto.Secret.v1.SecretVersion + SecretVersion = new Proto.Secrets.v1.SecretVersion { - Secret = new Proto.Secret.v1.Secret + Secret = new Proto.Secrets.v1.Secret { Name = "test-secret", }, @@ -265,7 +250,7 @@ public void TestAccess() }, Value = Google.Protobuf.ByteString.CopyFromUtf8("Super secret message"), }; - Mock sc = new Mock(); + Mock sc = new Mock(); sc.Setup(e => e.Access(It.IsAny(), null, null, It.IsAny())) .Returns(secretPutResponse) @@ -301,9 +286,9 @@ public void TestSecretValueToString() { var secretPutResponse = new SecretAccessResponse { - SecretVersion = new Proto.Secret.v1.SecretVersion + SecretVersion = new Proto.Secrets.v1.SecretVersion { - Secret = new Proto.Secret.v1.Secret + Secret = new Proto.Secrets.v1.Secret { Name = "test-secret", }, @@ -311,7 +296,7 @@ public void TestSecretValueToString() }, Value = Google.Protobuf.ByteString.CopyFromUtf8("Super secret message"), }; - Mock sc = new Mock(); + Mock sc = new Mock(); sc.Setup(e => e.Access(It.IsAny(), null, null, It.IsAny())) .Returns(secretPutResponse) diff --git a/test/Nitric.Sdk.Test/Api/Storage/StorageClientTest.cs b/test/Nitric.Sdk.Test/Api/Storage/StorageClientTest.cs index 4a87995..2ea5ba1 100644 --- a/test/Nitric.Sdk.Test/Api/Storage/StorageClientTest.cs +++ b/test/Nitric.Sdk.Test/Api/Storage/StorageClientTest.cs @@ -17,175 +17,175 @@ using Moq; using Nitric.Proto.Storage.v1; using Xunit; +using GrpcClient = Nitric.Proto.Storage.v1.Storage.StorageClient; -namespace Nitric.Sdk.Test.Api.Storage +namespace Nitric.Sdk.Test.Api.Storage; + +public class StorageClientTest { - public class StorageClientTest + [Fact] + public void TestBuildStorage() { - [Fact] - public void TestBuildStorage() - { - var storage = new Sdk.Storage.Storage(); - Assert.NotNull(storage); - } + var storage = new Sdk.Storage.StorageClient(); + Assert.NotNull(storage); + } - [Fact] - public void TestBuildBucketWithName() - { - var bucket = new Sdk.Storage.Storage().Bucket("test-bucket"); - Assert.NotNull(bucket); - Assert.Equal("test-bucket", bucket.Name); - } + [Fact] + public void TestBuildBucketWithName() + { + var bucket = new Sdk.Storage.StorageClient().Bucket("test-bucket"); + Assert.NotNull(bucket); + Assert.Equal("test-bucket", bucket.Name); + } - [Fact] - public void TestBuildBucketWithoutName() - { - Assert.Throws( - () => new Sdk.Storage.Storage().Bucket("") - ); - Assert.Throws( - () => new Sdk.Storage.Storage().Bucket(null) - ); - } + [Fact] + public void TestBuildBucketWithoutName() + { + Assert.Throws( + () => new Sdk.Storage.StorageClient().Bucket("") + ); + Assert.Throws( + () => new Sdk.Storage.StorageClient().Bucket(null) + ); + } - [Fact] - public void TestBuildFileWithName() - { - var file = new Sdk.Storage.Storage().Bucket("test-bucket").File("test-file"); - Assert.NotNull(file); - Assert.Equal("test-file", file.Name); - } + [Fact] + public void TestBuildFileWithName() + { + var file = new Sdk.Storage.StorageClient().Bucket("test-bucket").File("test-file"); + Assert.NotNull(file); + Assert.Equal("test-file", file.Name); + } - [Fact] - public void TestBuildFileWithoutName() - { - Assert.Throws( - () => new Sdk.Storage.Storage().Bucket("test-bucket").File("") - ); - Assert.Throws( - () => new Sdk.Storage.Storage().Bucket("test-bucket").File(null) - ); - } + [Fact] + public void TestBuildFileWithoutName() + { + Assert.Throws( + () => new Sdk.Storage.StorageClient().Bucket("test-bucket").File("") + ); + Assert.Throws( + () => new Sdk.Storage.StorageClient().Bucket("test-bucket").File(null) + ); + } - [Fact] - public void TestWrite() + [Fact] + public void TestWrite() + { + var request = new StorageWriteRequest { - var request = new StorageWriteRequest - { - BucketName = "test-bucket", - Key = "test-file", - Body = Google.Protobuf.ByteString.CopyFrom( - System.Text.Encoding.UTF8.GetBytes("Body")) - }; - - Mock bc = new Mock(); - bc.Setup(e => e.Write(It.IsAny(), null, null, - It.IsAny())) - .Returns(new StorageWriteResponse()) - .Verifiable(); - - var file = new Sdk.Storage.Storage(bc.Object).Bucket("test-bucket").File("test-file"); - - file.Write(System.Text.Encoding.UTF8.GetBytes("Hello World")); - - bc.Verify( - t => t.Write(It.IsAny(), null, null, - It.IsAny()), Times.Once); - } + BucketName = "test-bucket", + Key = "test-file", + Body = Google.Protobuf.ByteString.CopyFrom( + System.Text.Encoding.UTF8.GetBytes("Body")) + }; - [Fact] - public void TestWriteString() - { - var request = new StorageWriteRequest - { - BucketName = "test-bucket", - Key = "test-file", - Body = Google.Protobuf.ByteString.CopyFrom( - System.Text.Encoding.UTF8.GetBytes("Body")) - }; - - Mock bc = new Mock(); - bc.Setup(e => e.Write(It.IsAny(), null, null, - It.IsAny())) - .Returns(new StorageWriteResponse()) - .Verifiable(); - - var file = new Sdk.Storage.Storage(bc.Object).Bucket("test-bucket").File("test-file"); - - file.Write("Hello World"); - - bc.Verify( - t => t.Write(It.IsAny(), null, null, - It.IsAny()), Times.Once); - } + Mock bc = new Mock(); + bc.Setup(e => e.Write(It.IsAny(), null, null, + It.IsAny())) + .Returns(new StorageWriteResponse()) + .Verifiable(); - [Fact] - public void TestReadExistingKey() + var file = new Sdk.Storage.StorageClient(bc.Object).Bucket("test-bucket").File("test-file"); + + file.Write(System.Text.Encoding.UTF8.GetBytes("Hello World")); + + bc.Verify( + t => t.Write(It.IsAny(), null, null, + It.IsAny()), Times.Once); + } + + [Fact] + public void TestWriteString() + { + var request = new StorageWriteRequest { - var storageResponse = new StorageReadResponse(); - storageResponse.Body = - Google.Protobuf.ByteString.CopyFrom(System.Text.Encoding.UTF8.GetBytes("Hello World")); + BucketName = "test-bucket", + Key = "test-file", + Body = Google.Protobuf.ByteString.CopyFrom( + System.Text.Encoding.UTF8.GetBytes("Body")) + }; + + Mock bc = new Mock(); + bc.Setup(e => e.Write(It.IsAny(), null, null, + It.IsAny())) + .Returns(new StorageWriteResponse()) + .Verifiable(); - Mock bc = new Mock(); - bc.Setup(e => e.Read(It.IsAny(), null, null, - It.IsAny())) - .Returns(storageResponse) - .Verifiable(); + var file = new Sdk.Storage.StorageClient(bc.Object).Bucket("test-bucket").File("test-file"); - var file = new Sdk.Storage.Storage(bc.Object).Bucket("test-bucket").File("test-file"); + file.Write("Hello World"); - var response = file.Read(); + bc.Verify( + t => t.Write(It.IsAny(), null, null, + It.IsAny()), Times.Once); + } - Assert.Equal("Hello World", System.Text.Encoding.UTF8.GetString(response)); + [Fact] + public void TestReadExistingKey() + { + var storageResponse = new StorageReadResponse(); + storageResponse.Body = + Google.Protobuf.ByteString.CopyFrom(System.Text.Encoding.UTF8.GetBytes("Hello World")); - bc.Verify( - t => t.Read(It.IsAny(), null, null, It.IsAny()), - Times.Once); - } + Mock bc = new Mock(); + bc.Setup(e => e.Read(It.IsAny(), null, null, + It.IsAny())) + .Returns(storageResponse) + .Verifiable(); + + var file = new Sdk.Storage.StorageClient(bc.Object).Bucket("test-bucket").File("test-file"); + + var response = file.Read(); + + Assert.Equal("Hello World", System.Text.Encoding.UTF8.GetString(response)); - [Fact] - public void TestReadNonExistingKey() + bc.Verify( + t => t.Read(It.IsAny(), null, null, It.IsAny()), + Times.Once); + } + + [Fact] + public void TestReadNonExistingKey() + { + Mock bc = new Mock(); + bc.Setup(e => e.Read(It.IsAny(), null, null, + It.IsAny())) + .Throws(new RpcException(new Status(StatusCode.NotFound, "The specified key does not exist"))) + .Verifiable(); + + var file = new Sdk.Storage.StorageClient(bc.Object).Bucket("test-bucket").File("test-file"); + + try { - Mock bc = new Mock(); - bc.Setup(e => e.Read(It.IsAny(), null, null, - It.IsAny())) - .Throws(new RpcException(new Status(StatusCode.NotFound, "The specified key does not exist"))) - .Verifiable(); - - var file = new Sdk.Storage.Storage(bc.Object).Bucket("test-bucket").File("test-file"); - - try - { - file.Read(); - Assert.True(false); - } - catch (global::Nitric.Sdk.Common.NitricException ne) - { - Assert.Equal("Status(StatusCode=\"NotFound\", Detail=\"The specified key does not exist\")", - ne.Message); - } - - bc.Verify( - t => t.Read(It.IsAny(), null, null, It.IsAny()), - Times.Once); + file.Read(); + Assert.True(false); } - - [Fact] - public void TestDeleteExistingKey() + catch (Common.NitricException ne) { - Mock bc = new Mock(); - bc.Setup(e => e.Delete(It.IsAny(), null, null, - It.IsAny())) - .Returns(new StorageDeleteResponse()) - .Verifiable(); + Assert.Equal("Status(StatusCode=\"NotFound\", Detail=\"The specified key does not exist\")", + ne.Message); + } + + bc.Verify( + t => t.Read(It.IsAny(), null, null, It.IsAny()), + Times.Once); + } - var file = new Sdk.Storage.Storage(bc.Object).Bucket("test-bucket").File("test-file"); + [Fact] + public void TestDeleteExistingKey() + { + Mock bc = new Mock(); + bc.Setup(e => e.Delete(It.IsAny(), null, null, + It.IsAny())) + .Returns(new StorageDeleteResponse()) + .Verifiable(); - file.Delete(); + var file = new Sdk.Storage.StorageClient(bc.Object).Bucket("test-bucket").File("test-file"); - bc.Verify( - t => t.Delete(It.IsAny(), null, null, - It.IsAny()), Times.Once); - } + file.Delete(); + + bc.Verify( + t => t.Delete(It.IsAny(), null, null, + It.IsAny()), Times.Once); } } diff --git a/test/Nitric.Sdk.Test/Api/Topics/TopicsClientTest.cs b/test/Nitric.Sdk.Test/Api/Topics/TopicsClientTest.cs new file mode 100644 index 0000000..0315ebe --- /dev/null +++ b/test/Nitric.Sdk.Test/Api/Topics/TopicsClientTest.cs @@ -0,0 +1,104 @@ +// Copyright 2021, Nitric Technologies Pty Ltd. +// +// 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. + +using System; +using System.Collections.Generic; +using Grpc.Core; +using Moq; +using GrpcClient = Nitric.Proto.Topics.v1.Topics.TopicsClient; +using Nitric.Proto.Topics.v1; +using Nitric.Sdk.Topics; +using Xunit; + +namespace Nitric.Sdk.Test.Api.Event +{ + public class TestProfile + { + public string Name; + public double Age; + public List Addresses; + } + + public class EventClientTest + { + [Fact] + public void TestBuildEvents() + { + var evt = new TopicsClient(); + Assert.NotNull(evt); + } + [Fact] + public void TestBuildTopicWithName() + { + var topic = new TopicsClient().Topic("test-topic"); + Assert.NotNull(topic); + Assert.Equal("test-topic", topic.Name); + } + + [Fact] + public void TestBuildTopicWithoutName() + { + Assert.Throws( + () => new TopicsClient().Topic("") + ); + Assert.Throws( + () => new TopicsClient().Topic(null) + ); + } + + [Fact] + public void TestPublish() + { + Mock ec = new Mock(); + + ec.Setup(e => e.Publish(It.IsAny(), null, null, It.IsAny())) + .Verifiable(); + + var topic = new TopicsClient(ec.Object).Topic("test-topic"); + + var profile = new TestProfile + { Name = "John Smith", Age = 30, Addresses = new List { "123 street st" } }; + + topic.Publish(profile); + + ec.Verify(t => t.Publish(It.IsAny(), null, null, It.IsAny()), Times.Once); + } + + [Fact] + public void TestPublishToNonExistentTopic() + { + Mock ec = new Mock(); + + ec.Setup(e => e.Publish(It.IsAny(), null, null, It.IsAny())) + .Throws(new RpcException(new Status(StatusCode.NotFound, "The specified topic does not exist"))) + .Verifiable(); + + var topic = new TopicsClient(ec.Object).Topic("test-topic"); + + var profile = new TestProfile + { Name = "John Smith", Age = 30, Addresses = new List { "123 street st" } }; + + try + { + topic.Publish(profile); + } + catch (Common.NitricException ne) + { + Assert.Equal("Status(StatusCode=\"NotFound\", Detail=\"The specified topic does not exist\")", ne.Message); + } + + ec.Verify(t => t.Publish(It.IsAny(), null, null, It.IsAny()), Times.Once); + } + }; +} diff --git a/test/Nitric.Sdk.Test/Api/Websocket/WebsocketTest.cs b/test/Nitric.Sdk.Test/Api/Websocket/WebsocketTest.cs index b918486..a32e5d4 100644 --- a/test/Nitric.Sdk.Test/Api/Websocket/WebsocketTest.cs +++ b/test/Nitric.Sdk.Test/Api/Websocket/WebsocketTest.cs @@ -1,19 +1,17 @@ using System; -using System.Text; using Google.Protobuf; using Grpc.Core; using Moq; -using Nitric.Proto.Secret.v1; -using Nitric.Proto.Websocket.v1; +using Nitric.Proto.Websockets.v1; using Nitric.Sdk.Common; -using Nitric.Sdk.Resource; -using Nitric.Sdk.Secret; using Nitric.Sdk.Websocket; using Xunit; +using GrpcClient = Nitric.Proto.Websockets.v1.Websocket.WebsocketClient; namespace Nitric.Sdk.Test.Api.Websocket; -public class WebsocketTest { +public class WebsocketTest +{ [Fact] public void TestWebsocketBuild() { @@ -22,7 +20,7 @@ public void TestWebsocketBuild() } [Fact] - public void TestBuildSecretsWithNullClient() + public void TestBuildWebsocketsWithNullClient() { var websocket = new WebsocketClient(null); Assert.NotNull(websocket); @@ -31,10 +29,10 @@ public void TestBuildSecretsWithNullClient() [Fact] public void TestBuildWebsocketWithIdAndSocket() { - var connection = new WebsocketClient().Connection("socket-name", "connection-id"); + var connection = Nitric.Websocket("socket-name").Connection("connection-id"); Assert.NotNull(connection); Assert.Equal("connection-id", connection.Id); - Assert.Equal("socket-name", connection.Socket); + Assert.Equal("socket-name", connection.SocketName); } [Fact] @@ -56,22 +54,22 @@ public void TestWebsocketSend() { var websocketSendRequest = new WebsocketSendRequest { - Socket = "socket-name", + SocketName = "socket-name", ConnectionId = "connection-id", Data = ByteString.CopyFromUtf8("websocket-data") }; - Mock wc = new Mock(); + Mock wc = new Mock(); wc.Setup(e => - e.Send(websocketSendRequest, null, null, It.IsAny())) + e.SendMessage(websocketSendRequest, null, null, It.IsAny())) .Verifiable(); var connection = new WebsocketClient(wc.Object) .Connection("socket-name", "connection-id"); - connection.Send("websocket-data"); + connection.SendMessage("websocket-data"); wc.Verify( - t => t.Send(websocketSendRequest, null, null, It.IsAny()), + t => t.SendMessage(websocketSendRequest, null, null, It.IsAny()), Times.Once); } @@ -80,64 +78,64 @@ public void TestWebsocketSendWithError() { var websocketSendRequest = new WebsocketSendRequest { - Socket = "socket-name", + SocketName = "socket-name", ConnectionId = "connection-id", Data = ByteString.CopyFromUtf8("websocket-data") }; - Mock wc = new Mock(); + Mock wc = new Mock(); wc.Setup(e => - e.Send(websocketSendRequest, null, null, It.IsAny())) + e.SendMessage(websocketSendRequest, null, null, It.IsAny())) .Throws(new RpcException(Status.DefaultCancelled, "succeeded in failing")); var connection = new WebsocketClient(wc.Object) .Connection("socket-name", "connection-id"); Assert.Throws(() => - connection.Send("websocket-data") + connection.SendMessage("websocket-data") ); } [Fact] public void TestWebsocketClose() { - var websocketCloseRequest = new WebsocketCloseRequest + var websocketCloseRequest = new WebsocketCloseConnectionRequest { - Socket = "socket-name", + SocketName = "socket-name", ConnectionId = "connection-id", }; - Mock wc = new Mock(); + Mock wc = new Mock(); wc.Setup(e => - e.Close(websocketCloseRequest, null, null, It.IsAny())) + e.CloseConnection(websocketCloseRequest, null, null, It.IsAny())) .Verifiable(); var connection = new WebsocketClient(wc.Object) .Connection("socket-name", "connection-id"); - connection.Close(); + connection.CloseConnection(); wc.Verify( - t => t.Close(websocketCloseRequest, null, null, It.IsAny()), + t => t.CloseConnection(websocketCloseRequest, null, null, It.IsAny()), Times.Once); } [Fact] public void TestWebsocketCloseWithError() { - var websocketCloseRequest = new WebsocketCloseRequest + var websocketCloseRequest = new WebsocketCloseConnectionRequest { - Socket = "socket-name", + SocketName = "socket-name", ConnectionId = "connection-id", }; - Mock wc = new Mock(); + Mock wc = new Mock(); wc.Setup(e => - e.Close(websocketCloseRequest, null, null, It.IsAny())) + e.CloseConnection(websocketCloseRequest, null, null, It.IsAny())) .Throws(new RpcException(Status.DefaultCancelled, "succeeded in failing")); var connection = new WebsocketClient(wc.Object) .Connection("socket-name", "connection-id"); Assert.Throws(() => - connection.Close() + connection.CloseConnection() ); } } diff --git a/test/Nitric.Sdk.Test/Faas/FaasTest.cs b/test/Nitric.Sdk.Test/Faas/FaasTest.cs deleted file mode 100644 index 9c1911d..0000000 --- a/test/Nitric.Sdk.Test/Faas/FaasTest.cs +++ /dev/null @@ -1,49 +0,0 @@ -// Copyright 2021, Nitric Technologies Pty Ltd. -// -// 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. - -namespace Nitric.Sdk.Test.Faas -{ - // //[TestClass] - // public class FaasTest - // { - // //[Fact] - // public async void TestDoubleStart() - // { - // Sdk.Function.Faas faas = Sdk.Function.Faas.NewBuilder() - // .Function(new HelloWorld()) - // .Build(); - // Thread faasThread = new Thread(() => faas.Start()); - // faasThread.Start(); - // await Assert.ThrowsAsync(() => faas.Start()); - // } - // //[Fact] - // public void TestCall() - // { - // Sdk.Function.Faas faas = new Sdk.Function.Faas { HttpHandler = new HelloWorld() }; - // Thread faasThread = new Thread(() => faas.Start()); - // faasThread.Start(); - // var client = new HttpClient(); - // var result = client.GetAsync(string.Format("http://{0}:{1}/", "127.0.0.1", 8080)); - // Assert.Equal("Hello World", result.Result.ToString()); - // } - // } - // public class HelloWorld : INitricFunction - // { - // public int requestNum = 0; - // public Response Handle(Trigger request) - // { - // return request.DefaultResponse(Encoding.UTF8.GetBytes("Hello World")); - // } - // } -} diff --git a/test/Nitric.Sdk.Test/Faas/ResponseTest.cs b/test/Nitric.Sdk.Test/Faas/ResponseTest.cs deleted file mode 100644 index b0c8f06..0000000 --- a/test/Nitric.Sdk.Test/Faas/ResponseTest.cs +++ /dev/null @@ -1,56 +0,0 @@ -// Copyright 2021, Nitric Technologies Pty Ltd. -// -// 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. - -namespace Nitric.Sdk.Test.Faas -{ - // public class ResponseTest - // { - // [Fact] - // public void TestHttpToGrpc() - // { - // var ctx = new HttpResponseContext() - // .SetStatus(200) - // .AddHeader("x-nitric-testing", "test"); - // - // var response = new Response( - // Encoding.UTF8.GetBytes("Hello World"), - // ctx - // ); - // - // var triggerResponse = response.ToGrpcTriggerResponse(); - // - // Assert.Equal("Hello World", triggerResponse.Data.ToStringUtf8()); - // Assert.NotNull(triggerResponse.Http); - // Assert.Equal(200, triggerResponse.Http.Status); - // Assert.Equal("test", triggerResponse.Http.Headers["x-nitric-testing"].Value[0]); - // } - // - // public void TestTopicToGrpc() - // { - // var ctx = new EventResponse() - // .SetSuccess(true); - // - // var response = new Response( - // Encoding.UTF8.GetBytes("Hello World"), - // ctx - // ); - // - // var triggerResponse = response.ToGrpcTriggerResponse(); - // - // Assert.Equal("Hello World", triggerResponse.Data.ToStringUtf8()); - // Assert.NotNull(triggerResponse.Topic); - // Assert.Equal(true, triggerResponse.Topic.Success); - // } - // } -} diff --git a/test/Nitric.Sdk.Test/Faas/TriggerTest.cs b/test/Nitric.Sdk.Test/Faas/TriggerTest.cs deleted file mode 100644 index d9560fc..0000000 --- a/test/Nitric.Sdk.Test/Faas/TriggerTest.cs +++ /dev/null @@ -1,60 +0,0 @@ -// Copyright 2021, Nitric Technologies Pty Ltd. -// -// 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. - -namespace Nitric.Sdk.Test.Faas -{ - // public class TriggerTest - // { - // [Fact] - // public void TestFromGrpcTriggerRequestHttp() - // { - // var triggerRequest = new TriggerRequest(); - // triggerRequest.Data = Google.Protobuf.ByteString.CopyFrom(Encoding.UTF8.GetBytes("Hello World")); - // triggerRequest.Http = new HttpTriggerContext(); - // triggerRequest.Http.Method = "GET"; - // var testHeader = new HeaderValue(); - // testHeader.Value.Add("test"); - // triggerRequest.Http.Headers.Add("x-nitric-test", testHeader); - // triggerRequest.MimeType = "text/plain"; - // triggerRequest.Http.Path = "/test/"; - // - // var trigger = Trigger.FromGrpcTriggerRequest(triggerRequest); - // - // - // Assert.True(trigger.Context.IsHttp()); - // Assert.Equal("Hello World", Encoding.UTF8.GetString(trigger.Data)); - // Assert.Equal("text/plain", trigger.MimeType); - // Assert.Equal("GET", trigger.Context.AsHttp().Method); - // Assert.Equal("/test/", trigger.Context.AsHttp().Path); - // Assert.Equal("test", trigger.Context.AsHttp().Headers["x-nitric-test"][0]); - // } - // - // [Fact] - // public void TestFromGrpcTriggerTopic() - // { - // var triggerRequest = new TriggerRequest(); - // triggerRequest.Data = Google.Protobuf.ByteString.CopyFrom(Encoding.UTF8.GetBytes("Hello World")); - // triggerRequest.MimeType = "text/plain"; - // triggerRequest.Topic = new Nitric.Proto.Faas.v1.TopicTriggerContext(); - // triggerRequest.Topic.Topic = "Test"; - // - // var trigger = Trigger.FromGrpcTriggerRequest(triggerRequest); - // - // Assert.True(trigger.Context.IsTopic()); - // Assert.Equal("Hello World", Encoding.UTF8.GetString(trigger.Data)); - // Assert.Equal("text/plain", trigger.MimeType); - // Assert.Equal("Test", trigger.Context.AsTopic().Topic); - // } - // } -} diff --git a/test/Nitric.Sdk.Test/Nitric.Sdk.Test.csproj b/test/Nitric.Sdk.Test/Nitric.Sdk.Test.csproj index 3ef2bda..8ea816b 100644 --- a/test/Nitric.Sdk.Test/Nitric.Sdk.Test.csproj +++ b/test/Nitric.Sdk.Test/Nitric.Sdk.Test.csproj @@ -25,13 +25,11 @@ - - - + @@ -41,5 +39,6 @@ + From b4999c23a503cbdfd8cc77605a5a223b6339e50f Mon Sep 17 00:00:00 2001 From: Ryan Cartwright Date: Tue, 20 Feb 2024 10:42:02 +1100 Subject: [PATCH 09/34] add kv store tests --- .../KeyValueStore/KeyValueStoreClient.cs | 2 +- .../KeyValueStore/KeyValueStoreClientTest.cs | 176 ++++++++++++++++++ test/Nitric.Sdk.Test/Nitric.Sdk.Test.csproj | 2 + 3 files changed, 179 insertions(+), 1 deletion(-) create mode 100644 test/Nitric.Sdk.Test/Api/KeyValueStore/KeyValueStoreClientTest.cs diff --git a/src/Nitric.Sdk/KeyValueStore/KeyValueStoreClient.cs b/src/Nitric.Sdk/KeyValueStore/KeyValueStoreClient.cs index 6cb1107..2e1d678 100644 --- a/src/Nitric.Sdk/KeyValueStore/KeyValueStoreClient.cs +++ b/src/Nitric.Sdk/KeyValueStore/KeyValueStoreClient.cs @@ -12,7 +12,7 @@ public class KeyValueStoreClient /// Optional gRPC client to reuse. internal readonly GrpcClient Client; - internal KeyValueStoreClient(GrpcClient client = null) + public KeyValueStoreClient(GrpcClient client = null) { this.Client = client ?? new GrpcClient(GrpcChannelProvider.GetChannel()); } diff --git a/test/Nitric.Sdk.Test/Api/KeyValueStore/KeyValueStoreClientTest.cs b/test/Nitric.Sdk.Test/Api/KeyValueStore/KeyValueStoreClientTest.cs new file mode 100644 index 0000000..5e2e1f6 --- /dev/null +++ b/test/Nitric.Sdk.Test/Api/KeyValueStore/KeyValueStoreClientTest.cs @@ -0,0 +1,176 @@ +using System; +using System.Collections.Generic; +using Grpc.Core; +using Moq; +using Xunit; +using GrpcClient = Nitric.Proto.KeyValue.v1.KeyValue.KeyValueClient; +using Nitric.Sdk.KeyValueStore; +using Nitric.Proto.KeyValue.v1; + +namespace Nitric.Sdk.Test.Api.KeyValueStore +{ + public class TestProfile + { + public string Name { get; set; } + public int Age { get; set; } + public List Addresses { get; set; } + } + + public class KeyValueStoreClientTest + { + [Fact] + public void TestBuildKeyValueClient() + { + var storage = new KeyValueStoreClient(); + Assert.NotNull(storage); + } + + [Fact] + public void TestBuildKeyValueStoreWithName() + { + var store = new KeyValueStoreClient().Store("test-store"); + Assert.NotNull(store); + Assert.Equal("test-store", store.Name); + } + + [Fact] + public void TestBuildKeyValueStoreWithoutName() + { + Assert.Throws( + () => new KeyValueStoreClient().Store("") + ); + Assert.Throws( + () => new KeyValueStoreClient().Store(null) + ); + } + + [Fact] + public void TestSetToKeyValueStore() + { + var testProfile = new TestProfile + { + Name = "John Smith", + Age = 21, + Addresses = new List { "123 address street" } + }; + + var payload = Common.Struct.FromJsonSerializable(testProfile); + + var request = new KeyValueSetRequest + { + Content = payload, + Ref = new ValueRef + { + Key = "test-key", + Store = "test-store" + } + }; + + Mock gc = new Mock(); + gc.Setup(e => + e.Set(It.IsAny(), null, null, It.IsAny())) + .Returns(new KeyValueSetResponse()) + .Verifiable(); + + var kv = new KeyValueStoreClient(gc.Object).Store("test-store"); + + kv.Set("test-key", testProfile); + + gc.Verify( + t => t.Set(request, null, null, It.IsAny()), Times.Once); + } + + [Fact] + public void TestSetNullToKeyValueStore() + { + var request = new KeyValueSetRequest + { + Content = null, + Ref = new ValueRef + { + Key = "test-key", + Store = "test-store" + } + }; + + Mock gc = new Mock(); + gc.Setup(e => + e.Set(It.IsAny(), null, null, It.IsAny())) + .Returns(new KeyValueSetResponse()) + .Verifiable(); + + var kv = new KeyValueStoreClient(gc.Object).Store("test-store"); + + kv.Set("test-key", null); + + gc.Verify( + t => t.Set(request, null, null, It.IsAny()), Times.Once); + } + + [Fact] + public void TestGetToKeyValueStore() + { + var testProfile = new TestProfile + { + Name = "John Smith", + Age = 21, + Addresses = new List { "123 address street" } + }; + + var payload = Common.Struct.FromJsonSerializable(testProfile); + + var request = new KeyValueGetRequest + { + Ref = new ValueRef + { + Key = "test-key", + Store = "test-store" + } + }; + + Mock gc = new Mock(); + gc.Setup(e => + e.Get(It.IsAny(), null, null, It.IsAny())) + .Returns(new KeyValueGetResponse { Value = new Value { Content = payload, Ref = new ValueRef { Key = "test-key", Store = "test-store" } } }) + .Verifiable(); + + var kv = new KeyValueStoreClient(gc.Object).Store("test-store"); + + var profile = kv.Get("test-key"); + + Assert.Equal("John Smith", profile.Name); + Assert.Equal(21, profile.Age); + Assert.Equal("123 address street", profile.Addresses[0]); + + gc.Verify( + t => t.Get(request, null, null, It.IsAny()), Times.Once); + } + + [Fact] + public void TestDeleteKeyValuePair() + { + var request = new KeyValueDeleteRequest + { + Ref = new ValueRef + { + Key = "test-key", + Store = "test-store" + } + }; + + Mock gc = new Mock(); + gc.Setup(e => + e.Delete(It.IsAny(), null, null, It.IsAny())) + .Returns(new KeyValueDeleteResponse()) + .Verifiable(); + + var kv = new KeyValueStoreClient(gc.Object).Store("test-store"); + + kv.Delete("test-key"); + + gc.Verify( + t => t.Delete(request, null, null, It.IsAny()), Times.Once); + } + } +} + diff --git a/test/Nitric.Sdk.Test/Nitric.Sdk.Test.csproj b/test/Nitric.Sdk.Test/Nitric.Sdk.Test.csproj index 8ea816b..c2c8c24 100644 --- a/test/Nitric.Sdk.Test/Nitric.Sdk.Test.csproj +++ b/test/Nitric.Sdk.Test/Nitric.Sdk.Test.csproj @@ -30,6 +30,7 @@ + @@ -40,5 +41,6 @@ + From 4b4682820d0d6cfb9e0bea2eee942f5ff75fa35f Mon Sep 17 00:00:00 2001 From: Ryan Cartwright Date: Tue, 27 Feb 2024 17:34:05 +1100 Subject: [PATCH 10/34] add worker graceful exiting --- makefile | 28 +++++++------ src/Nitric.Sdk/Nitric.Sdk.csproj | 2 +- src/Nitric.Sdk/Nitric.cs | 40 ++++++++----------- src/Nitric.Sdk/Resource/ApiResource.cs | 2 - src/Nitric.Sdk/Resource/BaseResource.cs | 2 +- src/Nitric.Sdk/Resource/BucketResource.cs | 3 +- .../Resource/KeyValueStoreResource.cs | 3 +- src/Nitric.Sdk/Resource/QueueResource.cs | 3 +- src/Nitric.Sdk/Resource/ScheduleResource.cs | 16 ++++++-- src/Nitric.Sdk/Resource/SecretResource.cs | 3 +- src/Nitric.Sdk/Resource/TopicResource.cs | 5 +-- src/Nitric.Sdk/Resource/WebsocketResource.cs | 3 +- src/Nitric.Sdk/Service/BlobEventContext.cs | 13 +++--- src/Nitric.Sdk/Service/HttpContext.cs | 7 ++++ src/Nitric.Sdk/Service/MessageContext.cs | 4 +- src/Nitric.Sdk/Worker/ApiWorker.cs | 16 +++++--- src/Nitric.Sdk/Worker/BlobEventWorker.cs | 17 +++++--- src/Nitric.Sdk/Worker/ScheduleWorker.cs | 15 ++++--- src/Nitric.Sdk/Worker/SubscriptionWorker.cs | 18 +++++---- src/Nitric.Sdk/Worker/WebsocketWorker.cs | 16 +++++--- 20 files changed, 121 insertions(+), 95 deletions(-) diff --git a/makefile b/makefile index 4fa962b..5c0305d 100644 --- a/makefile +++ b/makefile @@ -1,23 +1,25 @@ # the version of of https://github.com/nitrictech/nitric to use in base client generation. -NITRIC_VERSION := 0.33.0 +NITRIC_VERSION := 1.0.0 generate: clean download build test: - dotnet test tests/Nitric.Sdk.Test + @dotnet test tests/Nitric.Sdk.Test build: - dotnet build src/Nitric.Sdk/Nitric.Sdk.csproj + @dotnet build src/Nitric.Sdk/Nitric.Sdk.csproj + @mv src/Nitric.Sdk/Proto/nitric/proto/* src/Nitric.Sdk/Proto/ + @rm -rf src/Nitric.Sdk/Proto/nitric clean: - rm -rf src/Nitric.Sdk/bin - rm -rf src/Nitric.Sdk/obj - rm -rf src/Nitric.Sdk/Proto + @rm -rf src/Nitric.Sdk/bin + @rm -rf src/Nitric.Sdk/obj + @rm -rf src/Nitric.Sdk/Proto download: - curl -L https://github.com/nitrictech/nitric/releases/download/v${NITRIC_VERSION}/contracts.tgz -o contracts.tgz - tar xvzf contracts.tgz - rm contracts.tgz + @curl -L https://github.com/nitrictech/nitric/releases/download/v${NITRIC_VERSION}/proto.tgz -o contracts.tgz + @tar xvzf contracts.tgz + @rm contracts.tgz download-local: @rm -rf ./nitric @@ -28,7 +30,7 @@ download-local: # "rm -r ./nitric && mkdir ./nitric && cp -r $NITRIC_CORE_HOME/nitric/proto ./nitric", -pack: clean download-local - dotnet build src/Nitric.Sdk/Nitric.Sdk.csproj -c Release - mkdir -p __out - dotnet pack -c Release -o __out \ No newline at end of file +pack: clean download + @dotnet build src/Nitric.Sdk/Nitric.Sdk.csproj -c Release + @mkdir -p __out + @dotnet pack -c Release -o __out \ No newline at end of file diff --git a/src/Nitric.Sdk/Nitric.Sdk.csproj b/src/Nitric.Sdk/Nitric.Sdk.csproj index 75447f5..097347c 100644 --- a/src/Nitric.Sdk/Nitric.Sdk.csproj +++ b/src/Nitric.Sdk/Nitric.Sdk.csproj @@ -1,7 +1,7 @@ netstandard2.1 - 0.0.13 + 1.0.0 Nitric.Sdk Nitric Pty Ltd LICENSE.txt diff --git a/src/Nitric.Sdk/Nitric.cs b/src/Nitric.Sdk/Nitric.cs index 90db2ce..5e778e6 100644 --- a/src/Nitric.Sdk/Nitric.cs +++ b/src/Nitric.Sdk/Nitric.cs @@ -51,28 +51,6 @@ public static void Run() Task.WaitAll(Workers.Select(worker => worker.Start()).ToArray()); } - /// - /// Declare a REST/HTTP API resource. - /// - /// Used to register routes and handlers for HTTP requests. - /// - /// The unique name of this API. - /// - //public static ApiResource Api(string name, ApiOptions options = null) - //{ - // return new ApiResource(name, options); - //} - - /// - /// Declare a schedule. - /// - /// A short description of the schedule - /// - public static ScheduleResource Schedule(string description) - { - return new ScheduleResource(description); - } - private static T Cached(string name, Func make) where T : BaseResource { var typeMap = Cache.GetValueOrDefault(typeof(T), new Dictionary()); @@ -85,13 +63,29 @@ private static T Cached(string name, Func make) where T : BaseReso } else { + resource.Register(); Cache.Add(typeof(T), typeMap); - } return resource; } + /// + /// Declare a REST/HTTP API resource. + /// + /// Used to register routes and handlers for HTTP requests. + /// + /// The unique name of this API. + /// + public static ApiResource Api(string name, ApiOptions options = null) => Cached(name, s => new ApiResource(s, options)); + + /// + /// Declare a schedule. + /// + /// A short description of the schedule + /// + public static ScheduleResource Schedule(string description) => Cached(description, s => new ScheduleResource(s)); + /// /// Declare a bucket resources for file/blob storage. /// diff --git a/src/Nitric.Sdk/Resource/ApiResource.cs b/src/Nitric.Sdk/Resource/ApiResource.cs index ee65d2a..8e312bd 100644 --- a/src/Nitric.Sdk/Resource/ApiResource.cs +++ b/src/Nitric.Sdk/Resource/ApiResource.cs @@ -23,8 +23,6 @@ using ProtoSecurityDefinition = Nitric.Proto.Resources.v1.ApiSecurityDefinitionResource; using ProtoSecurityDefinitionJwt = Nitric.Proto.Resources.v1.ApiOpenIdConnectionDefinition; using System.Net.Http; -using Google.Protobuf.Collections; -using System.Runtime.InteropServices; namespace Nitric.Sdk.Resource { diff --git a/src/Nitric.Sdk/Resource/BaseResource.cs b/src/Nitric.Sdk/Resource/BaseResource.cs index 5f15997..a4c0cda 100644 --- a/src/Nitric.Sdk/Resource/BaseResource.cs +++ b/src/Nitric.Sdk/Resource/BaseResource.cs @@ -28,7 +28,7 @@ public BaseResource(string name, ResourceType type) { this.Name = name; this.type = type; - BaseResource.client = (BaseResource.client == null) ? new GrpcClient(GrpcChannelProvider.GetChannel()) : client; + client = (client == null) ? new GrpcClient(GrpcChannelProvider.GetChannel()) : client; } internal ProtoResource AsProtoResource() diff --git a/src/Nitric.Sdk/Resource/BucketResource.cs b/src/Nitric.Sdk/Resource/BucketResource.cs index 2a076c6..e318a68 100644 --- a/src/Nitric.Sdk/Resource/BucketResource.cs +++ b/src/Nitric.Sdk/Resource/BucketResource.cs @@ -53,8 +53,7 @@ internal BucketResource(string name) : base(name, ResourceType.Bucket) internal override BaseResource Register() { - var resource = new NitricResource { Name = this.Name, Type = ResourceType.Bucket }; - var request = new ResourceDeclareRequest { Id = resource }; + var request = new ResourceDeclareRequest { Id = this.AsProtoResource() }; BaseResource.client.Declare(request); return this; } diff --git a/src/Nitric.Sdk/Resource/KeyValueStoreResource.cs b/src/Nitric.Sdk/Resource/KeyValueStoreResource.cs index 3d54b7f..22595cb 100644 --- a/src/Nitric.Sdk/Resource/KeyValueStoreResource.cs +++ b/src/Nitric.Sdk/Resource/KeyValueStoreResource.cs @@ -48,8 +48,7 @@ internal KeyValueStoreResource(string name) : base(name, ResourceType.KeyValueSt internal override BaseResource Register() { - var resource = new NitricResource { Name = this.Name, Type = ResourceType.KeyValueStore }; - var request = new ResourceDeclareRequest { Id = resource }; + var request = new ResourceDeclareRequest { Id = this.AsProtoResource() }; client.Declare(request); return this; } diff --git a/src/Nitric.Sdk/Resource/QueueResource.cs b/src/Nitric.Sdk/Resource/QueueResource.cs index 0da715f..75425b6 100644 --- a/src/Nitric.Sdk/Resource/QueueResource.cs +++ b/src/Nitric.Sdk/Resource/QueueResource.cs @@ -43,8 +43,7 @@ internal QueueResource(string name) : base(name, ResourceType.Queue) internal override BaseResource Register() { - var resource = new NitricResource { Name = this.Name, Type = ResourceType.Queue }; - var request = new ResourceDeclareRequest { Id = resource }; + var request = new ResourceDeclareRequest { Id = this.AsProtoResource() }; client.Declare(request); return this; } diff --git a/src/Nitric.Sdk/Resource/ScheduleResource.cs b/src/Nitric.Sdk/Resource/ScheduleResource.cs index 281a8b5..396b12f 100644 --- a/src/Nitric.Sdk/Resource/ScheduleResource.cs +++ b/src/Nitric.Sdk/Resource/ScheduleResource.cs @@ -15,16 +15,24 @@ using Nitric.Sdk.Service; using Nitric.Sdk.Worker; using Nitric.Proto.Schedules.v1; +using Nitric.Proto.Resources.v1; +using NitricResource = Nitric.Proto.Resources.v1.ResourceIdentifier; +using ResourceType = Nitric.Proto.Resources.v1.ResourceType; namespace Nitric.Sdk.Resource { - public class ScheduleResource + public class ScheduleResource : BaseResource { - private string Name; + internal ScheduleResource(string name) : base(name, ResourceType.Schedule) + { + + } - internal ScheduleResource(string name) + internal override BaseResource Register() { - this.Name = name; + var request = new ResourceDeclareRequest { Id = this.AsProtoResource() }; + BaseResource.client.Declare(request); + return this; } /// diff --git a/src/Nitric.Sdk/Resource/SecretResource.cs b/src/Nitric.Sdk/Resource/SecretResource.cs index 279792f..b9ce3e7 100644 --- a/src/Nitric.Sdk/Resource/SecretResource.cs +++ b/src/Nitric.Sdk/Resource/SecretResource.cs @@ -43,8 +43,7 @@ internal SecretResource(string name) : base(name, ResourceType.Secret) internal override BaseResource Register() { - var resource = new NitricResource { Name = this.Name, Type = ResourceType.Secret }; - var request = new ResourceDeclareRequest { Id = resource }; + var request = new ResourceDeclareRequest { Id = this.AsProtoResource() }; client.Declare(request); return this; } diff --git a/src/Nitric.Sdk/Resource/TopicResource.cs b/src/Nitric.Sdk/Resource/TopicResource.cs index 2c8c307..2fe61a0 100644 --- a/src/Nitric.Sdk/Resource/TopicResource.cs +++ b/src/Nitric.Sdk/Resource/TopicResource.cs @@ -44,9 +44,8 @@ internal TopicResource(string name) : base(name, ResourceType.Topic) internal override BaseResource Register() { - var resource = new NitricResource { Name = this.Name, Type = ResourceType.Topic }; - var request = new ResourceDeclareRequest { Id = resource }; - BaseResource.client.Declare(request); + var request = new ResourceDeclareRequest { Id = this.AsProtoResource() }; + client.Declare(request); return this; } diff --git a/src/Nitric.Sdk/Resource/WebsocketResource.cs b/src/Nitric.Sdk/Resource/WebsocketResource.cs index d9b7e0d..13b8698 100644 --- a/src/Nitric.Sdk/Resource/WebsocketResource.cs +++ b/src/Nitric.Sdk/Resource/WebsocketResource.cs @@ -49,8 +49,7 @@ internal WebsocketResource(string name) : base(name, ResourceType.Websocket) internal override BaseResource Register() { - var resource = new NitricResource { Name = this.Name, Type = ResourceType.Websocket }; - var request = new ResourceDeclareRequest { Id = resource }; + var request = new ResourceDeclareRequest { Id = this.AsProtoResource() }; BaseResource.client.Declare(request); return this; } diff --git a/src/Nitric.Sdk/Service/BlobEventContext.cs b/src/Nitric.Sdk/Service/BlobEventContext.cs index b7d4cf0..d7560f3 100644 --- a/src/Nitric.Sdk/Service/BlobEventContext.cs +++ b/src/Nitric.Sdk/Service/BlobEventContext.cs @@ -66,7 +66,7 @@ public class BlobEventRequest : TriggerRequest /// /// A reference to the file that triggered this request /// - public Storage.Blob File { get; private set; } + public string Key { get; private set; } /// /// The type of event that triggered this request @@ -77,13 +77,11 @@ public class BlobEventRequest : TriggerRequest /// /// Construct a bucket notification request /// - /// the payload of the message /// the file that triggered the notification /// the type of bucket notification - /// the bucket that triggered the notification - public BlobEventRequest(string key, BlobEventType notificationType, Bucket bucket) : base() + public BlobEventRequest(string key, BlobEventType notificationType) : base() { - this.File = bucket.File(key); + this.Key = key; this.NotificationType = notificationType; } } @@ -130,7 +128,7 @@ public BlobEventContext(string id, BlobEventRequest req, BlobEventResponse res) /// The trigger to convert into a BucketNotificationContext. /// The bucket notification worker options describing the worker options. /// the new bucket notification context - public static BlobEventContext FromRequest(ServerMessage trigger, Bucket bucket) + public static BlobEventContext FromRequest(ServerMessage trigger) { var notificationType = FromGrpcBlobEventType(trigger.BlobEventRequest.BlobEvent.Type); @@ -138,8 +136,7 @@ public static BlobEventContext FromRequest(ServerMessage trigger, Bucket bucket) trigger.Id, new BlobEventRequest( trigger.BlobEventRequest.BlobEvent.Key, - notificationType, - bucket + notificationType ), new BlobEventResponse(true)); } diff --git a/src/Nitric.Sdk/Service/HttpContext.cs b/src/Nitric.Sdk/Service/HttpContext.cs index 8d80697..04b3aed 100644 --- a/src/Nitric.Sdk/Service/HttpContext.cs +++ b/src/Nitric.Sdk/Service/HttpContext.cs @@ -136,6 +136,13 @@ public void Text(string text) this.Body = Encoding.UTF8.GetBytes(text); this.Headers["Content-Type"] = new List { "text/plain" }; } + + public void WithError(System.Exception exception) + { + this.Status = 500; + this.Body = Encoding.UTF8.GetBytes(exception.ToString()); + this.Headers["Content-Type"] = new List { "text/plain" }; + } } /// diff --git a/src/Nitric.Sdk/Service/MessageContext.cs b/src/Nitric.Sdk/Service/MessageContext.cs index 571097c..91d32a0 100644 --- a/src/Nitric.Sdk/Service/MessageContext.cs +++ b/src/Nitric.Sdk/Service/MessageContext.cs @@ -28,7 +28,7 @@ public class MessageRequest : TriggerRequest /// public string TopicName { get; private set; } - public T Payload { get; private set; } + public T Message { get; private set; } /// /// Construct an event request @@ -38,7 +38,7 @@ public class MessageRequest : TriggerRequest public MessageRequest(string topicName, TopicMessage message) : base() { this.TopicName = topicName; - this.Payload = Struct.ToJsonSerializable(message.StructPayload); + this.Message = Struct.ToJsonSerializable(message.StructPayload); } } diff --git a/src/Nitric.Sdk/Worker/ApiWorker.cs b/src/Nitric.Sdk/Worker/ApiWorker.cs index 53a3370..b7d2443 100644 --- a/src/Nitric.Sdk/Worker/ApiWorker.cs +++ b/src/Nitric.Sdk/Worker/ApiWorker.cs @@ -34,18 +34,24 @@ public override async Task Start() { var req = stream.ResponseStream.Current; + if (req.RegistrationResponse != null) { // Schedule connected with Nitric server. } - else if (req.HttpRequest != null) - { - var ctx = HttpContext.FromRequest(req); - ctx = this.Middleware(ctx); + var ctx = HttpContext.FromRequest(req); - await stream.RequestStream.WriteAsync(ctx.ToResponse()); + try + { + ctx = this.Middleware(ctx); + } + catch (Exception err) + { + ctx.Res.WithError(err); } + + await stream.RequestStream.WriteAsync(ctx.ToResponse()); } await stream.RequestStream.CompleteAsync(); diff --git a/src/Nitric.Sdk/Worker/BlobEventWorker.cs b/src/Nitric.Sdk/Worker/BlobEventWorker.cs index ec503a8..2a85fda 100644 --- a/src/Nitric.Sdk/Worker/BlobEventWorker.cs +++ b/src/Nitric.Sdk/Worker/BlobEventWorker.cs @@ -12,7 +12,6 @@ namespace Nitric.Sdk.Worker public class BlobEventWorker : AbstractWorker { readonly private RegistrationRequest RegistrationRequest; - readonly private Bucket bucket; public BlobEventWorker(RegistrationRequest request, Func middleware) : base(middleware) { @@ -40,14 +39,20 @@ public override async Task Start() { // Bucket listener connected with Nitric server. } - else if (req.BlobEventRequest != null) - { - var ctx = BlobEventContext.FromRequest(req, bucket); - ctx = this.Middleware(ctx); + var ctx = BlobEventContext.FromRequest(req); - await stream.RequestStream.WriteAsync(ctx.ToResponse()); + try + { + ctx = this.Middleware(ctx); } + catch (Exception err) + { + Console.WriteLine("Unhandled application error: {0}", err.ToString()); + ctx.Res.Success = false; + } + + await stream.RequestStream.WriteAsync(ctx.ToResponse()); } await stream.RequestStream.CompleteAsync(); diff --git a/src/Nitric.Sdk/Worker/ScheduleWorker.cs b/src/Nitric.Sdk/Worker/ScheduleWorker.cs index e5b0d08..2efb9af 100644 --- a/src/Nitric.Sdk/Worker/ScheduleWorker.cs +++ b/src/Nitric.Sdk/Worker/ScheduleWorker.cs @@ -38,14 +38,19 @@ public override async Task Start() { // Schedule connected with Nitric server. } - else if (req.IntervalRequest != null) - { - var ctx = IntervalContext.FromRequest(req); - ctx = this.Middleware(ctx); + var ctx = IntervalContext.FromRequest(req); - await stream.RequestStream.WriteAsync(ctx.ToResponse()); + try + { + ctx = this.Middleware(ctx); } + catch (Exception err) + { + Console.WriteLine("Unhandled application error: {0}", err.ToString()); + } + + await stream.RequestStream.WriteAsync(ctx.ToResponse()); } await stream.RequestStream.CompleteAsync(); diff --git a/src/Nitric.Sdk/Worker/SubscriptionWorker.cs b/src/Nitric.Sdk/Worker/SubscriptionWorker.cs index 181a46b..5145c1f 100644 --- a/src/Nitric.Sdk/Worker/SubscriptionWorker.cs +++ b/src/Nitric.Sdk/Worker/SubscriptionWorker.cs @@ -30,8 +30,6 @@ public override async Task Start() await stream.RequestStream.WriteAsync(new ClientMessage { RegistrationRequest = RegistrationRequest }); - Console.WriteLine(RegistrationRequest); - while (await stream.ResponseStream.MoveNext(CancellationToken.None)) { var req = stream.ResponseStream.Current; @@ -40,14 +38,20 @@ public override async Task Start() { // Topic connected with Nitric Server. } - else if (req.MessageRequest != null) - { - var ctx = MessageContext.FromRequest(req); - ctx = this.Middleware(ctx); + var ctx = MessageContext.FromRequest(req); - await stream.RequestStream.WriteAsync(ctx.ToResponse()); + try + { + ctx = this.Middleware(ctx); + } + catch (Exception err) + { + Console.WriteLine("Unhandled application error: {0}", err.ToString()); + ctx.Res.Success = false; } + + await stream.RequestStream.WriteAsync(ctx.ToResponse()); } await stream.RequestStream.CompleteAsync(); diff --git a/src/Nitric.Sdk/Worker/WebsocketWorker.cs b/src/Nitric.Sdk/Worker/WebsocketWorker.cs index 1ff0484..0d55abf 100644 --- a/src/Nitric.Sdk/Worker/WebsocketWorker.cs +++ b/src/Nitric.Sdk/Worker/WebsocketWorker.cs @@ -38,14 +38,20 @@ public override async Task Start() { // Websocket connected with Nitric server. } - else if (req.WebsocketEventRequest != null) - { - var ctx = WebsocketContext.FromRequest(req); - ctx = this.Middleware(ctx); + var ctx = WebsocketContext.FromRequest(req); - await stream.RequestStream.WriteAsync(ctx.ToResponse()); + try + { + ctx = this.Middleware(ctx); } + catch (Exception err) + { + Console.WriteLine("Unhandled application error: {0}", err.ToString()); + ctx.Res.Success = false; + } + + await stream.RequestStream.WriteAsync(ctx.ToResponse()); } await stream.RequestStream.CompleteAsync(); From 5cc3e835401c7f558ccbd9d55851dc2be659628f Mon Sep 17 00:00:00 2001 From: Ryan Cartwright Date: Wed, 28 Feb 2024 11:36:47 +1100 Subject: [PATCH 11/34] stop attempting response to registration request --- src/Nitric.Sdk/Worker/ApiWorker.cs | 27 +++++++++++---------- src/Nitric.Sdk/Worker/BlobEventWorker.cs | 24 +++++++++--------- src/Nitric.Sdk/Worker/ScheduleWorker.cs | 24 +++++++++--------- src/Nitric.Sdk/Worker/SubscriptionWorker.cs | 26 +++++++++++--------- src/Nitric.Sdk/Worker/WebsocketWorker.cs | 26 +++++++++++--------- src/Nitric.Sdk/Worker/Worker.cs | 2 +- 6 files changed, 69 insertions(+), 60 deletions(-) diff --git a/src/Nitric.Sdk/Worker/ApiWorker.cs b/src/Nitric.Sdk/Worker/ApiWorker.cs index b7d2443..3580b02 100644 --- a/src/Nitric.Sdk/Worker/ApiWorker.cs +++ b/src/Nitric.Sdk/Worker/ApiWorker.cs @@ -34,24 +34,25 @@ public override async Task Start() { var req = stream.ResponseStream.Current; - if (req.RegistrationResponse != null) { // Schedule connected with Nitric server. - } - - var ctx = HttpContext.FromRequest(req); - - try + } + else if (req.HttpRequest != null) { - ctx = this.Middleware(ctx); + var ctx = HttpContext.FromRequest(req); + + try + { + ctx = this.Middleware(ctx); + } + catch (Exception err) + { + ctx.Res.WithError(err); + } + + await stream.RequestStream.WriteAsync(ctx.ToResponse()); } - catch (Exception err) - { - ctx.Res.WithError(err); - } - - await stream.RequestStream.WriteAsync(ctx.ToResponse()); } await stream.RequestStream.CompleteAsync(); diff --git a/src/Nitric.Sdk/Worker/BlobEventWorker.cs b/src/Nitric.Sdk/Worker/BlobEventWorker.cs index 2a85fda..a77d2bb 100644 --- a/src/Nitric.Sdk/Worker/BlobEventWorker.cs +++ b/src/Nitric.Sdk/Worker/BlobEventWorker.cs @@ -39,20 +39,22 @@ public override async Task Start() { // Bucket listener connected with Nitric server. } + else if (req.BlobEventRequest != null) + { + var ctx = BlobEventContext.FromRequest(req); - var ctx = BlobEventContext.FromRequest(req); + try + { + ctx = this.Middleware(ctx); + } + catch (Exception err) + { + Console.WriteLine("Unhandled application error: {0}", err.ToString()); + ctx.Res.Success = false; + } - try - { - ctx = this.Middleware(ctx); + await stream.RequestStream.WriteAsync(ctx.ToResponse()); } - catch (Exception err) - { - Console.WriteLine("Unhandled application error: {0}", err.ToString()); - ctx.Res.Success = false; - } - - await stream.RequestStream.WriteAsync(ctx.ToResponse()); } await stream.RequestStream.CompleteAsync(); diff --git a/src/Nitric.Sdk/Worker/ScheduleWorker.cs b/src/Nitric.Sdk/Worker/ScheduleWorker.cs index 2efb9af..f1a0635 100644 --- a/src/Nitric.Sdk/Worker/ScheduleWorker.cs +++ b/src/Nitric.Sdk/Worker/ScheduleWorker.cs @@ -38,19 +38,21 @@ public override async Task Start() { // Schedule connected with Nitric server. } - - var ctx = IntervalContext.FromRequest(req); - - try + else if (req.IntervalRequest != null) { - ctx = this.Middleware(ctx); + var ctx = IntervalContext.FromRequest(req); + + try + { + ctx = this.Middleware(ctx); + } + catch (Exception err) + { + Console.WriteLine("Unhandled application error: {0}", err.ToString()); + } + + await stream.RequestStream.WriteAsync(ctx.ToResponse()); } - catch (Exception err) - { - Console.WriteLine("Unhandled application error: {0}", err.ToString()); - } - - await stream.RequestStream.WriteAsync(ctx.ToResponse()); } await stream.RequestStream.CompleteAsync(); diff --git a/src/Nitric.Sdk/Worker/SubscriptionWorker.cs b/src/Nitric.Sdk/Worker/SubscriptionWorker.cs index 5145c1f..6553487 100644 --- a/src/Nitric.Sdk/Worker/SubscriptionWorker.cs +++ b/src/Nitric.Sdk/Worker/SubscriptionWorker.cs @@ -38,20 +38,22 @@ public override async Task Start() { // Topic connected with Nitric Server. } - - var ctx = MessageContext.FromRequest(req); - - try + else if (req.MessageRequest != null) { - ctx = this.Middleware(ctx); + var ctx = MessageContext.FromRequest(req); + + try + { + ctx = this.Middleware(ctx); + } + catch (Exception err) + { + Console.WriteLine("Unhandled application error: {0}", err.ToString()); + ctx.Res.Success = false; + } + + await stream.RequestStream.WriteAsync(ctx.ToResponse()); } - catch (Exception err) - { - Console.WriteLine("Unhandled application error: {0}", err.ToString()); - ctx.Res.Success = false; - } - - await stream.RequestStream.WriteAsync(ctx.ToResponse()); } await stream.RequestStream.CompleteAsync(); diff --git a/src/Nitric.Sdk/Worker/WebsocketWorker.cs b/src/Nitric.Sdk/Worker/WebsocketWorker.cs index 0d55abf..c887dba 100644 --- a/src/Nitric.Sdk/Worker/WebsocketWorker.cs +++ b/src/Nitric.Sdk/Worker/WebsocketWorker.cs @@ -38,20 +38,22 @@ public override async Task Start() { // Websocket connected with Nitric server. } - - var ctx = WebsocketContext.FromRequest(req); - - try + else if (req.WebsocketEventRequest != null) { - ctx = this.Middleware(ctx); + var ctx = WebsocketContext.FromRequest(req); + + try + { + ctx = this.Middleware(ctx); + } + catch (Exception err) + { + Console.WriteLine("Unhandled application error: {0}", err.ToString()); + ctx.Res.Success = false; + } + + await stream.RequestStream.WriteAsync(ctx.ToResponse()); } - catch (Exception err) - { - Console.WriteLine("Unhandled application error: {0}", err.ToString()); - ctx.Res.Success = false; - } - - await stream.RequestStream.WriteAsync(ctx.ToResponse()); } await stream.RequestStream.CompleteAsync(); diff --git a/src/Nitric.Sdk/Worker/Worker.cs b/src/Nitric.Sdk/Worker/Worker.cs index 247945b..cd785db 100644 --- a/src/Nitric.Sdk/Worker/Worker.cs +++ b/src/Nitric.Sdk/Worker/Worker.cs @@ -1,4 +1,4 @@ -using System; +using System; using System.Threading.Tasks; using System.Collections.Generic; using Nitric.Sdk.Service; From df0bb8ed1c373cee4dae333d04807718383838e2 Mon Sep 17 00:00:00 2001 From: Ryan Cartwright Date: Wed, 28 Feb 2024 14:20:02 +1100 Subject: [PATCH 12/34] add license files --- makefile | 16 +- nitric/proto/apis/v1/apis.proto | 113 ------- nitric/proto/deployments/v1/deployments.proto | 295 ------------------ nitric/proto/http/v1/http.proto | 29 -- nitric/proto/keyvalue/v1/keyvalue.proto | 75 ----- nitric/proto/queues/v1/queues.proto | 81 ----- nitric/proto/resources/v1/resources.proto | 121 ------- nitric/proto/schedules/v1/schedules.proto | 67 ---- nitric/proto/secrets/v1/secrets.proto | 60 ---- nitric/proto/storage/v1/storage.proto | 189 ----------- nitric/proto/topics/v1/topics.proto | 92 ------ nitric/proto/websockets/v1/websockets.proto | 147 --------- src/Nitric.Sdk/Common/Struct.cs | 18 +- src/Nitric.Sdk/KeyValueStore/KeyValueStore.cs | 16 +- .../KeyValueStore/KeyValueStoreClient.cs | 14 + .../Proto/{nitric/proto => }/apis/v1/Apis.cs | 0 .../{nitric/proto => }/apis/v1/ApisGrpc.cs | 0 .../proto => }/deployments/v1/Deployments.cs | 0 .../deployments/v1/DeploymentsGrpc.cs | 0 .../Proto/{nitric/proto => }/http/v1/Http.cs | 0 .../{nitric/proto => }/http/v1/HttpGrpc.cs | 0 .../proto => }/keyvalue/v1/Keyvalue.cs | 0 .../proto => }/keyvalue/v1/KeyvalueGrpc.cs | 0 .../{nitric/proto => }/queues/v1/Queues.cs | 0 .../proto => }/queues/v1/QueuesGrpc.cs | 0 .../proto => }/resources/v1/Resources.cs | 0 .../proto => }/resources/v1/ResourcesGrpc.cs | 0 .../proto => }/schedules/v1/Schedules.cs | 0 .../proto => }/schedules/v1/SchedulesGrpc.cs | 0 .../{nitric/proto => }/secrets/v1/Secrets.cs | 0 .../proto => }/secrets/v1/SecretsGrpc.cs | 0 .../{nitric/proto => }/storage/v1/Storage.cs | 0 .../proto => }/storage/v1/StorageGrpc.cs | 0 .../{nitric/proto => }/topics/v1/Topics.cs | 0 .../proto => }/topics/v1/TopicsGrpc.cs | 0 .../proto => }/websockets/v1/Websockets.cs | 0 .../websockets/v1/WebsocketsGrpc.cs | 0 src/Nitric.Sdk/Worker/ApiWorker.cs | 14 + src/Nitric.Sdk/Worker/BlobEventWorker.cs | 14 + src/Nitric.Sdk/Worker/ScheduleWorker.cs | 14 + src/Nitric.Sdk/Worker/SubscriptionWorker.cs | 14 + src/Nitric.Sdk/Worker/WebsocketWorker.cs | 14 + src/Nitric.Sdk/Worker/Worker.cs | 14 + 43 files changed, 131 insertions(+), 1286 deletions(-) delete mode 100644 nitric/proto/apis/v1/apis.proto delete mode 100644 nitric/proto/deployments/v1/deployments.proto delete mode 100644 nitric/proto/http/v1/http.proto delete mode 100644 nitric/proto/keyvalue/v1/keyvalue.proto delete mode 100644 nitric/proto/queues/v1/queues.proto delete mode 100644 nitric/proto/resources/v1/resources.proto delete mode 100644 nitric/proto/schedules/v1/schedules.proto delete mode 100644 nitric/proto/secrets/v1/secrets.proto delete mode 100644 nitric/proto/storage/v1/storage.proto delete mode 100644 nitric/proto/topics/v1/topics.proto delete mode 100644 nitric/proto/websockets/v1/websockets.proto rename src/Nitric.Sdk/Proto/{nitric/proto => }/apis/v1/Apis.cs (100%) rename src/Nitric.Sdk/Proto/{nitric/proto => }/apis/v1/ApisGrpc.cs (100%) rename src/Nitric.Sdk/Proto/{nitric/proto => }/deployments/v1/Deployments.cs (100%) rename src/Nitric.Sdk/Proto/{nitric/proto => }/deployments/v1/DeploymentsGrpc.cs (100%) rename src/Nitric.Sdk/Proto/{nitric/proto => }/http/v1/Http.cs (100%) rename src/Nitric.Sdk/Proto/{nitric/proto => }/http/v1/HttpGrpc.cs (100%) rename src/Nitric.Sdk/Proto/{nitric/proto => }/keyvalue/v1/Keyvalue.cs (100%) rename src/Nitric.Sdk/Proto/{nitric/proto => }/keyvalue/v1/KeyvalueGrpc.cs (100%) rename src/Nitric.Sdk/Proto/{nitric/proto => }/queues/v1/Queues.cs (100%) rename src/Nitric.Sdk/Proto/{nitric/proto => }/queues/v1/QueuesGrpc.cs (100%) rename src/Nitric.Sdk/Proto/{nitric/proto => }/resources/v1/Resources.cs (100%) rename src/Nitric.Sdk/Proto/{nitric/proto => }/resources/v1/ResourcesGrpc.cs (100%) rename src/Nitric.Sdk/Proto/{nitric/proto => }/schedules/v1/Schedules.cs (100%) rename src/Nitric.Sdk/Proto/{nitric/proto => }/schedules/v1/SchedulesGrpc.cs (100%) rename src/Nitric.Sdk/Proto/{nitric/proto => }/secrets/v1/Secrets.cs (100%) rename src/Nitric.Sdk/Proto/{nitric/proto => }/secrets/v1/SecretsGrpc.cs (100%) rename src/Nitric.Sdk/Proto/{nitric/proto => }/storage/v1/Storage.cs (100%) rename src/Nitric.Sdk/Proto/{nitric/proto => }/storage/v1/StorageGrpc.cs (100%) rename src/Nitric.Sdk/Proto/{nitric/proto => }/topics/v1/Topics.cs (100%) rename src/Nitric.Sdk/Proto/{nitric/proto => }/topics/v1/TopicsGrpc.cs (100%) rename src/Nitric.Sdk/Proto/{nitric/proto => }/websockets/v1/Websockets.cs (100%) rename src/Nitric.Sdk/Proto/{nitric/proto => }/websockets/v1/WebsocketsGrpc.cs (100%) diff --git a/makefile b/makefile index 5c0305d..4ace11e 100644 --- a/makefile +++ b/makefile @@ -9,6 +9,7 @@ test: build: @dotnet build src/Nitric.Sdk/Nitric.Sdk.csproj @mv src/Nitric.Sdk/Proto/nitric/proto/* src/Nitric.Sdk/Proto/ + @rm -rf nitric @rm -rf src/Nitric.Sdk/Proto/nitric clean: @@ -17,18 +18,9 @@ clean: @rm -rf src/Nitric.Sdk/Proto download: - @curl -L https://github.com/nitrictech/nitric/releases/download/v${NITRIC_VERSION}/proto.tgz -o contracts.tgz - @tar xvzf contracts.tgz - @rm contracts.tgz - -download-local: - @rm -rf ./nitric - @mkdir ./nitric - @cp -r ${NITRIC_CORE_HOME}/nitric/proto ./nitric - -# /Users/rs/Development/nitric - -# "rm -r ./nitric && mkdir ./nitric && cp -r $NITRIC_CORE_HOME/nitric/proto ./nitric", + @curl -L https://github.com/nitrictech/nitric/releases/download/v${NITRIC_VERSION}/proto.tgz -o nitric.tgz + @tar xvzf nitric.tgz + @rm nitric.tgz pack: clean download @dotnet build src/Nitric.Sdk/Nitric.Sdk.csproj -c Release diff --git a/nitric/proto/apis/v1/apis.proto b/nitric/proto/apis/v1/apis.proto deleted file mode 100644 index ba7f9a6..0000000 --- a/nitric/proto/apis/v1/apis.proto +++ /dev/null @@ -1,113 +0,0 @@ -syntax = "proto3"; -package nitric.proto.apis.v1; - -// protoc plugin options for code generation -option go_package = "github.com/nitrictech/nitric/core/pkg/proto/apis/v1;apispb"; -option java_package = "io.nitric.proto.apis.v1"; -option java_multiple_files = true; -option java_outer_classname = "Apis"; -option php_namespace = "Nitric\\Proto\\Apis\\V1"; -option csharp_namespace = "Nitric.Proto.Apis.v1"; - -// Service for API routing and handlers -service Api { - // Serve a route on an API - rpc Serve(stream ClientMessage) returns (stream ServerMessage); - - // Retrieve details about an API - rpc ApiDetails(ApiDetailsRequest) returns (ApiDetailsResponse); -} - -message ApiDetailsRequest { - string api_name = 1; -} - -message ApiDetailsResponse { - string url = 1; -} - -// ClientMessage sent by the service to the nitric server -message ClientMessage { - // globally unique ID of the request/response pair - string id = 1; - - oneof content { - // Register an API route handler - RegistrationRequest registration_request = 2; - - // Response to an HTTP request - HttpResponse http_response = 3; - } -} - -message HeaderValue { repeated string value = 1; } - -message QueryValue { repeated string value = 1; } - -message HttpRequest { - // The request method - string method = 1; - - // The path of the request - string path = 2; - - // HTTP request headers - map headers = 3; - - // HTTP Query params - map query_params = 4; - - // HTTP Path parameters - map path_params = 5; - - // HTTP Request body - bytes body = 6; -} - -// HttpResponseMessage -message HttpResponse { - // The HTTP response status code - int32 status = 1; - - // HTTP response headers - map headers = 2; - - // HTTP response body - bytes body = 3; -} - -// ServerMessage sent by the nitric server to the service -message ServerMessage { - // globally unique ID of the request/response pair - string id = 1; - - oneof content { - // Response to an API serve request - RegistrationResponse registration_response = 2; - - // HTTP request to be routed to the service (handler) - HttpRequest http_request = 3; - } -} - -message RegistrationResponse {} - -message ApiWorkerScopes { repeated string scopes = 1; } - -message ApiWorkerOptions { - // Apply security definitions to this operation - // This will be mapped to named ApiSecurityDefinitionResource(s) - map security = 1; - // explicitly disable security for this endpoint - // We need to do this as the default value of a repeated field - // is always empty so there is no way of knowing if security is explicitly - // disabled - bool security_disabled = 2; -} - -message RegistrationRequest { - string api = 1; - string path = 2; - repeated string methods = 3; - ApiWorkerOptions options = 4; -} diff --git a/nitric/proto/deployments/v1/deployments.proto b/nitric/proto/deployments/v1/deployments.proto deleted file mode 100644 index b7890b3..0000000 --- a/nitric/proto/deployments/v1/deployments.proto +++ /dev/null @@ -1,295 +0,0 @@ -syntax = "proto3"; -package nitric.proto.deployments.v1; - -//protoc plugin options for code generation -option go_package = "github.com/nitrictech/nitric/core/pkg/proto/deployments/v1;deploymentspb"; -option java_package = "io.nitric.proto.deployments.v1"; -option java_multiple_files = true; -option java_outer_classname = "Deployments"; -option php_namespace = "Nitric\\Proto\\Deployments\\V1"; -option csharp_namespace = "Nitric.Proto.Deployments.v1"; - -import "google/protobuf/struct.proto"; -import "nitric/proto/resources/v1/resources.proto"; -import "nitric/proto/storage/v1/storage.proto"; - -// The Nitric Deloyment Service contract -service Deployment { - // Begins a new deployment - // Server will stream updates back to the connected client - // on the status of the deployment - rpc Up (DeploymentUpRequest) returns (stream DeploymentUpEvent); - // Tears down an existing deployment - // Server will stream updates back to the connected client - // on the status of the teardown - rpc Down (DeploymentDownRequest) returns (stream DeploymentDownEvent); -} - -message DeploymentUpRequest { - // The spec to deploy - Spec spec = 1; - - // A map of attributes related to the deploy request - // this allows for adding project identifiers etc. - google.protobuf.Struct attributes = 2; - - // A hint to the provider of the kind of output that the client can accept - // This will allow provider developers to provider richer output back to clients. - bool interactive = 3; -} - -message DeploymentUpEvent { - oneof content { - string message = 1; - ResourceUpdate update = 2; - UpResult result = 3; - } -} - -enum ResourceDeploymentAction { - // A new resource is being created - CREATE = 0; - // An existing resource is being updated - UPDATE = 1; - // An existing resource is being replaced - REPLACE = 2; - // No-op on the resource (it already exists and requires no changes) - SAME = 3; - // An existing resource is being deleted - DELETE = 4; -} - -enum ResourceDeploymentStatus { - // The action hasn't started, usually due to a dependency - PENDING = 0; - // The action in currently in-flight, e.g. waiting for cloud provder to provision a resource - IN_PROGRESS = 1; - // The action has been applied successfully - SUCCESS = 2; - // The action has failed to be (completely) applied - FAILED = 3; -} - -message ResourceUpdate { - // The resource being updated, if this is nil the update applies to the stack - nitric.proto.resources.v1.ResourceIdentifier id = 1; - - // The type of update being applied - ResourceDeploymentAction action = 3; - - // The current status of the action being applied - ResourceDeploymentStatus status = 4; - - // (optional) A globally unique identifier (scoped to the id above), used when Nitric Resources map 1:many in a cloud provider. - // e.g. the container image repository for a service deployment. - // This can also be set when id is nil above and it will imply a non-nitric resource that is necessary to deploy for a stack to operate - // e.g. an Azure StorageAccount - string sub_resource = 5; - - // Additional information about the update - string message = 6; -} - -// Terminal message indicating deployment success -message UpResult { - // Indicate the success status - bool success = 1; - - - oneof content { - // Simple text output as result - string Text = 2; - } -} - -message DeploymentDownRequest { - // A map of attributes related to the deploy request - // this allows for adding project identifiers etc. - google.protobuf.Struct attributes = 1; - - // A hint to the provider of the kind of output that the client can accept - // This will allow provider developers to provider richer output back to clients. - bool interactive = 2; -} - -message DeploymentDownEvent { - oneof content { - string message = 1; - DownResult result = 2; - ResourceUpdate update = 3; - } -} - -// Terminal message indicating deployment success -message DownResult {} - -// An image source to be used for service deployment -message ImageSource { - // URI of the docker image - // To support remote images this may also need to provide auth information - string uri = 1; -} - -// A unit of compute (i.e. function/container) -message Service { - // Source of the service - oneof source { - // Container image as a service - ImageSource image = 1; - // Alternative sources could include - // - zipped code sources - // - git/scm repository URIs - - } - - // Expected worker count for this service - int32 workers = 10; - // Configurable timeout for request handling - int32 timeout = 11 [deprecated = true]; - // Configurable memory size for this instance - int32 memory = 12 [deprecated = true]; - - // A simple type property - // describes the requested type of service that this should be - // for this project, a provider can implement how this request is satisfied - // in any way - string type = 13; - - // Environment variables for this service - map env = 14; -} - -message Bucket { - repeated BucketListener listeners = 1; -} - -message BucketListener { - nitric.proto.storage.v1.RegistrationRequest config = 1; - oneof target { - // The name of an service to target - string service = 2; - } -} - - -message Topic { - repeated SubscriptionTarget subscriptions = 1; -} - -message Queue {} - -message KeyValueStore {} - -message Secret {} - -message SubscriptionTarget { - oneof target { - // The name of an service to target - string service = 1; - // Additional targets could potentially include - // - HTTP/API Endpoints - // - Queues - } -} - -message TopicSubscription { - SubscriptionTarget target = 1; -} - -message HttpTarget { - oneof target { - // The name of an service to target - string service = 1; - } -} - -// An http proxy resource -message Http { - HttpTarget target = 1; -} - -message Api { - oneof document { - // An OpenAPI document for deployment - // This document will contain extensions that hint of services that should be targeted as part of the deployment - string openapi = 1; - } -} - -// Declare a new websocket -message Websocket { - // Target for handling new client connections - WebsocketTarget connect_target = 1; - // Target for handling client disconnections - WebsocketTarget disconnect_target = 2; - // Target for handling all other message types - WebsocketTarget message_target = 3; -} - -message WebsocketTarget { - oneof target { - // The name of an service to target - string service = 1; - // Additional targets could potentially include - // - HTTP/API Endpoints - } -} - -message ScheduleTarget { - oneof target { - // The name of an service to target - string service = 1; - // Additional targets could potentially include - // - HTTP/API Endpoints - } -} - -message Schedule { - ScheduleTarget target = 1; - - oneof cadence { - ScheduleEvery every = 10; - ScheduleCron cron = 11; - } -} - -message ScheduleEvery { - // rate string e.g. '5 minutes'. Value frequencies are 'minutes', 'hours', 'days'. - string rate = 1; -} - -message ScheduleCron { - // standard unix cron expression - string expression = 1; -} - -message Resource { - nitric.proto.resources.v1.ResourceIdentifier id = 1; - - oneof config { - Service service = 10; - Bucket bucket = 11; - Topic topic = 12; - Api api = 13; - Policy policy = 14; - Schedule schedule = 15; - KeyValueStore key_value_store = 16; - Secret secret = 17; - Websocket websocket = 18; - Http http = 19; - Queue queue = 20; - } -} - -// This is already defined in the resource contracts, -// unfortunately there are parts we don't want to duplicate, such as API config -message Policy { - repeated Resource principals = 1; - repeated nitric.proto.resources.v1.Action actions = 2; - repeated Resource resources = 3; -} - -message Spec { - // list of resources to deploy - repeated Resource resources = 1; -} diff --git a/nitric/proto/http/v1/http.proto b/nitric/proto/http/v1/http.proto deleted file mode 100644 index 72c060b..0000000 --- a/nitric/proto/http/v1/http.proto +++ /dev/null @@ -1,29 +0,0 @@ -syntax = "proto3"; -package nitric.proto.http.v1; - -// protoc plugin options for code generation -option go_package = "github.com/nitrictech/nitric/core/pkg/proto/http/v1;httppb"; -option java_package = "io.nitric.proto.http.v1"; -option java_multiple_files = true; -option java_outer_classname = "Https"; -option php_namespace = "Nitric\\Proto\\Http\\V1"; -option csharp_namespace = "Nitric.Proto.Http.v1"; - -// Service for proxying HTTP requests -service Http { - // Proxy an HTTP server - rpc Proxy(stream ClientMessage) returns (stream ServerMessage); -} - -message ClientMessage { - // Details of the HTTP server to proxy - HttpProxyRequest request = 1; -} - -message ServerMessage {} - -message HttpProxyRequest { - // The address the server can be accessed on - string host = 1; -} - diff --git a/nitric/proto/keyvalue/v1/keyvalue.proto b/nitric/proto/keyvalue/v1/keyvalue.proto deleted file mode 100644 index 1ef0e29..0000000 --- a/nitric/proto/keyvalue/v1/keyvalue.proto +++ /dev/null @@ -1,75 +0,0 @@ -syntax = "proto3"; -package nitric.proto.KeyValue.v1; - -import "google/protobuf/struct.proto"; - -// protoc plugin options for code generation -// option go_package = "nitric/v1;v1"; -option go_package = "github.com/nitrictech/nitric/core/pkg/proto/keyvalue/v1;KeyValuepb"; -option java_package = "io.nitric.proto.keyvalue.v1"; -option java_multiple_files = true; -option java_outer_classname = "KeyValue"; -option php_namespace = "Nitric\\Proto\\KeyValue\\V1"; -option csharp_namespace = "Nitric.Proto.KeyValue.v1"; - -// Service for storage and retrieval of simple JSON keyValue -service KeyValue { - // Get an existing value - rpc Get (KeyValueGetRequest) returns (KeyValueGetResponse); - - // Create a new or overwrite an existing value - rpc Set (KeyValueSetRequest) returns (KeyValueSetResponse); - - // Delete a key and its value - rpc Delete (KeyValueDeleteRequest) returns (KeyValueDeleteResponse); -} - -// Provides a Key/Value Store -message Store { - // The store name - string name = 1; -} - -// ValueRef provides a unique identifier for a value -message ValueRef { - // The key/value store name - string store = 1; - - // The item's unique key within the store - string key = 2; -} - -// Value provides a return value type -message Value { - // ValueRef of the key/value pair, which includes the store and key - ValueRef ref = 1; - - // The content (JSON object) - google.protobuf.Struct content = 2; -} - -message KeyValueGetRequest { - // ValueRef of the key/value pair to get, which includes the store and key - ValueRef ref = 1; -} - -message KeyValueGetResponse { - // The retrieved value - Value value = 1; -} - -message KeyValueSetRequest { - // ValueRef of the key/value pair to set, which includes the store and key - ValueRef ref = 1 ; - // The value content to store (JSON object) - google.protobuf.Struct content = 3; -} - -message KeyValueSetResponse {} - -message KeyValueDeleteRequest { - // ValueRef of the key/value pair to delete, which includes the store and key - ValueRef ref = 1; -} - -message KeyValueDeleteResponse {} diff --git a/nitric/proto/queues/v1/queues.proto b/nitric/proto/queues/v1/queues.proto deleted file mode 100644 index bcc146c..0000000 --- a/nitric/proto/queues/v1/queues.proto +++ /dev/null @@ -1,81 +0,0 @@ -syntax = "proto3"; -package nitric.proto.queues.v1; - -import "google/protobuf/struct.proto"; - -// protoc plugin options for code generation -option go_package = "github.com/nitrictech/nitric/core/pkg/proto/queues/v1;queuespb"; -option java_package = "io.nitric.proto.queues.v1"; -option java_multiple_files = true; -option java_outer_classname = "QueuesService"; -option php_namespace = "Nitric\\Proto\\Queues\\V1"; -option csharp_namespace = "Nitric.Proto.Queues.v1"; - -// The Nitric Queue Service contract -service Queues { - // Send message(s) to a queue - rpc Enqueue (QueueEnqueueRequest) returns (QueueEnqueueResponse); - // Receive message(s) from a queue - rpc Dequeue (QueueDequeueRequest) returns (QueueDequeueResponse); - // Complete an message previously popped from a queue - rpc Complete (QueueCompleteRequest) returns (QueueCompleteResponse); -} - -message QueueEnqueueRequest { - // The Nitric name for the queue - // this will automatically be resolved to the provider specific queue identifier. - string queue_name = 1; - // Array of messages to push to the queue - repeated QueueMessage messages = 2; -} - -// Response for sending messages to a queue -message QueueEnqueueResponse { - // A list of messages that failed to be queued - repeated FailedEnqueueMessage failed_messages = 1; -} - -message QueueDequeueRequest { - // The nitric name for the queue - // this will automatically be resolved to the provider specific queue identifier. - string queue_name = 1; - // The max number of messages to pop off the queue, may be capped by provider specific limitations - int32 depth = 2; -} - -message QueueDequeueResponse { - // Array of messages popped off the queue - repeated DequeuedMessage messages = 1; -} - -message QueueCompleteRequest { - // The nitric name for the queue - // this will automatically be resolved to the provider specific queue identifier. - string queue_name = 1; - - // Lease id of the message to be completed - string lease_id = 2; -} - -message QueueCompleteResponse {} - -// An message to be sent to a queue. -message QueueMessage { - // The queue message contents - oneof content { - google.protobuf.Struct struct_payload = 1; - } -} - -message DequeuedMessage { - string lease_id = 1; - - QueueMessage message = 2; -} - -message FailedEnqueueMessage { - // The message that failed to be pushed - QueueMessage message = 1; - // A description of the failure - string details = 2; -} diff --git a/nitric/proto/resources/v1/resources.proto b/nitric/proto/resources/v1/resources.proto deleted file mode 100644 index 79bbb14..0000000 --- a/nitric/proto/resources/v1/resources.proto +++ /dev/null @@ -1,121 +0,0 @@ -syntax = "proto3"; -package nitric.proto.resources.v1; - -//protoc plugin options for code generation -option go_package = "github.com/nitrictech/nitric/core/pkg/proto/resources/v1;resourcespb"; -option java_package = "io.nitric.proto.resources.v1"; -option java_multiple_files = true; -option java_outer_classname = "Resources"; -option php_namespace = "Nitric\\Proto\\Resources\\V1"; -option csharp_namespace = "Nitric.Proto.Resources.v1"; - -// Nitric Resource Service -// The service definition exists to allow a nitric application to declare peripheral dependencies -service Resources { - // Declare a resource for the nitric application - // At Deploy time this will create resources as part of the nitric stacks dependency graph - // At runtime - rpc Declare (ResourceDeclareRequest) returns (ResourceDeclareResponse); -} - -message PolicyResource { - repeated ResourceIdentifier principals = 1; - repeated Action actions = 2; - repeated ResourceIdentifier resources = 3; -} - -enum ResourceType { - Api = 0; - Service = 1; - Bucket = 2; - Topic = 3; - Schedule = 4; - Subscription = 5; - KeyValueStore = 6; - Policy = 7; - Secret = 8; - BucketListener = 9; - Websocket = 10; - Http = 11; - ApiSecurityDefinition = 12; - Queue = 13; -} - -// Unique identifier for a resource within a nitric application. -message ResourceIdentifier { - ResourceType type = 1; - string name = 2; -} - -message ResourceDeclareRequest { - ResourceIdentifier id = 1; - - oneof config { - PolicyResource policy = 10; - BucketResource bucket = 11; - TopicResource topic = 12; - KeyValueStoreResource key_value_store = 13; - SecretResource secret = 14; - ApiResource api = 15; - ApiSecurityDefinitionResource api_security_definition = 16; - QueueResource queue = 17; - } -} - -message BucketResource {} -message TopicResource {} -message QueueResource {} -message KeyValueStoreResource {} -message SecretResource {} - -message ApiOpenIdConnectionDefinition { - string issuer = 1; - repeated string audiences = 2; -} - -message ApiSecurityDefinitionResource { - string api_name = 1; - - oneof definition { - ApiOpenIdConnectionDefinition oidc = 2; - } -} - -message ApiScopes { - repeated string scopes = 1; -} - -message ApiResource { - // root level security map for this api - // references ApiSecurityDefinitionResource(s) - map security = 1; -} - -enum Action { - // Bucket Permissions: 0XX - BucketFileList = 0; - BucketFileGet = 1; - BucketFilePut = 2; - BucketFileDelete = 3; - - // Topic Permissions: 2XX - TopicPublish = 200; - - // KeyValue Store Permissions: 3XX - KeyValueStoreRead = 300; - KeyValueStoreWrite = 301; - KeyValueStoreDelete = 302; - - // Secret Permissions: 4XX - SecretPut = 400; - SecretAccess = 401; - - // Websocket Permissions: 5XX - WebsocketManage = 500; - - // Queue Permissions: 6XX - QueueEnqueue = 600; - QueueDequeue = 601; -} - -message ResourceDeclareResponse {} diff --git a/nitric/proto/schedules/v1/schedules.proto b/nitric/proto/schedules/v1/schedules.proto deleted file mode 100644 index 83d4f59..0000000 --- a/nitric/proto/schedules/v1/schedules.proto +++ /dev/null @@ -1,67 +0,0 @@ -syntax = "proto3"; -package nitric.proto.schedules.v1; - -// protoc plugin options for code generation -option go_package = "github.com/nitrictech/nitric/core/pkg/proto/schedules/v1;schedulespb"; -option java_package = "io.nitric.proto.schedules.v1"; -option java_multiple_files = true; -option java_outer_classname = "SchedulesService"; -option php_namespace = "Nitric\\Proto\\Schedules\\V1"; -option csharp_namespace = "Nitric.Proto.Schedules.v1"; - -// Service for scheduling callbacks on a cadence -service Schedules { - rpc Schedule(stream ClientMessage) returns (stream ServerMessage); -} - -// ClientMessages are sent from the service to the nitric server -message ClientMessage { - // globally unique ID of the request/response pair - string id = 1; - - oneof content { - // Register new a schedule - RegistrationRequest registration_request = 2; - - // Response to a schedule interval (i.e. response from callback function) - IntervalResponse interval_response = 3; - } -} - -message IntervalRequest { - string schedule_name = 1; -} - -// ServerMessages are sent from the nitric server to the service -message ServerMessage { - // globally unique ID of the request/response pair - string id = 1; - - oneof content { - // Response to a schedule subscription request - RegistrationResponse registration_response = 2; - - // A schedule interval trigger request (i.e. call the callback) - IntervalRequest interval_request = 3; - } -} - -message RegistrationRequest { - string schedule_name = 1; - oneof cadence { - ScheduleEvery every = 10; - ScheduleCron cron = 11; - } -} - -message ScheduleEvery { - string rate = 1; -} - -message ScheduleCron { - string expression = 1; -} - -message RegistrationResponse {} - -message IntervalResponse {} diff --git a/nitric/proto/secrets/v1/secrets.proto b/nitric/proto/secrets/v1/secrets.proto deleted file mode 100644 index 7d64e8c..0000000 --- a/nitric/proto/secrets/v1/secrets.proto +++ /dev/null @@ -1,60 +0,0 @@ -syntax = "proto3"; -package nitric.proto.secrets.v1; - -//protoc plugin options for code generation -option go_package = "github.com/nitrictech/nitric/core/pkg/proto/secrets/v1;secretspb"; -option java_package = "io.nitric.proto.secrets.v1"; -option java_multiple_files = true; -option java_outer_classname = "SecretsService"; -option php_namespace = "Nitric\\Proto\\Secrets\\V1"; -option csharp_namespace = "Nitric.Proto.Secrets.v1"; - -// The Nitric Secret Service -service SecretManager { - // Updates a secret, creating a new one if it doesn't already exist - rpc Put (SecretPutRequest) returns (SecretPutResponse); - // Gets a secret from a Secret Store - rpc Access (SecretAccessRequest) returns (SecretAccessResponse); -} - -// Request to put a secret to a Secret Store -message SecretPutRequest { - // The Secret to put to the Secret store - Secret secret = 1; - // The value to assign to that secret - bytes value = 2; -} - -// Result from putting the secret to a Secret Store -message SecretPutResponse { - // The id of the secret - SecretVersion secret_version = 1; -} - -// Request to get a secret from a Secret Store -message SecretAccessRequest { - // The id of the secret - SecretVersion secret_version = 1; -} - -// The secret response -message SecretAccessResponse { - // The version of the secret that was requested - SecretVersion secret_version = 1; - // The value of the secret - bytes value = 2; -} - -// The secret container -message Secret { - // The secret name - string name = 1; -} - -// A version of a secret -message SecretVersion { - // Reference to the secret container - Secret secret = 1; - // The secret version - string version = 2; -} \ No newline at end of file diff --git a/nitric/proto/storage/v1/storage.proto b/nitric/proto/storage/v1/storage.proto deleted file mode 100644 index ae89900..0000000 --- a/nitric/proto/storage/v1/storage.proto +++ /dev/null @@ -1,189 +0,0 @@ -syntax = "proto3"; -package nitric.proto.storage.v1; - -// protoc plugin options for code generation -option go_package = "github.com/nitrictech/nitric/core/pkg/proto/storage/v1;storagepb"; -option java_package = "io.nitric.proto.storage.v1"; -option java_multiple_files = true; -option java_outer_classname = "StorageService"; -option php_namespace = "Nitric\\Proto\\Storage\\V1"; -option csharp_namespace = "Nitric.Proto.Storage.v1"; - -import "google/protobuf/duration.proto"; - -// Services for storage and retrieval of blobs in the form of byte arrays, such as text and binary blobs. -service Storage { - // Retrieve an item from a bucket - rpc Read (StorageReadRequest) returns (StorageReadResponse); - // Store an item to a bucket - rpc Write (StorageWriteRequest) returns (StorageWriteResponse); - // Delete an item from a bucket - rpc Delete (StorageDeleteRequest) returns (StorageDeleteResponse); - // Generate a pre-signed URL for direct operations on an item - rpc PreSignUrl (StoragePreSignUrlRequest) returns (StoragePreSignUrlResponse); - // List blobs currently in the bucket - rpc ListBlobs (StorageListBlobsRequest) returns (StorageListBlobsResponse); - // Determine is an object exists in a bucket - rpc Exists (StorageExistsRequest) returns (StorageExistsResponse); -} - -service StorageListener { - // Listen for changes on a bucket - rpc Listen (stream ClientMessage) returns (stream ServerMessage); -} - -// ClientMessages are sent from the service to the nitric server -message ClientMessage { - // globally unique ID of the request/response pair - string id = 1; - - oneof content { - // Watch for changes on a bucket - RegistrationRequest registration_request = 2; - // Response to a blob event (change to a blob) - BlobEventResponse blob_event_response = 3; - } -} - -// ServerMessages are sent from the nitric server to the service -message ServerMessage { - // globally unique ID of the request/response pair - string id = 1; - - oneof content { - // Watch for changes on a bucket - RegistrationResponse registration_response = 2; - // Event for a blob in a bucket - BlobEventRequest blob_event_request = 3; - } -} - -message BlobEventRequest { - string bucket_name = 1; - - oneof event { - BlobEvent blob_event = 10; - } -} - -message BlobEvent { - // The key of the blob the event is for - string key = 1; - - // The type of event that occurred - BlobEventType type = 2; -} - - -message BlobEventResponse { - bool success = 1; -} - -enum BlobEventType { - Created = 0; - Deleted = 1; -} - -message RegistrationRequest { - // Name of the bucket to watch - string bucket_name = 1; - - // Event type to listen for - BlobEventType blob_event_type = 2; - - // A blob key prefix to filter events by - string key_prefix_filter = 3; -} - -message RegistrationResponse { - // The ID of the registration - string id = 1; -} - -// Request to put (create/update) a storage item -message StorageWriteRequest { - // Nitric name of the bucket to store in - // this will be automatically resolved to the provider specific bucket identifier. - string bucket_name = 1; - // Key to store the item under - string key = 2; - // bytes array to store - bytes body = 3; -} - -// Result of putting a storage item -message StorageWriteResponse {} - -// Request to retrieve a storage item -message StorageReadRequest { - // Nitric name of the bucket to retrieve from - // this will be automatically resolved to the provider specific bucket identifier. - string bucket_name = 1; - // Key of item to retrieve - string key = 2; -} - -// Returned storage item -message StorageReadResponse { - // The body bytes of the retrieved storage item - bytes body = 1; -} - -// Request to delete a storage item -message StorageDeleteRequest { - // Name of the bucket to delete from - string bucket_name = 1; - // Key of item to delete - string key = 2; -} - -// Result of deleting a storage item -message StorageDeleteResponse {} - -// Request to generate a pre-signed URL for a blob to perform a specific operation, such as read or write. -message StoragePreSignUrlRequest { - // Nitric name of the bucket to retrieve from - // this will be automatically resolved to the provider specific bucket identifier. - string bucket_name = 1; - // Key of item to generate the signed URL for. - // The URL and the token it contains will only be valid for operations on this resource specifically. - string key = 2; - // Operation - enum Operation { - READ = 0; - WRITE = 1; - } - Operation operation = 3; - // Expiry defined as as protobuf duration - google.protobuf.Duration expiry = 4; -} - -message StoragePreSignUrlResponse { - // The pre-signed url, restricted to the operation, resource and expiry time specified in the request. - string url = 1; -} - -message StorageListBlobsRequest { - string bucket_name = 1; - - string prefix = 2; -} - -message Blob { - string key = 1; -} - -message StorageListBlobsResponse { - // keys of the blobs in the bucket - repeated Blob blobs = 1; -} - -message StorageExistsRequest { - string bucket_name = 1; - // Key of item to retrieve - string key = 2; -} - -message StorageExistsResponse { - bool exists = 1; -} \ No newline at end of file diff --git a/nitric/proto/topics/v1/topics.proto b/nitric/proto/topics/v1/topics.proto deleted file mode 100644 index 690a526..0000000 --- a/nitric/proto/topics/v1/topics.proto +++ /dev/null @@ -1,92 +0,0 @@ -syntax = "proto3"; -package nitric.proto.topics.v1; - -import "google/protobuf/struct.proto"; -import "google/protobuf/duration.proto"; - -// protoc plugin options for code generation -option go_package = "github.com/nitrictech/nitric/core/pkg/proto/topics/v1;topicspb"; -option java_package = "io.nitric.proto.topics.v1"; -option java_multiple_files = true; -option java_outer_classname = "TopicsService"; -option php_namespace = "Nitric\\Proto\\Topics\\V1"; -option csharp_namespace = "Nitric.Proto.Topics.v1"; - -// Service for publishing asynchronous messages -service Topics { - // Publishes a message to a given topic - rpc Publish (TopicPublishRequest) returns (TopicPublishResponse); -} - -// Service for subscribing to asynchronous messages -service Subscriber { - // Subscribe to a topic and handle incoming messages - rpc Subscribe (stream ClientMessage) returns (stream ServerMessage); -} - -// ClientMessage is the message sent from the service to the nitric server -message ClientMessage { - // globally unique ID of the request/response pair - string id = 1; - - oneof content { - // Register a subscription to a topic - RegistrationRequest registration_request = 2; - - // Handle a message received from a topic - MessageResponse message_response = 3; - } -} - -message MessageRequest { - string topic_name = 1; - - // Message Type - TopicMessage message = 2; -} - -message MessageResponse { - bool success = 1; -} - -// ServerMessage is the message sent from the nitric server to the service -message ServerMessage { - // globally unique ID of the request/response pair - string id = 1; - - oneof content { - // Response to a topic subscription request - RegistrationResponse registration_response = 2; - - // Response to a topic message request - MessageRequest message_request = 3; - } -} - -message RegistrationRequest { - string topic_name = 1; -} - -message RegistrationResponse {} - -message TopicMessage { - // The topic message contents - oneof content { - google.protobuf.Struct struct_payload = 1; - } -} - -// Request to publish a message to a topic -message TopicPublishRequest { - // The name of the topic to publish the topic to - string topic_name = 1; - - // The message to be published - TopicMessage message = 2; - - // An optional delay specified in seconds (minimum 10 seconds) - google.protobuf.Duration delay = 3; -} - -// Result of publishing an topic -message TopicPublishResponse {} diff --git a/nitric/proto/websockets/v1/websockets.proto b/nitric/proto/websockets/v1/websockets.proto deleted file mode 100644 index bf54715..0000000 --- a/nitric/proto/websockets/v1/websockets.proto +++ /dev/null @@ -1,147 +0,0 @@ -syntax = "proto3"; -package nitric.proto.websockets.v1; - -// protoc plugin options for code generation -option go_package = "github.com/nitrictech/nitric/core/pkg/proto/websockets/v1;websocketspb"; -option java_package = "io.nitric.proto.websockets.v1"; -option java_multiple_files = true; -option java_outer_classname = "WebsocketsService"; -option php_namespace = "Nitric\\Proto\\Websockets\\V1"; -option csharp_namespace = "Nitric.Proto.Websockets.v1"; - -service Websocket { - // Send a messages to a websocket - rpc SendMessage(WebsocketSendRequest) returns (WebsocketSendResponse); - - // Close a websocket connection - // This can be used to force a client to disconnect - rpc CloseConnection(WebsocketCloseConnectionRequest) returns (WebsocketCloseConnectionResponse); - - // Retrieve details about an API - rpc SocketDetails(WebsocketDetailsRequest) returns (WebsocketDetailsResponse); -} - -message WebsocketDetailsRequest { - string socket_name = 1; -} - -message WebsocketDetailsResponse { - string url = 1; -} - -service WebsocketHandler { - // Handle incoming websocket events - rpc HandleEvents (stream ClientMessage) returns (stream ServerMessage); -} - -message WebsocketSendRequest { - // The nitric name of the socket to send on - string socket_name = 1; - // The connection ID of the client to send to - string connection_id = 2; - // The data to send to the socket - bytes data = 3; -} - -message WebsocketSendResponse {} - -message WebsocketCloseConnectionRequest { - // The nitric name of the socket to send on - string socket_name = 1; - // The connection ID of the client to send to - string connection_id = 2; -} - -message WebsocketCloseConnectionResponse {} - - -// ClientMessages are sent from the service to the nitric server -message ClientMessage { - // Globally unique id to pair requests/responses - string id = 1; - - oneof content { - // Client initialisation request - // A worker will not be eligible for triggers - // until it has identified itself - RegistrationRequest registration_request = 2; - - // Client responding with result of a trigger - WebsocketEventResponse websocket_event_response = 3; - } -} - -enum WebsocketEventType { - // Specialised Event for handling new client connections - Connect = 0; - // Specialised Event for handling existing client connections - Disconnect = 1; - // All other types of events are messages - Message = 2; -} - -// Placeholder message -message RegistrationResponse {} - -message RegistrationRequest { - // The nitric name of the socket that this worker listens on - string socket_name = 1; - // The type of event that this worker handles - WebsocketEventType event_type = 2; -} - -message WebsocketEventRequest { - // The nitric name of the socket that this worker listens on - string socket_name = 1; - - // The connection this trigger came from - string connectionId = 2; - - oneof websocket_event { - WebsocketConnectionEvent connection = 10; - WebsocketDisconnectionEvent disconnection = 11; - WebsocketMessageEvent message = 12; - } -} - -message QueryValue { repeated string value = 1; } - -// ServerMessages are sent from the nitric server to the service -message ServerMessage { - // Server message ID, used to pair requests/responses - string id = 1; - - oneof content { - // Server responding - // with client configuration details to an - // InitRequest - RegistrationResponse registration_response = 2; - - // Server requesting client to process an event - WebsocketEventRequest websocket_event_request = 3; - } -} - -message WebsocketEventResponse { - oneof websocket_response { - WebsocketConnectionResponse connection_response = 10; - // WebsocketDisconnectionResponse disconnection_response = 11; - // WebsocketMessageEventResponse message_response = 12; - } -} - -message WebsocketConnectionEvent { - // The query params available in the connection request - map query_params = 1; -} - -message WebsocketConnectionResponse { - bool reject = 1; -} - -message WebsocketDisconnectionEvent {} - -message WebsocketMessageEvent { - // Data available on - bytes body = 1; -} diff --git a/src/Nitric.Sdk/Common/Struct.cs b/src/Nitric.Sdk/Common/Struct.cs index 3c6779c..56a7a5e 100644 --- a/src/Nitric.Sdk/Common/Struct.cs +++ b/src/Nitric.Sdk/Common/Struct.cs @@ -1,10 +1,20 @@ -using System; -using System.Collections.Generic; +// Copyright 2021, Nitric Technologies Pty Ltd. +// +// 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. + using Google.Protobuf; using Newtonsoft.Json; -using KindOneofCase = Google.Protobuf.WellKnownTypes.Value.KindOneofCase; using ProtoStruct = Google.Protobuf.WellKnownTypes.Struct; -using ProtoValue = Google.Protobuf.WellKnownTypes.Value; namespace Nitric.Sdk.Common { diff --git a/src/Nitric.Sdk/KeyValueStore/KeyValueStore.cs b/src/Nitric.Sdk/KeyValueStore/KeyValueStore.cs index 1f19a9e..3045dd8 100644 --- a/src/Nitric.Sdk/KeyValueStore/KeyValueStore.cs +++ b/src/Nitric.Sdk/KeyValueStore/KeyValueStore.cs @@ -1,4 +1,18 @@ -using System.Threading.Tasks; +// Copyright 2021, Nitric Technologies Pty Ltd. +// +// 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. + +using System.Threading.Tasks; using Nitric.Proto.KeyValue.v1; using Nitric.Sdk.Common; diff --git a/src/Nitric.Sdk/KeyValueStore/KeyValueStoreClient.cs b/src/Nitric.Sdk/KeyValueStore/KeyValueStoreClient.cs index 2e1d678..2f10b26 100644 --- a/src/Nitric.Sdk/KeyValueStore/KeyValueStoreClient.cs +++ b/src/Nitric.Sdk/KeyValueStore/KeyValueStoreClient.cs @@ -1,3 +1,17 @@ +// Copyright 2021, Nitric Technologies Pty Ltd. +// +// 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. + using System; using Nitric.Sdk.Common; using GrpcClient = Nitric.Proto.KeyValue.v1.KeyValue.KeyValueClient; diff --git a/src/Nitric.Sdk/Proto/nitric/proto/apis/v1/Apis.cs b/src/Nitric.Sdk/Proto/apis/v1/Apis.cs similarity index 100% rename from src/Nitric.Sdk/Proto/nitric/proto/apis/v1/Apis.cs rename to src/Nitric.Sdk/Proto/apis/v1/Apis.cs diff --git a/src/Nitric.Sdk/Proto/nitric/proto/apis/v1/ApisGrpc.cs b/src/Nitric.Sdk/Proto/apis/v1/ApisGrpc.cs similarity index 100% rename from src/Nitric.Sdk/Proto/nitric/proto/apis/v1/ApisGrpc.cs rename to src/Nitric.Sdk/Proto/apis/v1/ApisGrpc.cs diff --git a/src/Nitric.Sdk/Proto/nitric/proto/deployments/v1/Deployments.cs b/src/Nitric.Sdk/Proto/deployments/v1/Deployments.cs similarity index 100% rename from src/Nitric.Sdk/Proto/nitric/proto/deployments/v1/Deployments.cs rename to src/Nitric.Sdk/Proto/deployments/v1/Deployments.cs diff --git a/src/Nitric.Sdk/Proto/nitric/proto/deployments/v1/DeploymentsGrpc.cs b/src/Nitric.Sdk/Proto/deployments/v1/DeploymentsGrpc.cs similarity index 100% rename from src/Nitric.Sdk/Proto/nitric/proto/deployments/v1/DeploymentsGrpc.cs rename to src/Nitric.Sdk/Proto/deployments/v1/DeploymentsGrpc.cs diff --git a/src/Nitric.Sdk/Proto/nitric/proto/http/v1/Http.cs b/src/Nitric.Sdk/Proto/http/v1/Http.cs similarity index 100% rename from src/Nitric.Sdk/Proto/nitric/proto/http/v1/Http.cs rename to src/Nitric.Sdk/Proto/http/v1/Http.cs diff --git a/src/Nitric.Sdk/Proto/nitric/proto/http/v1/HttpGrpc.cs b/src/Nitric.Sdk/Proto/http/v1/HttpGrpc.cs similarity index 100% rename from src/Nitric.Sdk/Proto/nitric/proto/http/v1/HttpGrpc.cs rename to src/Nitric.Sdk/Proto/http/v1/HttpGrpc.cs diff --git a/src/Nitric.Sdk/Proto/nitric/proto/keyvalue/v1/Keyvalue.cs b/src/Nitric.Sdk/Proto/keyvalue/v1/Keyvalue.cs similarity index 100% rename from src/Nitric.Sdk/Proto/nitric/proto/keyvalue/v1/Keyvalue.cs rename to src/Nitric.Sdk/Proto/keyvalue/v1/Keyvalue.cs diff --git a/src/Nitric.Sdk/Proto/nitric/proto/keyvalue/v1/KeyvalueGrpc.cs b/src/Nitric.Sdk/Proto/keyvalue/v1/KeyvalueGrpc.cs similarity index 100% rename from src/Nitric.Sdk/Proto/nitric/proto/keyvalue/v1/KeyvalueGrpc.cs rename to src/Nitric.Sdk/Proto/keyvalue/v1/KeyvalueGrpc.cs diff --git a/src/Nitric.Sdk/Proto/nitric/proto/queues/v1/Queues.cs b/src/Nitric.Sdk/Proto/queues/v1/Queues.cs similarity index 100% rename from src/Nitric.Sdk/Proto/nitric/proto/queues/v1/Queues.cs rename to src/Nitric.Sdk/Proto/queues/v1/Queues.cs diff --git a/src/Nitric.Sdk/Proto/nitric/proto/queues/v1/QueuesGrpc.cs b/src/Nitric.Sdk/Proto/queues/v1/QueuesGrpc.cs similarity index 100% rename from src/Nitric.Sdk/Proto/nitric/proto/queues/v1/QueuesGrpc.cs rename to src/Nitric.Sdk/Proto/queues/v1/QueuesGrpc.cs diff --git a/src/Nitric.Sdk/Proto/nitric/proto/resources/v1/Resources.cs b/src/Nitric.Sdk/Proto/resources/v1/Resources.cs similarity index 100% rename from src/Nitric.Sdk/Proto/nitric/proto/resources/v1/Resources.cs rename to src/Nitric.Sdk/Proto/resources/v1/Resources.cs diff --git a/src/Nitric.Sdk/Proto/nitric/proto/resources/v1/ResourcesGrpc.cs b/src/Nitric.Sdk/Proto/resources/v1/ResourcesGrpc.cs similarity index 100% rename from src/Nitric.Sdk/Proto/nitric/proto/resources/v1/ResourcesGrpc.cs rename to src/Nitric.Sdk/Proto/resources/v1/ResourcesGrpc.cs diff --git a/src/Nitric.Sdk/Proto/nitric/proto/schedules/v1/Schedules.cs b/src/Nitric.Sdk/Proto/schedules/v1/Schedules.cs similarity index 100% rename from src/Nitric.Sdk/Proto/nitric/proto/schedules/v1/Schedules.cs rename to src/Nitric.Sdk/Proto/schedules/v1/Schedules.cs diff --git a/src/Nitric.Sdk/Proto/nitric/proto/schedules/v1/SchedulesGrpc.cs b/src/Nitric.Sdk/Proto/schedules/v1/SchedulesGrpc.cs similarity index 100% rename from src/Nitric.Sdk/Proto/nitric/proto/schedules/v1/SchedulesGrpc.cs rename to src/Nitric.Sdk/Proto/schedules/v1/SchedulesGrpc.cs diff --git a/src/Nitric.Sdk/Proto/nitric/proto/secrets/v1/Secrets.cs b/src/Nitric.Sdk/Proto/secrets/v1/Secrets.cs similarity index 100% rename from src/Nitric.Sdk/Proto/nitric/proto/secrets/v1/Secrets.cs rename to src/Nitric.Sdk/Proto/secrets/v1/Secrets.cs diff --git a/src/Nitric.Sdk/Proto/nitric/proto/secrets/v1/SecretsGrpc.cs b/src/Nitric.Sdk/Proto/secrets/v1/SecretsGrpc.cs similarity index 100% rename from src/Nitric.Sdk/Proto/nitric/proto/secrets/v1/SecretsGrpc.cs rename to src/Nitric.Sdk/Proto/secrets/v1/SecretsGrpc.cs diff --git a/src/Nitric.Sdk/Proto/nitric/proto/storage/v1/Storage.cs b/src/Nitric.Sdk/Proto/storage/v1/Storage.cs similarity index 100% rename from src/Nitric.Sdk/Proto/nitric/proto/storage/v1/Storage.cs rename to src/Nitric.Sdk/Proto/storage/v1/Storage.cs diff --git a/src/Nitric.Sdk/Proto/nitric/proto/storage/v1/StorageGrpc.cs b/src/Nitric.Sdk/Proto/storage/v1/StorageGrpc.cs similarity index 100% rename from src/Nitric.Sdk/Proto/nitric/proto/storage/v1/StorageGrpc.cs rename to src/Nitric.Sdk/Proto/storage/v1/StorageGrpc.cs diff --git a/src/Nitric.Sdk/Proto/nitric/proto/topics/v1/Topics.cs b/src/Nitric.Sdk/Proto/topics/v1/Topics.cs similarity index 100% rename from src/Nitric.Sdk/Proto/nitric/proto/topics/v1/Topics.cs rename to src/Nitric.Sdk/Proto/topics/v1/Topics.cs diff --git a/src/Nitric.Sdk/Proto/nitric/proto/topics/v1/TopicsGrpc.cs b/src/Nitric.Sdk/Proto/topics/v1/TopicsGrpc.cs similarity index 100% rename from src/Nitric.Sdk/Proto/nitric/proto/topics/v1/TopicsGrpc.cs rename to src/Nitric.Sdk/Proto/topics/v1/TopicsGrpc.cs diff --git a/src/Nitric.Sdk/Proto/nitric/proto/websockets/v1/Websockets.cs b/src/Nitric.Sdk/Proto/websockets/v1/Websockets.cs similarity index 100% rename from src/Nitric.Sdk/Proto/nitric/proto/websockets/v1/Websockets.cs rename to src/Nitric.Sdk/Proto/websockets/v1/Websockets.cs diff --git a/src/Nitric.Sdk/Proto/nitric/proto/websockets/v1/WebsocketsGrpc.cs b/src/Nitric.Sdk/Proto/websockets/v1/WebsocketsGrpc.cs similarity index 100% rename from src/Nitric.Sdk/Proto/nitric/proto/websockets/v1/WebsocketsGrpc.cs rename to src/Nitric.Sdk/Proto/websockets/v1/WebsocketsGrpc.cs diff --git a/src/Nitric.Sdk/Worker/ApiWorker.cs b/src/Nitric.Sdk/Worker/ApiWorker.cs index 3580b02..46b6d15 100644 --- a/src/Nitric.Sdk/Worker/ApiWorker.cs +++ b/src/Nitric.Sdk/Worker/ApiWorker.cs @@ -1,3 +1,17 @@ +// Copyright 2021, Nitric Technologies Pty Ltd. +// +// 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. + using System.Threading; using System.Threading.Tasks; using Nitric.Sdk.Common; diff --git a/src/Nitric.Sdk/Worker/BlobEventWorker.cs b/src/Nitric.Sdk/Worker/BlobEventWorker.cs index a77d2bb..f958db0 100644 --- a/src/Nitric.Sdk/Worker/BlobEventWorker.cs +++ b/src/Nitric.Sdk/Worker/BlobEventWorker.cs @@ -1,3 +1,17 @@ +// Copyright 2021, Nitric Technologies Pty Ltd. +// +// 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. + using System.Threading; using System.Threading.Tasks; using Nitric.Sdk.Common; diff --git a/src/Nitric.Sdk/Worker/ScheduleWorker.cs b/src/Nitric.Sdk/Worker/ScheduleWorker.cs index f1a0635..59f7340 100644 --- a/src/Nitric.Sdk/Worker/ScheduleWorker.cs +++ b/src/Nitric.Sdk/Worker/ScheduleWorker.cs @@ -1,3 +1,17 @@ +// Copyright 2021, Nitric Technologies Pty Ltd. +// +// 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. + using System.Threading; using System.Threading.Tasks; using Nitric.Sdk.Common; diff --git a/src/Nitric.Sdk/Worker/SubscriptionWorker.cs b/src/Nitric.Sdk/Worker/SubscriptionWorker.cs index 6553487..2b99897 100644 --- a/src/Nitric.Sdk/Worker/SubscriptionWorker.cs +++ b/src/Nitric.Sdk/Worker/SubscriptionWorker.cs @@ -1,3 +1,17 @@ +// Copyright 2021, Nitric Technologies Pty Ltd. +// +// 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. + using System.Threading; using System.Threading.Tasks; using Nitric.Sdk.Common; diff --git a/src/Nitric.Sdk/Worker/WebsocketWorker.cs b/src/Nitric.Sdk/Worker/WebsocketWorker.cs index c887dba..2372882 100644 --- a/src/Nitric.Sdk/Worker/WebsocketWorker.cs +++ b/src/Nitric.Sdk/Worker/WebsocketWorker.cs @@ -1,3 +1,17 @@ +// Copyright 2021, Nitric Technologies Pty Ltd. +// +// 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. + using System.Threading; using System.Threading.Tasks; using Nitric.Sdk.Common; diff --git a/src/Nitric.Sdk/Worker/Worker.cs b/src/Nitric.Sdk/Worker/Worker.cs index cd785db..57fe7fa 100644 --- a/src/Nitric.Sdk/Worker/Worker.cs +++ b/src/Nitric.Sdk/Worker/Worker.cs @@ -1,3 +1,17 @@ +// Copyright 2021, Nitric Technologies Pty Ltd. +// +// 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. + using System; using System.Threading.Tasks; using System.Collections.Generic; From d44609d6e52a653fb76d58e44243ffb7b6c67e84 Mon Sep 17 00:00:00 2001 From: Ryan Cartwright Date: Wed, 28 Feb 2024 14:33:34 +1100 Subject: [PATCH 13/34] update websocket tests --- test/Nitric.Sdk.Test/Api/Websocket/WebsocketTest.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/Nitric.Sdk.Test/Api/Websocket/WebsocketTest.cs b/test/Nitric.Sdk.Test/Api/Websocket/WebsocketTest.cs index a32e5d4..f2d5516 100644 --- a/test/Nitric.Sdk.Test/Api/Websocket/WebsocketTest.cs +++ b/test/Nitric.Sdk.Test/Api/Websocket/WebsocketTest.cs @@ -29,7 +29,7 @@ public void TestBuildWebsocketsWithNullClient() [Fact] public void TestBuildWebsocketWithIdAndSocket() { - var connection = Nitric.Websocket("socket-name").Connection("connection-id"); + var connection = new WebsocketClient(null).Connection("socket-name", "connection-id"); Assert.NotNull(connection); Assert.Equal("connection-id", connection.Id); Assert.Equal("socket-name", connection.SocketName); From bb241158d4341dabd8accd38ec1a1367974b8c17 Mon Sep 17 00:00:00 2001 From: Ryan Cartwright Date: Wed, 20 Mar 2024 09:50:55 +1100 Subject: [PATCH 14/34] wip improve testing --- .gitignore | 3 +- makefile | 10 +- src/Nitric.Sdk/Common/Exceptions.cs | 2 +- src/Nitric.Sdk/KeyValueStore/KeyValueStore.cs | 86 +- .../KeyValueStore/KeyValueStoreClient.cs | 4 +- src/Nitric.Sdk/Nitric.cs | 4 +- .../Proto/deployments/v1/Deployments.cs | 4 +- src/Nitric.Sdk/Proto/kvstore/v1/Kvstore.cs | 2167 +++++++++++++++++ .../Proto/kvstore/v1/KvstoreGrpc.cs | 351 +++ src/Nitric.Sdk/Proto/topics/v1/Topics.cs | 6 +- .../Proto/websockets/v1/Websockets.cs | 84 +- src/Nitric.Sdk/Queue/{Task.cs => Message.cs} | 25 +- src/Nitric.Sdk/Resource/BucketResource.cs | 2 +- .../Resource/KeyValueStoreResource.cs | 5 +- src/Nitric.Sdk/Resource/QueueResource.cs | 2 +- src/Nitric.Sdk/Resource/SecretResource.cs | 2 +- src/Nitric.Sdk/Resource/TopicResource.cs | 2 +- src/Nitric.Sdk/Secret/Secret.cs | 10 - src/Nitric.Sdk/Secret/SecretVersion.cs | 10 - src/Nitric.Sdk/Service/BlobEventContext.cs | 1 - src/Nitric.Sdk/Service/FileEventContext.cs | 132 + src/Nitric.Sdk/Storage/Bucket.cs | 71 +- src/Nitric.Sdk/Storage/File.cs | 93 +- src/Nitric.Sdk/Worker/ApiWorker.cs | 2 +- src/Nitric.Sdk/Worker/FileEventWorker.cs | 80 + .../KeyValueStore/KeyValueStoreClientTest.cs | 176 -- .../Api/Queue/QueueClientTest.cs | 256 -- .../Api/Storage/StorageClientTest.cs | 191 -- .../Api/Websocket/WebsocketTest.cs | 141 -- test/Nitric.Sdk.Test/Common/ExceptionsTest.cs | 186 ++ .../KeyValueStore/KeyValueStoreClientTest.cs | 731 ++++++ test/Nitric.Sdk.Test/Nitric.Sdk.Test.csproj | 27 +- .../{Api => }/Queue/FailedTaskTest.cs | 2 +- test/Nitric.Sdk.Test/Queue/QueueClientTest.cs | 627 +++++ .../{Api => }/Queue/TaskTest.cs | 2 +- .../{Api => }/Secret/SecretTest.cs | 235 +- .../Storage/StorageClientTest.cs | 1058 ++++++++ .../{Api => }/Topics/TopicsClientTest.cs | 51 +- .../Websocket/WebsocketTest.cs | 236 ++ 39 files changed, 6116 insertions(+), 961 deletions(-) create mode 100644 src/Nitric.Sdk/Proto/kvstore/v1/Kvstore.cs create mode 100644 src/Nitric.Sdk/Proto/kvstore/v1/KvstoreGrpc.cs rename src/Nitric.Sdk/Queue/{Task.cs => Message.cs} (80%) create mode 100644 src/Nitric.Sdk/Service/FileEventContext.cs create mode 100644 src/Nitric.Sdk/Worker/FileEventWorker.cs delete mode 100644 test/Nitric.Sdk.Test/Api/KeyValueStore/KeyValueStoreClientTest.cs delete mode 100644 test/Nitric.Sdk.Test/Api/Queue/QueueClientTest.cs delete mode 100644 test/Nitric.Sdk.Test/Api/Storage/StorageClientTest.cs delete mode 100644 test/Nitric.Sdk.Test/Api/Websocket/WebsocketTest.cs create mode 100644 test/Nitric.Sdk.Test/Common/ExceptionsTest.cs create mode 100644 test/Nitric.Sdk.Test/KeyValueStore/KeyValueStoreClientTest.cs rename test/Nitric.Sdk.Test/{Api => }/Queue/FailedTaskTest.cs (97%) create mode 100644 test/Nitric.Sdk.Test/Queue/QueueClientTest.cs rename test/Nitric.Sdk.Test/{Api => }/Queue/TaskTest.cs (98%) rename test/Nitric.Sdk.Test/{Api => }/Secret/SecretTest.cs (60%) create mode 100644 test/Nitric.Sdk.Test/Storage/StorageClientTest.cs rename test/Nitric.Sdk.Test/{Api => }/Topics/TopicsClientTest.cs (62%) create mode 100644 test/Nitric.Sdk.Test/Websocket/WebsocketTest.cs diff --git a/.gitignore b/.gitignore index 1dac2f4..2d99d8a 100644 --- a/.gitignore +++ b/.gitignore @@ -330,4 +330,5 @@ ASALocalRun/ **/obj/ **/bin/ .idea -.vs \ No newline at end of file +.vs +dotCover.* \ No newline at end of file diff --git a/makefile b/makefile index 4ace11e..c41a57e 100644 --- a/makefile +++ b/makefile @@ -1,5 +1,5 @@ # the version of of https://github.com/nitrictech/nitric to use in base client generation. -NITRIC_VERSION := 1.0.0 +NITRIC_VERSION := 1.1.1 generate: clean download build @@ -25,4 +25,10 @@ download: pack: clean download @dotnet build src/Nitric.Sdk/Nitric.Sdk.csproj -c Release @mkdir -p __out - @dotnet pack -c Release -o __out \ No newline at end of file + @dotnet pack -c Release -o __out + +coverage: + @echo "Using dotcover tool... Install using: 'dotnet tool install --global JetBrains.dotCover.GlobalTool'" + @rm -f coverage.xml dotCover.Output.html + @dotnet dotcover test --dcReportType=HTML --dcFilters="+:Nitric.Sdk;-:type=Nitric.Proto.*" + @open dotCover.Output.html \ No newline at end of file diff --git a/src/Nitric.Sdk/Common/Exceptions.cs b/src/Nitric.Sdk/Common/Exceptions.cs index 59a6c47..f462026 100644 --- a/src/Nitric.Sdk/Common/Exceptions.cs +++ b/src/Nitric.Sdk/Common/Exceptions.cs @@ -48,7 +48,7 @@ public NitricException(string message) : base(message) { } - internal static NitricException FromRpcException(RpcException exception) + public static NitricException FromRpcException(RpcException exception) { return Exceptions.ContainsKey(exception.StatusCode) ? Exceptions[exception.StatusCode](exception.Message) diff --git a/src/Nitric.Sdk/KeyValueStore/KeyValueStore.cs b/src/Nitric.Sdk/KeyValueStore/KeyValueStore.cs index 3045dd8..f822904 100644 --- a/src/Nitric.Sdk/KeyValueStore/KeyValueStore.cs +++ b/src/Nitric.Sdk/KeyValueStore/KeyValueStore.cs @@ -12,8 +12,9 @@ // See the License for the specific language governing permissions and // limitations under the License. +using System.Threading; using System.Threading.Tasks; -using Nitric.Proto.KeyValue.v1; +using Nitric.Proto.KvStore.v1; using Nitric.Sdk.Common; namespace Nitric.Sdk.KeyValueStore @@ -36,7 +37,7 @@ public KeyValueStore(KeyValueStoreClient client, string name) /// The value that was referenced by the key. public T Get(string key) { - var request = new KeyValueGetRequest + var request = new KvStoreGetValueRequest { Ref = new ValueRef { @@ -47,7 +48,7 @@ public T Get(string key) try { - var resp = KeyValueClient.Client.Get(request); + var resp = KeyValueClient.Client.GetValue(request); return Struct.ToJsonSerializable(resp.Value.Content); } @@ -64,7 +65,7 @@ public T Get(string key) /// The value that was referenced by the key. public async Task GetAsync(string key) { - var request = new KeyValueGetRequest + var request = new KvStoreGetValueRequest { Ref = new ValueRef { @@ -75,7 +76,7 @@ public async Task GetAsync(string key) try { - var resp = await KeyValueClient.Client.GetAsync(request); + var resp = await KeyValueClient.Client.GetValueAsync(request); return Struct.ToJsonSerializable(resp.Value.Content); } @@ -92,7 +93,7 @@ public async Task GetAsync(string key) /// The value to store. public void Set(string key, T value) { - var request = new KeyValueSetRequest + var request = new KvStoreSetValueRequest { Content = Struct.FromJsonSerializable(value), Ref = new ValueRef @@ -104,7 +105,7 @@ public void Set(string key, T value) try { - KeyValueClient.Client.Set(request); + KeyValueClient.Client.SetValue(request); } catch (Grpc.Core.RpcException re) { @@ -119,7 +120,7 @@ public void Set(string key, T value) /// The value to store. public async Task SetAsync(string key, T value) { - var request = new KeyValueSetRequest + var request = new KvStoreSetValueRequest { Content = Struct.FromJsonSerializable(value), Ref = new ValueRef @@ -131,7 +132,7 @@ public async Task SetAsync(string key, T value) try { - await KeyValueClient.Client.SetAsync(request); + await KeyValueClient.Client.SetValueAsync(request); } catch (Grpc.Core.RpcException re) { @@ -145,7 +146,7 @@ public async Task SetAsync(string key, T value) /// The unique key that references the value. public void Delete(string key) { - var request = new KeyValueDeleteRequest + var request = new KvStoreDeleteKeyRequest { Ref = new ValueRef { @@ -156,7 +157,7 @@ public void Delete(string key) try { - KeyValueClient.Client.Delete(request); + KeyValueClient.Client.DeleteKey(request); } catch (Grpc.Core.RpcException re) { @@ -170,7 +171,7 @@ public void Delete(string key) /// The unique key that references the value. public async Task DeleteAsync(string key) { - var request = new KeyValueDeleteRequest + var request = new KvStoreDeleteKeyRequest { Ref = new ValueRef { @@ -181,13 +182,72 @@ public async Task DeleteAsync(string key) try { - await KeyValueClient.Client.DeleteAsync(request); + await KeyValueClient.Client.DeleteKeyAsync(request); } catch (Grpc.Core.RpcException re) { throw NitricException.FromRpcException(re); } } + + public KeyValueKeysResponseStream Keys(string prefix = "") + { + var request = new KvStoreScanKeysRequest + { + Prefix = prefix, + Store = new Store + { + Name = this.Name, + }, + }; + + try + { + var resp = KeyValueClient.Client.ScanKeys(request); + + return new KeyValueKeysResponseStream(resp.ResponseStream); + + } + catch (Grpc.Core.RpcException re) + { + throw NitricException.FromRpcException(re); + } + } + } + + public class KeyValueKeysResponseStream + { + private Grpc.Core.IAsyncStreamReader stream; + + internal KeyValueKeysResponseStream(Grpc.Core.IAsyncStreamReader stream) + { + this.stream = stream; + } + + /// + /// Advances the reader to the next element in the sequence, returning the result asynchronously + /// + /// Task containing the result of the operation: true if the reader was successfully advanced to the next element; false if the reader has passed the end of the sequence. + public Task MoveNext() + { + return stream.MoveNext(CancellationToken.None); + } + + /// + /// Advances the reader to the next element in the sequence, returning the result asynchronously + /// + /// Cancellation token that can be used to cancel the operation. + /// Task containing the result of the operation: true if the reader was successfully advanced to the next element; false if the reader has passed the end of the sequence. + public Task MoveNext(CancellationToken cancellationToken) + { + return stream.MoveNext(cancellationToken); + } + + + /// + /// Gets the current key in the iteration. + /// + public string Current { get => stream.Current.Key; } } } diff --git a/src/Nitric.Sdk/KeyValueStore/KeyValueStoreClient.cs b/src/Nitric.Sdk/KeyValueStore/KeyValueStoreClient.cs index 2f10b26..3647373 100644 --- a/src/Nitric.Sdk/KeyValueStore/KeyValueStoreClient.cs +++ b/src/Nitric.Sdk/KeyValueStore/KeyValueStoreClient.cs @@ -14,7 +14,7 @@ using System; using Nitric.Sdk.Common; -using GrpcClient = Nitric.Proto.KeyValue.v1.KeyValue.KeyValueClient; +using GrpcClient = Nitric.Proto.KvStore.v1.KvStore.KvStoreClient; namespace Nitric.Sdk.KeyValueStore { @@ -38,7 +38,7 @@ public KeyValueStoreClient(GrpcClient client = null) /// The expected type for values in the key value store. /// The collection reference. /// - public KeyValueStore Store(string name) + public KeyValueStore KV(string name) { if (string.IsNullOrEmpty(name)) { diff --git a/src/Nitric.Sdk/Nitric.cs b/src/Nitric.Sdk/Nitric.cs index 5e778e6..6825b41 100644 --- a/src/Nitric.Sdk/Nitric.cs +++ b/src/Nitric.Sdk/Nitric.cs @@ -34,7 +34,7 @@ internal static void RegisterWorker(IWorker worker) { if (worker == null) { - throw new ArgumentNullException("Cannot register a null worker."); + throw new ArgumentNullException(nameof(worker)); } Workers.Add(worker); @@ -100,7 +100,7 @@ private static T Cached(string name, Func make) where T : BaseReso /// The unique name of the key value store within this application. /// The type of values to be stored. /// A key value resource, if the name has already been declared the same resource will be returned. - public static KeyValueStoreResource KeyValue(string name) => + public static KeyValueStoreResource KV(string name) => Cached(name, t => new KeyValueStoreResource(t)); /// diff --git a/src/Nitric.Sdk/Proto/deployments/v1/Deployments.cs b/src/Nitric.Sdk/Proto/deployments/v1/Deployments.cs index caaa8ca..2977214 100644 --- a/src/Nitric.Sdk/Proto/deployments/v1/Deployments.cs +++ b/src/Nitric.Sdk/Proto/deployments/v1/Deployments.cs @@ -41,7 +41,7 @@ static DeploymentsReflection() { "Y2VEZXBsb3ltZW50QWN0aW9uEkUKBnN0YXR1cxgEIAEoDjI1Lm5pdHJpYy5w", "cm90by5kZXBsb3ltZW50cy52MS5SZXNvdXJjZURlcGxveW1lbnRTdGF0dXMS", "FAoMc3ViX3Jlc291cmNlGAUgASgJEg8KB21lc3NhZ2UYBiABKAkiNgoIVXBS", - "ZXN1bHQSDwoHc3VjY2VzcxgBIAEoCBIOCgRUZXh0GAIgASgJSABCCQoHY29u", + "ZXN1bHQSDwoHc3VjY2VzcxgBIAEoCBIOCgR0ZXh0GAIgASgJSABCCQoHY29u", "dGVudCJZChVEZXBsb3ltZW50RG93blJlcXVlc3QSKwoKYXR0cmlidXRlcxgB", "IAEoCzIXLmdvb2dsZS5wcm90b2J1Zi5TdHJ1Y3QSEwoLaW50ZXJhY3RpdmUY", "AiABKAgirQEKE0RlcGxveW1lbnREb3duRXZlbnQSEQoHbWVzc2FnZRgBIAEo", @@ -1180,7 +1180,7 @@ public bool Success { } } - /// Field number for the "Text" field. + /// Field number for the "text" field. public const int TextFieldNumber = 2; /// /// Simple text output as result diff --git a/src/Nitric.Sdk/Proto/kvstore/v1/Kvstore.cs b/src/Nitric.Sdk/Proto/kvstore/v1/Kvstore.cs new file mode 100644 index 0000000..de182a4 --- /dev/null +++ b/src/Nitric.Sdk/Proto/kvstore/v1/Kvstore.cs @@ -0,0 +1,2167 @@ +// +// Generated by the protocol buffer compiler. DO NOT EDIT! +// source: nitric/proto/kvstore/v1/kvstore.proto +// +#pragma warning disable 1591, 0612, 3021 +#region Designer generated code + +using pb = global::Google.Protobuf; +using pbc = global::Google.Protobuf.Collections; +using pbr = global::Google.Protobuf.Reflection; +using scg = global::System.Collections.Generic; +namespace Nitric.Proto.KvStore.v1 { + + /// Holder for reflection information generated from nitric/proto/kvstore/v1/kvstore.proto + public static partial class KvstoreReflection { + + #region Descriptor + /// File descriptor for nitric/proto/kvstore/v1/kvstore.proto + public static pbr::FileDescriptor Descriptor { + get { return descriptor; } + } + private static pbr::FileDescriptor descriptor; + + static KvstoreReflection() { + byte[] descriptorData = global::System.Convert.FromBase64String( + string.Concat( + "CiVuaXRyaWMvcHJvdG8va3ZzdG9yZS92MS9rdnN0b3JlLnByb3RvEhduaXRy", + "aWMucHJvdG8ua3ZzdG9yZS52MRocZ29vZ2xlL3Byb3RvYnVmL3N0cnVjdC5w", + "cm90byIVCgVTdG9yZRIMCgRuYW1lGAEgASgJIiYKCFZhbHVlUmVmEg0KBXN0", + "b3JlGAEgASgJEgsKA2tleRgCIAEoCSJhCgVWYWx1ZRIuCgNyZWYYASABKAsy", + "IS5uaXRyaWMucHJvdG8ua3ZzdG9yZS52MS5WYWx1ZVJlZhIoCgdjb250ZW50", + "GAIgASgLMhcuZ29vZ2xlLnByb3RvYnVmLlN0cnVjdCJIChZLdlN0b3JlR2V0", + "VmFsdWVSZXF1ZXN0Ei4KA3JlZhgBIAEoCzIhLm5pdHJpYy5wcm90by5rdnN0", + "b3JlLnYxLlZhbHVlUmVmIkgKF0t2U3RvcmVHZXRWYWx1ZVJlc3BvbnNlEi0K", + "BXZhbHVlGAEgASgLMh4ubml0cmljLnByb3RvLmt2c3RvcmUudjEuVmFsdWUi", + "cgoWS3ZTdG9yZVNldFZhbHVlUmVxdWVzdBIuCgNyZWYYASABKAsyIS5uaXRy", + "aWMucHJvdG8ua3ZzdG9yZS52MS5WYWx1ZVJlZhIoCgdjb250ZW50GAMgASgL", + "MhcuZ29vZ2xlLnByb3RvYnVmLlN0cnVjdCIZChdLdlN0b3JlU2V0VmFsdWVS", + "ZXNwb25zZSJJChdLdlN0b3JlRGVsZXRlS2V5UmVxdWVzdBIuCgNyZWYYASAB", + "KAsyIS5uaXRyaWMucHJvdG8ua3ZzdG9yZS52MS5WYWx1ZVJlZiIaChhLdlN0", + "b3JlRGVsZXRlS2V5UmVzcG9uc2UiVwoWS3ZTdG9yZVNjYW5LZXlzUmVxdWVz", + "dBItCgVzdG9yZRgBIAEoCzIeLm5pdHJpYy5wcm90by5rdnN0b3JlLnYxLlN0", + "b3JlEg4KBnByZWZpeBgCIAEoCSImChdLdlN0b3JlU2NhbktleXNSZXNwb25z", + "ZRILCgNrZXkYASABKAkyygMKB0t2U3RvcmUSbQoIR2V0VmFsdWUSLy5uaXRy", + "aWMucHJvdG8ua3ZzdG9yZS52MS5LdlN0b3JlR2V0VmFsdWVSZXF1ZXN0GjAu", + "bml0cmljLnByb3RvLmt2c3RvcmUudjEuS3ZTdG9yZUdldFZhbHVlUmVzcG9u", + "c2USbQoIU2V0VmFsdWUSLy5uaXRyaWMucHJvdG8ua3ZzdG9yZS52MS5LdlN0", + "b3JlU2V0VmFsdWVSZXF1ZXN0GjAubml0cmljLnByb3RvLmt2c3RvcmUudjEu", + "S3ZTdG9yZVNldFZhbHVlUmVzcG9uc2UScAoJRGVsZXRlS2V5EjAubml0cmlj", + "LnByb3RvLmt2c3RvcmUudjEuS3ZTdG9yZURlbGV0ZUtleVJlcXVlc3QaMS5u", + "aXRyaWMucHJvdG8ua3ZzdG9yZS52MS5LdlN0b3JlRGVsZXRlS2V5UmVzcG9u", + "c2USbwoIU2NhbktleXMSLy5uaXRyaWMucHJvdG8ua3ZzdG9yZS52MS5LdlN0", + "b3JlU2NhbktleXNSZXF1ZXN0GjAubml0cmljLnByb3RvLmt2c3RvcmUudjEu", + "S3ZTdG9yZVNjYW5LZXlzUmVzcG9uc2UwAUKdAQoaaW8ubml0cmljLnByb3Rv", + "Lmt2c3RvcmUudjFCB0t2U3RvcmVQAVpAZ2l0aHViLmNvbS9uaXRyaWN0ZWNo", + "L25pdHJpYy9jb3JlL3BrZy9wcm90by9rdnN0b3JlL3YxO2t2c3RvcmVwYqoC", + "F05pdHJpYy5Qcm90by5LdlN0b3JlLnYxygIXTml0cmljXFByb3RvXEt2U3Rv", + "cmVcVjFiBnByb3RvMw==")); + descriptor = pbr::FileDescriptor.FromGeneratedCode(descriptorData, + new pbr::FileDescriptor[] { global::Google.Protobuf.WellKnownTypes.StructReflection.Descriptor, }, + new pbr::GeneratedClrTypeInfo(null, null, new pbr::GeneratedClrTypeInfo[] { + new pbr::GeneratedClrTypeInfo(typeof(global::Nitric.Proto.KvStore.v1.Store), global::Nitric.Proto.KvStore.v1.Store.Parser, new[]{ "Name" }, null, null, null, null), + new pbr::GeneratedClrTypeInfo(typeof(global::Nitric.Proto.KvStore.v1.ValueRef), global::Nitric.Proto.KvStore.v1.ValueRef.Parser, new[]{ "Store", "Key" }, null, null, null, null), + new pbr::GeneratedClrTypeInfo(typeof(global::Nitric.Proto.KvStore.v1.Value), global::Nitric.Proto.KvStore.v1.Value.Parser, new[]{ "Ref", "Content" }, null, null, null, null), + new pbr::GeneratedClrTypeInfo(typeof(global::Nitric.Proto.KvStore.v1.KvStoreGetValueRequest), global::Nitric.Proto.KvStore.v1.KvStoreGetValueRequest.Parser, new[]{ "Ref" }, null, null, null, null), + new pbr::GeneratedClrTypeInfo(typeof(global::Nitric.Proto.KvStore.v1.KvStoreGetValueResponse), global::Nitric.Proto.KvStore.v1.KvStoreGetValueResponse.Parser, new[]{ "Value" }, null, null, null, null), + new pbr::GeneratedClrTypeInfo(typeof(global::Nitric.Proto.KvStore.v1.KvStoreSetValueRequest), global::Nitric.Proto.KvStore.v1.KvStoreSetValueRequest.Parser, new[]{ "Ref", "Content" }, null, null, null, null), + new pbr::GeneratedClrTypeInfo(typeof(global::Nitric.Proto.KvStore.v1.KvStoreSetValueResponse), global::Nitric.Proto.KvStore.v1.KvStoreSetValueResponse.Parser, null, null, null, null, null), + new pbr::GeneratedClrTypeInfo(typeof(global::Nitric.Proto.KvStore.v1.KvStoreDeleteKeyRequest), global::Nitric.Proto.KvStore.v1.KvStoreDeleteKeyRequest.Parser, new[]{ "Ref" }, null, null, null, null), + new pbr::GeneratedClrTypeInfo(typeof(global::Nitric.Proto.KvStore.v1.KvStoreDeleteKeyResponse), global::Nitric.Proto.KvStore.v1.KvStoreDeleteKeyResponse.Parser, null, null, null, null, null), + new pbr::GeneratedClrTypeInfo(typeof(global::Nitric.Proto.KvStore.v1.KvStoreScanKeysRequest), global::Nitric.Proto.KvStore.v1.KvStoreScanKeysRequest.Parser, new[]{ "Store", "Prefix" }, null, null, null, null), + new pbr::GeneratedClrTypeInfo(typeof(global::Nitric.Proto.KvStore.v1.KvStoreScanKeysResponse), global::Nitric.Proto.KvStore.v1.KvStoreScanKeysResponse.Parser, new[]{ "Key" }, null, null, null, null) + })); + } + #endregion + + } + #region Messages + /// + /// Provides a Key/Value Store + /// + public sealed partial class Store : pb::IMessage + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + , pb::IBufferMessage + #endif + { + private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new Store()); + private pb::UnknownFieldSet _unknownFields; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public static pb::MessageParser Parser { get { return _parser; } } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public static pbr::MessageDescriptor Descriptor { + get { return global::Nitric.Proto.KvStore.v1.KvstoreReflection.Descriptor.MessageTypes[0]; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + pbr::MessageDescriptor pb::IMessage.Descriptor { + get { return Descriptor; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public Store() { + OnConstruction(); + } + + partial void OnConstruction(); + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public Store(Store other) : this() { + name_ = other.name_; + _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public Store Clone() { + return new Store(this); + } + + /// Field number for the "name" field. + public const int NameFieldNumber = 1; + private string name_ = ""; + /// + /// The store name + /// + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public string Name { + get { return name_; } + set { + name_ = pb::ProtoPreconditions.CheckNotNull(value, "value"); + } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public override bool Equals(object other) { + return Equals(other as Store); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public bool Equals(Store other) { + if (ReferenceEquals(other, null)) { + return false; + } + if (ReferenceEquals(other, this)) { + return true; + } + if (Name != other.Name) return false; + return Equals(_unknownFields, other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public override int GetHashCode() { + int hash = 1; + if (Name.Length != 0) hash ^= Name.GetHashCode(); + if (_unknownFields != null) { + hash ^= _unknownFields.GetHashCode(); + } + return hash; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public override string ToString() { + return pb::JsonFormatter.ToDiagnosticString(this); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public void WriteTo(pb::CodedOutputStream output) { + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + output.WriteRawMessage(this); + #else + if (Name.Length != 0) { + output.WriteRawTag(10); + output.WriteString(Name); + } + if (_unknownFields != null) { + _unknownFields.WriteTo(output); + } + #endif + } + + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + void pb::IBufferMessage.InternalWriteTo(ref pb::WriteContext output) { + if (Name.Length != 0) { + output.WriteRawTag(10); + output.WriteString(Name); + } + if (_unknownFields != null) { + _unknownFields.WriteTo(ref output); + } + } + #endif + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public int CalculateSize() { + int size = 0; + if (Name.Length != 0) { + size += 1 + pb::CodedOutputStream.ComputeStringSize(Name); + } + if (_unknownFields != null) { + size += _unknownFields.CalculateSize(); + } + return size; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public void MergeFrom(Store other) { + if (other == null) { + return; + } + if (other.Name.Length != 0) { + Name = other.Name; + } + _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public void MergeFrom(pb::CodedInputStream input) { + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + input.ReadRawMessage(this); + #else + uint tag; + while ((tag = input.ReadTag()) != 0) { + switch(tag) { + default: + _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input); + break; + case 10: { + Name = input.ReadString(); + break; + } + } + } + #endif + } + + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + void pb::IBufferMessage.InternalMergeFrom(ref pb::ParseContext input) { + uint tag; + while ((tag = input.ReadTag()) != 0) { + switch(tag) { + default: + _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, ref input); + break; + case 10: { + Name = input.ReadString(); + break; + } + } + } + } + #endif + + } + + /// + /// ValueRef provides a unique identifier for a value + /// + public sealed partial class ValueRef : pb::IMessage + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + , pb::IBufferMessage + #endif + { + private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new ValueRef()); + private pb::UnknownFieldSet _unknownFields; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public static pb::MessageParser Parser { get { return _parser; } } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public static pbr::MessageDescriptor Descriptor { + get { return global::Nitric.Proto.KvStore.v1.KvstoreReflection.Descriptor.MessageTypes[1]; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + pbr::MessageDescriptor pb::IMessage.Descriptor { + get { return Descriptor; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public ValueRef() { + OnConstruction(); + } + + partial void OnConstruction(); + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public ValueRef(ValueRef other) : this() { + store_ = other.store_; + key_ = other.key_; + _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public ValueRef Clone() { + return new ValueRef(this); + } + + /// Field number for the "store" field. + public const int StoreFieldNumber = 1; + private string store_ = ""; + /// + /// The key/value store name + /// + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public string Store { + get { return store_; } + set { + store_ = pb::ProtoPreconditions.CheckNotNull(value, "value"); + } + } + + /// Field number for the "key" field. + public const int KeyFieldNumber = 2; + private string key_ = ""; + /// + /// The item's unique key within the store + /// + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public string Key { + get { return key_; } + set { + key_ = pb::ProtoPreconditions.CheckNotNull(value, "value"); + } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public override bool Equals(object other) { + return Equals(other as ValueRef); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public bool Equals(ValueRef other) { + if (ReferenceEquals(other, null)) { + return false; + } + if (ReferenceEquals(other, this)) { + return true; + } + if (Store != other.Store) return false; + if (Key != other.Key) return false; + return Equals(_unknownFields, other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public override int GetHashCode() { + int hash = 1; + if (Store.Length != 0) hash ^= Store.GetHashCode(); + if (Key.Length != 0) hash ^= Key.GetHashCode(); + if (_unknownFields != null) { + hash ^= _unknownFields.GetHashCode(); + } + return hash; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public override string ToString() { + return pb::JsonFormatter.ToDiagnosticString(this); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public void WriteTo(pb::CodedOutputStream output) { + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + output.WriteRawMessage(this); + #else + if (Store.Length != 0) { + output.WriteRawTag(10); + output.WriteString(Store); + } + if (Key.Length != 0) { + output.WriteRawTag(18); + output.WriteString(Key); + } + if (_unknownFields != null) { + _unknownFields.WriteTo(output); + } + #endif + } + + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + void pb::IBufferMessage.InternalWriteTo(ref pb::WriteContext output) { + if (Store.Length != 0) { + output.WriteRawTag(10); + output.WriteString(Store); + } + if (Key.Length != 0) { + output.WriteRawTag(18); + output.WriteString(Key); + } + if (_unknownFields != null) { + _unknownFields.WriteTo(ref output); + } + } + #endif + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public int CalculateSize() { + int size = 0; + if (Store.Length != 0) { + size += 1 + pb::CodedOutputStream.ComputeStringSize(Store); + } + if (Key.Length != 0) { + size += 1 + pb::CodedOutputStream.ComputeStringSize(Key); + } + if (_unknownFields != null) { + size += _unknownFields.CalculateSize(); + } + return size; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public void MergeFrom(ValueRef other) { + if (other == null) { + return; + } + if (other.Store.Length != 0) { + Store = other.Store; + } + if (other.Key.Length != 0) { + Key = other.Key; + } + _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public void MergeFrom(pb::CodedInputStream input) { + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + input.ReadRawMessage(this); + #else + uint tag; + while ((tag = input.ReadTag()) != 0) { + switch(tag) { + default: + _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input); + break; + case 10: { + Store = input.ReadString(); + break; + } + case 18: { + Key = input.ReadString(); + break; + } + } + } + #endif + } + + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + void pb::IBufferMessage.InternalMergeFrom(ref pb::ParseContext input) { + uint tag; + while ((tag = input.ReadTag()) != 0) { + switch(tag) { + default: + _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, ref input); + break; + case 10: { + Store = input.ReadString(); + break; + } + case 18: { + Key = input.ReadString(); + break; + } + } + } + } + #endif + + } + + /// + /// Value provides a return value type + /// + public sealed partial class Value : pb::IMessage + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + , pb::IBufferMessage + #endif + { + private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new Value()); + private pb::UnknownFieldSet _unknownFields; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public static pb::MessageParser Parser { get { return _parser; } } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public static pbr::MessageDescriptor Descriptor { + get { return global::Nitric.Proto.KvStore.v1.KvstoreReflection.Descriptor.MessageTypes[2]; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + pbr::MessageDescriptor pb::IMessage.Descriptor { + get { return Descriptor; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public Value() { + OnConstruction(); + } + + partial void OnConstruction(); + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public Value(Value other) : this() { + ref_ = other.ref_ != null ? other.ref_.Clone() : null; + content_ = other.content_ != null ? other.content_.Clone() : null; + _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public Value Clone() { + return new Value(this); + } + + /// Field number for the "ref" field. + public const int RefFieldNumber = 1; + private global::Nitric.Proto.KvStore.v1.ValueRef ref_; + /// + /// ValueRef of the key/value pair, which includes the store and key + /// + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public global::Nitric.Proto.KvStore.v1.ValueRef Ref { + get { return ref_; } + set { + ref_ = value; + } + } + + /// Field number for the "content" field. + public const int ContentFieldNumber = 2; + private global::Google.Protobuf.WellKnownTypes.Struct content_; + /// + /// The content (JSON object) + /// + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public global::Google.Protobuf.WellKnownTypes.Struct Content { + get { return content_; } + set { + content_ = value; + } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public override bool Equals(object other) { + return Equals(other as Value); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public bool Equals(Value other) { + if (ReferenceEquals(other, null)) { + return false; + } + if (ReferenceEquals(other, this)) { + return true; + } + if (!object.Equals(Ref, other.Ref)) return false; + if (!object.Equals(Content, other.Content)) return false; + return Equals(_unknownFields, other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public override int GetHashCode() { + int hash = 1; + if (ref_ != null) hash ^= Ref.GetHashCode(); + if (content_ != null) hash ^= Content.GetHashCode(); + if (_unknownFields != null) { + hash ^= _unknownFields.GetHashCode(); + } + return hash; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public override string ToString() { + return pb::JsonFormatter.ToDiagnosticString(this); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public void WriteTo(pb::CodedOutputStream output) { + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + output.WriteRawMessage(this); + #else + if (ref_ != null) { + output.WriteRawTag(10); + output.WriteMessage(Ref); + } + if (content_ != null) { + output.WriteRawTag(18); + output.WriteMessage(Content); + } + if (_unknownFields != null) { + _unknownFields.WriteTo(output); + } + #endif + } + + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + void pb::IBufferMessage.InternalWriteTo(ref pb::WriteContext output) { + if (ref_ != null) { + output.WriteRawTag(10); + output.WriteMessage(Ref); + } + if (content_ != null) { + output.WriteRawTag(18); + output.WriteMessage(Content); + } + if (_unknownFields != null) { + _unknownFields.WriteTo(ref output); + } + } + #endif + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public int CalculateSize() { + int size = 0; + if (ref_ != null) { + size += 1 + pb::CodedOutputStream.ComputeMessageSize(Ref); + } + if (content_ != null) { + size += 1 + pb::CodedOutputStream.ComputeMessageSize(Content); + } + if (_unknownFields != null) { + size += _unknownFields.CalculateSize(); + } + return size; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public void MergeFrom(Value other) { + if (other == null) { + return; + } + if (other.ref_ != null) { + if (ref_ == null) { + Ref = new global::Nitric.Proto.KvStore.v1.ValueRef(); + } + Ref.MergeFrom(other.Ref); + } + if (other.content_ != null) { + if (content_ == null) { + Content = new global::Google.Protobuf.WellKnownTypes.Struct(); + } + Content.MergeFrom(other.Content); + } + _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public void MergeFrom(pb::CodedInputStream input) { + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + input.ReadRawMessage(this); + #else + uint tag; + while ((tag = input.ReadTag()) != 0) { + switch(tag) { + default: + _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input); + break; + case 10: { + if (ref_ == null) { + Ref = new global::Nitric.Proto.KvStore.v1.ValueRef(); + } + input.ReadMessage(Ref); + break; + } + case 18: { + if (content_ == null) { + Content = new global::Google.Protobuf.WellKnownTypes.Struct(); + } + input.ReadMessage(Content); + break; + } + } + } + #endif + } + + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + void pb::IBufferMessage.InternalMergeFrom(ref pb::ParseContext input) { + uint tag; + while ((tag = input.ReadTag()) != 0) { + switch(tag) { + default: + _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, ref input); + break; + case 10: { + if (ref_ == null) { + Ref = new global::Nitric.Proto.KvStore.v1.ValueRef(); + } + input.ReadMessage(Ref); + break; + } + case 18: { + if (content_ == null) { + Content = new global::Google.Protobuf.WellKnownTypes.Struct(); + } + input.ReadMessage(Content); + break; + } + } + } + } + #endif + + } + + public sealed partial class KvStoreGetValueRequest : pb::IMessage + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + , pb::IBufferMessage + #endif + { + private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new KvStoreGetValueRequest()); + private pb::UnknownFieldSet _unknownFields; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public static pb::MessageParser Parser { get { return _parser; } } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public static pbr::MessageDescriptor Descriptor { + get { return global::Nitric.Proto.KvStore.v1.KvstoreReflection.Descriptor.MessageTypes[3]; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + pbr::MessageDescriptor pb::IMessage.Descriptor { + get { return Descriptor; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public KvStoreGetValueRequest() { + OnConstruction(); + } + + partial void OnConstruction(); + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public KvStoreGetValueRequest(KvStoreGetValueRequest other) : this() { + ref_ = other.ref_ != null ? other.ref_.Clone() : null; + _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public KvStoreGetValueRequest Clone() { + return new KvStoreGetValueRequest(this); + } + + /// Field number for the "ref" field. + public const int RefFieldNumber = 1; + private global::Nitric.Proto.KvStore.v1.ValueRef ref_; + /// + /// ValueRef of the key/value pair to get, which includes the store and key + /// + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public global::Nitric.Proto.KvStore.v1.ValueRef Ref { + get { return ref_; } + set { + ref_ = value; + } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public override bool Equals(object other) { + return Equals(other as KvStoreGetValueRequest); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public bool Equals(KvStoreGetValueRequest other) { + if (ReferenceEquals(other, null)) { + return false; + } + if (ReferenceEquals(other, this)) { + return true; + } + if (!object.Equals(Ref, other.Ref)) return false; + return Equals(_unknownFields, other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public override int GetHashCode() { + int hash = 1; + if (ref_ != null) hash ^= Ref.GetHashCode(); + if (_unknownFields != null) { + hash ^= _unknownFields.GetHashCode(); + } + return hash; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public override string ToString() { + return pb::JsonFormatter.ToDiagnosticString(this); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public void WriteTo(pb::CodedOutputStream output) { + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + output.WriteRawMessage(this); + #else + if (ref_ != null) { + output.WriteRawTag(10); + output.WriteMessage(Ref); + } + if (_unknownFields != null) { + _unknownFields.WriteTo(output); + } + #endif + } + + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + void pb::IBufferMessage.InternalWriteTo(ref pb::WriteContext output) { + if (ref_ != null) { + output.WriteRawTag(10); + output.WriteMessage(Ref); + } + if (_unknownFields != null) { + _unknownFields.WriteTo(ref output); + } + } + #endif + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public int CalculateSize() { + int size = 0; + if (ref_ != null) { + size += 1 + pb::CodedOutputStream.ComputeMessageSize(Ref); + } + if (_unknownFields != null) { + size += _unknownFields.CalculateSize(); + } + return size; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public void MergeFrom(KvStoreGetValueRequest other) { + if (other == null) { + return; + } + if (other.ref_ != null) { + if (ref_ == null) { + Ref = new global::Nitric.Proto.KvStore.v1.ValueRef(); + } + Ref.MergeFrom(other.Ref); + } + _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public void MergeFrom(pb::CodedInputStream input) { + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + input.ReadRawMessage(this); + #else + uint tag; + while ((tag = input.ReadTag()) != 0) { + switch(tag) { + default: + _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input); + break; + case 10: { + if (ref_ == null) { + Ref = new global::Nitric.Proto.KvStore.v1.ValueRef(); + } + input.ReadMessage(Ref); + break; + } + } + } + #endif + } + + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + void pb::IBufferMessage.InternalMergeFrom(ref pb::ParseContext input) { + uint tag; + while ((tag = input.ReadTag()) != 0) { + switch(tag) { + default: + _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, ref input); + break; + case 10: { + if (ref_ == null) { + Ref = new global::Nitric.Proto.KvStore.v1.ValueRef(); + } + input.ReadMessage(Ref); + break; + } + } + } + } + #endif + + } + + public sealed partial class KvStoreGetValueResponse : pb::IMessage + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + , pb::IBufferMessage + #endif + { + private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new KvStoreGetValueResponse()); + private pb::UnknownFieldSet _unknownFields; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public static pb::MessageParser Parser { get { return _parser; } } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public static pbr::MessageDescriptor Descriptor { + get { return global::Nitric.Proto.KvStore.v1.KvstoreReflection.Descriptor.MessageTypes[4]; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + pbr::MessageDescriptor pb::IMessage.Descriptor { + get { return Descriptor; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public KvStoreGetValueResponse() { + OnConstruction(); + } + + partial void OnConstruction(); + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public KvStoreGetValueResponse(KvStoreGetValueResponse other) : this() { + value_ = other.value_ != null ? other.value_.Clone() : null; + _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public KvStoreGetValueResponse Clone() { + return new KvStoreGetValueResponse(this); + } + + /// Field number for the "value" field. + public const int ValueFieldNumber = 1; + private global::Nitric.Proto.KvStore.v1.Value value_; + /// + /// The retrieved value + /// + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public global::Nitric.Proto.KvStore.v1.Value Value { + get { return value_; } + set { + value_ = value; + } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public override bool Equals(object other) { + return Equals(other as KvStoreGetValueResponse); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public bool Equals(KvStoreGetValueResponse other) { + if (ReferenceEquals(other, null)) { + return false; + } + if (ReferenceEquals(other, this)) { + return true; + } + if (!object.Equals(Value, other.Value)) return false; + return Equals(_unknownFields, other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public override int GetHashCode() { + int hash = 1; + if (value_ != null) hash ^= Value.GetHashCode(); + if (_unknownFields != null) { + hash ^= _unknownFields.GetHashCode(); + } + return hash; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public override string ToString() { + return pb::JsonFormatter.ToDiagnosticString(this); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public void WriteTo(pb::CodedOutputStream output) { + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + output.WriteRawMessage(this); + #else + if (value_ != null) { + output.WriteRawTag(10); + output.WriteMessage(Value); + } + if (_unknownFields != null) { + _unknownFields.WriteTo(output); + } + #endif + } + + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + void pb::IBufferMessage.InternalWriteTo(ref pb::WriteContext output) { + if (value_ != null) { + output.WriteRawTag(10); + output.WriteMessage(Value); + } + if (_unknownFields != null) { + _unknownFields.WriteTo(ref output); + } + } + #endif + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public int CalculateSize() { + int size = 0; + if (value_ != null) { + size += 1 + pb::CodedOutputStream.ComputeMessageSize(Value); + } + if (_unknownFields != null) { + size += _unknownFields.CalculateSize(); + } + return size; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public void MergeFrom(KvStoreGetValueResponse other) { + if (other == null) { + return; + } + if (other.value_ != null) { + if (value_ == null) { + Value = new global::Nitric.Proto.KvStore.v1.Value(); + } + Value.MergeFrom(other.Value); + } + _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public void MergeFrom(pb::CodedInputStream input) { + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + input.ReadRawMessage(this); + #else + uint tag; + while ((tag = input.ReadTag()) != 0) { + switch(tag) { + default: + _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input); + break; + case 10: { + if (value_ == null) { + Value = new global::Nitric.Proto.KvStore.v1.Value(); + } + input.ReadMessage(Value); + break; + } + } + } + #endif + } + + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + void pb::IBufferMessage.InternalMergeFrom(ref pb::ParseContext input) { + uint tag; + while ((tag = input.ReadTag()) != 0) { + switch(tag) { + default: + _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, ref input); + break; + case 10: { + if (value_ == null) { + Value = new global::Nitric.Proto.KvStore.v1.Value(); + } + input.ReadMessage(Value); + break; + } + } + } + } + #endif + + } + + public sealed partial class KvStoreSetValueRequest : pb::IMessage + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + , pb::IBufferMessage + #endif + { + private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new KvStoreSetValueRequest()); + private pb::UnknownFieldSet _unknownFields; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public static pb::MessageParser Parser { get { return _parser; } } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public static pbr::MessageDescriptor Descriptor { + get { return global::Nitric.Proto.KvStore.v1.KvstoreReflection.Descriptor.MessageTypes[5]; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + pbr::MessageDescriptor pb::IMessage.Descriptor { + get { return Descriptor; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public KvStoreSetValueRequest() { + OnConstruction(); + } + + partial void OnConstruction(); + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public KvStoreSetValueRequest(KvStoreSetValueRequest other) : this() { + ref_ = other.ref_ != null ? other.ref_.Clone() : null; + content_ = other.content_ != null ? other.content_.Clone() : null; + _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public KvStoreSetValueRequest Clone() { + return new KvStoreSetValueRequest(this); + } + + /// Field number for the "ref" field. + public const int RefFieldNumber = 1; + private global::Nitric.Proto.KvStore.v1.ValueRef ref_; + /// + /// ValueRef of the key/value pair to set, which includes the store and key + /// + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public global::Nitric.Proto.KvStore.v1.ValueRef Ref { + get { return ref_; } + set { + ref_ = value; + } + } + + /// Field number for the "content" field. + public const int ContentFieldNumber = 3; + private global::Google.Protobuf.WellKnownTypes.Struct content_; + /// + /// The value content to store (JSON object) + /// + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public global::Google.Protobuf.WellKnownTypes.Struct Content { + get { return content_; } + set { + content_ = value; + } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public override bool Equals(object other) { + return Equals(other as KvStoreSetValueRequest); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public bool Equals(KvStoreSetValueRequest other) { + if (ReferenceEquals(other, null)) { + return false; + } + if (ReferenceEquals(other, this)) { + return true; + } + if (!object.Equals(Ref, other.Ref)) return false; + if (!object.Equals(Content, other.Content)) return false; + return Equals(_unknownFields, other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public override int GetHashCode() { + int hash = 1; + if (ref_ != null) hash ^= Ref.GetHashCode(); + if (content_ != null) hash ^= Content.GetHashCode(); + if (_unknownFields != null) { + hash ^= _unknownFields.GetHashCode(); + } + return hash; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public override string ToString() { + return pb::JsonFormatter.ToDiagnosticString(this); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public void WriteTo(pb::CodedOutputStream output) { + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + output.WriteRawMessage(this); + #else + if (ref_ != null) { + output.WriteRawTag(10); + output.WriteMessage(Ref); + } + if (content_ != null) { + output.WriteRawTag(26); + output.WriteMessage(Content); + } + if (_unknownFields != null) { + _unknownFields.WriteTo(output); + } + #endif + } + + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + void pb::IBufferMessage.InternalWriteTo(ref pb::WriteContext output) { + if (ref_ != null) { + output.WriteRawTag(10); + output.WriteMessage(Ref); + } + if (content_ != null) { + output.WriteRawTag(26); + output.WriteMessage(Content); + } + if (_unknownFields != null) { + _unknownFields.WriteTo(ref output); + } + } + #endif + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public int CalculateSize() { + int size = 0; + if (ref_ != null) { + size += 1 + pb::CodedOutputStream.ComputeMessageSize(Ref); + } + if (content_ != null) { + size += 1 + pb::CodedOutputStream.ComputeMessageSize(Content); + } + if (_unknownFields != null) { + size += _unknownFields.CalculateSize(); + } + return size; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public void MergeFrom(KvStoreSetValueRequest other) { + if (other == null) { + return; + } + if (other.ref_ != null) { + if (ref_ == null) { + Ref = new global::Nitric.Proto.KvStore.v1.ValueRef(); + } + Ref.MergeFrom(other.Ref); + } + if (other.content_ != null) { + if (content_ == null) { + Content = new global::Google.Protobuf.WellKnownTypes.Struct(); + } + Content.MergeFrom(other.Content); + } + _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public void MergeFrom(pb::CodedInputStream input) { + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + input.ReadRawMessage(this); + #else + uint tag; + while ((tag = input.ReadTag()) != 0) { + switch(tag) { + default: + _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input); + break; + case 10: { + if (ref_ == null) { + Ref = new global::Nitric.Proto.KvStore.v1.ValueRef(); + } + input.ReadMessage(Ref); + break; + } + case 26: { + if (content_ == null) { + Content = new global::Google.Protobuf.WellKnownTypes.Struct(); + } + input.ReadMessage(Content); + break; + } + } + } + #endif + } + + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + void pb::IBufferMessage.InternalMergeFrom(ref pb::ParseContext input) { + uint tag; + while ((tag = input.ReadTag()) != 0) { + switch(tag) { + default: + _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, ref input); + break; + case 10: { + if (ref_ == null) { + Ref = new global::Nitric.Proto.KvStore.v1.ValueRef(); + } + input.ReadMessage(Ref); + break; + } + case 26: { + if (content_ == null) { + Content = new global::Google.Protobuf.WellKnownTypes.Struct(); + } + input.ReadMessage(Content); + break; + } + } + } + } + #endif + + } + + public sealed partial class KvStoreSetValueResponse : pb::IMessage + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + , pb::IBufferMessage + #endif + { + private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new KvStoreSetValueResponse()); + private pb::UnknownFieldSet _unknownFields; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public static pb::MessageParser Parser { get { return _parser; } } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public static pbr::MessageDescriptor Descriptor { + get { return global::Nitric.Proto.KvStore.v1.KvstoreReflection.Descriptor.MessageTypes[6]; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + pbr::MessageDescriptor pb::IMessage.Descriptor { + get { return Descriptor; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public KvStoreSetValueResponse() { + OnConstruction(); + } + + partial void OnConstruction(); + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public KvStoreSetValueResponse(KvStoreSetValueResponse other) : this() { + _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public KvStoreSetValueResponse Clone() { + return new KvStoreSetValueResponse(this); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public override bool Equals(object other) { + return Equals(other as KvStoreSetValueResponse); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public bool Equals(KvStoreSetValueResponse other) { + if (ReferenceEquals(other, null)) { + return false; + } + if (ReferenceEquals(other, this)) { + return true; + } + return Equals(_unknownFields, other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public override int GetHashCode() { + int hash = 1; + if (_unknownFields != null) { + hash ^= _unknownFields.GetHashCode(); + } + return hash; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public override string ToString() { + return pb::JsonFormatter.ToDiagnosticString(this); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public void WriteTo(pb::CodedOutputStream output) { + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + output.WriteRawMessage(this); + #else + if (_unknownFields != null) { + _unknownFields.WriteTo(output); + } + #endif + } + + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + void pb::IBufferMessage.InternalWriteTo(ref pb::WriteContext output) { + if (_unknownFields != null) { + _unknownFields.WriteTo(ref output); + } + } + #endif + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public int CalculateSize() { + int size = 0; + if (_unknownFields != null) { + size += _unknownFields.CalculateSize(); + } + return size; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public void MergeFrom(KvStoreSetValueResponse other) { + if (other == null) { + return; + } + _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public void MergeFrom(pb::CodedInputStream input) { + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + input.ReadRawMessage(this); + #else + uint tag; + while ((tag = input.ReadTag()) != 0) { + switch(tag) { + default: + _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input); + break; + } + } + #endif + } + + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + void pb::IBufferMessage.InternalMergeFrom(ref pb::ParseContext input) { + uint tag; + while ((tag = input.ReadTag()) != 0) { + switch(tag) { + default: + _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, ref input); + break; + } + } + } + #endif + + } + + public sealed partial class KvStoreDeleteKeyRequest : pb::IMessage + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + , pb::IBufferMessage + #endif + { + private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new KvStoreDeleteKeyRequest()); + private pb::UnknownFieldSet _unknownFields; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public static pb::MessageParser Parser { get { return _parser; } } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public static pbr::MessageDescriptor Descriptor { + get { return global::Nitric.Proto.KvStore.v1.KvstoreReflection.Descriptor.MessageTypes[7]; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + pbr::MessageDescriptor pb::IMessage.Descriptor { + get { return Descriptor; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public KvStoreDeleteKeyRequest() { + OnConstruction(); + } + + partial void OnConstruction(); + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public KvStoreDeleteKeyRequest(KvStoreDeleteKeyRequest other) : this() { + ref_ = other.ref_ != null ? other.ref_.Clone() : null; + _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public KvStoreDeleteKeyRequest Clone() { + return new KvStoreDeleteKeyRequest(this); + } + + /// Field number for the "ref" field. + public const int RefFieldNumber = 1; + private global::Nitric.Proto.KvStore.v1.ValueRef ref_; + /// + /// ValueRef of the key/value pair to delete, which includes the store and key + /// + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public global::Nitric.Proto.KvStore.v1.ValueRef Ref { + get { return ref_; } + set { + ref_ = value; + } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public override bool Equals(object other) { + return Equals(other as KvStoreDeleteKeyRequest); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public bool Equals(KvStoreDeleteKeyRequest other) { + if (ReferenceEquals(other, null)) { + return false; + } + if (ReferenceEquals(other, this)) { + return true; + } + if (!object.Equals(Ref, other.Ref)) return false; + return Equals(_unknownFields, other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public override int GetHashCode() { + int hash = 1; + if (ref_ != null) hash ^= Ref.GetHashCode(); + if (_unknownFields != null) { + hash ^= _unknownFields.GetHashCode(); + } + return hash; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public override string ToString() { + return pb::JsonFormatter.ToDiagnosticString(this); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public void WriteTo(pb::CodedOutputStream output) { + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + output.WriteRawMessage(this); + #else + if (ref_ != null) { + output.WriteRawTag(10); + output.WriteMessage(Ref); + } + if (_unknownFields != null) { + _unknownFields.WriteTo(output); + } + #endif + } + + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + void pb::IBufferMessage.InternalWriteTo(ref pb::WriteContext output) { + if (ref_ != null) { + output.WriteRawTag(10); + output.WriteMessage(Ref); + } + if (_unknownFields != null) { + _unknownFields.WriteTo(ref output); + } + } + #endif + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public int CalculateSize() { + int size = 0; + if (ref_ != null) { + size += 1 + pb::CodedOutputStream.ComputeMessageSize(Ref); + } + if (_unknownFields != null) { + size += _unknownFields.CalculateSize(); + } + return size; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public void MergeFrom(KvStoreDeleteKeyRequest other) { + if (other == null) { + return; + } + if (other.ref_ != null) { + if (ref_ == null) { + Ref = new global::Nitric.Proto.KvStore.v1.ValueRef(); + } + Ref.MergeFrom(other.Ref); + } + _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public void MergeFrom(pb::CodedInputStream input) { + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + input.ReadRawMessage(this); + #else + uint tag; + while ((tag = input.ReadTag()) != 0) { + switch(tag) { + default: + _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input); + break; + case 10: { + if (ref_ == null) { + Ref = new global::Nitric.Proto.KvStore.v1.ValueRef(); + } + input.ReadMessage(Ref); + break; + } + } + } + #endif + } + + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + void pb::IBufferMessage.InternalMergeFrom(ref pb::ParseContext input) { + uint tag; + while ((tag = input.ReadTag()) != 0) { + switch(tag) { + default: + _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, ref input); + break; + case 10: { + if (ref_ == null) { + Ref = new global::Nitric.Proto.KvStore.v1.ValueRef(); + } + input.ReadMessage(Ref); + break; + } + } + } + } + #endif + + } + + public sealed partial class KvStoreDeleteKeyResponse : pb::IMessage + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + , pb::IBufferMessage + #endif + { + private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new KvStoreDeleteKeyResponse()); + private pb::UnknownFieldSet _unknownFields; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public static pb::MessageParser Parser { get { return _parser; } } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public static pbr::MessageDescriptor Descriptor { + get { return global::Nitric.Proto.KvStore.v1.KvstoreReflection.Descriptor.MessageTypes[8]; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + pbr::MessageDescriptor pb::IMessage.Descriptor { + get { return Descriptor; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public KvStoreDeleteKeyResponse() { + OnConstruction(); + } + + partial void OnConstruction(); + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public KvStoreDeleteKeyResponse(KvStoreDeleteKeyResponse other) : this() { + _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public KvStoreDeleteKeyResponse Clone() { + return new KvStoreDeleteKeyResponse(this); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public override bool Equals(object other) { + return Equals(other as KvStoreDeleteKeyResponse); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public bool Equals(KvStoreDeleteKeyResponse other) { + if (ReferenceEquals(other, null)) { + return false; + } + if (ReferenceEquals(other, this)) { + return true; + } + return Equals(_unknownFields, other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public override int GetHashCode() { + int hash = 1; + if (_unknownFields != null) { + hash ^= _unknownFields.GetHashCode(); + } + return hash; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public override string ToString() { + return pb::JsonFormatter.ToDiagnosticString(this); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public void WriteTo(pb::CodedOutputStream output) { + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + output.WriteRawMessage(this); + #else + if (_unknownFields != null) { + _unknownFields.WriteTo(output); + } + #endif + } + + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + void pb::IBufferMessage.InternalWriteTo(ref pb::WriteContext output) { + if (_unknownFields != null) { + _unknownFields.WriteTo(ref output); + } + } + #endif + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public int CalculateSize() { + int size = 0; + if (_unknownFields != null) { + size += _unknownFields.CalculateSize(); + } + return size; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public void MergeFrom(KvStoreDeleteKeyResponse other) { + if (other == null) { + return; + } + _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public void MergeFrom(pb::CodedInputStream input) { + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + input.ReadRawMessage(this); + #else + uint tag; + while ((tag = input.ReadTag()) != 0) { + switch(tag) { + default: + _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input); + break; + } + } + #endif + } + + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + void pb::IBufferMessage.InternalMergeFrom(ref pb::ParseContext input) { + uint tag; + while ((tag = input.ReadTag()) != 0) { + switch(tag) { + default: + _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, ref input); + break; + } + } + } + #endif + + } + + public sealed partial class KvStoreScanKeysRequest : pb::IMessage + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + , pb::IBufferMessage + #endif + { + private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new KvStoreScanKeysRequest()); + private pb::UnknownFieldSet _unknownFields; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public static pb::MessageParser Parser { get { return _parser; } } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public static pbr::MessageDescriptor Descriptor { + get { return global::Nitric.Proto.KvStore.v1.KvstoreReflection.Descriptor.MessageTypes[9]; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + pbr::MessageDescriptor pb::IMessage.Descriptor { + get { return Descriptor; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public KvStoreScanKeysRequest() { + OnConstruction(); + } + + partial void OnConstruction(); + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public KvStoreScanKeysRequest(KvStoreScanKeysRequest other) : this() { + store_ = other.store_ != null ? other.store_.Clone() : null; + prefix_ = other.prefix_; + _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public KvStoreScanKeysRequest Clone() { + return new KvStoreScanKeysRequest(this); + } + + /// Field number for the "store" field. + public const int StoreFieldNumber = 1; + private global::Nitric.Proto.KvStore.v1.Store store_; + /// + /// The store to iterate over + /// + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public global::Nitric.Proto.KvStore.v1.Store Store { + get { return store_; } + set { + store_ = value; + } + } + + /// Field number for the "prefix" field. + public const int PrefixFieldNumber = 2; + private string prefix_ = ""; + /// + /// The prefix to filter keys by + /// + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public string Prefix { + get { return prefix_; } + set { + prefix_ = pb::ProtoPreconditions.CheckNotNull(value, "value"); + } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public override bool Equals(object other) { + return Equals(other as KvStoreScanKeysRequest); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public bool Equals(KvStoreScanKeysRequest other) { + if (ReferenceEquals(other, null)) { + return false; + } + if (ReferenceEquals(other, this)) { + return true; + } + if (!object.Equals(Store, other.Store)) return false; + if (Prefix != other.Prefix) return false; + return Equals(_unknownFields, other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public override int GetHashCode() { + int hash = 1; + if (store_ != null) hash ^= Store.GetHashCode(); + if (Prefix.Length != 0) hash ^= Prefix.GetHashCode(); + if (_unknownFields != null) { + hash ^= _unknownFields.GetHashCode(); + } + return hash; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public override string ToString() { + return pb::JsonFormatter.ToDiagnosticString(this); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public void WriteTo(pb::CodedOutputStream output) { + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + output.WriteRawMessage(this); + #else + if (store_ != null) { + output.WriteRawTag(10); + output.WriteMessage(Store); + } + if (Prefix.Length != 0) { + output.WriteRawTag(18); + output.WriteString(Prefix); + } + if (_unknownFields != null) { + _unknownFields.WriteTo(output); + } + #endif + } + + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + void pb::IBufferMessage.InternalWriteTo(ref pb::WriteContext output) { + if (store_ != null) { + output.WriteRawTag(10); + output.WriteMessage(Store); + } + if (Prefix.Length != 0) { + output.WriteRawTag(18); + output.WriteString(Prefix); + } + if (_unknownFields != null) { + _unknownFields.WriteTo(ref output); + } + } + #endif + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public int CalculateSize() { + int size = 0; + if (store_ != null) { + size += 1 + pb::CodedOutputStream.ComputeMessageSize(Store); + } + if (Prefix.Length != 0) { + size += 1 + pb::CodedOutputStream.ComputeStringSize(Prefix); + } + if (_unknownFields != null) { + size += _unknownFields.CalculateSize(); + } + return size; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public void MergeFrom(KvStoreScanKeysRequest other) { + if (other == null) { + return; + } + if (other.store_ != null) { + if (store_ == null) { + Store = new global::Nitric.Proto.KvStore.v1.Store(); + } + Store.MergeFrom(other.Store); + } + if (other.Prefix.Length != 0) { + Prefix = other.Prefix; + } + _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public void MergeFrom(pb::CodedInputStream input) { + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + input.ReadRawMessage(this); + #else + uint tag; + while ((tag = input.ReadTag()) != 0) { + switch(tag) { + default: + _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input); + break; + case 10: { + if (store_ == null) { + Store = new global::Nitric.Proto.KvStore.v1.Store(); + } + input.ReadMessage(Store); + break; + } + case 18: { + Prefix = input.ReadString(); + break; + } + } + } + #endif + } + + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + void pb::IBufferMessage.InternalMergeFrom(ref pb::ParseContext input) { + uint tag; + while ((tag = input.ReadTag()) != 0) { + switch(tag) { + default: + _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, ref input); + break; + case 10: { + if (store_ == null) { + Store = new global::Nitric.Proto.KvStore.v1.Store(); + } + input.ReadMessage(Store); + break; + } + case 18: { + Prefix = input.ReadString(); + break; + } + } + } + } + #endif + + } + + public sealed partial class KvStoreScanKeysResponse : pb::IMessage + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + , pb::IBufferMessage + #endif + { + private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new KvStoreScanKeysResponse()); + private pb::UnknownFieldSet _unknownFields; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public static pb::MessageParser Parser { get { return _parser; } } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public static pbr::MessageDescriptor Descriptor { + get { return global::Nitric.Proto.KvStore.v1.KvstoreReflection.Descriptor.MessageTypes[10]; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + pbr::MessageDescriptor pb::IMessage.Descriptor { + get { return Descriptor; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public KvStoreScanKeysResponse() { + OnConstruction(); + } + + partial void OnConstruction(); + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public KvStoreScanKeysResponse(KvStoreScanKeysResponse other) : this() { + key_ = other.key_; + _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public KvStoreScanKeysResponse Clone() { + return new KvStoreScanKeysResponse(this); + } + + /// Field number for the "key" field. + public const int KeyFieldNumber = 1; + private string key_ = ""; + /// + /// The key of the key/value pair + /// + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public string Key { + get { return key_; } + set { + key_ = pb::ProtoPreconditions.CheckNotNull(value, "value"); + } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public override bool Equals(object other) { + return Equals(other as KvStoreScanKeysResponse); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public bool Equals(KvStoreScanKeysResponse other) { + if (ReferenceEquals(other, null)) { + return false; + } + if (ReferenceEquals(other, this)) { + return true; + } + if (Key != other.Key) return false; + return Equals(_unknownFields, other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public override int GetHashCode() { + int hash = 1; + if (Key.Length != 0) hash ^= Key.GetHashCode(); + if (_unknownFields != null) { + hash ^= _unknownFields.GetHashCode(); + } + return hash; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public override string ToString() { + return pb::JsonFormatter.ToDiagnosticString(this); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public void WriteTo(pb::CodedOutputStream output) { + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + output.WriteRawMessage(this); + #else + if (Key.Length != 0) { + output.WriteRawTag(10); + output.WriteString(Key); + } + if (_unknownFields != null) { + _unknownFields.WriteTo(output); + } + #endif + } + + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + void pb::IBufferMessage.InternalWriteTo(ref pb::WriteContext output) { + if (Key.Length != 0) { + output.WriteRawTag(10); + output.WriteString(Key); + } + if (_unknownFields != null) { + _unknownFields.WriteTo(ref output); + } + } + #endif + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public int CalculateSize() { + int size = 0; + if (Key.Length != 0) { + size += 1 + pb::CodedOutputStream.ComputeStringSize(Key); + } + if (_unknownFields != null) { + size += _unknownFields.CalculateSize(); + } + return size; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public void MergeFrom(KvStoreScanKeysResponse other) { + if (other == null) { + return; + } + if (other.Key.Length != 0) { + Key = other.Key; + } + _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public void MergeFrom(pb::CodedInputStream input) { + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + input.ReadRawMessage(this); + #else + uint tag; + while ((tag = input.ReadTag()) != 0) { + switch(tag) { + default: + _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input); + break; + case 10: { + Key = input.ReadString(); + break; + } + } + } + #endif + } + + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + void pb::IBufferMessage.InternalMergeFrom(ref pb::ParseContext input) { + uint tag; + while ((tag = input.ReadTag()) != 0) { + switch(tag) { + default: + _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, ref input); + break; + case 10: { + Key = input.ReadString(); + break; + } + } + } + } + #endif + + } + + #endregion + +} + +#endregion Designer generated code diff --git a/src/Nitric.Sdk/Proto/kvstore/v1/KvstoreGrpc.cs b/src/Nitric.Sdk/Proto/kvstore/v1/KvstoreGrpc.cs new file mode 100644 index 0000000..b153b17 --- /dev/null +++ b/src/Nitric.Sdk/Proto/kvstore/v1/KvstoreGrpc.cs @@ -0,0 +1,351 @@ +// +// Generated by the protocol buffer compiler. DO NOT EDIT! +// source: nitric/proto/kvstore/v1/kvstore.proto +// +#pragma warning disable 0414, 1591 +#region Designer generated code + +using grpc = global::Grpc.Core; + +namespace Nitric.Proto.KvStore.v1 { + /// + /// Service for storage and retrieval of simple JSON keyValue + /// + public static partial class KvStore + { + static readonly string __ServiceName = "nitric.proto.kvstore.v1.KvStore"; + + static void __Helper_SerializeMessage(global::Google.Protobuf.IMessage message, grpc::SerializationContext context) + { + #if !GRPC_DISABLE_PROTOBUF_BUFFER_SERIALIZATION + if (message is global::Google.Protobuf.IBufferMessage) + { + context.SetPayloadLength(message.CalculateSize()); + global::Google.Protobuf.MessageExtensions.WriteTo(message, context.GetBufferWriter()); + context.Complete(); + return; + } + #endif + context.Complete(global::Google.Protobuf.MessageExtensions.ToByteArray(message)); + } + + static class __Helper_MessageCache + { + public static readonly bool IsBufferMessage = global::System.Reflection.IntrospectionExtensions.GetTypeInfo(typeof(global::Google.Protobuf.IBufferMessage)).IsAssignableFrom(typeof(T)); + } + + static T __Helper_DeserializeMessage(grpc::DeserializationContext context, global::Google.Protobuf.MessageParser parser) where T : global::Google.Protobuf.IMessage + { + #if !GRPC_DISABLE_PROTOBUF_BUFFER_SERIALIZATION + if (__Helper_MessageCache.IsBufferMessage) + { + return parser.ParseFrom(context.PayloadAsReadOnlySequence()); + } + #endif + return parser.ParseFrom(context.PayloadAsNewBuffer()); + } + + static readonly grpc::Marshaller __Marshaller_nitric_proto_kvstore_v1_KvStoreGetValueRequest = grpc::Marshallers.Create(__Helper_SerializeMessage, context => __Helper_DeserializeMessage(context, global::Nitric.Proto.KvStore.v1.KvStoreGetValueRequest.Parser)); + static readonly grpc::Marshaller __Marshaller_nitric_proto_kvstore_v1_KvStoreGetValueResponse = grpc::Marshallers.Create(__Helper_SerializeMessage, context => __Helper_DeserializeMessage(context, global::Nitric.Proto.KvStore.v1.KvStoreGetValueResponse.Parser)); + static readonly grpc::Marshaller __Marshaller_nitric_proto_kvstore_v1_KvStoreSetValueRequest = grpc::Marshallers.Create(__Helper_SerializeMessage, context => __Helper_DeserializeMessage(context, global::Nitric.Proto.KvStore.v1.KvStoreSetValueRequest.Parser)); + static readonly grpc::Marshaller __Marshaller_nitric_proto_kvstore_v1_KvStoreSetValueResponse = grpc::Marshallers.Create(__Helper_SerializeMessage, context => __Helper_DeserializeMessage(context, global::Nitric.Proto.KvStore.v1.KvStoreSetValueResponse.Parser)); + static readonly grpc::Marshaller __Marshaller_nitric_proto_kvstore_v1_KvStoreDeleteKeyRequest = grpc::Marshallers.Create(__Helper_SerializeMessage, context => __Helper_DeserializeMessage(context, global::Nitric.Proto.KvStore.v1.KvStoreDeleteKeyRequest.Parser)); + static readonly grpc::Marshaller __Marshaller_nitric_proto_kvstore_v1_KvStoreDeleteKeyResponse = grpc::Marshallers.Create(__Helper_SerializeMessage, context => __Helper_DeserializeMessage(context, global::Nitric.Proto.KvStore.v1.KvStoreDeleteKeyResponse.Parser)); + static readonly grpc::Marshaller __Marshaller_nitric_proto_kvstore_v1_KvStoreScanKeysRequest = grpc::Marshallers.Create(__Helper_SerializeMessage, context => __Helper_DeserializeMessage(context, global::Nitric.Proto.KvStore.v1.KvStoreScanKeysRequest.Parser)); + static readonly grpc::Marshaller __Marshaller_nitric_proto_kvstore_v1_KvStoreScanKeysResponse = grpc::Marshallers.Create(__Helper_SerializeMessage, context => __Helper_DeserializeMessage(context, global::Nitric.Proto.KvStore.v1.KvStoreScanKeysResponse.Parser)); + + static readonly grpc::Method __Method_GetValue = new grpc::Method( + grpc::MethodType.Unary, + __ServiceName, + "GetValue", + __Marshaller_nitric_proto_kvstore_v1_KvStoreGetValueRequest, + __Marshaller_nitric_proto_kvstore_v1_KvStoreGetValueResponse); + + static readonly grpc::Method __Method_SetValue = new grpc::Method( + grpc::MethodType.Unary, + __ServiceName, + "SetValue", + __Marshaller_nitric_proto_kvstore_v1_KvStoreSetValueRequest, + __Marshaller_nitric_proto_kvstore_v1_KvStoreSetValueResponse); + + static readonly grpc::Method __Method_DeleteKey = new grpc::Method( + grpc::MethodType.Unary, + __ServiceName, + "DeleteKey", + __Marshaller_nitric_proto_kvstore_v1_KvStoreDeleteKeyRequest, + __Marshaller_nitric_proto_kvstore_v1_KvStoreDeleteKeyResponse); + + static readonly grpc::Method __Method_ScanKeys = new grpc::Method( + grpc::MethodType.ServerStreaming, + __ServiceName, + "ScanKeys", + __Marshaller_nitric_proto_kvstore_v1_KvStoreScanKeysRequest, + __Marshaller_nitric_proto_kvstore_v1_KvStoreScanKeysResponse); + + /// Service descriptor + public static global::Google.Protobuf.Reflection.ServiceDescriptor Descriptor + { + get { return global::Nitric.Proto.KvStore.v1.KvstoreReflection.Descriptor.Services[0]; } + } + + /// Base class for server-side implementations of KvStore + [grpc::BindServiceMethod(typeof(KvStore), "BindService")] + public abstract partial class KvStoreBase + { + /// + /// Get an existing value + /// + /// The request received from the client. + /// The context of the server-side call handler being invoked. + /// The response to send back to the client (wrapped by a task). + public virtual global::System.Threading.Tasks.Task GetValue(global::Nitric.Proto.KvStore.v1.KvStoreGetValueRequest request, grpc::ServerCallContext context) + { + throw new grpc::RpcException(new grpc::Status(grpc::StatusCode.Unimplemented, "")); + } + + /// + /// Create a new or overwrite an existing value + /// + /// The request received from the client. + /// The context of the server-side call handler being invoked. + /// The response to send back to the client (wrapped by a task). + public virtual global::System.Threading.Tasks.Task SetValue(global::Nitric.Proto.KvStore.v1.KvStoreSetValueRequest request, grpc::ServerCallContext context) + { + throw new grpc::RpcException(new grpc::Status(grpc::StatusCode.Unimplemented, "")); + } + + /// + /// Delete a key and its value + /// + /// The request received from the client. + /// The context of the server-side call handler being invoked. + /// The response to send back to the client (wrapped by a task). + public virtual global::System.Threading.Tasks.Task DeleteKey(global::Nitric.Proto.KvStore.v1.KvStoreDeleteKeyRequest request, grpc::ServerCallContext context) + { + throw new grpc::RpcException(new grpc::Status(grpc::StatusCode.Unimplemented, "")); + } + + /// + /// Iterate over all keys in a store + /// + /// The request received from the client. + /// Used for sending responses back to the client. + /// The context of the server-side call handler being invoked. + /// A task indicating completion of the handler. + public virtual global::System.Threading.Tasks.Task ScanKeys(global::Nitric.Proto.KvStore.v1.KvStoreScanKeysRequest request, grpc::IServerStreamWriter responseStream, grpc::ServerCallContext context) + { + throw new grpc::RpcException(new grpc::Status(grpc::StatusCode.Unimplemented, "")); + } + + } + + /// Client for KvStore + public partial class KvStoreClient : grpc::ClientBase + { + /// Creates a new client for KvStore + /// The channel to use to make remote calls. + public KvStoreClient(grpc::ChannelBase channel) : base(channel) + { + } + /// Creates a new client for KvStore that uses a custom CallInvoker. + /// The callInvoker to use to make remote calls. + public KvStoreClient(grpc::CallInvoker callInvoker) : base(callInvoker) + { + } + /// Protected parameterless constructor to allow creation of test doubles. + protected KvStoreClient() : base() + { + } + /// Protected constructor to allow creation of configured clients. + /// The client configuration. + protected KvStoreClient(ClientBaseConfiguration configuration) : base(configuration) + { + } + + /// + /// Get an existing value + /// + /// The request to send to the server. + /// The initial metadata to send with the call. This parameter is optional. + /// An optional deadline for the call. The call will be cancelled if deadline is hit. + /// An optional token for canceling the call. + /// The response received from the server. + public virtual global::Nitric.Proto.KvStore.v1.KvStoreGetValueResponse GetValue(global::Nitric.Proto.KvStore.v1.KvStoreGetValueRequest request, grpc::Metadata headers = null, global::System.DateTime? deadline = null, global::System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken)) + { + return GetValue(request, new grpc::CallOptions(headers, deadline, cancellationToken)); + } + /// + /// Get an existing value + /// + /// The request to send to the server. + /// The options for the call. + /// The response received from the server. + public virtual global::Nitric.Proto.KvStore.v1.KvStoreGetValueResponse GetValue(global::Nitric.Proto.KvStore.v1.KvStoreGetValueRequest request, grpc::CallOptions options) + { + return CallInvoker.BlockingUnaryCall(__Method_GetValue, null, options, request); + } + /// + /// Get an existing value + /// + /// The request to send to the server. + /// The initial metadata to send with the call. This parameter is optional. + /// An optional deadline for the call. The call will be cancelled if deadline is hit. + /// An optional token for canceling the call. + /// The call object. + public virtual grpc::AsyncUnaryCall GetValueAsync(global::Nitric.Proto.KvStore.v1.KvStoreGetValueRequest request, grpc::Metadata headers = null, global::System.DateTime? deadline = null, global::System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken)) + { + return GetValueAsync(request, new grpc::CallOptions(headers, deadline, cancellationToken)); + } + /// + /// Get an existing value + /// + /// The request to send to the server. + /// The options for the call. + /// The call object. + public virtual grpc::AsyncUnaryCall GetValueAsync(global::Nitric.Proto.KvStore.v1.KvStoreGetValueRequest request, grpc::CallOptions options) + { + return CallInvoker.AsyncUnaryCall(__Method_GetValue, null, options, request); + } + /// + /// Create a new or overwrite an existing value + /// + /// The request to send to the server. + /// The initial metadata to send with the call. This parameter is optional. + /// An optional deadline for the call. The call will be cancelled if deadline is hit. + /// An optional token for canceling the call. + /// The response received from the server. + public virtual global::Nitric.Proto.KvStore.v1.KvStoreSetValueResponse SetValue(global::Nitric.Proto.KvStore.v1.KvStoreSetValueRequest request, grpc::Metadata headers = null, global::System.DateTime? deadline = null, global::System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken)) + { + return SetValue(request, new grpc::CallOptions(headers, deadline, cancellationToken)); + } + /// + /// Create a new or overwrite an existing value + /// + /// The request to send to the server. + /// The options for the call. + /// The response received from the server. + public virtual global::Nitric.Proto.KvStore.v1.KvStoreSetValueResponse SetValue(global::Nitric.Proto.KvStore.v1.KvStoreSetValueRequest request, grpc::CallOptions options) + { + return CallInvoker.BlockingUnaryCall(__Method_SetValue, null, options, request); + } + /// + /// Create a new or overwrite an existing value + /// + /// The request to send to the server. + /// The initial metadata to send with the call. This parameter is optional. + /// An optional deadline for the call. The call will be cancelled if deadline is hit. + /// An optional token for canceling the call. + /// The call object. + public virtual grpc::AsyncUnaryCall SetValueAsync(global::Nitric.Proto.KvStore.v1.KvStoreSetValueRequest request, grpc::Metadata headers = null, global::System.DateTime? deadline = null, global::System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken)) + { + return SetValueAsync(request, new grpc::CallOptions(headers, deadline, cancellationToken)); + } + /// + /// Create a new or overwrite an existing value + /// + /// The request to send to the server. + /// The options for the call. + /// The call object. + public virtual grpc::AsyncUnaryCall SetValueAsync(global::Nitric.Proto.KvStore.v1.KvStoreSetValueRequest request, grpc::CallOptions options) + { + return CallInvoker.AsyncUnaryCall(__Method_SetValue, null, options, request); + } + /// + /// Delete a key and its value + /// + /// The request to send to the server. + /// The initial metadata to send with the call. This parameter is optional. + /// An optional deadline for the call. The call will be cancelled if deadline is hit. + /// An optional token for canceling the call. + /// The response received from the server. + public virtual global::Nitric.Proto.KvStore.v1.KvStoreDeleteKeyResponse DeleteKey(global::Nitric.Proto.KvStore.v1.KvStoreDeleteKeyRequest request, grpc::Metadata headers = null, global::System.DateTime? deadline = null, global::System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken)) + { + return DeleteKey(request, new grpc::CallOptions(headers, deadline, cancellationToken)); + } + /// + /// Delete a key and its value + /// + /// The request to send to the server. + /// The options for the call. + /// The response received from the server. + public virtual global::Nitric.Proto.KvStore.v1.KvStoreDeleteKeyResponse DeleteKey(global::Nitric.Proto.KvStore.v1.KvStoreDeleteKeyRequest request, grpc::CallOptions options) + { + return CallInvoker.BlockingUnaryCall(__Method_DeleteKey, null, options, request); + } + /// + /// Delete a key and its value + /// + /// The request to send to the server. + /// The initial metadata to send with the call. This parameter is optional. + /// An optional deadline for the call. The call will be cancelled if deadline is hit. + /// An optional token for canceling the call. + /// The call object. + public virtual grpc::AsyncUnaryCall DeleteKeyAsync(global::Nitric.Proto.KvStore.v1.KvStoreDeleteKeyRequest request, grpc::Metadata headers = null, global::System.DateTime? deadline = null, global::System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken)) + { + return DeleteKeyAsync(request, new grpc::CallOptions(headers, deadline, cancellationToken)); + } + /// + /// Delete a key and its value + /// + /// The request to send to the server. + /// The options for the call. + /// The call object. + public virtual grpc::AsyncUnaryCall DeleteKeyAsync(global::Nitric.Proto.KvStore.v1.KvStoreDeleteKeyRequest request, grpc::CallOptions options) + { + return CallInvoker.AsyncUnaryCall(__Method_DeleteKey, null, options, request); + } + /// + /// Iterate over all keys in a store + /// + /// The request to send to the server. + /// The initial metadata to send with the call. This parameter is optional. + /// An optional deadline for the call. The call will be cancelled if deadline is hit. + /// An optional token for canceling the call. + /// The call object. + public virtual grpc::AsyncServerStreamingCall ScanKeys(global::Nitric.Proto.KvStore.v1.KvStoreScanKeysRequest request, grpc::Metadata headers = null, global::System.DateTime? deadline = null, global::System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken)) + { + return ScanKeys(request, new grpc::CallOptions(headers, deadline, cancellationToken)); + } + /// + /// Iterate over all keys in a store + /// + /// The request to send to the server. + /// The options for the call. + /// The call object. + public virtual grpc::AsyncServerStreamingCall ScanKeys(global::Nitric.Proto.KvStore.v1.KvStoreScanKeysRequest request, grpc::CallOptions options) + { + return CallInvoker.AsyncServerStreamingCall(__Method_ScanKeys, null, options, request); + } + /// Creates a new instance of client from given ClientBaseConfiguration. + protected override KvStoreClient NewInstance(ClientBaseConfiguration configuration) + { + return new KvStoreClient(configuration); + } + } + + /// Creates service definition that can be registered with a server + /// An object implementing the server-side handling logic. + public static grpc::ServerServiceDefinition BindService(KvStoreBase serviceImpl) + { + return grpc::ServerServiceDefinition.CreateBuilder() + .AddMethod(__Method_GetValue, serviceImpl.GetValue) + .AddMethod(__Method_SetValue, serviceImpl.SetValue) + .AddMethod(__Method_DeleteKey, serviceImpl.DeleteKey) + .AddMethod(__Method_ScanKeys, serviceImpl.ScanKeys).Build(); + } + + /// Register service method with a service binder with or without implementation. Useful when customizing the service binding logic. + /// Note: this method is part of an experimental API that can change or be removed without any prior notice. + /// Service methods will be bound by calling AddMethod on this object. + /// An object implementing the server-side handling logic. + public static void BindService(grpc::ServiceBinderBase serviceBinder, KvStoreBase serviceImpl) + { + serviceBinder.AddMethod(__Method_GetValue, serviceImpl == null ? null : new grpc::UnaryServerMethod(serviceImpl.GetValue)); + serviceBinder.AddMethod(__Method_SetValue, serviceImpl == null ? null : new grpc::UnaryServerMethod(serviceImpl.SetValue)); + serviceBinder.AddMethod(__Method_DeleteKey, serviceImpl == null ? null : new grpc::UnaryServerMethod(serviceImpl.DeleteKey)); + serviceBinder.AddMethod(__Method_ScanKeys, serviceImpl == null ? null : new grpc::ServerStreamingServerMethod(serviceImpl.ScanKeys)); + } + + } +} +#endregion diff --git a/src/Nitric.Sdk/Proto/topics/v1/Topics.cs b/src/Nitric.Sdk/Proto/topics/v1/Topics.cs index f85d37d..0f00cf4 100644 --- a/src/Nitric.Sdk/Proto/topics/v1/Topics.cs +++ b/src/Nitric.Sdk/Proto/topics/v1/Topics.cs @@ -25,8 +25,8 @@ static TopicsReflection() { byte[] descriptorData = global::System.Convert.FromBase64String( string.Concat( "CiNuaXRyaWMvcHJvdG8vdG9waWNzL3YxL3RvcGljcy5wcm90bxIWbml0cmlj", - "LnByb3RvLnRvcGljcy52MRocZ29vZ2xlL3Byb3RvYnVmL3N0cnVjdC5wcm90", - "bxoeZ29vZ2xlL3Byb3RvYnVmL2R1cmF0aW9uLnByb3RvIrgBCg1DbGllbnRN", + "LnByb3RvLnRvcGljcy52MRoeZ29vZ2xlL3Byb3RvYnVmL2R1cmF0aW9uLnBy", + "b3RvGhxnb29nbGUvcHJvdG9idWYvc3RydWN0LnByb3RvIrgBCg1DbGllbnRN", "ZXNzYWdlEgoKAmlkGAEgASgJEksKFHJlZ2lzdHJhdGlvbl9yZXF1ZXN0GAIg", "ASgLMisubml0cmljLnByb3RvLnRvcGljcy52MS5SZWdpc3RyYXRpb25SZXF1", "ZXN0SAASQwoQbWVzc2FnZV9yZXNwb25zZRgDIAEoCzInLm5pdHJpYy5wcm90", @@ -55,7 +55,7 @@ static TopicsReflection() { "dG9waWNzcGKqAhZOaXRyaWMuUHJvdG8uVG9waWNzLnYxygIWTml0cmljXFBy", "b3RvXFRvcGljc1xWMWIGcHJvdG8z")); descriptor = pbr::FileDescriptor.FromGeneratedCode(descriptorData, - new pbr::FileDescriptor[] { global::Google.Protobuf.WellKnownTypes.StructReflection.Descriptor, global::Google.Protobuf.WellKnownTypes.DurationReflection.Descriptor, }, + new pbr::FileDescriptor[] { global::Google.Protobuf.WellKnownTypes.DurationReflection.Descriptor, global::Google.Protobuf.WellKnownTypes.StructReflection.Descriptor, }, new pbr::GeneratedClrTypeInfo(null, null, new pbr::GeneratedClrTypeInfo[] { new pbr::GeneratedClrTypeInfo(typeof(global::Nitric.Proto.Topics.v1.ClientMessage), global::Nitric.Proto.Topics.v1.ClientMessage.Parser, new[]{ "Id", "RegistrationRequest", "MessageResponse" }, new[]{ "Content" }, null, null, null), new pbr::GeneratedClrTypeInfo(typeof(global::Nitric.Proto.Topics.v1.MessageRequest), global::Nitric.Proto.Topics.v1.MessageRequest.Parser, new[]{ "TopicName", "Message" }, null, null, null, null), diff --git a/src/Nitric.Sdk/Proto/websockets/v1/Websockets.cs b/src/Nitric.Sdk/Proto/websockets/v1/Websockets.cs index d860c53..1fe3f6c 100644 --- a/src/Nitric.Sdk/Proto/websockets/v1/Websockets.cs +++ b/src/Nitric.Sdk/Proto/websockets/v1/Websockets.cs @@ -40,47 +40,47 @@ static WebsocketsReflection() { "Cgdjb250ZW50IhYKFFJlZ2lzdHJhdGlvblJlc3BvbnNlIm4KE1JlZ2lzdHJh", "dGlvblJlcXVlc3QSEwoLc29ja2V0X25hbWUYASABKAkSQgoKZXZlbnRfdHlw", "ZRgCIAEoDjIuLm5pdHJpYy5wcm90by53ZWJzb2NrZXRzLnYxLldlYnNvY2tl", - "dEV2ZW50VHlwZSK5AgoVV2Vic29ja2V0RXZlbnRSZXF1ZXN0EhMKC3NvY2tl", - "dF9uYW1lGAEgASgJEhQKDGNvbm5lY3Rpb25JZBgCIAEoCRJKCgpjb25uZWN0", - "aW9uGAogASgLMjQubml0cmljLnByb3RvLndlYnNvY2tldHMudjEuV2Vic29j", - "a2V0Q29ubmVjdGlvbkV2ZW50SAASUAoNZGlzY29ubmVjdGlvbhgLIAEoCzI3", - "Lm5pdHJpYy5wcm90by53ZWJzb2NrZXRzLnYxLldlYnNvY2tldERpc2Nvbm5l", - "Y3Rpb25FdmVudEgAEkQKB21lc3NhZ2UYDCABKAsyMS5uaXRyaWMucHJvdG8u", - "d2Vic29ja2V0cy52MS5XZWJzb2NrZXRNZXNzYWdlRXZlbnRIAEIRCg93ZWJz", - "b2NrZXRfZXZlbnQiGwoKUXVlcnlWYWx1ZRINCgV2YWx1ZRgBIAMoCSLPAQoN", - "U2VydmVyTWVzc2FnZRIKCgJpZBgBIAEoCRJRChVyZWdpc3RyYXRpb25fcmVz", - "cG9uc2UYAiABKAsyMC5uaXRyaWMucHJvdG8ud2Vic29ja2V0cy52MS5SZWdp", - "c3RyYXRpb25SZXNwb25zZUgAElQKF3dlYnNvY2tldF9ldmVudF9yZXF1ZXN0", - "GAMgASgLMjEubml0cmljLnByb3RvLndlYnNvY2tldHMudjEuV2Vic29ja2V0", - "RXZlbnRSZXF1ZXN0SABCCQoHY29udGVudCKGAQoWV2Vic29ja2V0RXZlbnRS", - "ZXNwb25zZRJWChNjb25uZWN0aW9uX3Jlc3BvbnNlGAogASgLMjcubml0cmlj", - "LnByb3RvLndlYnNvY2tldHMudjEuV2Vic29ja2V0Q29ubmVjdGlvblJlc3Bv", - "bnNlSABCFAoSd2Vic29ja2V0X3Jlc3BvbnNlItMBChhXZWJzb2NrZXRDb25u", - "ZWN0aW9uRXZlbnQSWwoMcXVlcnlfcGFyYW1zGAEgAygLMkUubml0cmljLnBy", - "b3RvLndlYnNvY2tldHMudjEuV2Vic29ja2V0Q29ubmVjdGlvbkV2ZW50LlF1", - "ZXJ5UGFyYW1zRW50cnkaWgoQUXVlcnlQYXJhbXNFbnRyeRILCgNrZXkYASAB", - "KAkSNQoFdmFsdWUYAiABKAsyJi5uaXRyaWMucHJvdG8ud2Vic29ja2V0cy52", - "MS5RdWVyeVZhbHVlOgI4ASItChtXZWJzb2NrZXRDb25uZWN0aW9uUmVzcG9u", - "c2USDgoGcmVqZWN0GAEgASgIIh0KG1dlYnNvY2tldERpc2Nvbm5lY3Rpb25F", - "dmVudCIlChVXZWJzb2NrZXRNZXNzYWdlRXZlbnQSDAoEYm9keRgBIAEoDCo+", - "ChJXZWJzb2NrZXRFdmVudFR5cGUSCwoHQ29ubmVjdBAAEg4KCkRpc2Nvbm5l", - "Y3QQARILCgdNZXNzYWdlEAIyigMKCVdlYnNvY2tldBJyCgtTZW5kTWVzc2Fn", - "ZRIwLm5pdHJpYy5wcm90by53ZWJzb2NrZXRzLnYxLldlYnNvY2tldFNlbmRS", - "ZXF1ZXN0GjEubml0cmljLnByb3RvLndlYnNvY2tldHMudjEuV2Vic29ja2V0", - "U2VuZFJlc3BvbnNlEowBCg9DbG9zZUNvbm5lY3Rpb24SOy5uaXRyaWMucHJv", - "dG8ud2Vic29ja2V0cy52MS5XZWJzb2NrZXRDbG9zZUNvbm5lY3Rpb25SZXF1", - "ZXN0Gjwubml0cmljLnByb3RvLndlYnNvY2tldHMudjEuV2Vic29ja2V0Q2xv", - "c2VDb25uZWN0aW9uUmVzcG9uc2USegoNU29ja2V0RGV0YWlscxIzLm5pdHJp", - "Yy5wcm90by53ZWJzb2NrZXRzLnYxLldlYnNvY2tldERldGFpbHNSZXF1ZXN0", - "GjQubml0cmljLnByb3RvLndlYnNvY2tldHMudjEuV2Vic29ja2V0RGV0YWls", - "c1Jlc3BvbnNlMnwKEFdlYnNvY2tldEhhbmRsZXISaAoMSGFuZGxlRXZlbnRz", - "Eikubml0cmljLnByb3RvLndlYnNvY2tldHMudjEuQ2xpZW50TWVzc2FnZRop", - "Lm5pdHJpYy5wcm90by53ZWJzb2NrZXRzLnYxLlNlcnZlck1lc3NhZ2UoATAB", - "QrYBCh1pby5uaXRyaWMucHJvdG8ud2Vic29ja2V0cy52MUIRV2Vic29ja2V0", - "c1NlcnZpY2VQAVpGZ2l0aHViLmNvbS9uaXRyaWN0ZWNoL25pdHJpYy9jb3Jl", - "L3BrZy9wcm90by93ZWJzb2NrZXRzL3YxO3dlYnNvY2tldHNwYqoCGk5pdHJp", - "Yy5Qcm90by5XZWJzb2NrZXRzLnYxygIaTml0cmljXFByb3RvXFdlYnNvY2tl", - "dHNcVjFiBnByb3RvMw==")); + "dEV2ZW50VHlwZSK6AgoVV2Vic29ja2V0RXZlbnRSZXF1ZXN0EhMKC3NvY2tl", + "dF9uYW1lGAEgASgJEhUKDWNvbm5lY3Rpb25faWQYAiABKAkSSgoKY29ubmVj", + "dGlvbhgKIAEoCzI0Lm5pdHJpYy5wcm90by53ZWJzb2NrZXRzLnYxLldlYnNv", + "Y2tldENvbm5lY3Rpb25FdmVudEgAElAKDWRpc2Nvbm5lY3Rpb24YCyABKAsy", + "Ny5uaXRyaWMucHJvdG8ud2Vic29ja2V0cy52MS5XZWJzb2NrZXREaXNjb25u", + "ZWN0aW9uRXZlbnRIABJECgdtZXNzYWdlGAwgASgLMjEubml0cmljLnByb3Rv", + "LndlYnNvY2tldHMudjEuV2Vic29ja2V0TWVzc2FnZUV2ZW50SABCEQoPd2Vi", + "c29ja2V0X2V2ZW50IhsKClF1ZXJ5VmFsdWUSDQoFdmFsdWUYASADKAkizwEK", + "DVNlcnZlck1lc3NhZ2USCgoCaWQYASABKAkSUQoVcmVnaXN0cmF0aW9uX3Jl", + "c3BvbnNlGAIgASgLMjAubml0cmljLnByb3RvLndlYnNvY2tldHMudjEuUmVn", + "aXN0cmF0aW9uUmVzcG9uc2VIABJUChd3ZWJzb2NrZXRfZXZlbnRfcmVxdWVz", + "dBgDIAEoCzIxLm5pdHJpYy5wcm90by53ZWJzb2NrZXRzLnYxLldlYnNvY2tl", + "dEV2ZW50UmVxdWVzdEgAQgkKB2NvbnRlbnQihgEKFldlYnNvY2tldEV2ZW50", + "UmVzcG9uc2USVgoTY29ubmVjdGlvbl9yZXNwb25zZRgKIAEoCzI3Lm5pdHJp", + "Yy5wcm90by53ZWJzb2NrZXRzLnYxLldlYnNvY2tldENvbm5lY3Rpb25SZXNw", + "b25zZUgAQhQKEndlYnNvY2tldF9yZXNwb25zZSLTAQoYV2Vic29ja2V0Q29u", + "bmVjdGlvbkV2ZW50ElsKDHF1ZXJ5X3BhcmFtcxgBIAMoCzJFLm5pdHJpYy5w", + "cm90by53ZWJzb2NrZXRzLnYxLldlYnNvY2tldENvbm5lY3Rpb25FdmVudC5R", + "dWVyeVBhcmFtc0VudHJ5GloKEFF1ZXJ5UGFyYW1zRW50cnkSCwoDa2V5GAEg", + "ASgJEjUKBXZhbHVlGAIgASgLMiYubml0cmljLnByb3RvLndlYnNvY2tldHMu", + "djEuUXVlcnlWYWx1ZToCOAEiLQobV2Vic29ja2V0Q29ubmVjdGlvblJlc3Bv", + "bnNlEg4KBnJlamVjdBgBIAEoCCIdChtXZWJzb2NrZXREaXNjb25uZWN0aW9u", + "RXZlbnQiJQoVV2Vic29ja2V0TWVzc2FnZUV2ZW50EgwKBGJvZHkYASABKAwq", + "PgoSV2Vic29ja2V0RXZlbnRUeXBlEgsKB0Nvbm5lY3QQABIOCgpEaXNjb25u", + "ZWN0EAESCwoHTWVzc2FnZRACMooDCglXZWJzb2NrZXQScgoLU2VuZE1lc3Nh", + "Z2USMC5uaXRyaWMucHJvdG8ud2Vic29ja2V0cy52MS5XZWJzb2NrZXRTZW5k", + "UmVxdWVzdBoxLm5pdHJpYy5wcm90by53ZWJzb2NrZXRzLnYxLldlYnNvY2tl", + "dFNlbmRSZXNwb25zZRKMAQoPQ2xvc2VDb25uZWN0aW9uEjsubml0cmljLnBy", + "b3RvLndlYnNvY2tldHMudjEuV2Vic29ja2V0Q2xvc2VDb25uZWN0aW9uUmVx", + "dWVzdBo8Lm5pdHJpYy5wcm90by53ZWJzb2NrZXRzLnYxLldlYnNvY2tldENs", + "b3NlQ29ubmVjdGlvblJlc3BvbnNlEnoKDVNvY2tldERldGFpbHMSMy5uaXRy", + "aWMucHJvdG8ud2Vic29ja2V0cy52MS5XZWJzb2NrZXREZXRhaWxzUmVxdWVz", + "dBo0Lm5pdHJpYy5wcm90by53ZWJzb2NrZXRzLnYxLldlYnNvY2tldERldGFp", + "bHNSZXNwb25zZTJ8ChBXZWJzb2NrZXRIYW5kbGVyEmgKDEhhbmRsZUV2ZW50", + "cxIpLm5pdHJpYy5wcm90by53ZWJzb2NrZXRzLnYxLkNsaWVudE1lc3NhZ2Ua", + "KS5uaXRyaWMucHJvdG8ud2Vic29ja2V0cy52MS5TZXJ2ZXJNZXNzYWdlKAEw", + "AUK2AQodaW8ubml0cmljLnByb3RvLndlYnNvY2tldHMudjFCEVdlYnNvY2tl", + "dHNTZXJ2aWNlUAFaRmdpdGh1Yi5jb20vbml0cmljdGVjaC9uaXRyaWMvY29y", + "ZS9wa2cvcHJvdG8vd2Vic29ja2V0cy92MTt3ZWJzb2NrZXRzcGKqAhpOaXRy", + "aWMuUHJvdG8uV2Vic29ja2V0cy52McoCGk5pdHJpY1xQcm90b1xXZWJzb2Nr", + "ZXRzXFYxYgZwcm90bzM=")); descriptor = pbr::FileDescriptor.FromGeneratedCode(descriptorData, new pbr::FileDescriptor[] { }, new pbr::GeneratedClrTypeInfo(new[] {typeof(global::Nitric.Proto.Websockets.v1.WebsocketEventType), }, null, new pbr::GeneratedClrTypeInfo[] { @@ -1941,7 +1941,7 @@ public string SocketName { } } - /// Field number for the "connectionId" field. + /// Field number for the "connection_id" field. public const int ConnectionIdFieldNumber = 2; private string connectionId_ = ""; /// diff --git a/src/Nitric.Sdk/Queue/Task.cs b/src/Nitric.Sdk/Queue/Message.cs similarity index 80% rename from src/Nitric.Sdk/Queue/Task.cs rename to src/Nitric.Sdk/Queue/Message.cs index 37c955c..b55b8c1 100644 --- a/src/Nitric.Sdk/Queue/Task.cs +++ b/src/Nitric.Sdk/Queue/Message.cs @@ -15,6 +15,7 @@ using System; using Nitric.Sdk.Common; using Nitric.Proto.Queues.v1; +using System.Threading.Tasks; namespace Nitric.Sdk.Queue { @@ -48,11 +49,29 @@ public class ReceivedMessage /// public void Complete() { - if (string.IsNullOrEmpty(this.LeaseId)) + var request = new QueueCompleteRequest + { + QueueName = this.Queue.Name, + LeaseId = this.LeaseId, + }; + + try + { + Queue.Queues.Client.Complete(request); + } + catch (Grpc.Core.RpcException re) { - throw new ArgumentNullException(nameof(this.LeaseId)); + throw NitricException.FromRpcException(re); } + } + /// + /// Complete this task and remove it from the source queue. + /// + /// + /// + public async Task CompleteAsync() + { var request = new QueueCompleteRequest { QueueName = this.Queue.Name, @@ -61,7 +80,7 @@ public void Complete() try { - Queue.Queues.Client.Complete(request); + await Queue.Queues.Client.CompleteAsync(request); } catch (Grpc.Core.RpcException re) { diff --git a/src/Nitric.Sdk/Resource/BucketResource.cs b/src/Nitric.Sdk/Resource/BucketResource.cs index e318a68..60ca6ed 100644 --- a/src/Nitric.Sdk/Resource/BucketResource.cs +++ b/src/Nitric.Sdk/Resource/BucketResource.cs @@ -127,7 +127,7 @@ public void On( /// /// The permissions that the function has to access the bucket. /// A reference to the bucket. - public Bucket With(BucketPermission permission, params BucketPermission[] permissions) + public Bucket Allow(BucketPermission permission, params BucketPermission[] permissions) { var allPerms = new List { permission }; allPerms.AddRange(permissions); diff --git a/src/Nitric.Sdk/Resource/KeyValueStoreResource.cs b/src/Nitric.Sdk/Resource/KeyValueStoreResource.cs index 22595cb..dd8f352 100644 --- a/src/Nitric.Sdk/Resource/KeyValueStoreResource.cs +++ b/src/Nitric.Sdk/Resource/KeyValueStoreResource.cs @@ -16,7 +16,6 @@ using Nitric.Proto.Resources.v1; using Nitric.Sdk.KeyValueStore; using Action = Nitric.Proto.Resources.v1.Action; -using NitricResource = Nitric.Proto.Resources.v1.ResourceIdentifier; using ResourceType = Nitric.Proto.Resources.v1.ResourceType; namespace Nitric.Sdk.Resource @@ -74,13 +73,13 @@ protected override IEnumerable PermissionsToActions(IEnumerable With(KeyValueStorePermission permission, params KeyValueStorePermission[] permissions) + public KeyValueStore Allow(KeyValueStorePermission permission, params KeyValueStorePermission[] permissions) { var allPerms = new List { permission }; allPerms.AddRange(permissions); this.RegisterPolicy(allPerms); - return new KeyValueStoreClient().Store(this.Name); + return new KeyValueStoreClient().KV(this.Name); } } } diff --git a/src/Nitric.Sdk/Resource/QueueResource.cs b/src/Nitric.Sdk/Resource/QueueResource.cs index 75425b6..79b969f 100644 --- a/src/Nitric.Sdk/Resource/QueueResource.cs +++ b/src/Nitric.Sdk/Resource/QueueResource.cs @@ -69,7 +69,7 @@ protected override IEnumerable PermissionsToActions(IEnumerable /// The permissions that the function has to access the queue. /// A reference to the queue. - public Queue.Queue With(QueuePermission permission, params QueuePermission[] permissions) + public Queue.Queue Allow(QueuePermission permission, params QueuePermission[] permissions) { var allPerms = new List { permission }; allPerms.AddRange(permissions); diff --git a/src/Nitric.Sdk/Resource/SecretResource.cs b/src/Nitric.Sdk/Resource/SecretResource.cs index b9ce3e7..782d552 100644 --- a/src/Nitric.Sdk/Resource/SecretResource.cs +++ b/src/Nitric.Sdk/Resource/SecretResource.cs @@ -64,7 +64,7 @@ protected override IEnumerable PermissionsToActions(IEnumerable)new List(), (acc, x) => acc.Concat(actionMap[x])).Distinct(); } - public Secret.Secret With(SecretPermission permission, params SecretPermission[] permissions) + public Secret.Secret Allow(SecretPermission permission, params SecretPermission[] permissions) { var allPerms = new List { permission }; allPerms.AddRange(permissions); diff --git a/src/Nitric.Sdk/Resource/TopicResource.cs b/src/Nitric.Sdk/Resource/TopicResource.cs index 2fe61a0..e2e78a8 100644 --- a/src/Nitric.Sdk/Resource/TopicResource.cs +++ b/src/Nitric.Sdk/Resource/TopicResource.cs @@ -93,7 +93,7 @@ public void Subscribe(Func, MessageContext> handler) /// /// The permissions that the function has to access the topic. /// A reference to the topic. - public Topic With(TopicPermission permission, params TopicPermission[] permissions) + public Topic Allow(TopicPermission permission, params TopicPermission[] permissions) { var allPerms = new List { permission }; allPerms.AddRange(permissions); diff --git a/src/Nitric.Sdk/Secret/Secret.cs b/src/Nitric.Sdk/Secret/Secret.cs index 7d0a124..508d9ef 100644 --- a/src/Nitric.Sdk/Secret/Secret.cs +++ b/src/Nitric.Sdk/Secret/Secret.cs @@ -75,11 +75,6 @@ public SecretVersion Latest() public SecretVersion Put(string value) { if (string.IsNullOrEmpty(value)) - { - throw new ArgumentNullException("value"); - } - - if (value == null || value.Length == 0) { throw new ArgumentNullException(nameof(value)); } @@ -116,11 +111,6 @@ public SecretVersion Put(string value) public async Task PutAsync(string value) { if (string.IsNullOrEmpty(value)) - { - throw new ArgumentNullException("value"); - } - - if (value == null || value.Length == 0) { throw new ArgumentNullException(nameof(value)); } diff --git a/src/Nitric.Sdk/Secret/SecretVersion.cs b/src/Nitric.Sdk/Secret/SecretVersion.cs index 4994702..6f51304 100644 --- a/src/Nitric.Sdk/Secret/SecretVersion.cs +++ b/src/Nitric.Sdk/Secret/SecretVersion.cs @@ -36,16 +36,6 @@ public class SecretVersion internal SecretVersion(Secret secret, string id) { - if (secret == null || string.IsNullOrEmpty(secret.Name)) - { - throw new ArgumentNullException(nameof(secret)); - } - - if (string.IsNullOrEmpty(id)) - { - throw new ArgumentNullException(nameof(id)); - } - this.Secret = secret; this.Id = id; } diff --git a/src/Nitric.Sdk/Service/BlobEventContext.cs b/src/Nitric.Sdk/Service/BlobEventContext.cs index d7560f3..d40fcf5 100644 --- a/src/Nitric.Sdk/Service/BlobEventContext.cs +++ b/src/Nitric.Sdk/Service/BlobEventContext.cs @@ -14,7 +14,6 @@ using System; using Nitric.Proto.Storage.v1; -using Nitric.Sdk.Storage; using ProtoBlobEventResponse = Nitric.Proto.Storage.v1.BlobEventResponse; using ProtoBlobEventType = Nitric.Proto.Storage.v1.BlobEventType; diff --git a/src/Nitric.Sdk/Service/FileEventContext.cs b/src/Nitric.Sdk/Service/FileEventContext.cs new file mode 100644 index 0000000..4606501 --- /dev/null +++ b/src/Nitric.Sdk/Service/FileEventContext.cs @@ -0,0 +1,132 @@ +// Copyright 2021, Nitric Technologies Pty Ltd. +// +// 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. + +using System; +using Nitric.Proto.Storage.v1; +using Nitric.Sdk.Storage; +using ProtoBlobEventResponse = Nitric.Proto.Storage.v1.BlobEventResponse; +using ProtoBlobEventType = Nitric.Proto.Storage.v1.BlobEventType; + +namespace Nitric.Sdk.Service +{ + /// + /// Represents a bucket notification being created by a write or delete event in the bucket + /// + public class FileEventRequest : TriggerRequest + { + /// + /// A reference to the file that triggered this request + /// + public File File { get; private set; } + + /// + /// The type of event that triggered this request + /// + /// + public BlobEventType NotificationType { get; private set; } + + /// + /// Construct a bucket notification request + /// + /// the file that triggered the notification + /// the type of bucket notification + public FileEventRequest(File file, BlobEventType notificationType) : base() + { + this.File = file; + this.NotificationType = notificationType; + } + } + + /// + /// Represents the results of processing a bucket notification. + /// + public class FileEventResponse : TriggerResponse + { + /// + /// Indicates whether the event was successfully processed. + /// + /// If this value is false, the event may be resent. + /// + public bool Success { get; set; } + + /// + /// Construct a bucket notification response. + /// + /// Indicates whether the event was successfully processed. + public FileEventResponse(bool success) + { + this.Success = success; + } + } + + /// + /// Represents the request/response context for a permissioned bucket notification. + /// + public class FileEventContext : TriggerContext + { + /// + /// Construct a new BucketNotificationContext. + /// + /// The request object + /// The response object + public FileEventContext(string id, FileEventRequest req, FileEventResponse res) : base(id, req, res) + { + } + + /// + /// Construct a bucket notification context from a trigger request gRPC object. + /// + /// The trigger to convert into a BucketNotificationContext. + /// The bucket notification worker options describing the worker options. + /// the new bucket notification context + public static FileEventContext FromRequest(ServerMessage trigger, Bucket bucket) + { + var notificationType = FromGrpcBlobEventType(trigger.BlobEventRequest.BlobEvent.Type); + + return new FileEventContext( + trigger.Id, + new FileEventRequest( + bucket.File(trigger.BlobEventRequest.BlobEvent.Key), + notificationType + ), + new FileEventResponse(true)); + } + + /// + /// Convert a gRPC blob event type into a SDK blob event type. + /// + /// + /// + /// + private static BlobEventType FromGrpcBlobEventType( + ProtoBlobEventType blobEventType) + { + return blobEventType switch + { + ProtoBlobEventType.Created => BlobEventType.Write, + ProtoBlobEventType.Deleted => BlobEventType.Delete, + _ => throw new ArgumentException("Unsupported blob event type") + }; + } + + /// + /// Create a gRPC trigger response from this context. + /// + /// the new trigger response + public ClientMessage ToResponse() + { + return new ClientMessage { Id = Id, BlobEventResponse = new ProtoBlobEventResponse { Success = this.Res.Success } }; + } + } +} diff --git a/src/Nitric.Sdk/Storage/Bucket.cs b/src/Nitric.Sdk/Storage/Bucket.cs index bd7b951..79acbf2 100644 --- a/src/Nitric.Sdk/Storage/Bucket.cs +++ b/src/Nitric.Sdk/Storage/Bucket.cs @@ -14,6 +14,7 @@ using System; using System.Collections.Generic; +using System.Threading.Tasks; using Nitric.Proto.Storage.v1; using Nitric.Sdk.Service; using Nitric.Sdk.Worker; @@ -46,37 +47,78 @@ internal Bucket(StorageClient storage, string name) /// The blobs name/path /// The blob reference. /// - public Blob File(string key) + public File File(string key) { if (string.IsNullOrEmpty(key)) { throw new ArgumentNullException(nameof(key)); } - return new Blob(this, key); + return new File(this, key); } /// - /// Get a list of blobs in a bucket. + /// Get a list of files in a bucket. /// - /// All the files in the bucket as Nitric blob references. - public List Files() + /// The prefix to filter file names by. + /// All the files in the bucket as Nitric file references. + public List Files(string prefix = "") { var request = new StorageListBlobsRequest { BucketName = this.Name, + Prefix = prefix, }; - var resp = this.Storage.Client.ListBlobs(request); + try + { + var resp = this.Storage.Client.ListBlobs(request); + + var files = new List(); - List files = new List(); + foreach (ProtoBlob file in resp.Blobs) + { + files.Add(new File(this, file.Key)); + } - foreach (ProtoBlob file in resp.Blobs) + return files; + } + catch (Grpc.Core.RpcException e) { - files.Add(new Blob(this, file.Key)); + throw Common.NitricException.FromRpcException(e); } + } + + /// + /// Get a list of files in a bucket. + /// + /// The prefix to filter file names by. + /// All the files in the bucket as Nitric file references. + public async Task> FilesAsync(string prefix = "") + { + var request = new StorageListBlobsRequest + { + BucketName = this.Name, + Prefix = prefix, + }; - return files; + try + { + var resp = await this.Storage.Client.ListBlobsAsync(request); + + var files = new List(); + + foreach (ProtoBlob file in resp.Blobs) + { + files.Add(new File(this, file.Key)); + } + + return files; + } + catch (Grpc.Core.RpcException e) + { + throw Common.NitricException.FromRpcException(e); + } } /// @@ -122,5 +164,14 @@ public void On( Nitric.RegisterWorker(notificationWorker); } + + /// + /// Return a string representation of the file. Will not contain the file contents. + /// + /// + public override string ToString() + { + return GetType().Name + "[name=" + Name + "]"; + } } } diff --git a/src/Nitric.Sdk/Storage/File.cs b/src/Nitric.Sdk/Storage/File.cs index 809b639..11e76c0 100644 --- a/src/Nitric.Sdk/Storage/File.cs +++ b/src/Nitric.Sdk/Storage/File.cs @@ -27,32 +27,32 @@ namespace Nitric.Sdk.Storage public enum SignedMode { /// - /// Download a blob from a bucket. + /// Download a file from a bucket. /// Read, /// - /// Upload a blob to a bucket. + /// Upload a file to a bucket. /// Write, } /// - /// A reference to a specific blob in a bucket. + /// A reference to a specific file in a bucket. /// - public class Blob + public class File { private readonly Bucket Bucket; public string Name { get; private set; } - internal Blob(Bucket bucket, string key) + internal File(Bucket bucket, string key) { this.Bucket = bucket; this.Name = key; } /// - /// Create or update the contents of the blob. + /// Create or update the contents of the file. /// /// The contents to write. /// @@ -75,7 +75,7 @@ public void Write(byte[] body) } /// - /// Create or update the contents of the blob. + /// Create or update the contents of the file. /// /// The contents to write. /// @@ -98,7 +98,7 @@ public void Write(string body) } /// - /// Create or update the contents of the blob. + /// Create or update the contents of the file. /// /// The contents to write. /// @@ -121,7 +121,7 @@ public async Task WriteAsync(byte[] body) } /// - /// Create or update the contents of the blob. + /// Create or update the contents of the file. /// /// The contents to write. /// @@ -144,9 +144,9 @@ public async Task WriteAsync(string body) } /// - /// Retrieve the contents of a blob. + /// Retrieve the contents of a file. /// - /// The blob contents. + /// The file contents. /// public byte[] Read() { @@ -167,9 +167,9 @@ public byte[] Read() } /// - /// Retrieve the contents of a blob. + /// Retrieve the contents of a file. /// - /// The blob contents. + /// The file contents. /// public async Task ReadAsync() { @@ -190,7 +190,7 @@ public async Task ReadAsync() } /// - /// Delete the blob. + /// Delete the file. /// /// public void Delete() @@ -211,7 +211,7 @@ public void Delete() } /// - /// Delete the blob. + /// Delete the file. /// /// public async Task DeleteAsync() @@ -232,9 +232,29 @@ public async Task DeleteAsync() } /// - /// Create a presigned URL for reading or writing for the given blob reference. + /// Create a presigned URL for writing to a given file reference. /// - /// The mode the URL will access the blob with. E.g. reading or writing. + /// How long the URL should be valid for in seconds. Defaults to 600 seconds (10 minutes). + /// The signed URL for writing. + public string GetUploadUrl(int expiry = 600) + { + return this.PreSignUrl(SignedMode.Write, expiry); + } + + /// + /// Create a presigned URL for reading a given file reference. + /// + /// How long the URL should be valid for in seconds. Defaults to 600 seconds (10 minutes). + /// The signed URL for reading. + public string GetDownloadUrl(int expiry = 600) + { + return this.PreSignUrl(SignedMode.Read, expiry); + } + + /// + /// Create a presigned URL for reading or writing for the given file reference. + /// + /// The mode the URL will access the file with. E.g. reading or writing. /// How long the URL should be valid for in seconds (max of 604800). /// The signed URL for reading or writing internal string PreSignUrl(SignedMode mode, int expiry) @@ -262,29 +282,30 @@ internal string PreSignUrl(SignedMode mode, int expiry) } /// - /// Create a presigned URL for reading a given blob reference. + /// Create a presigned URL for reading a given file reference. /// /// How long the URL should be valid for in seconds. Defaults to 600 seconds (10 minutes). /// The signed URL for reading. - public string GetDownloadUrl(int expiry = 600) + public async Task GetDownloadUrlAsync(int expiry = 600) { - return this.PreSignUrl(SignedMode.Write, expiry); + return await this.PreSignUrlAsync(SignedMode.Read, expiry); } + /// - /// Create a presigned URL for writing to a given blob reference. + /// Create a presigned URL for writing to a given file reference. /// /// How long the URL should be valid for in seconds. Defaults to 600 seconds (10 minutes). /// The signed URL for writing. - public string GetUploadUrl(int expiry = 600) + public async Task GetUploadUrlAsync(int expiry = 600) { - return this.PreSignUrl(SignedMode.Read, expiry); + return await this.PreSignUrlAsync(SignedMode.Write, expiry); } /// - /// Create a presigned URL for reading or writing for the given blob reference. + /// Create a presigned URL for reading or writing for the given file reference. /// - /// The mode the URL will access the blob with. E.g. reading or writing. + /// The mode the URL will access the file with. E.g. reading or writing. /// How long the URL should be valid for in seconds (max of 604800). /// The signed URL for reading or writing internal async Task PreSignUrlAsync(SignedMode mode, int expiry) @@ -312,27 +333,7 @@ internal async Task PreSignUrlAsync(SignedMode mode, int expiry) } /// - /// Create a presigned URL for reading a given blob reference. - /// - /// How long the URL should be valid for in seconds. Defaults to 600 seconds (10 minutes). - /// The signed URL for reading. - public async Task GetDownloadUrlAsync(int expiry = 600) - { - return await this.PreSignUrlAsync(SignedMode.Write, expiry); - } - - /// - /// Create a presigned URL for writing to a given blob reference. - /// - /// How long the URL should be valid for in seconds. Defaults to 600 seconds (10 minutes). - /// The signed URL for writing. - public async Task GetUploadUrlAsync(int expiry = 600) - { - return await this.PreSignUrlAsync(SignedMode.Read, expiry); - } - - /// - /// Return a string representation of the blob. Will not contain the blob contents. + /// Return a string representation of the file. Will not contain the file contents. /// /// public override string ToString() diff --git a/src/Nitric.Sdk/Worker/ApiWorker.cs b/src/Nitric.Sdk/Worker/ApiWorker.cs index 46b6d15..ab5f06c 100644 --- a/src/Nitric.Sdk/Worker/ApiWorker.cs +++ b/src/Nitric.Sdk/Worker/ApiWorker.cs @@ -51,7 +51,7 @@ public override async Task Start() if (req.RegistrationResponse != null) { // Schedule connected with Nitric server. - } + } else if (req.HttpRequest != null) { var ctx = HttpContext.FromRequest(req); diff --git a/src/Nitric.Sdk/Worker/FileEventWorker.cs b/src/Nitric.Sdk/Worker/FileEventWorker.cs new file mode 100644 index 0000000..f1392f8 --- /dev/null +++ b/src/Nitric.Sdk/Worker/FileEventWorker.cs @@ -0,0 +1,80 @@ +// Copyright 2021, Nitric Technologies Pty Ltd. +// +// 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. + +using System.Threading; +using System.Threading.Tasks; +using Nitric.Sdk.Common; +using Nitric.Proto.Storage.v1; +using GrpcClient = Nitric.Proto.Storage.v1.StorageListener.StorageListenerClient; +using Nitric.Sdk.Service; +using Nitric.Sdk.Storage; +using System; + +namespace Nitric.Sdk.Worker +{ + public class FileEventWorker : AbstractWorker + { + readonly private RegistrationRequest RegistrationRequest; + readonly private Bucket bucket; + + public FileEventWorker(RegistrationRequest request, Bucket bucket, Func middleware) : base(middleware) + { + this.RegistrationRequest = request; + this.bucket = bucket; + } + + public FileEventWorker(RegistrationRequest request, params Middleware[] middlewares) : base(middlewares) + { + this.RegistrationRequest = request; + } + + public override async Task Start() + { + var client = new GrpcClient(GrpcChannelProvider.GetChannel()); + + var stream = client.Listen(); + + await stream.RequestStream.WriteAsync(new ClientMessage { RegistrationRequest = RegistrationRequest }); + + while (await stream.ResponseStream.MoveNext(CancellationToken.None)) + { + var req = stream.ResponseStream.Current; + + if (req.RegistrationResponse != null) + { + // Bucket listener connected with Nitric server. + } + else if (req.BlobEventRequest != null) + { + var ctx = FileEventContext.FromRequest(req, this.bucket); + + try + { + ctx = this.Middleware(ctx); + } + catch (Exception err) + { + Console.WriteLine("Unhandled application error: {0}", err.ToString()); + ctx.Res.Success = false; + } + + await stream.RequestStream.WriteAsync(ctx.ToResponse()); + } + } + + await stream.RequestStream.CompleteAsync(); + } + } +} + diff --git a/test/Nitric.Sdk.Test/Api/KeyValueStore/KeyValueStoreClientTest.cs b/test/Nitric.Sdk.Test/Api/KeyValueStore/KeyValueStoreClientTest.cs deleted file mode 100644 index 5e2e1f6..0000000 --- a/test/Nitric.Sdk.Test/Api/KeyValueStore/KeyValueStoreClientTest.cs +++ /dev/null @@ -1,176 +0,0 @@ -using System; -using System.Collections.Generic; -using Grpc.Core; -using Moq; -using Xunit; -using GrpcClient = Nitric.Proto.KeyValue.v1.KeyValue.KeyValueClient; -using Nitric.Sdk.KeyValueStore; -using Nitric.Proto.KeyValue.v1; - -namespace Nitric.Sdk.Test.Api.KeyValueStore -{ - public class TestProfile - { - public string Name { get; set; } - public int Age { get; set; } - public List Addresses { get; set; } - } - - public class KeyValueStoreClientTest - { - [Fact] - public void TestBuildKeyValueClient() - { - var storage = new KeyValueStoreClient(); - Assert.NotNull(storage); - } - - [Fact] - public void TestBuildKeyValueStoreWithName() - { - var store = new KeyValueStoreClient().Store("test-store"); - Assert.NotNull(store); - Assert.Equal("test-store", store.Name); - } - - [Fact] - public void TestBuildKeyValueStoreWithoutName() - { - Assert.Throws( - () => new KeyValueStoreClient().Store("") - ); - Assert.Throws( - () => new KeyValueStoreClient().Store(null) - ); - } - - [Fact] - public void TestSetToKeyValueStore() - { - var testProfile = new TestProfile - { - Name = "John Smith", - Age = 21, - Addresses = new List { "123 address street" } - }; - - var payload = Common.Struct.FromJsonSerializable(testProfile); - - var request = new KeyValueSetRequest - { - Content = payload, - Ref = new ValueRef - { - Key = "test-key", - Store = "test-store" - } - }; - - Mock gc = new Mock(); - gc.Setup(e => - e.Set(It.IsAny(), null, null, It.IsAny())) - .Returns(new KeyValueSetResponse()) - .Verifiable(); - - var kv = new KeyValueStoreClient(gc.Object).Store("test-store"); - - kv.Set("test-key", testProfile); - - gc.Verify( - t => t.Set(request, null, null, It.IsAny()), Times.Once); - } - - [Fact] - public void TestSetNullToKeyValueStore() - { - var request = new KeyValueSetRequest - { - Content = null, - Ref = new ValueRef - { - Key = "test-key", - Store = "test-store" - } - }; - - Mock gc = new Mock(); - gc.Setup(e => - e.Set(It.IsAny(), null, null, It.IsAny())) - .Returns(new KeyValueSetResponse()) - .Verifiable(); - - var kv = new KeyValueStoreClient(gc.Object).Store("test-store"); - - kv.Set("test-key", null); - - gc.Verify( - t => t.Set(request, null, null, It.IsAny()), Times.Once); - } - - [Fact] - public void TestGetToKeyValueStore() - { - var testProfile = new TestProfile - { - Name = "John Smith", - Age = 21, - Addresses = new List { "123 address street" } - }; - - var payload = Common.Struct.FromJsonSerializable(testProfile); - - var request = new KeyValueGetRequest - { - Ref = new ValueRef - { - Key = "test-key", - Store = "test-store" - } - }; - - Mock gc = new Mock(); - gc.Setup(e => - e.Get(It.IsAny(), null, null, It.IsAny())) - .Returns(new KeyValueGetResponse { Value = new Value { Content = payload, Ref = new ValueRef { Key = "test-key", Store = "test-store" } } }) - .Verifiable(); - - var kv = new KeyValueStoreClient(gc.Object).Store("test-store"); - - var profile = kv.Get("test-key"); - - Assert.Equal("John Smith", profile.Name); - Assert.Equal(21, profile.Age); - Assert.Equal("123 address street", profile.Addresses[0]); - - gc.Verify( - t => t.Get(request, null, null, It.IsAny()), Times.Once); - } - - [Fact] - public void TestDeleteKeyValuePair() - { - var request = new KeyValueDeleteRequest - { - Ref = new ValueRef - { - Key = "test-key", - Store = "test-store" - } - }; - - Mock gc = new Mock(); - gc.Setup(e => - e.Delete(It.IsAny(), null, null, It.IsAny())) - .Returns(new KeyValueDeleteResponse()) - .Verifiable(); - - var kv = new KeyValueStoreClient(gc.Object).Store("test-store"); - - kv.Delete("test-key"); - - gc.Verify( - t => t.Delete(request, null, null, It.IsAny()), Times.Once); - } - } -} - diff --git a/test/Nitric.Sdk.Test/Api/Queue/QueueClientTest.cs b/test/Nitric.Sdk.Test/Api/Queue/QueueClientTest.cs deleted file mode 100644 index 1559935..0000000 --- a/test/Nitric.Sdk.Test/Api/Queue/QueueClientTest.cs +++ /dev/null @@ -1,256 +0,0 @@ -// Copyright 2021, Nitric Technologies Pty Ltd. -// -// 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. - -using System; -using System.Collections.Generic; -using System.Linq; -using Google.Protobuf.WellKnownTypes; -using Grpc.Core; -using Moq; -using Nitric.Proto.Queues.v1; -using GrpcClient = Nitric.Proto.Queues.v1.Queues.QueuesClient; -using Nitric.Sdk.Queue; -using Xunit; - -namespace Nitric.Sdk.Test.Api.Queue -{ - public class QueueClientTest - { - [Fact] - public void TestBuildQueues() - { - var queues = new QueuesClient(); - Assert.NotNull(queues); - } - - [Fact] - public void TestBuildQueueWithName() - { - var queue = new QueuesClient().Queue("test-queue"); - Assert.NotNull(queue); - Assert.Equal("test-queue", queue.Name); - } - - [Fact] - public void TestBuildQueueWithoutName() - { - Assert.Throws( - () => new QueuesClient().Queue("") - ); - Assert.Throws( - () => new QueuesClient().Queue(null) - ); - } - - [Fact] - public void TestSendToNonExistentQueue() - { - Mock qc = new Mock(); - qc.Setup(e => - e.Enqueue(It.IsAny(), null, null, It.IsAny())) - .Throws(new RpcException(new Status(StatusCode.NotFound, "The specified queue does not exist"))) - .Verifiable(); - - var queue = new QueuesClient(qc.Object).Queue("test-queue"); - - try - { - queue.Enqueue(new TestProfile()); - } - catch (Common.NitricException ne) - { - Assert.Equal("Status(StatusCode=\"NotFound\", Detail=\"The specified queue does not exist\")", - ne.Message); - } - - qc.Verify( - t => t.Enqueue(It.IsAny(), null, null, It.IsAny()), - Times.Once); - } - - [Fact] - public void TestSendBatchWithFailedTasks() - { - FailedEnqueueMessage failedMessage = new FailedEnqueueMessage(); - failedMessage.Details = "I am a failed task... I failed my task"; - failedMessage.Message = new QueueMessage(); - - List failedMessages = new List - { - failedMessage, - }; - - var queueBatchResponse = new QueueEnqueueResponse(); - queueBatchResponse.FailedMessages.AddRange(failedMessages); - - Mock qc = new Mock(); - qc.Setup(e => e.Enqueue(It.IsAny(), null, null, - It.IsAny())) - .Returns(queueBatchResponse) - .Verifiable(); - - var queue = new QueuesClient(qc.Object).Queue("test-queue"); - - var failedTasksResp = queue.Enqueue(new TestProfile { }, new TestProfile { }); - - Assert.Equal("I am a failed task... I failed my task", failedTasksResp[0].Details); - - qc.Verify( - t => t.Enqueue(It.IsAny(), null, null, - It.IsAny()), Times.Once); - } - - [Fact] - public void TestSendBatchWithNoFailedTasks() - { - Mock qc = new Mock(); - qc.Setup(e => e.Enqueue(It.IsAny(), null, null, - It.IsAny())) - .Returns(new QueueEnqueueResponse()) - .Verifiable(); - - var queue = new QueuesClient(qc.Object).Queue("test-queue"); - - var failedTasks = queue.Enqueue(new TestProfile { }, new TestProfile { }); - - Assert.Empty(failedTasks); - - qc.Verify( - t => t.Enqueue(It.IsAny(), null, null, - It.IsAny()), Times.Once); - } - - [Fact] - public void TestReceiveTasks() - { - var messagePayload = Common.Struct.FromJsonSerializable(new TestProfile { Name = "John Smith" }); - var message = new DequeuedMessage - { - LeaseId = "1234", - Message = new QueueMessage { StructPayload = messagePayload }, - }; - - var messages = new List() { message }; - - var queueReceieveResponse = new QueueDequeueResponse(); - queueReceieveResponse.Messages.AddRange(messages); - - Mock qc = new Mock(); - qc.Setup(e => e.Dequeue(It.IsAny(), null, null, - It.IsAny())) - .Returns(queueReceieveResponse) - .Verifiable(); - - var queue = new QueuesClient(qc.Object).Queue("test-queue"); - - var response = queue.Dequeue(3); - - Assert.Equal("1234", response[0].LeaseId); - Assert.Equal("John Smith", response[0].Message.Name); - - qc.Verify( - t => t.Dequeue(It.IsAny(), null, null, - It.IsAny()), Times.Once); - } - - [Fact] - public void TestReceiveNoTasks() - { - Mock qc = new Mock(); - qc.Setup(e => e.Dequeue(It.IsAny(), null, null, - It.IsAny())) - .Returns(new QueueDequeueResponse()) - .Verifiable(); - - var queue = new QueuesClient(qc.Object).Queue("test-queue"); - - var response = queue.Dequeue(3); - - Assert.Empty(response); - - qc.Verify( - t => t.Dequeue(It.IsAny(), null, null, - It.IsAny()), Times.Once); - } - - [Fact] - public void TestSend() - { - Mock qc = new Mock(); - qc.Setup(e => - e.Enqueue(It.IsAny(), null, null, It.IsAny())) - .Returns(new QueueEnqueueResponse()) - .Verifiable(); - - var queue = new QueuesClient(qc.Object).Queue("test-queue"); - - queue.Enqueue(new TestProfile { Name = "John Smith", Age = 30, Addresses = new List { "123 street st" } }); - - qc.Verify( - t => t.Enqueue(It.IsAny(), null, null, It.IsAny()), - Times.Once); - } - - [Fact] - public void TestComplete() - { - var receivedTask = new ReceivedMessage - { - LeaseId = "1", - Message = new TestProfile { Name = "John Smith", Age = 30, Addresses = new List { "123 street st" } } - }; - - var payload = new Struct(); - payload.Fields.Add("Name", Value.ForString("John Smith")); - payload.Fields.Add("Age", Value.ForNumber(30.0)); - payload.Fields.Add("Addresses", Value.ForList(new[] { Value.ForString("123 street st") })); - - var tasks = new List() - { - new DequeuedMessage - { - Message = new QueueMessage - { - StructPayload = payload - }, - LeaseId = "1" - } - }; - - var queueReceieveResponse = new QueueDequeueResponse(); - queueReceieveResponse.Messages.AddRange(tasks); - - Mock qc = new Mock(); - qc.Setup(e => e.Dequeue(It.IsAny(), null, null, - It.IsAny())) - .Returns(queueReceieveResponse) - .Verifiable(); - - Mock qcr = new Mock(); - qc.Setup(e => e.Complete(It.IsAny(), null, null, - It.IsAny())) - .Verifiable(); - - var queue = new QueuesClient(qc.Object).Queue("test-queue"); - - var response = queue.Dequeue(3); - - response.ToList()[0].Complete(); - - qc.Verify( - t => t.Complete(It.IsAny(), null, null, - It.IsAny()), Times.Once); - } - } -} diff --git a/test/Nitric.Sdk.Test/Api/Storage/StorageClientTest.cs b/test/Nitric.Sdk.Test/Api/Storage/StorageClientTest.cs deleted file mode 100644 index 2ea5ba1..0000000 --- a/test/Nitric.Sdk.Test/Api/Storage/StorageClientTest.cs +++ /dev/null @@ -1,191 +0,0 @@ -// Copyright 2021, Nitric Technologies Pty Ltd. -// -// 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. - -using System; -using Grpc.Core; -using Moq; -using Nitric.Proto.Storage.v1; -using Xunit; -using GrpcClient = Nitric.Proto.Storage.v1.Storage.StorageClient; - -namespace Nitric.Sdk.Test.Api.Storage; - -public class StorageClientTest -{ - [Fact] - public void TestBuildStorage() - { - var storage = new Sdk.Storage.StorageClient(); - Assert.NotNull(storage); - } - - [Fact] - public void TestBuildBucketWithName() - { - var bucket = new Sdk.Storage.StorageClient().Bucket("test-bucket"); - Assert.NotNull(bucket); - Assert.Equal("test-bucket", bucket.Name); - } - - [Fact] - public void TestBuildBucketWithoutName() - { - Assert.Throws( - () => new Sdk.Storage.StorageClient().Bucket("") - ); - Assert.Throws( - () => new Sdk.Storage.StorageClient().Bucket(null) - ); - } - - [Fact] - public void TestBuildFileWithName() - { - var file = new Sdk.Storage.StorageClient().Bucket("test-bucket").File("test-file"); - Assert.NotNull(file); - Assert.Equal("test-file", file.Name); - } - - [Fact] - public void TestBuildFileWithoutName() - { - Assert.Throws( - () => new Sdk.Storage.StorageClient().Bucket("test-bucket").File("") - ); - Assert.Throws( - () => new Sdk.Storage.StorageClient().Bucket("test-bucket").File(null) - ); - } - - [Fact] - public void TestWrite() - { - var request = new StorageWriteRequest - { - BucketName = "test-bucket", - Key = "test-file", - Body = Google.Protobuf.ByteString.CopyFrom( - System.Text.Encoding.UTF8.GetBytes("Body")) - }; - - Mock bc = new Mock(); - bc.Setup(e => e.Write(It.IsAny(), null, null, - It.IsAny())) - .Returns(new StorageWriteResponse()) - .Verifiable(); - - var file = new Sdk.Storage.StorageClient(bc.Object).Bucket("test-bucket").File("test-file"); - - file.Write(System.Text.Encoding.UTF8.GetBytes("Hello World")); - - bc.Verify( - t => t.Write(It.IsAny(), null, null, - It.IsAny()), Times.Once); - } - - [Fact] - public void TestWriteString() - { - var request = new StorageWriteRequest - { - BucketName = "test-bucket", - Key = "test-file", - Body = Google.Protobuf.ByteString.CopyFrom( - System.Text.Encoding.UTF8.GetBytes("Body")) - }; - - Mock bc = new Mock(); - bc.Setup(e => e.Write(It.IsAny(), null, null, - It.IsAny())) - .Returns(new StorageWriteResponse()) - .Verifiable(); - - var file = new Sdk.Storage.StorageClient(bc.Object).Bucket("test-bucket").File("test-file"); - - file.Write("Hello World"); - - bc.Verify( - t => t.Write(It.IsAny(), null, null, - It.IsAny()), Times.Once); - } - - [Fact] - public void TestReadExistingKey() - { - var storageResponse = new StorageReadResponse(); - storageResponse.Body = - Google.Protobuf.ByteString.CopyFrom(System.Text.Encoding.UTF8.GetBytes("Hello World")); - - Mock bc = new Mock(); - bc.Setup(e => e.Read(It.IsAny(), null, null, - It.IsAny())) - .Returns(storageResponse) - .Verifiable(); - - var file = new Sdk.Storage.StorageClient(bc.Object).Bucket("test-bucket").File("test-file"); - - var response = file.Read(); - - Assert.Equal("Hello World", System.Text.Encoding.UTF8.GetString(response)); - - bc.Verify( - t => t.Read(It.IsAny(), null, null, It.IsAny()), - Times.Once); - } - - [Fact] - public void TestReadNonExistingKey() - { - Mock bc = new Mock(); - bc.Setup(e => e.Read(It.IsAny(), null, null, - It.IsAny())) - .Throws(new RpcException(new Status(StatusCode.NotFound, "The specified key does not exist"))) - .Verifiable(); - - var file = new Sdk.Storage.StorageClient(bc.Object).Bucket("test-bucket").File("test-file"); - - try - { - file.Read(); - Assert.True(false); - } - catch (Common.NitricException ne) - { - Assert.Equal("Status(StatusCode=\"NotFound\", Detail=\"The specified key does not exist\")", - ne.Message); - } - - bc.Verify( - t => t.Read(It.IsAny(), null, null, It.IsAny()), - Times.Once); - } - - [Fact] - public void TestDeleteExistingKey() - { - Mock bc = new Mock(); - bc.Setup(e => e.Delete(It.IsAny(), null, null, - It.IsAny())) - .Returns(new StorageDeleteResponse()) - .Verifiable(); - - var file = new Sdk.Storage.StorageClient(bc.Object).Bucket("test-bucket").File("test-file"); - - file.Delete(); - - bc.Verify( - t => t.Delete(It.IsAny(), null, null, - It.IsAny()), Times.Once); - } -} diff --git a/test/Nitric.Sdk.Test/Api/Websocket/WebsocketTest.cs b/test/Nitric.Sdk.Test/Api/Websocket/WebsocketTest.cs deleted file mode 100644 index f2d5516..0000000 --- a/test/Nitric.Sdk.Test/Api/Websocket/WebsocketTest.cs +++ /dev/null @@ -1,141 +0,0 @@ -using System; -using Google.Protobuf; -using Grpc.Core; -using Moq; -using Nitric.Proto.Websockets.v1; -using Nitric.Sdk.Common; -using Nitric.Sdk.Websocket; -using Xunit; -using GrpcClient = Nitric.Proto.Websockets.v1.Websocket.WebsocketClient; - -namespace Nitric.Sdk.Test.Api.Websocket; - -public class WebsocketTest -{ - [Fact] - public void TestWebsocketBuild() - { - var websocket = new WebsocketClient(); - Assert.NotNull(websocket); - } - - [Fact] - public void TestBuildWebsocketsWithNullClient() - { - var websocket = new WebsocketClient(null); - Assert.NotNull(websocket); - } - - [Fact] - public void TestBuildWebsocketWithIdAndSocket() - { - var connection = new WebsocketClient(null).Connection("socket-name", "connection-id"); - Assert.NotNull(connection); - Assert.Equal("connection-id", connection.Id); - Assert.Equal("socket-name", connection.SocketName); - } - - [Fact] - public void TestBuildWebsocketWithoutIdOrSocket() - { - Assert.Throws( - () => new WebsocketClient().Connection("", "connection-id")); - Assert.Throws( - () => new WebsocketClient().Connection(null, "connection-id")); - Assert.Throws( - () => new WebsocketClient().Connection("socket-name", "")); - Assert.Throws( - () => new WebsocketClient().Connection("socket-name", null)); - } - - //Testing Websocket Methods - [Fact] - public void TestWebsocketSend() - { - var websocketSendRequest = new WebsocketSendRequest - { - SocketName = "socket-name", - ConnectionId = "connection-id", - Data = ByteString.CopyFromUtf8("websocket-data") - }; - Mock wc = new Mock(); - wc.Setup(e => - e.SendMessage(websocketSendRequest, null, null, It.IsAny())) - .Verifiable(); - - var connection = new WebsocketClient(wc.Object) - .Connection("socket-name", "connection-id"); - - connection.SendMessage("websocket-data"); - - wc.Verify( - t => t.SendMessage(websocketSendRequest, null, null, It.IsAny()), - Times.Once); - } - - [Fact] - public void TestWebsocketSendWithError() - { - var websocketSendRequest = new WebsocketSendRequest - { - SocketName = "socket-name", - ConnectionId = "connection-id", - Data = ByteString.CopyFromUtf8("websocket-data") - }; - Mock wc = new Mock(); - wc.Setup(e => - e.SendMessage(websocketSendRequest, null, null, It.IsAny())) - .Throws(new RpcException(Status.DefaultCancelled, "succeeded in failing")); - - var connection = new WebsocketClient(wc.Object) - .Connection("socket-name", "connection-id"); - - Assert.Throws(() => - connection.SendMessage("websocket-data") - ); - } - - [Fact] - public void TestWebsocketClose() - { - var websocketCloseRequest = new WebsocketCloseConnectionRequest - { - SocketName = "socket-name", - ConnectionId = "connection-id", - }; - Mock wc = new Mock(); - wc.Setup(e => - e.CloseConnection(websocketCloseRequest, null, null, It.IsAny())) - .Verifiable(); - - var connection = new WebsocketClient(wc.Object) - .Connection("socket-name", "connection-id"); - - connection.CloseConnection(); - - wc.Verify( - t => t.CloseConnection(websocketCloseRequest, null, null, It.IsAny()), - Times.Once); - } - - [Fact] - public void TestWebsocketCloseWithError() - { - var websocketCloseRequest = new WebsocketCloseConnectionRequest - { - SocketName = "socket-name", - ConnectionId = "connection-id", - }; - Mock wc = new Mock(); - wc.Setup(e => - e.CloseConnection(websocketCloseRequest, null, null, It.IsAny())) - .Throws(new RpcException(Status.DefaultCancelled, "succeeded in failing")); - - var connection = new WebsocketClient(wc.Object) - .Connection("socket-name", "connection-id"); - - Assert.Throws(() => - connection.CloseConnection() - ); - } -} diff --git a/test/Nitric.Sdk.Test/Common/ExceptionsTest.cs b/test/Nitric.Sdk.Test/Common/ExceptionsTest.cs new file mode 100644 index 0000000..c30f7a8 --- /dev/null +++ b/test/Nitric.Sdk.Test/Common/ExceptionsTest.cs @@ -0,0 +1,186 @@ +using Nitric.Sdk.Common; +using Grpc.Core; +using Xunit; + +namespace Nitric.Sdk.Test.Common +{ + public class ExceptionsTest + { + [Fact] + public void BuildUnknownException() + { + var rpcException = new RpcException(new Status(StatusCode.Unknown, "an error occurred")); + + var exception = NitricException.FromRpcException(rpcException); + + Assert.Equal("Status(StatusCode=\"Unknown\", Detail=\"an error occurred\")", + exception.Message); + } + + [Fact] + public void BuildCancelledException() + { + var rpcException = new RpcException(new Status(StatusCode.Cancelled, "an error occurred")); + + var exception = NitricException.FromRpcException(rpcException); + + Assert.Equal("Status(StatusCode=\"Cancelled\", Detail=\"an error occurred\")", + exception.Message); + } + + [Fact] + public void BuildInvalidArgumentException() + { + var rpcException = new RpcException(new Status(StatusCode.InvalidArgument, "an error occurred")); + + var exception = NitricException.FromRpcException(rpcException); + + Assert.Equal("Status(StatusCode=\"InvalidArgument\", Detail=\"an error occurred\")", + exception.Message); + } + + [Fact] + public void BuildDeadlineExceededException() + { + var rpcException = new RpcException(new Status(StatusCode.DeadlineExceeded, "an error occurred")); + + var exception = NitricException.FromRpcException(rpcException); + + Assert.Equal("Status(StatusCode=\"DeadlineExceeded\", Detail=\"an error occurred\")", + exception.Message); + } + + [Fact] + public void BuildNotFoundException() + { + var rpcException = new RpcException(new Status(StatusCode.NotFound, "an error occurred")); + + var exception = NitricException.FromRpcException(rpcException); + + Assert.Equal("Status(StatusCode=\"NotFound\", Detail=\"an error occurred\")", + exception.Message); + } + + [Fact] + public void BuildAlreadyExistsException() + { + var rpcException = new RpcException(new Status(StatusCode.AlreadyExists, "an error occurred")); + + var exception = NitricException.FromRpcException(rpcException); + + Assert.Equal("Status(StatusCode=\"AlreadyExists\", Detail=\"an error occurred\")", + exception.Message); + } + + [Fact] + public void BuildPermissionDeniedException() + { + var rpcException = new RpcException(new Status(StatusCode.PermissionDenied, "an error occurred")); + + var exception = NitricException.FromRpcException(rpcException); + + Assert.Equal("Status(StatusCode=\"PermissionDenied\", Detail=\"an error occurred\")", + exception.Message); + } + + [Fact] + public void BuildResourceExhaustedException() + { + var rpcException = new RpcException(new Status(StatusCode.ResourceExhausted, "an error occurred")); + + var exception = NitricException.FromRpcException(rpcException); + + Assert.Equal("Status(StatusCode=\"ResourceExhausted\", Detail=\"an error occurred\")", + exception.Message); + } + + [Fact] + public void BuildFailedPreconditionException() + { + var rpcException = new RpcException(new Status(StatusCode.FailedPrecondition, "an error occurred")); + + var exception = NitricException.FromRpcException(rpcException); + + Assert.Equal("Status(StatusCode=\"FailedPrecondition\", Detail=\"an error occurred\")", + exception.Message); + } + + [Fact] + public void BuildAbortedException() + { + var rpcException = new RpcException(new Status(StatusCode.Aborted, "an error occurred")); + + var exception = NitricException.FromRpcException(rpcException); + + Assert.Equal("Status(StatusCode=\"Aborted\", Detail=\"an error occurred\")", + exception.Message); + } + + [Fact] + public void BuildOutOfRangeException() + { + var rpcException = new RpcException(new Status(StatusCode.OutOfRange, "an error occurred")); + + var exception = NitricException.FromRpcException(rpcException); + + Assert.Equal("Status(StatusCode=\"OutOfRange\", Detail=\"an error occurred\")", + exception.Message); + } + + [Fact] + public void BuildUnimplementedException() + { + var rpcException = new RpcException(new Status(StatusCode.Unimplemented, "an error occurred")); + + var exception = NitricException.FromRpcException(rpcException); + + Assert.Equal("Status(StatusCode=\"Unimplemented\", Detail=\"an error occurred\")", + exception.Message); + } + + [Fact] + public void BuildInternalException() + { + var rpcException = new RpcException(new Status(StatusCode.Internal, "an error occurred")); + + var exception = NitricException.FromRpcException(rpcException); + + Assert.Equal("Status(StatusCode=\"Internal\", Detail=\"an error occurred\")", + exception.Message); + } + + [Fact] + public void BuildUnavailableException() + { + var rpcException = new RpcException(new Status(StatusCode.Unavailable, "an error occurred")); + + var exception = NitricException.FromRpcException(rpcException); + + Assert.Equal("Status(StatusCode=\"Unavailable\", Detail=\"an error occurred\")", + exception.Message); + } + + [Fact] + public void BuildDataLossException() + { + var rpcException = new RpcException(new Status(StatusCode.DataLoss, "an error occurred")); + + var exception = NitricException.FromRpcException(rpcException); + + Assert.Equal("Status(StatusCode=\"DataLoss\", Detail=\"an error occurred\")", + exception.Message); + } + + [Fact] + public void BuildUnauthenticatedException() + { + var rpcException = new RpcException(new Status(StatusCode.Unauthenticated, "an error occurred")); + + var exception = NitricException.FromRpcException(rpcException); + + Assert.Equal("Status(StatusCode=\"Unauthenticated\", Detail=\"an error occurred\")", + exception.Message); + } + } +} + diff --git a/test/Nitric.Sdk.Test/KeyValueStore/KeyValueStoreClientTest.cs b/test/Nitric.Sdk.Test/KeyValueStore/KeyValueStoreClientTest.cs new file mode 100644 index 0000000..ee66782 --- /dev/null +++ b/test/Nitric.Sdk.Test/KeyValueStore/KeyValueStoreClientTest.cs @@ -0,0 +1,731 @@ +using System; +using System.Collections.Generic; +using Grpc.Core; +using Moq; +using Xunit; +using GrpcClient = Nitric.Proto.KvStore.v1.KvStore.KvStoreClient; +using Nitric.Sdk.KeyValueStore; +using Nitric.Proto.KvStore.v1; +using System.Threading; +using System.Threading.Tasks; +using Nitric.Sdk.Common; + +namespace Nitric.Sdk.Test.KeyValueStore +{ + internal class FakeAsyncStreamReader : IAsyncStreamReader + { + private readonly List results; + private int index; + + public FakeAsyncStreamReader(List results) + { + index = 0; + this.results = results; + } + + public T Current => results[index]; + + public Task MoveNext(CancellationToken cancellationToken) + { + if (index == results.Count - 1) + { + return Task.FromResult(false); + } + + index += 1; + + return Task.FromResult(true); + } + } + + + public class TestProfile + { + public string Name { get; set; } + public int Age { get; set; } + public List Addresses { get; set; } + } + + public class KeyValueStoreClientTest + { + [Fact] + public void TestBuildKeyValueClient() + { + var storage = new KeyValueStoreClient(); + Assert.NotNull(storage); + } + + [Fact] + public void TestBuildKeyValueStoreWithName() + { + var store = new KeyValueStoreClient().KV("test-store"); + Assert.NotNull(store); + Assert.Equal("test-store", store.Name); + } + + [Fact] + public void TestBuildKeyValueStoreWithoutName() + { + Assert.Throws( + () => new KeyValueStoreClient().KV("") + ); + Assert.Throws( + () => new KeyValueStoreClient().KV(null) + ); + } + + [Fact] + public void TestSetToKeyValueStore() + { + var testProfile = new TestProfile + { + Name = "John Smith", + Age = 21, + Addresses = new List { "123 address street" } + }; + + var payload = Sdk.Common.Struct.FromJsonSerializable(testProfile); + + var request = new KvStoreSetValueRequest + { + Content = payload, + Ref = new ValueRef + { + Key = "test-key", + Store = "test-store" + } + }; + + Mock gc = new Mock(); + gc.Setup(e => + e.SetValue(It.IsAny(), null, null, It.IsAny())) + .Returns(new KvStoreSetValueResponse()) + .Verifiable(); + + var kv = new KeyValueStoreClient(gc.Object).KV("test-store"); + + kv.Set("test-key", testProfile); + + gc.Verify( + t => t.SetValue(request, null, null, It.IsAny()), Times.Once); + } + + [Fact] + public void TestSetNullToKeyValueStore() + { + var request = new KvStoreSetValueRequest + { + Content = null, + Ref = new ValueRef + { + Key = "test-key", + Store = "test-store" + } + }; + + Mock gc = new Mock(); + gc.Setup(e => + e.SetValue(It.IsAny(), null, null, It.IsAny())) + .Returns(new KvStoreSetValueResponse()) + .Verifiable(); + + var kv = new KeyValueStoreClient(gc.Object).KV("test-store"); + + kv.Set("test-key", null); + + gc.Verify( + t => t.SetValue(request, null, null, It.IsAny()), Times.Once); + } + + [Fact] + public void TestSetToKeyValueStoreWithError() + { + var testProfile = new TestProfile + { + Name = "John Smith", + Age = 21, + Addresses = new List { "123 address street" } + }; + + var payload = Sdk.Common.Struct.FromJsonSerializable(testProfile); + + var request = new KvStoreSetValueRequest + { + Content = payload, + Ref = new ValueRef + { + Key = "test-key", + Store = "test-store" + } + }; + + Mock gc = new Mock(); + gc.Setup(e => + e.SetValue(It.IsAny(), null, null, It.IsAny())) + .Throws(new RpcException(new Status(StatusCode.NotFound, "The specified key value store does not exist"))) + .Verifiable(); + + var kv = new KeyValueStoreClient(gc.Object).KV("test-store"); + + try + { + kv.Set("test-key", testProfile); + Assert.Fail(); + } + catch (NitricException e) + { + Assert.Equal("Status(StatusCode=\"NotFound\", Detail=\"The specified key value store does not exist\")", + e.Message); + } + + gc.Verify( + t => t.SetValue(request, null, null, It.IsAny()), Times.Once); + } + + [Fact] + public async void TestSetToKeyValueStoreAsync() + { + var testProfile = new TestProfile + { + Name = "John Smith", + Age = 21, + Addresses = new List { "123 address street" } + }; + + var payload = Sdk.Common.Struct.FromJsonSerializable(testProfile); + + var request = new KvStoreSetValueRequest + { + Content = payload, + Ref = new ValueRef + { + Key = "test-key", + Store = "test-store" + } + }; + + var resp = new KvStoreSetValueResponse(); + + Mock gc = new Mock(); + gc.Setup(e => + e.SetValueAsync(It.IsAny(), null, null, It.IsAny())) + .Returns(new AsyncUnaryCall(Task.FromResult(resp), null, null, null, null, null)) + .Verifiable(); + + var kv = new KeyValueStoreClient(gc.Object).KV("test-store"); + + await kv.SetAsync("test-key", testProfile); + + gc.Verify( + t => t.SetValueAsync(request, null, null, It.IsAny()), Times.Once); + } + + [Fact] + public async void TestSetNullToKeyValueStoreAsync() + { + var request = new KvStoreSetValueRequest + { + Content = null, + Ref = new ValueRef + { + Key = "test-key", + Store = "test-store" + } + }; + + var resp = new KvStoreSetValueResponse(); + + Mock gc = new Mock(); + gc.Setup(e => + e.SetValueAsync(It.IsAny(), null, null, It.IsAny())) + .Returns(new AsyncUnaryCall(Task.FromResult(resp), null, null, null, null, null)) + .Verifiable(); + + var kv = new KeyValueStoreClient(gc.Object).KV("test-store"); + + await kv.SetAsync("test-key", null); + + gc.Verify( + t => t.SetValueAsync(request, null, null, It.IsAny()), Times.Once); + } + + [Fact] + public async void TestSetNullToKeyValueStoreAsyncWithError() + { + var request = new KvStoreSetValueRequest + { + Content = null, + Ref = new ValueRef + { + Key = "test-key", + Store = "test-store" + } + }; + + Mock gc = new Mock(); + gc.Setup(e => + e.SetValueAsync(It.IsAny(), null, null, It.IsAny())) + .Throws(new RpcException(new Status(StatusCode.NotFound, "The specified key value store does not exist"))) + .Verifiable(); + + var kv = new KeyValueStoreClient(gc.Object).KV("test-store"); + + try + { + await kv.SetAsync("test-key", null); + Assert.Fail(); + } + catch (NitricException e) + { + Assert.Equal("Status(StatusCode=\"NotFound\", Detail=\"The specified key value store does not exist\")", + e.Message); + } + + gc.Verify( + t => t.SetValueAsync(request, null, null, It.IsAny()), Times.Once); + } + + [Fact] + public void TestGetToKeyValueStore() + { + var testProfile = new TestProfile + { + Name = "John Smith", + Age = 21, + Addresses = new List { "123 address street" } + }; + + var payload = Sdk.Common.Struct.FromJsonSerializable(testProfile); + + var request = new KvStoreGetValueRequest + { + Ref = new ValueRef + { + Key = "test-key", + Store = "test-store" + } + }; + + var resp = new KvStoreGetValueResponse + { + Value = new Value + { + Content = payload, + Ref = new ValueRef + { + Key = "test-key", + Store = "test-store" + } + } + }; + + Mock gc = new Mock(); + gc.Setup(e => + e.GetValue(It.IsAny(), null, null, It.IsAny())) + .Returns(resp) + .Verifiable(); + + var kv = new KeyValueStoreClient(gc.Object).KV("test-store"); + + var profile = kv.Get("test-key"); + + Assert.Equal("John Smith", profile.Name); + Assert.Equal(21, profile.Age); + Assert.Equal("123 address street", profile.Addresses[0]); + + gc.Verify( + t => t.GetValue(request, null, null, It.IsAny()), Times.Once); + } + + [Fact] + public void TestGetToKeyValueStoreWithError() + { + var testProfile = new TestProfile + { + Name = "John Smith", + Age = 21, + Addresses = new List { "123 address street" } + }; + + var payload = Sdk.Common.Struct.FromJsonSerializable(testProfile); + + var request = new KvStoreGetValueRequest + { + Ref = new ValueRef + { + Key = "test-key", + Store = "test-store" + } + }; + + Mock gc = new Mock(); + gc.Setup(e => + e.GetValue(It.IsAny(), null, null, It.IsAny())) + .Throws(new RpcException(new Status(StatusCode.NotFound, "The specified key value store does not exist"))) + .Verifiable(); + + var kv = new KeyValueStoreClient(gc.Object).KV("test-store"); + + try + { + kv.Get("test-key"); + Assert.Fail(); + } + catch (NitricException e) + { + Assert.Equal("Status(StatusCode=\"NotFound\", Detail=\"The specified key value store does not exist\")", + e.Message); + } + + gc.Verify( + t => t.GetValue(request, null, null, It.IsAny()), Times.Once); + } + + [Fact] + public async void TestGetToKeyValueStoreAsync() + { + var testProfile = new TestProfile + { + Name = "John Smith", + Age = 21, + Addresses = new List { "123 address street" } + }; + + var payload = Sdk.Common.Struct.FromJsonSerializable(testProfile); + + var request = new KvStoreGetValueRequest + { + Ref = new ValueRef + { + Key = "test-key", + Store = "test-store" + } + }; + + var resp = new KvStoreGetValueResponse + { + Value = new Value + { + Content = payload, + Ref = new ValueRef + { + Key = "test-key", + Store = "test-store" + } + } + }; + + Mock gc = new Mock(); + gc.Setup(e => + e.GetValueAsync(It.IsAny(), null, null, It.IsAny())) + .Returns(new AsyncUnaryCall(Task.FromResult(resp), null, null, null, null, null)) + .Verifiable(); + + var kv = new KeyValueStoreClient(gc.Object).KV("test-store"); + + var profile = await kv.GetAsync("test-key"); + + Assert.Equal("John Smith", profile.Name); + Assert.Equal(21, profile.Age); + Assert.Equal("123 address street", profile.Addresses[0]); + + gc.Verify( + t => t.GetValueAsync(request, null, null, It.IsAny()), Times.Once); + } + + [Fact] + public async void TestGetToKeyValueStoreAsyncWithError() + { + var testProfile = new TestProfile + { + Name = "John Smith", + Age = 21, + Addresses = new List { "123 address street" } + }; + + var payload = Sdk.Common.Struct.FromJsonSerializable(testProfile); + + var request = new KvStoreGetValueRequest + { + Ref = new ValueRef + { + Key = "test-key", + Store = "test-store" + } + }; + + Mock gc = new Mock(); + gc.Setup(e => + e.GetValueAsync(It.IsAny(), null, null, It.IsAny())) + .Throws(new RpcException(new Status(StatusCode.NotFound, "The specified key value store does not exist"))) + .Verifiable(); + + var kv = new KeyValueStoreClient(gc.Object).KV("test-store"); + + try + { + await kv.GetAsync("test-key"); + Assert.Fail(); + } + catch (NitricException e) + { + Assert.Equal("Status(StatusCode=\"NotFound\", Detail=\"The specified key value store does not exist\")", + e.Message); + } + + gc.Verify( + t => t.GetValueAsync(request, null, null, It.IsAny()), Times.Once); + } + + [Fact] + public void TestDeleteKeyValuePair() + { + var request = new KvStoreDeleteKeyRequest + { + Ref = new ValueRef + { + Key = "test-key", + Store = "test-store" + } + }; + + Mock gc = new Mock(); + gc.Setup(e => + e.DeleteKey(It.IsAny(), null, null, It.IsAny())) + .Returns(new KvStoreDeleteKeyResponse()) + .Verifiable(); + + var kv = new KeyValueStoreClient(gc.Object).KV("test-store"); + + kv.Delete("test-key"); + + gc.Verify( + t => t.DeleteKey(request, null, null, It.IsAny()), Times.Once); + } + + [Fact] + public void TestDeleteKeyValuePairWithError() + { + var request = new KvStoreDeleteKeyRequest + { + Ref = new ValueRef + { + Key = "test-key", + Store = "test-store" + } + }; + + Mock gc = new Mock(); + gc.Setup(e => + e.DeleteKey(It.IsAny(), null, null, It.IsAny())) + .Throws(new RpcException(new Status(StatusCode.NotFound, "The specified key value store does not exist"))) + .Verifiable(); + + var kv = new KeyValueStoreClient(gc.Object).KV("test-store"); + + try + { + kv.Delete("test-key"); + Assert.Fail(); + } + catch (NitricException e) + { + Assert.Equal("Status(StatusCode=\"NotFound\", Detail=\"The specified key value store does not exist\")", + e.Message); + } + + gc.Verify( + t => t.DeleteKey(request, null, null, It.IsAny()), Times.Once); + } + + [Fact] + public async void TestDeleteKeyValuePairAsync() + { + var request = new KvStoreDeleteKeyRequest + { + Ref = new ValueRef + { + Key = "test-key", + Store = "test-store" + } + }; + + var resp = new KvStoreDeleteKeyResponse(); + + Mock gc = new Mock(); + gc.Setup(e => + e.DeleteKeyAsync(It.IsAny(), null, null, It.IsAny())) + .Returns(new AsyncUnaryCall(Task.FromResult(resp), null, null, null, null, null)) + .Verifiable(); + + var kv = new KeyValueStoreClient(gc.Object).KV("test-store"); + + await kv.DeleteAsync("test-key"); + + gc.Verify( + t => t.DeleteKeyAsync(request, null, null, It.IsAny()), Times.Once); + } + + [Fact] + public async void TestDeleteKeyValuePairAsyncWithError() + { + var request = new KvStoreDeleteKeyRequest + { + Ref = new ValueRef + { + Key = "test-key", + Store = "test-store" + } + }; + + Mock gc = new Mock(); + gc.Setup(e => + e.DeleteKeyAsync(It.IsAny(), null, null, It.IsAny())) + .Throws(new RpcException(new Status(StatusCode.NotFound, "The specified key value store does not exist"))) + .Verifiable(); + + var kv = new KeyValueStoreClient(gc.Object).KV("test-store"); + + try + { + await kv.DeleteAsync("test-key"); + Assert.Fail(); + } + catch (NitricException e) + { + Assert.Equal("Status(StatusCode=\"NotFound\", Detail=\"The specified key value store does not exist\")", + e.Message); + } + + + gc.Verify( + t => t.DeleteKeyAsync(request, null, null, It.IsAny()), Times.Once); + } + + [Fact] + public async void TestGetListOfKeysWithNoPrefix() + { + var request = new KvStoreScanKeysRequest + { + Prefix = "", + Store = new Store + { + Name = "test-store", + }, + }; + + var responseStream = new FakeAsyncStreamReader( + new List + { + new KvStoreScanKeysResponse { Key = "key-1" }, + new KvStoreScanKeysResponse { Key = "key-2" }, + new KvStoreScanKeysResponse { Key = "key-3" }, + } + ); + + var resp = new AsyncServerStreamingCall(responseStream, null, null, null, null); + + Mock gc = new Mock(); + gc.Setup(e => + e.ScanKeys(It.IsAny(), null, null, It.IsAny())) + .Returns(resp) + .Verifiable(); + + var kv = new KeyValueStoreClient(gc.Object).KV("test-store"); + + var keys = kv.Keys(); + + gc.Verify( + t => t.ScanKeys(request, null, null, It.IsAny()), Times.Once); + + Assert.Equal("key-1", keys.Current); + await keys.MoveNext(); + Assert.Equal("key-2", keys.Current); + await keys.MoveNext(CancellationToken.None); + Assert.Equal("key-3", keys.Current); + var movedForward = await keys.MoveNext(); + Assert.False(movedForward); + } + + [Fact] + public async void TestGetListOfKeysWithPrefix() + { + var request = new KvStoreScanKeysRequest + { + Prefix = "key-", + Store = new Store + { + Name = "test-store", + }, + }; + + var responseStream = new FakeAsyncStreamReader( + new List + { + new KvStoreScanKeysResponse { Key = "key-1" }, + new KvStoreScanKeysResponse { Key = "key-2" }, + new KvStoreScanKeysResponse { Key = "key-3" }, + } + ); + + var resp = new AsyncServerStreamingCall(responseStream, null, null, null, null); + + Mock gc = new Mock(); + gc.Setup(e => + e.ScanKeys(It.IsAny(), null, null, It.IsAny())) + .Returns(resp) + .Verifiable(); + + var kv = new KeyValueStoreClient(gc.Object).KV("test-store"); + + var keys = kv.Keys("key-"); + + gc.Verify( + t => t.ScanKeys(request, null, null, It.IsAny()), Times.Once); + + Assert.Equal("key-1", keys.Current); + await keys.MoveNext(); + Assert.Equal("key-2", keys.Current); + await keys.MoveNext(CancellationToken.None); + Assert.Equal("key-3", keys.Current); + var movedForward = await keys.MoveNext(); + Assert.False(movedForward); + } + + [Fact] + public void TestGetListOfKeysWithError() + { + var request = new KvStoreScanKeysRequest + { + Prefix = "", + Store = new Store + { + Name = "test-store", + }, + }; + + Mock gc = new Mock(); + gc.Setup(e => + e.ScanKeys(It.IsAny(), null, null, It.IsAny())) + .Throws(new RpcException(new Status(StatusCode.NotFound, "The specified key value store does not exist"))) + .Verifiable(); + + var kv = new KeyValueStoreClient(gc.Object).KV("test-store"); + + try + { + kv.Keys(); + Assert.Fail(); + } + catch (NitricException e) + { + Assert.Equal("Status(StatusCode=\"NotFound\", Detail=\"The specified key value store does not exist\")", + e.Message); + } + + gc.Verify( + t => t.ScanKeys(request, null, null, It.IsAny()), Times.Once); + } + } +} + diff --git a/test/Nitric.Sdk.Test/Nitric.Sdk.Test.csproj b/test/Nitric.Sdk.Test/Nitric.Sdk.Test.csproj index c2c8c24..89e9006 100644 --- a/test/Nitric.Sdk.Test/Nitric.Sdk.Test.csproj +++ b/test/Nitric.Sdk.Test/Nitric.Sdk.Test.csproj @@ -1,7 +1,7 @@ - .net6.0 + .net7.0 false @@ -25,12 +25,13 @@ - - - - - - + + + + + + + @@ -40,7 +41,15 @@ - - + + + + + + + + + + diff --git a/test/Nitric.Sdk.Test/Api/Queue/FailedTaskTest.cs b/test/Nitric.Sdk.Test/Queue/FailedTaskTest.cs similarity index 97% rename from test/Nitric.Sdk.Test/Api/Queue/FailedTaskTest.cs rename to test/Nitric.Sdk.Test/Queue/FailedTaskTest.cs index 01c2ec1..b6f50cf 100644 --- a/test/Nitric.Sdk.Test/Api/Queue/FailedTaskTest.cs +++ b/test/Nitric.Sdk.Test/Queue/FailedTaskTest.cs @@ -17,7 +17,7 @@ using Nitric.Sdk.Queue; using Xunit; -namespace Nitric.Sdk.Test.Api.Queue +namespace Nitric.Sdk.Test.Queue { public class TestProfile { diff --git a/test/Nitric.Sdk.Test/Queue/QueueClientTest.cs b/test/Nitric.Sdk.Test/Queue/QueueClientTest.cs new file mode 100644 index 0000000..cd4cfdb --- /dev/null +++ b/test/Nitric.Sdk.Test/Queue/QueueClientTest.cs @@ -0,0 +1,627 @@ +// Copyright 2021, Nitric Technologies Pty Ltd. +// +// 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. + +using System; +using System.Collections.Generic; +using System.Linq; +using Google.Protobuf.WellKnownTypes; +using Grpc.Core; +using Moq; +using Nitric.Proto.Queues.v1; +using GrpcClient = Nitric.Proto.Queues.v1.Queues.QueuesClient; +using Nitric.Sdk.Queue; +using Xunit; +using System.Threading.Tasks; +using Nitric.Sdk.Common; + +namespace Nitric.Sdk.Test.Queue +{ + public class QueueClientTest + { + [Fact] + public void TestBuildQueues() + { + var queues = new QueuesClient(); + Assert.NotNull(queues); + } + + [Fact] + public void TestBuildQueueWithName() + { + var queue = new QueuesClient().Queue("test-queue"); + Assert.NotNull(queue); + Assert.Equal("test-queue", queue.Name); + } + + [Fact] + public void TestBuildQueueWithoutName() + { + Assert.Throws( + () => new QueuesClient().Queue("") + ); + Assert.Throws( + () => new QueuesClient().Queue(null) + ); + } + + [Fact] + public async void TestEnqueueAsync() + { + Mock qc = new Mock(); + qc.Setup(e => + e.EnqueueAsync(It.IsAny(), null, null, It.IsAny())) + .Returns(new AsyncUnaryCall(Task.FromResult(new QueueEnqueueResponse()), null, null, null, null)) + .Verifiable(); + + var queue = new QueuesClient(qc.Object).Queue("test-queue"); + + await queue.EnqueueAsync(new TestProfile { Name = "John Smith", Age = 30, Addresses = new List { "123 street st" } }); + + qc.Verify( + t => t.EnqueueAsync(It.IsAny(), null, null, It.IsAny()), + Times.Once); + } + + [Fact] + public void TestEnqueueNullMessageAsync() + { + var queue = new QueuesClient().Queue("test-queue"); + + Assert.ThrowsAsync(() => queue.EnqueueAsync(null)); + } + + [Fact] + public async void TestEnqueueMultipleMessagesWithFailedMessagesAsync() + { + FailedEnqueueMessage failedMessage = new FailedEnqueueMessage(); + failedMessage.Details = "I am a failed message... I failed my message"; + failedMessage.Message = new QueueMessage(); + + List failedMessages = new List + { + failedMessage, + }; + + var queueBatchResponse = new QueueEnqueueResponse(); + queueBatchResponse.FailedMessages.AddRange(failedMessages); + + Mock qc = new Mock(); + qc.Setup(e => e.EnqueueAsync(It.IsAny(), null, null, + It.IsAny())) + .Returns(new AsyncUnaryCall(Task.FromResult(queueBatchResponse), null, null, null, null)) + .Verifiable(); + + var queue = new QueuesClient(qc.Object).Queue("test-queue"); + + var failedMessagesResp = await queue.EnqueueAsync(new TestProfile { }, new TestProfile { }); + + Assert.Equal("I am a failed message... I failed my message", failedMessagesResp[0].Details); + + qc.Verify( + t => t.EnqueueAsync(It.IsAny(), null, null, + It.IsAny()), Times.Once); + } + + [Fact] + public async void TestEnqueueMultipleMessagesWithNoFailedMessagesAsync() + { + Mock qc = new Mock(); + qc.Setup(e => e.EnqueueAsync(It.IsAny(), null, null, + It.IsAny())) + .Returns(new AsyncUnaryCall(Task.FromResult(new QueueEnqueueResponse()), null, null, null, null)) + .Verifiable(); + + var queue = new QueuesClient(qc.Object).Queue("test-queue"); + + var failedMessages = await queue.EnqueueAsync(new TestProfile { }, new TestProfile { }); + + Assert.Empty(failedMessages); + + qc.Verify( + t => t.EnqueueAsync(It.IsAny(), null, null, + It.IsAny()), Times.Once); + } + + [Fact] + public async void TestEnqueueToNonExistentQueueAsync() + { + Mock qc = new Mock(); + qc.Setup(e => + e.EnqueueAsync(It.IsAny(), null, null, It.IsAny())) + .Throws(new RpcException(new Status(StatusCode.NotFound, "The specified queue does not exist"))) + .Verifiable(); + + var queue = new QueuesClient(qc.Object).Queue("test-queue"); + + try + { + await queue.EnqueueAsync(new TestProfile()); + } + catch (NitricException ne) + { + Assert.Equal("Status(StatusCode=\"NotFound\", Detail=\"The specified queue does not exist\")", + ne.Message); + } + + qc.Verify( + t => t.EnqueueAsync(It.IsAny(), null, null, It.IsAny()), + Times.Once); + } + + [Fact] + public void TestEnqueue() + { + Mock qc = new Mock(); + qc.Setup(e => + e.Enqueue(It.IsAny(), null, null, It.IsAny())) + .Returns(new QueueEnqueueResponse()) + .Verifiable(); + + var queue = new QueuesClient(qc.Object).Queue("test-queue"); + + queue.Enqueue(new TestProfile { Name = "John Smith", Age = 30, Addresses = new List { "123 street st" } }); + + qc.Verify( + t => t.Enqueue(It.IsAny(), null, null, It.IsAny()), + Times.Once); + } + + [Fact] + public void TestEnqueueToNonExistentQueue() + { + Mock qc = new Mock(); + qc.Setup(e => + e.Enqueue(It.IsAny(), null, null, It.IsAny())) + .Throws(new RpcException(new Status(StatusCode.NotFound, "The specified queue does not exist"))) + .Verifiable(); + + var queue = new QueuesClient(qc.Object).Queue("test-queue"); + + try + { + queue.Enqueue(new TestProfile()); + } + catch (NitricException ne) + { + Assert.Equal("Status(StatusCode=\"NotFound\", Detail=\"The specified queue does not exist\")", + ne.Message); + } + + qc.Verify( + t => t.Enqueue(It.IsAny(), null, null, It.IsAny()), + Times.Once); + } + + [Fact] + public void TestEnqueueNullMessage() + { + var queue = new QueuesClient().Queue("test-queue"); + + Assert.Throws(() => queue.Enqueue(null)); + } + + [Fact] + public void TestEnqueueMultipleMessagesWithFailedMessages() + { + FailedEnqueueMessage failedMessage = new FailedEnqueueMessage(); + failedMessage.Details = "I am a failed message... I failed my message"; + failedMessage.Message = new QueueMessage(); + + List failedMessages = new List + { + failedMessage, + }; + + var queueBatchResponse = new QueueEnqueueResponse(); + queueBatchResponse.FailedMessages.AddRange(failedMessages); + + Mock qc = new Mock(); + qc.Setup(e => e.Enqueue(It.IsAny(), null, null, + It.IsAny())) + .Returns(queueBatchResponse) + .Verifiable(); + + var queue = new QueuesClient(qc.Object).Queue("test-queue"); + + var failedMessagesResp = queue.Enqueue(new TestProfile { }, new TestProfile { }); + + Assert.Equal("I am a failed message... I failed my message", failedMessagesResp[0].Details); + + qc.Verify( + t => t.Enqueue(It.IsAny(), null, null, + It.IsAny()), Times.Once); + } + + [Fact] + public void TestEnqueueMultipleMessagesWithNoFailedMessages() + { + Mock qc = new Mock(); + qc.Setup(e => e.Enqueue(It.IsAny(), null, null, + It.IsAny())) + .Returns(new QueueEnqueueResponse()) + .Verifiable(); + + var queue = new QueuesClient(qc.Object).Queue("test-queue"); + + var failedMessages = queue.Enqueue(new TestProfile { }, new TestProfile { }); + + Assert.Empty(failedMessages); + + qc.Verify( + t => t.Enqueue(It.IsAny(), null, null, + It.IsAny()), Times.Once); + } + + [Fact] + public void TestDequeueMessages() + { + var messagePayload = Sdk.Common.Struct.FromJsonSerializable(new TestProfile { Name = "John Smith" }); + var message = new DequeuedMessage + { + LeaseId = "1234", + Message = new QueueMessage { StructPayload = messagePayload }, + }; + + var messages = new List() { message }; + + var queueReceieveResponse = new QueueDequeueResponse(); + queueReceieveResponse.Messages.AddRange(messages); + + Mock qc = new Mock(); + qc.Setup(e => e.Dequeue(It.IsAny(), null, null, + It.IsAny())) + .Returns(queueReceieveResponse) + .Verifiable(); + + var queue = new QueuesClient(qc.Object).Queue("test-queue"); + + var response = queue.Dequeue(3); + + Assert.Equal("1234", response[0].LeaseId); + Assert.Equal("John Smith", response[0].Message.Name); + + qc.Verify( + t => t.Dequeue(It.IsAny(), null, null, + It.IsAny()), Times.Once); + } + + [Fact] + public void TestDequeueNoMessages() + { + Mock qc = new Mock(); + qc.Setup(e => e.Dequeue(It.IsAny(), null, null, + It.IsAny())) + .Returns(new QueueDequeueResponse()) + .Verifiable(); + + var queue = new QueuesClient(qc.Object).Queue("test-queue"); + + var response = queue.Dequeue(3); + + Assert.Empty(response); + + qc.Verify( + t => t.Dequeue(It.IsAny(), null, null, + It.IsAny()), Times.Once); + } + + [Fact] + public void TestDequeueToNonExistentQueue() + { + Mock qc = new Mock(); + qc.Setup(e => e.Dequeue(It.IsAny(), null, null, + It.IsAny())) + .Throws(new RpcException(new Status(StatusCode.NotFound, "The specified queue does not exist"))) + .Verifiable(); + + var queue = new QueuesClient(qc.Object).Queue("test-queue"); + + try + { + queue.Dequeue(3); + Assert.Fail(); + } + catch (NitricException e) + { + Assert.Equal("Status(StatusCode=\"NotFound\", Detail=\"The specified queue does not exist\")", + e.Message); + } + + qc.Verify( + t => t.Dequeue(It.IsAny(), null, null, + It.IsAny()), Times.Once); + } + + [Fact] + public async void TestDequeueMessagesAsync() + { + var messagePayload = Sdk.Common.Struct.FromJsonSerializable(new TestProfile { Name = "John Smith" }); + var message = new DequeuedMessage + { + LeaseId = "1234", + Message = new QueueMessage { StructPayload = messagePayload }, + }; + + var messages = new List() { message }; + + var queueReceieveResponse = new QueueDequeueResponse(); + queueReceieveResponse.Messages.AddRange(messages); + + Mock qc = new Mock(); + qc.Setup(e => e.DequeueAsync(It.IsAny(), null, null, + It.IsAny())) + .Returns(new AsyncUnaryCall(Task.FromResult(queueReceieveResponse), null, null, null, null)) + .Verifiable(); + + var queue = new QueuesClient(qc.Object).Queue("test-queue"); + + var response = await queue.DequeueAsync(3); + + Assert.Equal("1234", response[0].LeaseId); + Assert.Equal("John Smith", response[0].Message.Name); + + qc.Verify( + t => t.DequeueAsync(It.IsAny(), null, null, + It.IsAny()), Times.Once); + } + + [Fact] + public async void TestDequeueNoMessagesAsync() + { + Mock qc = new Mock(); + qc.Setup(e => e.DequeueAsync(It.IsAny(), null, null, + It.IsAny())) + .Returns(new AsyncUnaryCall(Task.FromResult(new QueueDequeueResponse()), null, null, null, null)) + .Verifiable(); + + var queue = new QueuesClient(qc.Object).Queue("test-queue"); + + var response = await queue.DequeueAsync(3); + + Assert.Empty(response); + + qc.Verify( + t => t.DequeueAsync(It.IsAny(), null, null, + It.IsAny()), Times.Once); + } + + [Fact] + public async void TestDequeueToNonExistentQueueAsync() + { + Mock qc = new Mock(); + qc.Setup(e => e.DequeueAsync(It.IsAny(), null, null, + It.IsAny())) + .Throws(new RpcException(new Status(StatusCode.NotFound, "The specified queue does not exist"))) + .Verifiable(); + + var queue = new QueuesClient(qc.Object).Queue("test-queue"); + + try + { + await queue.DequeueAsync(3); + Assert.Fail(); + } + catch (NitricException e) + { + Assert.Equal("Status(StatusCode=\"NotFound\", Detail=\"The specified queue does not exist\")", + e.Message); + } + + qc.Verify( + t => t.DequeueAsync(It.IsAny(), null, null, + It.IsAny()), Times.Once); + } + + [Fact] + public void TestComplete() + { + var payload = new Google.Protobuf.WellKnownTypes.Struct(); + payload.Fields.Add("Name", Value.ForString("John Smith")); + payload.Fields.Add("Age", Value.ForNumber(30.0)); + payload.Fields.Add("Addresses", Value.ForList(new[] { Value.ForString("123 street st") })); + + var messages = new List() + { + new DequeuedMessage + { + Message = new QueueMessage + { + StructPayload = payload + }, + LeaseId = "1" + } + }; + + var queueReceieveResponse = new QueueDequeueResponse(); + queueReceieveResponse.Messages.AddRange(messages); + + Mock qc = new Mock(); + qc.Setup(e => e.Dequeue(It.IsAny(), null, null, + It.IsAny())) + .Returns(queueReceieveResponse) + .Verifiable(); + + Mock qcr = new Mock(); + qc.Setup(e => e.Complete(It.IsAny(), null, null, + It.IsAny())) + .Verifiable(); + + var queue = new QueuesClient(qc.Object).Queue("test-queue"); + + var response = queue.Dequeue(3); + + response.ToList()[0].Complete(); + + qc.Verify( + t => t.Complete(It.IsAny(), null, null, + It.IsAny()), Times.Once); + } + + [Fact] + public async void TestCompleteAsync() + { + var payload = new Google.Protobuf.WellKnownTypes.Struct(); + payload.Fields.Add("Name", Value.ForString("John Smith")); + payload.Fields.Add("Age", Value.ForNumber(30.0)); + payload.Fields.Add("Addresses", Value.ForList(new[] { Value.ForString("123 street st") })); + + var messages = new List() + { + new DequeuedMessage + { + Message = new QueueMessage + { + StructPayload = payload + }, + LeaseId = "1" + } + }; + + var queueReceieveResponse = new QueueDequeueResponse(); + queueReceieveResponse.Messages.AddRange(messages); + + Mock qc = new Mock(); + qc.Setup(e => e.DequeueAsync(It.IsAny(), null, null, + It.IsAny())) + .Returns(new AsyncUnaryCall(Task.FromResult(queueReceieveResponse), null, null, null, null)) + .Verifiable(); + + Mock qcr = new Mock(); + qc.Setup(e => e.CompleteAsync(It.IsAny(), null, null, + It.IsAny())) + .Returns(new AsyncUnaryCall(Task.FromResult(new QueueCompleteResponse()), null, null, null, null)) + .Verifiable(); + + var queue = new QueuesClient(qc.Object).Queue("test-queue"); + + var response = await queue.DequeueAsync(3); + + await response.ToList()[0].CompleteAsync(); + + qc.Verify( + t => t.CompleteAsync(It.IsAny(), null, null, + It.IsAny()), Times.Once); + } + + [Fact] + public void TestCompleteToNonExistentQueue() + { + var payload = new Google.Protobuf.WellKnownTypes.Struct(); + payload.Fields.Add("Name", Value.ForString("John Smith")); + payload.Fields.Add("Age", Value.ForNumber(30.0)); + payload.Fields.Add("Addresses", Value.ForList(new[] { Value.ForString("123 street st") })); + + var messages = new List() + { + new DequeuedMessage + { + Message = new QueueMessage + { + StructPayload = payload + }, + LeaseId = "1" + } + }; + + var queueReceieveResponse = new QueueDequeueResponse(); + queueReceieveResponse.Messages.AddRange(messages); + + Mock qc = new Mock(); + qc.Setup(e => e.Dequeue(It.IsAny(), null, null, + It.IsAny())) + .Returns(queueReceieveResponse) + .Verifiable(); + + Mock qcr = new Mock(); + qc.Setup(e => e.Complete(It.IsAny(), null, null, + It.IsAny())) + .Throws(new RpcException(new Status(StatusCode.NotFound, "The specified queue does not exist"))) + .Verifiable(); + + var queue = new QueuesClient(qc.Object).Queue("test-queue"); + + var response = queue.Dequeue(3); + + try + { + response.ToList()[0].Complete(); + Assert.Fail(); + } + catch (NitricException e) + { + Assert.Equal("Status(StatusCode=\"NotFound\", Detail=\"The specified queue does not exist\")", + e.Message); + } + + qc.Verify( + t => t.Complete(It.IsAny(), null, null, + It.IsAny()), Times.Once); + } + + [Fact] + public async void TestCompleteToNonExistentQueueAsync() + { + var payload = new Google.Protobuf.WellKnownTypes.Struct(); + payload.Fields.Add("Name", Value.ForString("John Smith")); + payload.Fields.Add("Age", Value.ForNumber(30.0)); + payload.Fields.Add("Addresses", Value.ForList(new[] { Value.ForString("123 street st") })); + + var messages = new List() + { + new DequeuedMessage + { + Message = new QueueMessage + { + StructPayload = payload + }, + LeaseId = "1" + } + }; + + var queueReceieveResponse = new QueueDequeueResponse(); + queueReceieveResponse.Messages.AddRange(messages); + + Mock qc = new Mock(); + qc.Setup(e => e.DequeueAsync(It.IsAny(), null, null, + It.IsAny())) + .Returns(new AsyncUnaryCall(Task.FromResult(queueReceieveResponse), null, null, null, null)) + .Verifiable(); + + Mock qcr = new Mock(); + qc.Setup(e => e.CompleteAsync(It.IsAny(), null, null, + It.IsAny())) + .Throws(new RpcException(new Status(StatusCode.NotFound, "The specified queue does not exist"))) + .Verifiable(); + + var queue = new QueuesClient(qc.Object).Queue("test-queue"); + + var response = await queue.DequeueAsync(3); + + try + { + await response.ToList()[0].CompleteAsync(); + Assert.Fail(); + } + catch (NitricException e) + { + Assert.Equal("Status(StatusCode=\"NotFound\", Detail=\"The specified queue does not exist\")", + e.Message); + } + + qc.Verify( + t => t.CompleteAsync(It.IsAny(), null, null, + It.IsAny()), Times.Once); + } + } +} diff --git a/test/Nitric.Sdk.Test/Api/Queue/TaskTest.cs b/test/Nitric.Sdk.Test/Queue/TaskTest.cs similarity index 98% rename from test/Nitric.Sdk.Test/Api/Queue/TaskTest.cs rename to test/Nitric.Sdk.Test/Queue/TaskTest.cs index eba57be..7b2e95b 100644 --- a/test/Nitric.Sdk.Test/Api/Queue/TaskTest.cs +++ b/test/Nitric.Sdk.Test/Queue/TaskTest.cs @@ -16,7 +16,7 @@ using Xunit; using Nitric.Sdk.Queue; -namespace Nitric.Sdk.Test.Api.Queue +namespace Nitric.Sdk.Test.Queue { public class QueueItemTest { diff --git a/test/Nitric.Sdk.Test/Api/Secret/SecretTest.cs b/test/Nitric.Sdk.Test/Secret/SecretTest.cs similarity index 60% rename from test/Nitric.Sdk.Test/Api/Secret/SecretTest.cs rename to test/Nitric.Sdk.Test/Secret/SecretTest.cs index 648a407..432a6ae 100644 --- a/test/Nitric.Sdk.Test/Api/Secret/SecretTest.cs +++ b/test/Nitric.Sdk.Test/Secret/SecretTest.cs @@ -20,9 +20,10 @@ using GrpcClient = Nitric.Proto.Secrets.v1.SecretManager.SecretManagerClient; using Nitric.Sdk.Secret; using Xunit; +using System.Threading.Tasks; +using Nitric.Sdk.Common; - -namespace Nitric.Sdk.Test.Api.Secret +namespace Nitric.Sdk.Test.Secret { public class SecretTest { @@ -58,6 +59,117 @@ public void TestBuildSecretWithoutName() } //Testing Secret Methods + [Fact] + public async void TestPutSecretBytesAsync() + { + var secretPutResponse = new SecretPutResponse + { + SecretVersion = new Proto.Secrets.v1.SecretVersion + { + Secret = new Proto.Secrets.v1.Secret + { + Name = "test-secret", + }, + Version = "test-version", + } + }; + Mock sc = new Mock(); + sc.Setup(e => + e.PutAsync(It.IsAny(), null, null, It.IsAny())) + .Returns(new AsyncUnaryCall(Task.FromResult(secretPutResponse), null, null, null, null)) + .Verifiable(); + + var secret = new SecretsClient(sc.Object) + .Secret("test-secret"); + + var response = await secret.PutAsync("Super secret message"); + + Assert.Equal("test-version", response.Id); + Assert.Equal(secret.Name, response.Secret.Name); + + sc.Verify( + t => t.PutAsync(It.IsAny(), null, null, It.IsAny()), + Times.Once); + } + + [Fact] + public async void TestPutSecretStringAsync() + { + var secretPutResponse = new SecretPutResponse + { + SecretVersion = new Proto.Secrets.v1.SecretVersion + { + Secret = new Proto.Secrets.v1.Secret + { + Name = "test-secret", + }, + Version = "test-version", + } + }; + Mock sc = new Mock(); + sc.Setup(e => + e.PutAsync(It.IsAny(), null, null, It.IsAny())) + .Returns(new AsyncUnaryCall(Task.FromResult(secretPutResponse), null, null, null, null)) + .Verifiable(); + + var testString = "Super secret message"; + var secret = new SecretsClient(sc.Object) + .Secret("test-secret"); + var response = await secret.PutAsync(testString); + + Assert.Equal("test-version", response.Id); + Assert.Equal(secret.Name, response.Secret.Name); + + sc.Verify( + t => t.PutAsync(It.IsAny(), null, null, It.IsAny()), + Times.Once); + } + + [Fact] + public void TestPutEmptySecretStringAsync() + { + var secret = new SecretsClient().Secret("test-secret"); + Assert.ThrowsAsync( + () => secret.PutAsync("")); + } + + [Fact] + public void TestPutNullSecretBytesAsync() + { + var secret = new SecretsClient().Secret("test-secret"); + Assert.ThrowsAsync( + () => secret.PutAsync(null)); + } + + [Fact] + public async void TestPutNonExistentSecretAsync() + { + Mock sc = new Mock(); + sc.Setup(e => + e.PutAsync(It.IsAny(), null, null, It.IsAny())) + .Throws(new RpcException(new Status(StatusCode.NotFound, "The specified secret does not exist"))) + .Verifiable(); + + var testString = "Super secret message"; + var secret = new SecretsClient(sc.Object) + .Secret("test-secret"); + try + { + var response = await secret.PutAsync(testString); + Assert.Fail(); + } + catch (NitricException ne) + { + Assert.Equal("Status(StatusCode=\"NotFound\", Detail=\"The specified secret does not exist\")", + ne.Message); + } + + + sc.Verify( + t => t.PutAsync(It.IsAny(), null, null, It.IsAny()), + Times.Once); + } + [Fact] public void TestPutSecretBytes() { @@ -155,8 +267,9 @@ public void TestPutNonExistentSecret() try { var response = secret.Put(testString); + Assert.Fail(); } - catch (Common.NitricException ne) + catch (NitricException ne) { Assert.Equal("Status(StatusCode=\"NotFound\", Detail=\"The specified secret does not exist\")", ne.Message); @@ -187,6 +300,61 @@ public void TestGetSecretVersionWithoutName() () => new SecretsClient().Secret("test-secret").Version(null)); } + [Fact] + public void TestGetLatestSecretVersion() + { + var secretVersion = new SecretsClient() + .Secret("test-secret") + .Latest(); + Assert.Equal("latest", secretVersion.Id); + } + + [Fact] + public void TestSecretToString() + { + var secretString = new SecretsClient() + .Secret("test-secret") + .ToString(); + Assert.Equal("[name=test-secret]", secretString); + } + + //Testing Secret Version Methods + [Fact] + public void TestAccess() + { + var secretPutResponse = new SecretAccessResponse + { + SecretVersion = new Proto.Secrets.v1.SecretVersion + { + Secret = new Proto.Secrets.v1.Secret + { + Name = "test-secret", + }, + Version = "test-version", + }, + Value = Google.Protobuf.ByteString.CopyFromUtf8("Super secret message"), + }; + Mock sc = new Mock(); + sc.Setup(e => e.Access(It.IsAny(), null, null, + It.IsAny())) + .Returns(secretPutResponse) + .Verifiable(); + + var version = new SecretsClient(sc.Object) + .Secret("test-secret") + .Version("test-version"); + var response = version.Access(); + + Assert.Equal("test-version", response.SecretVersion.Id); + Assert.Equal("test-secret", response.SecretVersion.Secret.Name); + Assert.Equal("Super secret message", Encoding.UTF8.GetString(response.ValueBytes)); + Assert.Equal("Super secret message", response.Value); + + sc.Verify( + t => t.Access(It.IsAny(), null, null, + It.IsAny()), Times.Once); + } + [Fact] public void TestAccessSecretWithoutPermission() { @@ -203,7 +371,7 @@ public void TestAccessSecretWithoutPermission() { var response = secret.Version("test-secret").Access(); } - catch (Common.NitricException ne) + catch (NitricException ne) { Assert.Equal( "Status(StatusCode=\"PermissionDenied\", Detail=\"You do not have permission to access this secret\")", @@ -217,26 +385,7 @@ public void TestAccessSecretWithoutPermission() } [Fact] - public void TestGetLatestSecretVersion() - { - var secretVersion = new SecretsClient() - .Secret("test-secret") - .Latest(); - Assert.Equal("latest", secretVersion.Id); - } - - [Fact] - public void TestSecretToString() - { - var secretString = new SecretsClient() - .Secret("test-secret") - .ToString(); - Assert.Equal("[name=test-secret]", secretString); - } - - //Testing Secret Version Methods - [Fact] - public void TestAccess() + public async void TestAccessAsync() { var secretPutResponse = new SecretAccessResponse { @@ -251,15 +400,15 @@ public void TestAccess() Value = Google.Protobuf.ByteString.CopyFromUtf8("Super secret message"), }; Mock sc = new Mock(); - sc.Setup(e => e.Access(It.IsAny(), null, null, + sc.Setup(e => e.AccessAsync(It.IsAny(), null, null, It.IsAny())) - .Returns(secretPutResponse) + .Returns(new AsyncUnaryCall(Task.FromResult(secretPutResponse), null, null, null, null)) .Verifiable(); var version = new SecretsClient(sc.Object) .Secret("test-secret") .Version("test-version"); - var response = version.Access(); + var response = await version.AccessAsync(); Assert.Equal("test-version", response.SecretVersion.Id); Assert.Equal("test-secret", response.SecretVersion.Secret.Name); @@ -267,10 +416,40 @@ public void TestAccess() Assert.Equal("Super secret message", response.Value); sc.Verify( - t => t.Access(It.IsAny(), null, null, + t => t.AccessAsync(It.IsAny(), null, null, + It.IsAny()), Times.Once); + } + + [Fact] + public async void TestAccessSecretWithoutPermissionAsync() + { + Mock sc = new Mock(); + sc.Setup(e => e.AccessAsync(It.IsAny(), null, null, + It.IsAny())) + .Throws(new RpcException(new Status(StatusCode.PermissionDenied, + "You do not have permission to access this secret"))) + .Verifiable(); + + var secret = new SecretsClient(sc.Object) + .Secret("test-secret"); + try + { + var response = await secret.Version("test-secret").AccessAsync(); + } + catch (NitricException ne) + { + Assert.Equal( + "Status(StatusCode=\"PermissionDenied\", Detail=\"You do not have permission to access this secret\")", + ne.Message); + } + + + sc.Verify( + t => t.AccessAsync(It.IsAny(), null, null, It.IsAny()), Times.Once); } + [Fact] public void TestSecretVersionToString() { diff --git a/test/Nitric.Sdk.Test/Storage/StorageClientTest.cs b/test/Nitric.Sdk.Test/Storage/StorageClientTest.cs new file mode 100644 index 0000000..721053e --- /dev/null +++ b/test/Nitric.Sdk.Test/Storage/StorageClientTest.cs @@ -0,0 +1,1058 @@ +// Copyright 2021, Nitric Technologies Pty Ltd. +// +// 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. + +using System; +using System.Collections.Generic; +using System.Threading.Tasks; +using Grpc.Core; +using Moq; +using Nitric.Proto.Storage.v1; +using Nitric.Sdk.Common; +using Xunit; +using GrpcClient = Nitric.Proto.Storage.v1.Storage.StorageClient; + +namespace Nitric.Sdk.Test.Storage +{ + + public class StorageClientTest + { + [Fact] + public void TestBuildStorage() + { + var storage = new Sdk.Storage.StorageClient(); + Assert.NotNull(storage); + } + + [Fact] + public void TestBuildBucketWithName() + { + var bucket = new Sdk.Storage.StorageClient().Bucket("test-bucket"); + Assert.NotNull(bucket); + Assert.Equal("test-bucket", bucket.Name); + } + + [Fact] + public void TestBuildBucketWithoutName() + { + Assert.Throws( + () => new Sdk.Storage.StorageClient().Bucket("") + ); + Assert.Throws( + () => new Sdk.Storage.StorageClient().Bucket(null) + ); + } + + [Fact] + public void TestBuildFileWithName() + { + var file = new Sdk.Storage.StorageClient().Bucket("test-bucket").File("test-file"); + Assert.NotNull(file); + Assert.Equal("test-file", file.Name); + } + + [Fact] + public void TestBuildFileWithoutName() + { + Assert.Throws( + () => new Sdk.Storage.StorageClient().Bucket("test-bucket").File("") + ); + Assert.Throws( + () => new Sdk.Storage.StorageClient().Bucket("test-bucket").File(null) + ); + } + + [Fact] + public void TestBucketToString() + { + var bucket = new Sdk.Storage.StorageClient().Bucket("test-bucket"); + Assert.Equal("Bucket[name=test-bucket]", bucket.ToString()); + } + + [Fact] + public void TestFileToString() + { + var file = new Sdk.Storage.StorageClient().Bucket("test-bucket").File("test-file"); + Assert.Equal("File[name=test-file\nbucket=test-bucket]", file.ToString()); + } + + [Fact] + public void TestListBlobsWithNoPrefix() + { + var request = new StorageListBlobsRequest + { + BucketName = "test-bucket", + Prefix = "", + }; + + var blobs = new List + { + new Blob { Key = "key-1" }, + new Blob { Key = "key-2" }, + new Blob { Key = "key-3" }, + }; + var response = new StorageListBlobsResponse(); + response.Blobs.AddRange(blobs); + + Mock bc = new Mock(); + bc.Setup(e => e.ListBlobs(It.IsAny(), null, null, + It.IsAny())) + .Returns(response) + .Verifiable(); + + var files = new Sdk.Storage.StorageClient(bc.Object).Bucket("test-bucket").Files(); + + bc.Verify( + t => t.ListBlobs(request, null, null, + It.IsAny()), Times.Once); + + Assert.Equal("key-1", files[0].Name); + Assert.Equal("key-2", files[1].Name); + Assert.Equal("key-3", files[2].Name); + } + + [Fact] + public void TestListBlobsWithPrefix() + { + var request = new StorageListBlobsRequest + { + BucketName = "test-bucket", + Prefix = "key-", + }; + + var blobs = new List + { + new Blob { Key = "key-1" }, + new Blob { Key = "key-2" }, + new Blob { Key = "key-3" }, + }; + var response = new StorageListBlobsResponse(); + response.Blobs.AddRange(blobs); + + Mock bc = new Mock(); + bc.Setup(e => e.ListBlobs(It.IsAny(), null, null, + It.IsAny())) + .Returns(response) + .Verifiable(); + + var files = new Sdk.Storage.StorageClient(bc.Object).Bucket("test-bucket").Files("key-"); + + bc.Verify( + t => t.ListBlobs(request, null, null, + It.IsAny()), Times.Once); + + Assert.Equal("key-1", files[0].Name); + Assert.Equal("key-2", files[1].Name); + Assert.Equal("key-3", files[2].Name); + } + + [Fact] + public void TestListBlobsToNonExistentBucket() + { + Mock bc = new Mock(); + bc.Setup(e => e.ListBlobs(It.IsAny(), null, null, + It.IsAny())) + .Throws(new RpcException(new Status(StatusCode.NotFound, "The specified bucket does not exist"))) + .Verifiable(); + + try + { + new Sdk.Storage.StorageClient(bc.Object).Bucket("test-bucket").Files("key-1"); + Assert.Fail(); + } + catch (NitricException e) + { + Assert.Equal("Status(StatusCode=\"NotFound\", Detail=\"The specified bucket does not exist\")", + e.Message); + } + + bc.Verify( + t => t.ListBlobs(It.IsAny(), null, null, + It.IsAny()), Times.Once); + } + + [Fact] + public async void TestListBlobsWithNoPrefixAsync() + { + var request = new StorageListBlobsRequest + { + BucketName = "test-bucket", + Prefix = "", + }; + + var blobs = new List + { + new Blob { Key = "key-1" }, + new Blob { Key = "key-2" }, + new Blob { Key = "key-3" }, + }; + var response = new StorageListBlobsResponse(); + response.Blobs.AddRange(blobs); + + Mock bc = new Mock(); + bc.Setup(e => e.ListBlobsAsync(It.IsAny(), null, null, + It.IsAny())) + .Returns(new AsyncUnaryCall(Task.FromResult(response), null, null, null, null)) + .Verifiable(); + + var files = await new Sdk.Storage.StorageClient(bc.Object).Bucket("test-bucket").FilesAsync(); + + bc.Verify( + t => t.ListBlobsAsync(request, null, null, + It.IsAny()), Times.Once); + + Assert.Equal("key-1", files[0].Name); + Assert.Equal("key-2", files[1].Name); + Assert.Equal("key-3", files[2].Name); + } + + [Fact] + public async void TestListBlobsWithPrefixAsync() + { + var request = new StorageListBlobsRequest + { + BucketName = "test-bucket", + Prefix = "key-", + }; + + var blobs = new List + { + new Blob { Key = "key-1" }, + new Blob { Key = "key-2" }, + new Blob { Key = "key-3" }, + }; + var response = new StorageListBlobsResponse(); + response.Blobs.AddRange(blobs); + + Mock bc = new Mock(); + bc.Setup(e => e.ListBlobsAsync(It.IsAny(), null, null, + It.IsAny())) + .Returns(new AsyncUnaryCall(Task.FromResult(response), null, null, null, null)) + .Verifiable(); + + var files = await new Sdk.Storage.StorageClient(bc.Object).Bucket("test-bucket").FilesAsync("key-"); + + bc.Verify( + t => t.ListBlobsAsync(request, null, null, + It.IsAny()), Times.Once); + + Assert.Equal("key-1", files[0].Name); + Assert.Equal("key-2", files[1].Name); + Assert.Equal("key-3", files[2].Name); + } + + [Fact] + public async void TestListBlobsToNonExistentBucketAsync() + { + Mock bc = new Mock(); + bc.Setup(e => e.ListBlobsAsync(It.IsAny(), null, null, + It.IsAny())) + .Throws(new RpcException(new Status(StatusCode.NotFound, "The specified bucket does not exist"))) + .Verifiable(); + + try + { + await new Sdk.Storage.StorageClient(bc.Object).Bucket("test-bucket").FilesAsync(); + Assert.Fail(); + } + catch (NitricException e) + { + Assert.Equal("Status(StatusCode=\"NotFound\", Detail=\"The specified bucket does not exist\")", + e.Message); + } + + bc.Verify( + t => t.ListBlobsAsync(It.IsAny(), null, null, + It.IsAny()), Times.Once); + } + + [Fact] + public void TestWrite() + { + var request = new StorageWriteRequest + { + BucketName = "test-bucket", + Key = "test-file", + Body = Google.Protobuf.ByteString.CopyFrom( + System.Text.Encoding.UTF8.GetBytes("Body")) + }; + + Mock bc = new Mock(); + bc.Setup(e => e.Write(It.IsAny(), null, null, + It.IsAny())) + .Returns(new StorageWriteResponse()) + .Verifiable(); + + var file = new Sdk.Storage.StorageClient(bc.Object).Bucket("test-bucket").File("test-file"); + + file.Write(System.Text.Encoding.UTF8.GetBytes("Hello World")); + + bc.Verify( + t => t.Write(It.IsAny(), null, null, + It.IsAny()), Times.Once); + } + + [Fact] + public void TestWriteString() + { + var request = new StorageWriteRequest + { + BucketName = "test-bucket", + Key = "test-file", + Body = Google.Protobuf.ByteString.CopyFrom( + System.Text.Encoding.UTF8.GetBytes("Body")) + }; + + Mock bc = new Mock(); + bc.Setup(e => e.Write(It.IsAny(), null, null, + It.IsAny())) + .Returns(new StorageWriteResponse()) + .Verifiable(); + + var file = new Sdk.Storage.StorageClient(bc.Object).Bucket("test-bucket").File("test-file"); + + file.Write("Hello World"); + + bc.Verify( + t => t.Write(It.IsAny(), null, null, + It.IsAny()), Times.Once); + } + + [Fact] + public void TestWriteToNonExistentBucket() + { + var request = new StorageWriteRequest + { + BucketName = "test-bucket", + Key = "test-file", + Body = Google.Protobuf.ByteString.CopyFrom( + System.Text.Encoding.UTF8.GetBytes("Body")) + }; + + Mock bc = new Mock(); + bc.Setup(e => e.Write(It.IsAny(), null, null, + It.IsAny())) + .Throws(new RpcException(new Status(StatusCode.NotFound, "The specified bucket does not exist"))) + .Verifiable(); + + var file = new Sdk.Storage.StorageClient(bc.Object).Bucket("test-bucket").File("test-file"); + + try + { + file.Write("Hello World"); + Assert.Fail(); + } + catch (NitricException e) + { + Assert.Equal("Status(StatusCode=\"NotFound\", Detail=\"The specified bucket does not exist\")", + e.Message); + } + + bc.Verify( + t => t.Write(It.IsAny(), null, null, + It.IsAny()), Times.Once); + } + + [Fact] + public void TestWriteBytesToNonExistentBucket() + { + var request = new StorageWriteRequest + { + BucketName = "test-bucket", + Key = "test-file", + Body = Google.Protobuf.ByteString.CopyFrom( + System.Text.Encoding.UTF8.GetBytes("Hello World")) + }; + + Mock bc = new Mock(); + bc.Setup(e => e.Write(It.IsAny(), null, null, + It.IsAny())) + .Throws(new RpcException(new Status(StatusCode.NotFound, "The specified bucket does not exist"))) + .Verifiable(); + + var file = new Sdk.Storage.StorageClient(bc.Object).Bucket("test-bucket").File("test-file"); + + try + { + file.Write(System.Text.Encoding.UTF8.GetBytes("Hello World")); + Assert.Fail(); + } + catch (NitricException e) + { + Assert.Equal("Status(StatusCode=\"NotFound\", Detail=\"The specified bucket does not exist\")", + e.Message); + } + + bc.Verify( + t => t.Write(It.IsAny(), null, null, + It.IsAny()), Times.Once); + } + + [Fact] + public async void TestWriteAsync() + { + var request = new StorageWriteRequest + { + BucketName = "test-bucket", + Key = "test-file", + Body = Google.Protobuf.ByteString.CopyFrom( + System.Text.Encoding.UTF8.GetBytes("Body")) + }; + + Mock bc = new Mock(); + bc.Setup(e => e.WriteAsync(It.IsAny(), null, null, + It.IsAny())) + .Returns(new AsyncUnaryCall(Task.FromResult(new StorageWriteResponse()), null, null, null, null)) + .Verifiable(); + + var file = new Sdk.Storage.StorageClient(bc.Object).Bucket("test-bucket").File("test-file"); + + await file.WriteAsync(System.Text.Encoding.UTF8.GetBytes("Hello World")); + + bc.Verify( + t => t.WriteAsync(It.IsAny(), null, null, + It.IsAny()), Times.Once); + } + + [Fact] + public async void TestWriteBytesToNonExistentBucketAsync() + { + Mock bc = new Mock(); + bc.Setup(e => e.WriteAsync(It.IsAny(), null, null, + It.IsAny())) + .Throws(new RpcException(new Status(StatusCode.NotFound, "The specified bucket does not exist"))) + .Verifiable(); + + var file = new Sdk.Storage.StorageClient(bc.Object).Bucket("test-bucket").File("test-file"); + + try + { + await file.WriteAsync(System.Text.Encoding.UTF8.GetBytes("Hello World")); + Assert.Fail(); + } + catch (NitricException e) + { + Assert.Equal("Status(StatusCode=\"NotFound\", Detail=\"The specified bucket does not exist\")", + e.Message); + } + + bc.Verify( + t => t.WriteAsync(It.IsAny(), null, null, + It.IsAny()), Times.Once); + } + + [Fact] + public async void TestWriteToNonExistentBucketAsync() + { + Mock bc = new Mock(); + bc.Setup(e => e.WriteAsync(It.IsAny(), null, null, + It.IsAny())) + .Throws(new RpcException(new Status(StatusCode.NotFound, "The specified bucket does not exist"))) + .Verifiable(); + + var file = new Sdk.Storage.StorageClient(bc.Object).Bucket("test-bucket").File("test-file"); + + try + { + await file.WriteAsync("Hello World"); + Assert.Fail(); + } + catch (NitricException e) + { + Assert.Equal("Status(StatusCode=\"NotFound\", Detail=\"The specified bucket does not exist\")", + e.Message); + } + + bc.Verify( + t => t.WriteAsync(It.IsAny(), null, null, + It.IsAny()), Times.Once); + } + + [Fact] + public async void TestWriteStringAsync() + { + var request = new StorageWriteRequest + { + BucketName = "test-bucket", + Key = "test-file", + Body = Google.Protobuf.ByteString.CopyFrom( + System.Text.Encoding.UTF8.GetBytes("Body")) + }; + + Mock bc = new Mock(); + bc.Setup(e => e.WriteAsync(It.IsAny(), null, null, + It.IsAny())) + .Returns(new AsyncUnaryCall(Task.FromResult(new StorageWriteResponse()), null, null, null, null)) + .Verifiable(); + + var file = new Sdk.Storage.StorageClient(bc.Object).Bucket("test-bucket").File("test-file"); + + await file.WriteAsync("Hello World"); + + bc.Verify( + t => t.WriteAsync(It.IsAny(), null, null, + It.IsAny()), Times.Once); + } + + [Fact] + public async void TestWriteStringToNonExistentBucketAsync() + { + Mock bc = new Mock(); + bc.Setup(e => e.WriteAsync(It.IsAny(), null, null, + It.IsAny())) + .Throws(new RpcException(new Status(StatusCode.NotFound, "The specified bucket does not exist"))) + .Verifiable(); + + var file = new Sdk.Storage.StorageClient(bc.Object).Bucket("test-bucket").File("test-file"); + + try + { + await file.WriteAsync("Hello World"); + Assert.Fail(); + } + catch (NitricException e) + { + Assert.Equal("Status(StatusCode=\"NotFound\", Detail=\"The specified bucket does not exist\")", + e.Message); + } + + bc.Verify( + t => t.WriteAsync(It.IsAny(), null, null, + It.IsAny()), Times.Once); + } + + [Fact] + public void TestReadExistingKey() + { + var storageResponse = new StorageReadResponse(); + storageResponse.Body = + Google.Protobuf.ByteString.CopyFrom(System.Text.Encoding.UTF8.GetBytes("Hello World")); + + Mock bc = new Mock(); + bc.Setup(e => e.Read(It.IsAny(), null, null, + It.IsAny())) + .Returns(storageResponse) + .Verifiable(); + + var file = new Sdk.Storage.StorageClient(bc.Object).Bucket("test-bucket").File("test-file"); + + var response = file.Read(); + + Assert.Equal("Hello World", System.Text.Encoding.UTF8.GetString(response)); + + bc.Verify( + t => t.Read(It.IsAny(), null, null, It.IsAny()), + Times.Once); + } + + [Fact] + public void TestReadNonExistingKey() + { + Mock bc = new Mock(); + bc.Setup(e => e.Read(It.IsAny(), null, null, + It.IsAny())) + .Throws(new RpcException(new Status(StatusCode.NotFound, "The specified key does not exist"))) + .Verifiable(); + + var file = new Sdk.Storage.StorageClient(bc.Object).Bucket("test-bucket").File("test-file"); + + try + { + file.Read(); + Assert.True(false); + } + catch (NitricException ne) + { + Assert.Equal("Status(StatusCode=\"NotFound\", Detail=\"The specified key does not exist\")", + ne.Message); + } + + bc.Verify( + t => t.Read(It.IsAny(), null, null, It.IsAny()), + Times.Once); + } + + [Fact] + public async void TestReadExistingKeyAsync() + { + var storageResponse = new StorageReadResponse(); + storageResponse.Body = + Google.Protobuf.ByteString.CopyFrom(System.Text.Encoding.UTF8.GetBytes("Hello World")); + + Mock bc = new Mock(); + bc.Setup(e => e.ReadAsync(It.IsAny(), null, null, + It.IsAny())) + .Returns(new AsyncUnaryCall(Task.FromResult(storageResponse), null, null, null, null)) + .Verifiable(); + + var file = new Sdk.Storage.StorageClient(bc.Object).Bucket("test-bucket").File("test-file"); + + var response = await file.ReadAsync(); + + Assert.Equal("Hello World", System.Text.Encoding.UTF8.GetString(response)); + + bc.Verify( + t => t.ReadAsync(It.IsAny(), null, null, It.IsAny()), + Times.Once); + } + + [Fact] + public async void TestReadNonExistingKeyAsync() + { + Mock bc = new Mock(); + bc.Setup(e => e.ReadAsync(It.IsAny(), null, null, + It.IsAny())) + .Throws(new RpcException(new Status(StatusCode.NotFound, "The specified key does not exist"))) + .Verifiable(); + + var file = new Sdk.Storage.StorageClient(bc.Object).Bucket("test-bucket").File("test-file"); + + try + { + await file.ReadAsync(); + Assert.Fail(); + } + catch (NitricException ne) + { + Assert.Equal("Status(StatusCode=\"NotFound\", Detail=\"The specified key does not exist\")", + ne.Message); + } + + bc.Verify( + t => t.ReadAsync(It.IsAny(), null, null, It.IsAny()), + Times.Once); + } + + [Fact] + public void TestDeleteExistingKey() + { + Mock bc = new Mock(); + bc.Setup(e => e.Delete(It.IsAny(), null, null, + It.IsAny())) + .Returns(new StorageDeleteResponse()) + .Verifiable(); + + var file = new Sdk.Storage.StorageClient(bc.Object).Bucket("test-bucket").File("test-file"); + + file.Delete(); + + bc.Verify( + t => t.Delete(It.IsAny(), null, null, + It.IsAny()), Times.Once); + } + + [Fact] + public void TestDeleteNonExistingKey() + { + Mock bc = new Mock(); + bc.Setup(e => e.Delete(It.IsAny(), null, null, + It.IsAny())) + .Throws(new RpcException(new Status(StatusCode.NotFound, "The specified key does not exist"))) + .Verifiable(); + + var file = new Sdk.Storage.StorageClient(bc.Object).Bucket("test-bucket").File("test-file"); + + try + { + file.Delete(); + Assert.Fail(); + } + catch (NitricException ne) + { + Assert.Equal("Status(StatusCode=\"NotFound\", Detail=\"The specified key does not exist\")", + ne.Message); + } + + bc.Verify( + t => t.Delete(It.IsAny(), null, null, It.IsAny()), + Times.Once); + } + + [Fact] + public async void TestDeleteExistingKeyAsync() + { + Mock bc = new Mock(); + bc.Setup(e => e.DeleteAsync(It.IsAny(), null, null, + It.IsAny())) + .Returns(new AsyncUnaryCall(Task.FromResult(new StorageDeleteResponse()), null, null, null, null)) + .Verifiable(); + + var file = new Sdk.Storage.StorageClient(bc.Object).Bucket("test-bucket").File("test-file"); + + await file.DeleteAsync(); + + bc.Verify( + t => t.DeleteAsync(It.IsAny(), null, null, + It.IsAny()), Times.Once); + } + + [Fact] + public async void TestDeleteNonExistingKeyAsync() + { + Mock bc = new Mock(); + bc.Setup(e => e.DeleteAsync(It.IsAny(), null, null, + It.IsAny())) + .Throws(new RpcException(new Status(StatusCode.NotFound, "The specified key does not exist"))) + .Verifiable(); + + var file = new Sdk.Storage.StorageClient(bc.Object).Bucket("test-bucket").File("test-file"); + + try + { + await file.DeleteAsync(); + Assert.Fail(); + } + catch (NitricException ne) + { + Assert.Equal("Status(StatusCode=\"NotFound\", Detail=\"The specified key does not exist\")", + ne.Message); + } + + bc.Verify( + t => t.DeleteAsync(It.IsAny(), null, null, It.IsAny()), + Times.Once); + } + + [Fact] + public void TestGetUploadUrlWithDefaultExpiry() + { + var request = new StoragePreSignUrlRequest + { + BucketName = "test-bucket", + Key = "test-file", + Operation = StoragePreSignUrlRequest.Types.Operation.Write, + Expiry = new Google.Protobuf.WellKnownTypes.Duration { Seconds = 600 }, + }; + + Mock bc = new Mock(); + bc.Setup(e => e.PreSignUrl(It.IsAny(), null, null, + It.IsAny())) + .Returns(new StoragePreSignUrlResponse { Url = "https://example.com" }) + .Verifiable(); + + var file = new Sdk.Storage.StorageClient(bc.Object).Bucket("test-bucket").File("test-file"); + + var url = file.GetUploadUrl(); + + bc.Verify( + t => t.PreSignUrl(request, null, null, + It.IsAny()), Times.Once); + + Assert.Equal("https://example.com", url); + } + + [Fact] + public void TestGetUploadUrlWithSpecificExpiry() + { + var request = new StoragePreSignUrlRequest + { + BucketName = "test-bucket", + Key = "test-file", + Operation = StoragePreSignUrlRequest.Types.Operation.Write, + Expiry = new Google.Protobuf.WellKnownTypes.Duration { Seconds = 300 }, + }; + + Mock bc = new Mock(); + bc.Setup(e => e.PreSignUrl(It.IsAny(), null, null, + It.IsAny())) + .Returns(new StoragePreSignUrlResponse { Url = "https://example.com" }) + .Verifiable(); + + var file = new Sdk.Storage.StorageClient(bc.Object).Bucket("test-bucket").File("test-file"); + + var url = file.GetUploadUrl(300); + + bc.Verify( + t => t.PreSignUrl(request, null, null, + It.IsAny()), Times.Once); + + Assert.Equal("https://example.com", url); + } + + [Fact] + public void TestGetUploadUrlNonExistingKey() + { + Mock bc = new Mock(); + bc.Setup(e => e.PreSignUrl(It.IsAny(), null, null, + It.IsAny())) + .Throws(new RpcException(new Status(StatusCode.NotFound, "The specified key does not exist"))) + .Verifiable(); + + var file = new Sdk.Storage.StorageClient(bc.Object).Bucket("test-bucket").File("test-file"); + + try + { + file.GetUploadUrl(); + Assert.Fail(); + } + catch (NitricException ne) + { + Assert.Equal("Status(StatusCode=\"NotFound\", Detail=\"The specified key does not exist\")", + ne.Message); + } + + bc.Verify( + t => t.PreSignUrl(It.IsAny(), null, null, It.IsAny()), + Times.Once); + } + + [Fact] + public async void TestGetUploadUrlWithDefaultExpiryAsync() + { + var request = new StoragePreSignUrlRequest + { + BucketName = "test-bucket", + Key = "test-file", + Operation = StoragePreSignUrlRequest.Types.Operation.Write, + Expiry = new Google.Protobuf.WellKnownTypes.Duration { Seconds = 600 }, + }; + + Mock bc = new Mock(); + bc.Setup(e => e.PreSignUrlAsync(It.IsAny(), null, null, + It.IsAny())) + .Returns(new AsyncUnaryCall(Task.FromResult(new StoragePreSignUrlResponse { Url = "https://example.com" }), null, null, null, null)) + .Verifiable(); + + var file = new Sdk.Storage.StorageClient(bc.Object).Bucket("test-bucket").File("test-file"); + + var url = await file.GetUploadUrlAsync(); + + bc.Verify( + t => t.PreSignUrlAsync(request, null, null, + It.IsAny()), Times.Once); + + Assert.Equal("https://example.com", url); + } + + [Fact] + public async void TestGetUploadUrlWithSpecificExpiryAsync() + { + var request = new StoragePreSignUrlRequest + { + BucketName = "test-bucket", + Key = "test-file", + Operation = StoragePreSignUrlRequest.Types.Operation.Write, + Expiry = new Google.Protobuf.WellKnownTypes.Duration { Seconds = 300 }, + }; + + Mock bc = new Mock(); + bc.Setup(e => e.PreSignUrlAsync(It.IsAny(), null, null, + It.IsAny())) + .Returns(new AsyncUnaryCall(Task.FromResult(new StoragePreSignUrlResponse { Url = "https://example.com" }), null, null, null, null)) + .Verifiable(); + + var file = new Sdk.Storage.StorageClient(bc.Object).Bucket("test-bucket").File("test-file"); + + var url = await file.GetUploadUrlAsync(300); + + bc.Verify( + t => t.PreSignUrlAsync(request, null, null, + It.IsAny()), Times.Once); + + Assert.Equal("https://example.com", url); + } + + [Fact] + public async void TestGetUploadUrlNonExistingKeyAsync() + { + Mock bc = new Mock(); + bc.Setup(e => e.PreSignUrlAsync(It.IsAny(), null, null, + It.IsAny())) + .Throws(new RpcException(new Status(StatusCode.NotFound, "The specified key does not exist"))) + .Verifiable(); + + var file = new Sdk.Storage.StorageClient(bc.Object).Bucket("test-bucket").File("test-file"); + + try + { + await file.GetUploadUrlAsync(); + Assert.Fail(); + } + catch (NitricException ne) + { + Assert.Equal("Status(StatusCode=\"NotFound\", Detail=\"The specified key does not exist\")", + ne.Message); + } + + bc.Verify( + t => t.PreSignUrlAsync(It.IsAny(), null, null, It.IsAny()), + Times.Once); + } + + [Fact] + public void TestGetDownloadUrlWithDefaultExpiry() + { + var request = new StoragePreSignUrlRequest + { + BucketName = "test-bucket", + Key = "test-file", + Operation = StoragePreSignUrlRequest.Types.Operation.Read, + Expiry = new Google.Protobuf.WellKnownTypes.Duration { Seconds = 600 }, + }; + + Mock bc = new Mock(); + bc.Setup(e => e.PreSignUrl(It.IsAny(), null, null, + It.IsAny())) + .Returns(new StoragePreSignUrlResponse { Url = "https://example.com" }) + .Verifiable(); + + var file = new Sdk.Storage.StorageClient(bc.Object).Bucket("test-bucket").File("test-file"); + + var url = file.GetDownloadUrl(); + + bc.Verify( + t => t.PreSignUrl(request, null, null, + It.IsAny()), Times.Once); + + Assert.Equal("https://example.com", url); + } + + [Fact] + public void TestGetDownloadUrlWithSpecificExpiry() + { + var request = new StoragePreSignUrlRequest + { + BucketName = "test-bucket", + Key = "test-file", + Operation = StoragePreSignUrlRequest.Types.Operation.Read, + Expiry = new Google.Protobuf.WellKnownTypes.Duration { Seconds = 300 }, + }; + + Mock bc = new Mock(); + bc.Setup(e => e.PreSignUrl(It.IsAny(), null, null, + It.IsAny())) + .Returns(new StoragePreSignUrlResponse { Url = "https://example.com" }) + .Verifiable(); + + var file = new Sdk.Storage.StorageClient(bc.Object).Bucket("test-bucket").File("test-file"); + + var url = file.GetDownloadUrl(300); + + bc.Verify( + t => t.PreSignUrl(request, null, null, + It.IsAny()), Times.Once); + + Assert.Equal("https://example.com", url); + } + + [Fact] + public void TestGetDownloadUrlNonExistingKey() + { + Mock bc = new Mock(); + bc.Setup(e => e.PreSignUrl(It.IsAny(), null, null, + It.IsAny())) + .Throws(new RpcException(new Status(StatusCode.NotFound, "The specified key does not exist"))) + .Verifiable(); + + var file = new Sdk.Storage.StorageClient(bc.Object).Bucket("test-bucket").File("test-file"); + + try + { + file.GetDownloadUrl(); + Assert.Fail(); + } + catch (NitricException ne) + { + Assert.Equal("Status(StatusCode=\"NotFound\", Detail=\"The specified key does not exist\")", + ne.Message); + } + + bc.Verify( + t => t.PreSignUrl(It.IsAny(), null, null, It.IsAny()), + Times.Once); + } + + [Fact] + public async void TestGetDownloadUrlWithDefaultExpiryAsync() + { + var request = new StoragePreSignUrlRequest + { + BucketName = "test-bucket", + Key = "test-file", + Operation = StoragePreSignUrlRequest.Types.Operation.Read, + Expiry = new Google.Protobuf.WellKnownTypes.Duration { Seconds = 600 }, + }; + + Mock bc = new Mock(); + bc.Setup(e => e.PreSignUrlAsync(It.IsAny(), null, null, + It.IsAny())) + .Returns(new AsyncUnaryCall(Task.FromResult(new StoragePreSignUrlResponse { Url = "https://example.com" }), null, null, null, null)) + .Verifiable(); + + var file = new Sdk.Storage.StorageClient(bc.Object).Bucket("test-bucket").File("test-file"); + + var url = await file.GetDownloadUrlAsync(); + + bc.Verify( + t => t.PreSignUrlAsync(request, null, null, + It.IsAny()), Times.Once); + + Assert.Equal("https://example.com", url); + } + + [Fact] + public async void TestGetDownloadUrlWithSpecificExpiryAsync() + { + var request = new StoragePreSignUrlRequest + { + BucketName = "test-bucket", + Key = "test-file", + Operation = StoragePreSignUrlRequest.Types.Operation.Read, + Expiry = new Google.Protobuf.WellKnownTypes.Duration { Seconds = 300 }, + }; + + Mock bc = new Mock(); + bc.Setup(e => e.PreSignUrlAsync(It.IsAny(), null, null, + It.IsAny())) + .Returns(new AsyncUnaryCall(Task.FromResult(new StoragePreSignUrlResponse { Url = "https://example.com" }), null, null, null, null)) + .Verifiable(); + + var file = new Sdk.Storage.StorageClient(bc.Object).Bucket("test-bucket").File("test-file"); + + var url = await file.GetDownloadUrlAsync(300); + + bc.Verify( + t => t.PreSignUrlAsync(request, null, null, + It.IsAny()), Times.Once); + + Assert.Equal("https://example.com", url); + } + + [Fact] + public async void TestGetDownloadUrlNonExistingKeyAsync() + { + Mock bc = new Mock(); + bc.Setup(e => e.PreSignUrlAsync(It.IsAny(), null, null, + It.IsAny())) + .Throws(new RpcException(new Status(StatusCode.NotFound, "The specified key does not exist"))) + .Verifiable(); + + var file = new Sdk.Storage.StorageClient(bc.Object).Bucket("test-bucket").File("test-file"); + + try + { + await file.GetDownloadUrlAsync(); + Assert.Fail(); + } + catch (NitricException ne) + { + Assert.Equal("Status(StatusCode=\"NotFound\", Detail=\"The specified key does not exist\")", + ne.Message); + } + + bc.Verify( + t => t.PreSignUrlAsync(It.IsAny(), null, null, It.IsAny()), + Times.Once); + } + } +} \ No newline at end of file diff --git a/test/Nitric.Sdk.Test/Api/Topics/TopicsClientTest.cs b/test/Nitric.Sdk.Test/Topics/TopicsClientTest.cs similarity index 62% rename from test/Nitric.Sdk.Test/Api/Topics/TopicsClientTest.cs rename to test/Nitric.Sdk.Test/Topics/TopicsClientTest.cs index 0315ebe..556d4de 100644 --- a/test/Nitric.Sdk.Test/Api/Topics/TopicsClientTest.cs +++ b/test/Nitric.Sdk.Test/Topics/TopicsClientTest.cs @@ -20,8 +20,10 @@ using Nitric.Proto.Topics.v1; using Nitric.Sdk.Topics; using Xunit; +using System.Threading.Tasks; +using Nitric.Sdk.Common; -namespace Nitric.Sdk.Test.Api.Event +namespace Nitric.Sdk.Test.Event { public class TestProfile { @@ -93,12 +95,57 @@ public void TestPublishToNonExistentTopic() { topic.Publish(profile); } - catch (Common.NitricException ne) + catch (NitricException ne) { Assert.Equal("Status(StatusCode=\"NotFound\", Detail=\"The specified topic does not exist\")", ne.Message); } ec.Verify(t => t.Publish(It.IsAny(), null, null, It.IsAny()), Times.Once); } + + [Fact] + public async void TestPublishAsync() + { + Mock ec = new Mock(); + + ec.Setup(e => e.PublishAsync(It.IsAny(), null, null, It.IsAny())) + .Returns(new AsyncUnaryCall(Task.FromResult(new TopicPublishResponse()), null, null, null, null)) + .Verifiable(); + + var topic = new TopicsClient(ec.Object).Topic("test-topic"); + + var profile = new TestProfile + { Name = "John Smith", Age = 30, Addresses = new List { "123 street st" } }; + + await topic.PublishAsync(profile); + + ec.Verify(t => t.PublishAsync(It.IsAny(), null, null, It.IsAny()), Times.Once); + } + + [Fact] + public async void TestPublishAsyncToNonExistentTopic() + { + Mock ec = new Mock(); + + ec.Setup(e => e.PublishAsync(It.IsAny(), null, null, It.IsAny())) + .Throws(new RpcException(new Status(StatusCode.NotFound, "The specified topic does not exist"))) + .Verifiable(); + + var topic = new TopicsClient(ec.Object).Topic("test-topic"); + + var profile = new TestProfile + { Name = "John Smith", Age = 30, Addresses = new List { "123 street st" } }; + + try + { + await topic.PublishAsync(profile); + } + catch (NitricException ne) + { + Assert.Equal("Status(StatusCode=\"NotFound\", Detail=\"The specified topic does not exist\")", ne.Message); + } + + ec.Verify(t => t.PublishAsync(It.IsAny(), null, null, It.IsAny()), Times.Once); + } }; } diff --git a/test/Nitric.Sdk.Test/Websocket/WebsocketTest.cs b/test/Nitric.Sdk.Test/Websocket/WebsocketTest.cs new file mode 100644 index 0000000..76a44d7 --- /dev/null +++ b/test/Nitric.Sdk.Test/Websocket/WebsocketTest.cs @@ -0,0 +1,236 @@ +using System; +using System.Threading.Tasks; +using Google.Protobuf; +using Grpc.Core; +using Moq; +using Nitric.Proto.Websockets.v1; +using Nitric.Sdk.Common; +using Nitric.Sdk.Websocket; +using Xunit; +using GrpcClient = Nitric.Proto.Websockets.v1.Websocket.WebsocketClient; + +namespace Nitric.Sdk.Test.Websocket +{ + + public class WebsocketTest + { + [Fact] + public void TestWebsocketBuild() + { + var websocket = new WebsocketClient(); + Assert.NotNull(websocket); + } + + [Fact] + public void TestBuildWebsocketsWithNullClient() + { + var websocket = new WebsocketClient(null); + Assert.NotNull(websocket); + } + + [Fact] + public void TestBuildWebsocketWithIdAndSocket() + { + var connection = new WebsocketClient(null).Connection("socket-name", "connection-id"); + Assert.NotNull(connection); + Assert.Equal("connection-id", connection.Id); + Assert.Equal("socket-name", connection.SocketName); + } + + [Fact] + public void TestBuildWebsocketWithoutIdOrSocket() + { + Assert.Throws( + () => new WebsocketClient().Connection("", "connection-id")); + Assert.Throws( + () => new WebsocketClient().Connection(null, "connection-id")); + Assert.Throws( + () => new WebsocketClient().Connection("socket-name", "")); + Assert.Throws( + () => new WebsocketClient().Connection("socket-name", null)); + } + + //Testing Websocket Methods + [Fact] + public void TestWebsocketSend() + { + var websocketSendRequest = new WebsocketSendRequest + { + SocketName = "socket-name", + ConnectionId = "connection-id", + Data = ByteString.CopyFromUtf8("websocket-data") + }; + Mock wc = new Mock(); + wc.Setup(e => + e.SendMessage(websocketSendRequest, null, null, It.IsAny())) + .Verifiable(); + + var connection = new WebsocketClient(wc.Object) + .Connection("socket-name", "connection-id"); + + connection.SendMessage("websocket-data"); + + wc.Verify( + t => t.SendMessage(websocketSendRequest, null, null, It.IsAny()), + Times.Once); + } + + [Fact] + public void TestWebsocketSendWithError() + { + var websocketSendRequest = new WebsocketSendRequest + { + SocketName = "socket-name", + ConnectionId = "connection-id", + Data = ByteString.CopyFromUtf8("websocket-data") + }; + Mock wc = new Mock(); + wc.Setup(e => + e.SendMessage(websocketSendRequest, null, null, It.IsAny())) + .Throws(new RpcException(Status.DefaultCancelled, "succeeded in failing")); + + var connection = new WebsocketClient(wc.Object) + .Connection("socket-name", "connection-id"); + + Assert.Throws(() => + connection.SendMessage("websocket-data") + ); + } + + [Fact] + public async void TestWebsocketSendAsync() + { + var websocketSendRequest = new WebsocketSendRequest + { + SocketName = "socket-name", + ConnectionId = "connection-id", + Data = ByteString.CopyFromUtf8("websocket-data") + }; + Mock wc = new Mock(); + wc.Setup(e => + e.SendMessageAsync(websocketSendRequest, null, null, It.IsAny())) + .Returns(new AsyncUnaryCall(Task.FromResult(new WebsocketSendResponse()), null, null, null, null)) + .Verifiable(); + + var connection = new WebsocketClient(wc.Object) + .Connection("socket-name", "connection-id"); + + await connection.SendMessageAsync("websocket-data"); + + wc.Verify( + t => t.SendMessageAsync(websocketSendRequest, null, null, It.IsAny()), + Times.Once); + } + + [Fact] + public void TestWebsocketSendWithErrorAsync() + { + var websocketSendRequest = new WebsocketSendRequest + { + SocketName = "socket-name", + ConnectionId = "connection-id", + Data = ByteString.CopyFromUtf8("websocket-data") + }; + Mock wc = new Mock(); + wc.Setup(e => + e.SendMessageAsync(websocketSendRequest, null, null, It.IsAny())) + .Throws(new RpcException(Status.DefaultCancelled, "succeeded in failing")); + + var connection = new WebsocketClient(wc.Object) + .Connection("socket-name", "connection-id"); + + Assert.ThrowsAsync(() => + connection.SendMessageAsync("websocket-data") + ); + } + + [Fact] + public void TestWebsocketClose() + { + var websocketCloseRequest = new WebsocketCloseConnectionRequest + { + SocketName = "socket-name", + ConnectionId = "connection-id", + }; + Mock wc = new Mock(); + wc.Setup(e => + e.CloseConnection(websocketCloseRequest, null, null, It.IsAny())) + .Verifiable(); + + var connection = new WebsocketClient(wc.Object) + .Connection("socket-name", "connection-id"); + + connection.CloseConnection(); + + wc.Verify( + t => t.CloseConnection(websocketCloseRequest, null, null, It.IsAny()), + Times.Once); + } + + [Fact] + public void TestWebsocketCloseWithError() + { + var websocketCloseRequest = new WebsocketCloseConnectionRequest + { + SocketName = "socket-name", + ConnectionId = "connection-id", + }; + Mock wc = new Mock(); + wc.Setup(e => + e.CloseConnection(websocketCloseRequest, null, null, It.IsAny())) + .Throws(new RpcException(Status.DefaultCancelled, "succeeded in failing")); + + var connection = new WebsocketClient(wc.Object) + .Connection("socket-name", "connection-id"); + + Assert.Throws(() => + connection.CloseConnection() + ); + } + + [Fact] + public async void TestWebsocketCloseAsync() + { + var websocketCloseRequest = new WebsocketCloseConnectionRequest + { + SocketName = "socket-name", + ConnectionId = "connection-id", + }; + Mock wc = new Mock(); + wc.Setup(e => + e.CloseConnectionAsync(websocketCloseRequest, null, null, It.IsAny())) + .Returns(new AsyncUnaryCall(Task.FromResult(new WebsocketCloseConnectionResponse()), null, null, null, null)) + .Verifiable(); + + var connection = new WebsocketClient(wc.Object) + .Connection("socket-name", "connection-id"); + + await connection.CloseConnectionAsync(); + + wc.Verify( + t => t.CloseConnectionAsync(websocketCloseRequest, null, null, It.IsAny()), + Times.Once); + } + + [Fact] + public void TestWebsocketCloseWithErrorAsync() + { + var websocketCloseRequest = new WebsocketCloseConnectionRequest + { + SocketName = "socket-name", + ConnectionId = "connection-id", + }; + Mock wc = new Mock(); + wc.Setup(e => + e.CloseConnectionAsync(websocketCloseRequest, null, null, It.IsAny())) + .Throws(new RpcException(Status.DefaultCancelled, "succeeded in failing")); + + var connection = new WebsocketClient(wc.Object) + .Connection("socket-name", "connection-id"); + + Assert.ThrowsAsync(() => + connection.CloseConnectionAsync() + ); + } + } +} \ No newline at end of file From 7f3c732e0e1a1df7ddc9f64b31a3fc5dccdd7d81 Mon Sep 17 00:00:00 2001 From: Ryan Cartwright Date: Wed, 24 Apr 2024 16:23:01 +1000 Subject: [PATCH 15/34] update proto, tests, and API interface --- makefile | 4 +- nitric/proto/apis/v1/apis.proto | 120 +++++ nitric/proto/deployments/v1/deployments.proto | 299 ++++++++++++ nitric/proto/http/v1/http.proto | 30 ++ nitric/proto/keyvalue/v1/keyvalue.proto | 75 +++ nitric/proto/kvstore/v1/kvstore.proto | 93 ++++ nitric/proto/queues/v1/queues.proto | 82 ++++ nitric/proto/resources/v1/resources.proto | 127 ++++++ nitric/proto/schedules/v1/schedules.proto | 69 +++ nitric/proto/secrets/v1/secrets.proto | 60 +++ nitric/proto/storage/v1/storage.proto | 191 ++++++++ nitric/proto/topics/v1/topics.proto | 94 ++++ nitric/proto/websockets/v1/websockets.proto | 153 +++++++ src/Nitric.Sdk/Nitric.Sdk.csproj | 2 +- src/Nitric.Sdk/Nitric.cs | 34 +- .../Proto/{ => nitric/proto}/apis/v1/Apis.cs | 0 .../{ => nitric/proto}/apis/v1/ApisGrpc.cs | 0 .../proto}/deployments/v1/Deployments.cs | 0 .../proto}/deployments/v1/DeploymentsGrpc.cs | 0 .../Proto/{ => nitric/proto}/http/v1/Http.cs | 0 .../{ => nitric/proto}/http/v1/HttpGrpc.cs | 0 .../proto}/keyvalue/v1/Keyvalue.cs | 0 .../proto}/keyvalue/v1/KeyvalueGrpc.cs | 0 .../{ => nitric/proto}/kvstore/v1/Kvstore.cs | 0 .../proto}/kvstore/v1/KvstoreGrpc.cs | 0 .../{ => nitric/proto}/queues/v1/Queues.cs | 0 .../proto}/queues/v1/QueuesGrpc.cs | 0 .../proto}/resources/v1/Resources.cs | 0 .../proto}/resources/v1/ResourcesGrpc.cs | 0 .../proto}/schedules/v1/Schedules.cs | 0 .../proto}/schedules/v1/SchedulesGrpc.cs | 0 .../{ => nitric/proto}/secrets/v1/Secrets.cs | 0 .../proto}/secrets/v1/SecretsGrpc.cs | 0 .../{ => nitric/proto}/storage/v1/Storage.cs | 0 .../proto}/storage/v1/StorageGrpc.cs | 0 .../{ => nitric/proto}/topics/v1/Topics.cs | 0 .../proto}/topics/v1/TopicsGrpc.cs | 0 .../proto}/websockets/v1/Websockets.cs | 0 .../proto}/websockets/v1/WebsocketsGrpc.cs | 0 src/Nitric.Sdk/Resource/ApiResource.cs | 426 +++++++++--------- src/Nitric.Sdk/Resource/OidcResource.cs | 64 +++ src/Nitric.Sdk/Service/WebsocketContext.cs | 4 +- src/Nitric.Sdk/Worker/ApiWorker.cs | 19 +- src/Nitric.Sdk/Worker/BlobEventWorker.cs | 20 +- src/Nitric.Sdk/Worker/FileEventWorker.cs | 22 +- src/Nitric.Sdk/Worker/ScheduleWorker.cs | 19 +- src/Nitric.Sdk/Worker/SubscriptionWorker.cs | 19 +- src/Nitric.Sdk/Worker/WebsocketWorker.cs | 19 +- src/Nitric.Sdk/Worker/Worker.cs | 5 +- .../KeyValueStore/KeyValueStoreClientTest.cs | 27 -- test/Nitric.Sdk.Test/Mocks.cs | 48 ++ .../Resource/ApiResourceTest.cs | 0 .../Storage/StorageClientTest.cs | 53 +++ test/Nitric.Sdk.Test/Test.cs | 24 + test/Nitric.Sdk.Test/Worker/ApiWorkerTest.cs | 168 +++++++ .../Nitric.Sdk.Test/Worker/BlobEventWorker.cs | 202 +++++++++ .../Nitric.Sdk.Test/Worker/FileEventWorker.cs | 215 +++++++++ .../Worker/ScheduleWorkerTest.cs | 160 +++++++ .../Worker/SubscriptionWorkerTest.cs | 192 ++++++++ .../Worker/WebsocketWorkerTest.cs | 174 +++++++ test/Nitric.Sdk.Test/examples/ExamplesTest.cs | 330 -------------- .../examples/documents/Delete.cs | 34 -- .../Nitric.Sdk.Test/examples/documents/Get.cs | 34 -- .../examples/documents/PagedResults.cs | 41 -- .../examples/documents/Query.cs | 34 -- .../examples/documents/QueryFilter.cs | 36 -- .../examples/documents/QueryLimits.cs | 36 -- .../examples/documents/Refs.cs | 36 -- .../Nitric.Sdk.Test/examples/documents/Set.cs | 39 -- .../examples/documents/SubColQuery.cs | 38 -- .../examples/documents/SubDocQuery.cs | 37 -- .../examples/events/EventIDs.cs | 39 -- .../examples/events/Publish.cs | 40 -- .../examples/queues/Receive.cs | 40 -- test/Nitric.Sdk.Test/examples/queues/Send.cs | 36 -- .../examples/secrets/Access.cs | 35 -- .../examples/secrets/Latest.cs | 31 -- test/Nitric.Sdk.Test/examples/secrets/Put.cs | 34 -- .../examples/storage/Delete.cs | 31 -- test/Nitric.Sdk.Test/examples/storage/Read.cs | 31 -- .../Nitric.Sdk.Test/examples/storage/Write.cs | 34 -- 81 files changed, 2995 insertions(+), 1364 deletions(-) create mode 100644 nitric/proto/apis/v1/apis.proto create mode 100644 nitric/proto/deployments/v1/deployments.proto create mode 100644 nitric/proto/http/v1/http.proto create mode 100644 nitric/proto/keyvalue/v1/keyvalue.proto create mode 100644 nitric/proto/kvstore/v1/kvstore.proto create mode 100644 nitric/proto/queues/v1/queues.proto create mode 100644 nitric/proto/resources/v1/resources.proto create mode 100644 nitric/proto/schedules/v1/schedules.proto create mode 100644 nitric/proto/secrets/v1/secrets.proto create mode 100644 nitric/proto/storage/v1/storage.proto create mode 100644 nitric/proto/topics/v1/topics.proto create mode 100644 nitric/proto/websockets/v1/websockets.proto rename src/Nitric.Sdk/Proto/{ => nitric/proto}/apis/v1/Apis.cs (100%) rename src/Nitric.Sdk/Proto/{ => nitric/proto}/apis/v1/ApisGrpc.cs (100%) rename src/Nitric.Sdk/Proto/{ => nitric/proto}/deployments/v1/Deployments.cs (100%) rename src/Nitric.Sdk/Proto/{ => nitric/proto}/deployments/v1/DeploymentsGrpc.cs (100%) rename src/Nitric.Sdk/Proto/{ => nitric/proto}/http/v1/Http.cs (100%) rename src/Nitric.Sdk/Proto/{ => nitric/proto}/http/v1/HttpGrpc.cs (100%) rename src/Nitric.Sdk/Proto/{ => nitric/proto}/keyvalue/v1/Keyvalue.cs (100%) rename src/Nitric.Sdk/Proto/{ => nitric/proto}/keyvalue/v1/KeyvalueGrpc.cs (100%) rename src/Nitric.Sdk/Proto/{ => nitric/proto}/kvstore/v1/Kvstore.cs (100%) rename src/Nitric.Sdk/Proto/{ => nitric/proto}/kvstore/v1/KvstoreGrpc.cs (100%) rename src/Nitric.Sdk/Proto/{ => nitric/proto}/queues/v1/Queues.cs (100%) rename src/Nitric.Sdk/Proto/{ => nitric/proto}/queues/v1/QueuesGrpc.cs (100%) rename src/Nitric.Sdk/Proto/{ => nitric/proto}/resources/v1/Resources.cs (100%) rename src/Nitric.Sdk/Proto/{ => nitric/proto}/resources/v1/ResourcesGrpc.cs (100%) rename src/Nitric.Sdk/Proto/{ => nitric/proto}/schedules/v1/Schedules.cs (100%) rename src/Nitric.Sdk/Proto/{ => nitric/proto}/schedules/v1/SchedulesGrpc.cs (100%) rename src/Nitric.Sdk/Proto/{ => nitric/proto}/secrets/v1/Secrets.cs (100%) rename src/Nitric.Sdk/Proto/{ => nitric/proto}/secrets/v1/SecretsGrpc.cs (100%) rename src/Nitric.Sdk/Proto/{ => nitric/proto}/storage/v1/Storage.cs (100%) rename src/Nitric.Sdk/Proto/{ => nitric/proto}/storage/v1/StorageGrpc.cs (100%) rename src/Nitric.Sdk/Proto/{ => nitric/proto}/topics/v1/Topics.cs (100%) rename src/Nitric.Sdk/Proto/{ => nitric/proto}/topics/v1/TopicsGrpc.cs (100%) rename src/Nitric.Sdk/Proto/{ => nitric/proto}/websockets/v1/Websockets.cs (100%) rename src/Nitric.Sdk/Proto/{ => nitric/proto}/websockets/v1/WebsocketsGrpc.cs (100%) create mode 100644 src/Nitric.Sdk/Resource/OidcResource.cs create mode 100644 test/Nitric.Sdk.Test/Mocks.cs create mode 100644 test/Nitric.Sdk.Test/Resource/ApiResourceTest.cs create mode 100644 test/Nitric.Sdk.Test/Test.cs create mode 100644 test/Nitric.Sdk.Test/Worker/ApiWorkerTest.cs create mode 100644 test/Nitric.Sdk.Test/Worker/BlobEventWorker.cs create mode 100644 test/Nitric.Sdk.Test/Worker/FileEventWorker.cs create mode 100644 test/Nitric.Sdk.Test/Worker/ScheduleWorkerTest.cs create mode 100644 test/Nitric.Sdk.Test/Worker/SubscriptionWorkerTest.cs create mode 100644 test/Nitric.Sdk.Test/Worker/WebsocketWorkerTest.cs delete mode 100644 test/Nitric.Sdk.Test/examples/ExamplesTest.cs delete mode 100644 test/Nitric.Sdk.Test/examples/documents/Delete.cs delete mode 100644 test/Nitric.Sdk.Test/examples/documents/Get.cs delete mode 100644 test/Nitric.Sdk.Test/examples/documents/PagedResults.cs delete mode 100644 test/Nitric.Sdk.Test/examples/documents/Query.cs delete mode 100644 test/Nitric.Sdk.Test/examples/documents/QueryFilter.cs delete mode 100644 test/Nitric.Sdk.Test/examples/documents/QueryLimits.cs delete mode 100644 test/Nitric.Sdk.Test/examples/documents/Refs.cs delete mode 100644 test/Nitric.Sdk.Test/examples/documents/Set.cs delete mode 100644 test/Nitric.Sdk.Test/examples/documents/SubColQuery.cs delete mode 100644 test/Nitric.Sdk.Test/examples/documents/SubDocQuery.cs delete mode 100644 test/Nitric.Sdk.Test/examples/events/EventIDs.cs delete mode 100644 test/Nitric.Sdk.Test/examples/events/Publish.cs delete mode 100644 test/Nitric.Sdk.Test/examples/queues/Receive.cs delete mode 100644 test/Nitric.Sdk.Test/examples/queues/Send.cs delete mode 100644 test/Nitric.Sdk.Test/examples/secrets/Access.cs delete mode 100644 test/Nitric.Sdk.Test/examples/secrets/Latest.cs delete mode 100644 test/Nitric.Sdk.Test/examples/secrets/Put.cs delete mode 100644 test/Nitric.Sdk.Test/examples/storage/Delete.cs delete mode 100644 test/Nitric.Sdk.Test/examples/storage/Read.cs delete mode 100644 test/Nitric.Sdk.Test/examples/storage/Write.cs diff --git a/makefile b/makefile index c41a57e..36e111b 100644 --- a/makefile +++ b/makefile @@ -1,10 +1,12 @@ +.PHONY: test + # the version of of https://github.com/nitrictech/nitric to use in base client generation. NITRIC_VERSION := 1.1.1 generate: clean download build test: - @dotnet test tests/Nitric.Sdk.Test + @dotnet test test/Nitric.Sdk.Test build: @dotnet build src/Nitric.Sdk/Nitric.Sdk.csproj diff --git a/nitric/proto/apis/v1/apis.proto b/nitric/proto/apis/v1/apis.proto new file mode 100644 index 0000000..02fc8ae --- /dev/null +++ b/nitric/proto/apis/v1/apis.proto @@ -0,0 +1,120 @@ +syntax = "proto3"; +package nitric.proto.apis.v1; + +// protoc plugin options for code generation +option go_package = "github.com/nitrictech/nitric/core/pkg/proto/apis/v1;apispb"; +option java_package = "io.nitric.proto.apis.v1"; +option java_multiple_files = true; +option java_outer_classname = "Apis"; +option php_namespace = "Nitric\\Proto\\Apis\\V1"; +option csharp_namespace = "Nitric.Proto.Apis.v1"; + +// Service for API routing and handlers +service Api { + // Serve a route on an API + rpc Serve(stream ClientMessage) returns (stream ServerMessage); + + // Retrieve details about an API + rpc ApiDetails(ApiDetailsRequest) returns (ApiDetailsResponse); +} + +message ApiDetailsRequest { + string api_name = 1; +} + +message ApiDetailsResponse { + string url = 1; +} + +// ClientMessage sent by the service to the nitric server +message ClientMessage { + // globally unique ID of the request/response pair + string id = 1; + + oneof content { + // Register an API route handler + RegistrationRequest registration_request = 2; + + // Response to an HTTP request + HttpResponse http_response = 3; + } +} + +message HeaderValue { + repeated string value = 1; +} + +message QueryValue { + repeated string value = 1; +} + +message HttpRequest { + // The request method + string method = 1; + + // The path of the request + string path = 2; + + // HTTP request headers + map headers = 3; + + // HTTP Query params + map query_params = 4; + + // HTTP Path parameters + map path_params = 5; + + // HTTP Request body + bytes body = 6; +} + +// HttpResponseMessage +message HttpResponse { + // The HTTP response status code + int32 status = 1; + + // HTTP response headers + map headers = 2; + + // HTTP response body + bytes body = 3; +} + +// ServerMessage sent by the nitric server to the service +message ServerMessage { + // globally unique ID of the request/response pair + string id = 1; + + oneof content { + // Response to an API serve request + RegistrationResponse registration_response = 2; + + // HTTP request to be routed to the service (handler) + HttpRequest http_request = 3; + } +} + +message RegistrationResponse { +} + +message ApiWorkerScopes { + repeated string scopes = 1; +} + +message ApiWorkerOptions { + // Apply security definitions to this operation + // This will be mapped to named ApiSecurityDefinitionResource(s) + map security = 1; + // explicitly disable security for this endpoint + // We need to do this as the default value of a repeated field + // is always empty so there is no way of knowing if security is explicitly + // disabled + bool security_disabled = 2; +} + +message RegistrationRequest { + string api = 1; + string path = 2; + repeated string methods = 3; + ApiWorkerOptions options = 4; +} diff --git a/nitric/proto/deployments/v1/deployments.proto b/nitric/proto/deployments/v1/deployments.proto new file mode 100644 index 0000000..c63c6e9 --- /dev/null +++ b/nitric/proto/deployments/v1/deployments.proto @@ -0,0 +1,299 @@ +syntax = "proto3"; + +package nitric.proto.deployments.v1; + +import "google/protobuf/struct.proto"; +import "nitric/proto/resources/v1/resources.proto"; +import "nitric/proto/storage/v1/storage.proto"; + +//protoc plugin options for code generation +option go_package = "github.com/nitrictech/nitric/core/pkg/proto/deployments/v1;deploymentspb"; +option java_package = "io.nitric.proto.deployments.v1"; +option java_multiple_files = true; +option java_outer_classname = "Deployments"; +option php_namespace = "Nitric\\Proto\\Deployments\\V1"; +option csharp_namespace = "Nitric.Proto.Deployments.v1"; + +// The Nitric Deloyment Service contract +service Deployment { + // Begins a new deployment + // Server will stream updates back to the connected client + // on the status of the deployment + rpc Up (DeploymentUpRequest) returns (stream DeploymentUpEvent); + // Tears down an existing deployment + // Server will stream updates back to the connected client + // on the status of the teardown + rpc Down (DeploymentDownRequest) returns (stream DeploymentDownEvent); +} + +message DeploymentUpRequest { + // The spec to deploy + Spec spec = 1; + + // A map of attributes related to the deploy request + // this allows for adding project identifiers etc. + google.protobuf.Struct attributes = 2; + + // A hint to the provider of the kind of output that the client can accept + // This will allow provider developers to provider richer output back to clients. + bool interactive = 3; +} + +message DeploymentUpEvent { + oneof content { + string message = 1; + ResourceUpdate update = 2; + UpResult result = 3; + } +} + +enum ResourceDeploymentAction { + // A new resource is being created + CREATE = 0; + // An existing resource is being updated + UPDATE = 1; + // An existing resource is being replaced + REPLACE = 2; + // No-op on the resource (it already exists and requires no changes) + SAME = 3; + // An existing resource is being deleted + DELETE = 4; +} + +enum ResourceDeploymentStatus { + // The action hasn't started, usually due to a dependency + PENDING = 0; + // The action in currently in-flight, e.g. waiting for cloud provder to provision a resource + IN_PROGRESS = 1; + // The action has been applied successfully + SUCCESS = 2; + // The action has failed to be (completely) applied + FAILED = 3; +} + +message ResourceUpdate { + // The resource being updated, if this is nil the update applies to the stack + nitric.proto.resources.v1.ResourceIdentifier id = 1; + + // The type of update being applied + ResourceDeploymentAction action = 3; + + // The current status of the action being applied + ResourceDeploymentStatus status = 4; + + // (optional) A globally unique identifier (scoped to the id above), used when Nitric Resources map 1:many in a cloud provider. + // e.g. the container image repository for a service deployment. + // This can also be set when id is nil above and it will imply a non-nitric resource that is necessary to deploy for a stack to operate + // e.g. an Azure StorageAccount + string sub_resource = 5; + + // Additional information about the update + string message = 6; +} + +// Terminal message indicating deployment success +message UpResult { + // Indicate the success status + bool success = 1; + + + oneof content { + // Simple text output as result + string text = 2; + } +} + +message DeploymentDownRequest { + // A map of attributes related to the deploy request + // this allows for adding project identifiers etc. + google.protobuf.Struct attributes = 1; + + // A hint to the provider of the kind of output that the client can accept + // This will allow provider developers to provider richer output back to clients. + bool interactive = 2; +} + +message DeploymentDownEvent { + oneof content { + string message = 1; + DownResult result = 2; + ResourceUpdate update = 3; + } +} + +// Terminal message indicating deployment success +message DownResult { +} + +// An image source to be used for service deployment +message ImageSource { + // URI of the docker image + // To support remote images this may also need to provide auth information + string uri = 1; +} + +// A unit of compute (i.e. function/container) +message Service { + // Source of the service + oneof source { + // Container image as a service + ImageSource image = 1; + // Alternative sources could include + // - zipped code sources + // - git/scm repository URIs + + } + + // Expected worker count for this service + int32 workers = 10; + // Configurable timeout for request handling + int32 timeout = 11 [deprecated = true]; + // Configurable memory size for this instance + int32 memory = 12 [deprecated = true]; + + // A simple type property + // describes the requested type of service that this should be + // for this project, a provider can implement how this request is satisfied + // in any way + string type = 13; + + // Environment variables for this service + map env = 14; +} + +message Bucket { + repeated BucketListener listeners = 1; +} + +message BucketListener { + nitric.proto.storage.v1.RegistrationRequest config = 1; + oneof target { + // The name of an service to target + string service = 2; + } +} + +message Topic { + repeated SubscriptionTarget subscriptions = 1; +} + +message Queue { +} + +message KeyValueStore { +} + +message Secret { +} + +message SubscriptionTarget { + oneof target { + // The name of an service to target + string service = 1; + // Additional targets could potentially include + // - HTTP/API Endpoints + // - Queues + } +} + +message TopicSubscription { + SubscriptionTarget target = 1; +} + +message HttpTarget { + oneof target { + // The name of an service to target + string service = 1; + } +} + +// An http proxy resource +message Http { + HttpTarget target = 1; +} + +message Api { + oneof document { + // An OpenAPI document for deployment + // This document will contain extensions that hint of services that should be targeted as part of the deployment + string openapi = 1; + } +} + +// Declare a new websocket +message Websocket { + // Target for handling new client connections + WebsocketTarget connect_target = 1; + // Target for handling client disconnections + WebsocketTarget disconnect_target = 2; + // Target for handling all other message types + WebsocketTarget message_target = 3; +} + +message WebsocketTarget { + oneof target { + // The name of an service to target + string service = 1; + // Additional targets could potentially include + // - HTTP/API Endpoints + } +} + +message ScheduleTarget { + oneof target { + // The name of an service to target + string service = 1; + // Additional targets could potentially include + // - HTTP/API Endpoints + } +} + +message Schedule { + ScheduleTarget target = 1; + + oneof cadence { + ScheduleEvery every = 10; + ScheduleCron cron = 11; + } +} + +message ScheduleEvery { + // rate string e.g. '5 minutes'. Value frequencies are 'minutes', 'hours', 'days'. + string rate = 1; +} + +message ScheduleCron { + // standard unix cron expression + string expression = 1; +} + +message Resource { + nitric.proto.resources.v1.ResourceIdentifier id = 1; + + oneof config { + Service service = 10; + Bucket bucket = 11; + Topic topic = 12; + Api api = 13; + Policy policy = 14; + Schedule schedule = 15; + KeyValueStore key_value_store = 16; + Secret secret = 17; + Websocket websocket = 18; + Http http = 19; + Queue queue = 20; + } +} + +// This is already defined in the resource contracts, +// unfortunately there are parts we don't want to duplicate, such as API config +message Policy { + repeated Resource principals = 1; + repeated nitric.proto.resources.v1.Action actions = 2; + repeated Resource resources = 3; +} + +message Spec { + // list of resources to deploy + repeated Resource resources = 1; +} diff --git a/nitric/proto/http/v1/http.proto b/nitric/proto/http/v1/http.proto new file mode 100644 index 0000000..b64e6d1 --- /dev/null +++ b/nitric/proto/http/v1/http.proto @@ -0,0 +1,30 @@ +syntax = "proto3"; +package nitric.proto.http.v1; + +// protoc plugin options for code generation +option go_package = "github.com/nitrictech/nitric/core/pkg/proto/http/v1;httppb"; +option java_package = "io.nitric.proto.http.v1"; +option java_multiple_files = true; +option java_outer_classname = "Https"; +option php_namespace = "Nitric\\Proto\\Http\\V1"; +option csharp_namespace = "Nitric.Proto.Http.v1"; + +// Service for proxying HTTP requests +service Http { + // Proxy an HTTP server + rpc Proxy(stream ClientMessage) returns (stream ServerMessage); +} + +message ClientMessage { + // Details of the HTTP server to proxy + HttpProxyRequest request = 1; +} + +message ServerMessage { +} + +message HttpProxyRequest { + // The address the server can be accessed on + string host = 1; +} + diff --git a/nitric/proto/keyvalue/v1/keyvalue.proto b/nitric/proto/keyvalue/v1/keyvalue.proto new file mode 100644 index 0000000..1ef0e29 --- /dev/null +++ b/nitric/proto/keyvalue/v1/keyvalue.proto @@ -0,0 +1,75 @@ +syntax = "proto3"; +package nitric.proto.KeyValue.v1; + +import "google/protobuf/struct.proto"; + +// protoc plugin options for code generation +// option go_package = "nitric/v1;v1"; +option go_package = "github.com/nitrictech/nitric/core/pkg/proto/keyvalue/v1;KeyValuepb"; +option java_package = "io.nitric.proto.keyvalue.v1"; +option java_multiple_files = true; +option java_outer_classname = "KeyValue"; +option php_namespace = "Nitric\\Proto\\KeyValue\\V1"; +option csharp_namespace = "Nitric.Proto.KeyValue.v1"; + +// Service for storage and retrieval of simple JSON keyValue +service KeyValue { + // Get an existing value + rpc Get (KeyValueGetRequest) returns (KeyValueGetResponse); + + // Create a new or overwrite an existing value + rpc Set (KeyValueSetRequest) returns (KeyValueSetResponse); + + // Delete a key and its value + rpc Delete (KeyValueDeleteRequest) returns (KeyValueDeleteResponse); +} + +// Provides a Key/Value Store +message Store { + // The store name + string name = 1; +} + +// ValueRef provides a unique identifier for a value +message ValueRef { + // The key/value store name + string store = 1; + + // The item's unique key within the store + string key = 2; +} + +// Value provides a return value type +message Value { + // ValueRef of the key/value pair, which includes the store and key + ValueRef ref = 1; + + // The content (JSON object) + google.protobuf.Struct content = 2; +} + +message KeyValueGetRequest { + // ValueRef of the key/value pair to get, which includes the store and key + ValueRef ref = 1; +} + +message KeyValueGetResponse { + // The retrieved value + Value value = 1; +} + +message KeyValueSetRequest { + // ValueRef of the key/value pair to set, which includes the store and key + ValueRef ref = 1 ; + // The value content to store (JSON object) + google.protobuf.Struct content = 3; +} + +message KeyValueSetResponse {} + +message KeyValueDeleteRequest { + // ValueRef of the key/value pair to delete, which includes the store and key + ValueRef ref = 1; +} + +message KeyValueDeleteResponse {} diff --git a/nitric/proto/kvstore/v1/kvstore.proto b/nitric/proto/kvstore/v1/kvstore.proto new file mode 100644 index 0000000..6171ebd --- /dev/null +++ b/nitric/proto/kvstore/v1/kvstore.proto @@ -0,0 +1,93 @@ +syntax = "proto3"; +package nitric.proto.kvstore.v1; + +import "google/protobuf/struct.proto"; + +// protoc plugin options for code generation +// option go_package = "nitric/v1;v1"; +option go_package = "github.com/nitrictech/nitric/core/pkg/proto/kvstore/v1;kvstorepb"; +option java_package = "io.nitric.proto.kvstore.v1"; +option java_multiple_files = true; +option java_outer_classname = "KvStore"; +option php_namespace = "Nitric\\Proto\\KvStore\\V1"; +option csharp_namespace = "Nitric.Proto.KvStore.v1"; + +// Service for storage and retrieval of simple JSON keyValue +service KvStore { + // Get an existing value + rpc GetValue (KvStoreGetValueRequest) returns (KvStoreGetValueResponse); + + // Create a new or overwrite an existing value + rpc SetValue (KvStoreSetValueRequest) returns (KvStoreSetValueResponse); + + // Delete a key and its value + rpc DeleteKey (KvStoreDeleteKeyRequest) returns (KvStoreDeleteKeyResponse); + + // Iterate over all keys in a store + rpc ScanKeys (KvStoreScanKeysRequest) returns (stream KvStoreScanKeysResponse); +} + +// Provides a Key/Value Store +message Store { + // The store name + string name = 1; +} + +// ValueRef provides a unique identifier for a value +message ValueRef { + // The key/value store name + string store = 1; + + // The item's unique key within the store + string key = 2; +} + +// Value provides a return value type +message Value { + // ValueRef of the key/value pair, which includes the store and key + ValueRef ref = 1; + + // The content (JSON object) + google.protobuf.Struct content = 2; +} + +message KvStoreGetValueRequest { + // ValueRef of the key/value pair to get, which includes the store and key + ValueRef ref = 1; +} + +message KvStoreGetValueResponse { + // The retrieved value + Value value = 1; +} + +message KvStoreSetValueRequest { + // ValueRef of the key/value pair to set, which includes the store and key + ValueRef ref = 1 ; + // The value content to store (JSON object) + google.protobuf.Struct content = 3; +} + +message KvStoreSetValueResponse { +} + +message KvStoreDeleteKeyRequest { + // ValueRef of the key/value pair to delete, which includes the store and key + ValueRef ref = 1; +} + +message KvStoreDeleteKeyResponse { +} + +message KvStoreScanKeysRequest { + // The store to iterate over + Store store = 1; + + // The prefix to filter keys by + string prefix = 2; +} + +message KvStoreScanKeysResponse { + // The key of the key/value pair + string key = 1; +} diff --git a/nitric/proto/queues/v1/queues.proto b/nitric/proto/queues/v1/queues.proto new file mode 100644 index 0000000..122af91 --- /dev/null +++ b/nitric/proto/queues/v1/queues.proto @@ -0,0 +1,82 @@ +syntax = "proto3"; +package nitric.proto.queues.v1; + +import "google/protobuf/struct.proto"; + +// protoc plugin options for code generation +option go_package = "github.com/nitrictech/nitric/core/pkg/proto/queues/v1;queuespb"; +option java_package = "io.nitric.proto.queues.v1"; +option java_multiple_files = true; +option java_outer_classname = "QueuesService"; +option php_namespace = "Nitric\\Proto\\Queues\\V1"; +option csharp_namespace = "Nitric.Proto.Queues.v1"; + +// The Nitric Queue Service contract +service Queues { + // Send message(s) to a queue + rpc Enqueue (QueueEnqueueRequest) returns (QueueEnqueueResponse); + // Receive message(s) from a queue + rpc Dequeue (QueueDequeueRequest) returns (QueueDequeueResponse); + // Complete an message previously popped from a queue + rpc Complete (QueueCompleteRequest) returns (QueueCompleteResponse); +} + +message QueueEnqueueRequest { + // The Nitric name for the queue + // this will automatically be resolved to the provider specific queue identifier. + string queue_name = 1; + // Array of messages to push to the queue + repeated QueueMessage messages = 2; +} + +// Response for sending messages to a queue +message QueueEnqueueResponse { + // A list of messages that failed to be queued + repeated FailedEnqueueMessage failed_messages = 1; +} + +message QueueDequeueRequest { + // The nitric name for the queue + // this will automatically be resolved to the provider specific queue identifier. + string queue_name = 1; + // The max number of messages to pop off the queue, may be capped by provider specific limitations + int32 depth = 2; +} + +message QueueDequeueResponse { + // Array of messages popped off the queue + repeated DequeuedMessage messages = 1; +} + +message QueueCompleteRequest { + // The nitric name for the queue + // this will automatically be resolved to the provider specific queue identifier. + string queue_name = 1; + + // Lease id of the message to be completed + string lease_id = 2; +} + +message QueueCompleteResponse { +} + +// An message to be sent to a queue. +message QueueMessage { + // The queue message contents + oneof content { + google.protobuf.Struct struct_payload = 1; + } +} + +message DequeuedMessage { + string lease_id = 1; + + QueueMessage message = 2; +} + +message FailedEnqueueMessage { + // The message that failed to be pushed + QueueMessage message = 1; + // A description of the failure + string details = 2; +} diff --git a/nitric/proto/resources/v1/resources.proto b/nitric/proto/resources/v1/resources.proto new file mode 100644 index 0000000..4fa5a3b --- /dev/null +++ b/nitric/proto/resources/v1/resources.proto @@ -0,0 +1,127 @@ +syntax = "proto3"; +package nitric.proto.resources.v1; + +//protoc plugin options for code generation +option go_package = "github.com/nitrictech/nitric/core/pkg/proto/resources/v1;resourcespb"; +option java_package = "io.nitric.proto.resources.v1"; +option java_multiple_files = true; +option java_outer_classname = "Resources"; +option php_namespace = "Nitric\\Proto\\Resources\\V1"; +option csharp_namespace = "Nitric.Proto.Resources.v1"; + +// Nitric Resource Service +// The service definition exists to allow a nitric application to declare peripheral dependencies +service Resources { + // Declare a resource for the nitric application + // At Deploy time this will create resources as part of the nitric stacks dependency graph + // At runtime + rpc Declare (ResourceDeclareRequest) returns (ResourceDeclareResponse); +} + +message PolicyResource { + repeated ResourceIdentifier principals = 1; + repeated Action actions = 2; + repeated ResourceIdentifier resources = 3; +} + +enum ResourceType { + Api = 0; + Service = 1; + Bucket = 2; + Topic = 3; + Schedule = 4; + Subscription = 5; + KeyValueStore = 6; + Policy = 7; + Secret = 8; + BucketListener = 9; + Websocket = 10; + Http = 11; + ApiSecurityDefinition = 12; + Queue = 13; +} + +// Unique identifier for a resource within a nitric application. +message ResourceIdentifier { + ResourceType type = 1; + string name = 2; +} + +message ResourceDeclareRequest { + ResourceIdentifier id = 1; + + oneof config { + PolicyResource policy = 10; + BucketResource bucket = 11; + TopicResource topic = 12; + KeyValueStoreResource key_value_store = 13; + SecretResource secret = 14; + ApiResource api = 15; + ApiSecurityDefinitionResource api_security_definition = 16; + QueueResource queue = 17; + } +} + +message BucketResource { +} +message TopicResource { +} +message QueueResource { +} +message KeyValueStoreResource { +} +message SecretResource { +} + +message ApiOpenIdConnectionDefinition { + string issuer = 1; + repeated string audiences = 2; +} + +message ApiSecurityDefinitionResource { + string api_name = 1; + + oneof definition { + ApiOpenIdConnectionDefinition oidc = 2; + } +} + +message ApiScopes { + repeated string scopes = 1; +} + +message ApiResource { + // root level security map for this api + // references ApiSecurityDefinitionResource(s) + map security = 1; +} + +enum Action { + // Bucket Permissions: 0XX + BucketFileList = 0; + BucketFileGet = 1; + BucketFilePut = 2; + BucketFileDelete = 3; + + // Topic Permissions: 2XX + TopicPublish = 200; + + // KeyValue Store Permissions: 3XX + KeyValueStoreRead = 300; + KeyValueStoreWrite = 301; + KeyValueStoreDelete = 302; + + // Secret Permissions: 4XX + SecretPut = 400; + SecretAccess = 401; + + // Websocket Permissions: 5XX + WebsocketManage = 500; + + // Queue Permissions: 6XX + QueueEnqueue = 600; + QueueDequeue = 601; +} + +message ResourceDeclareResponse { +} diff --git a/nitric/proto/schedules/v1/schedules.proto b/nitric/proto/schedules/v1/schedules.proto new file mode 100644 index 0000000..364d548 --- /dev/null +++ b/nitric/proto/schedules/v1/schedules.proto @@ -0,0 +1,69 @@ +syntax = "proto3"; +package nitric.proto.schedules.v1; + +// protoc plugin options for code generation +option go_package = "github.com/nitrictech/nitric/core/pkg/proto/schedules/v1;schedulespb"; +option java_package = "io.nitric.proto.schedules.v1"; +option java_multiple_files = true; +option java_outer_classname = "SchedulesService"; +option php_namespace = "Nitric\\Proto\\Schedules\\V1"; +option csharp_namespace = "Nitric.Proto.Schedules.v1"; + +// Service for scheduling callbacks on a cadence +service Schedules { + rpc Schedule(stream ClientMessage) returns (stream ServerMessage); +} + +// ClientMessages are sent from the service to the nitric server +message ClientMessage { + // globally unique ID of the request/response pair + string id = 1; + + oneof content { + // Register new a schedule + RegistrationRequest registration_request = 2; + + // Response to a schedule interval (i.e. response from callback function) + IntervalResponse interval_response = 3; + } +} + +message IntervalRequest { + string schedule_name = 1; +} + +// ServerMessages are sent from the nitric server to the service +message ServerMessage { + // globally unique ID of the request/response pair + string id = 1; + + oneof content { + // Response to a schedule subscription request + RegistrationResponse registration_response = 2; + + // A schedule interval trigger request (i.e. call the callback) + IntervalRequest interval_request = 3; + } +} + +message RegistrationRequest { + string schedule_name = 1; + oneof cadence { + ScheduleEvery every = 10; + ScheduleCron cron = 11; + } +} + +message ScheduleEvery { + string rate = 1; +} + +message ScheduleCron { + string expression = 1; +} + +message RegistrationResponse { +} + +message IntervalResponse { +} diff --git a/nitric/proto/secrets/v1/secrets.proto b/nitric/proto/secrets/v1/secrets.proto new file mode 100644 index 0000000..7d64e8c --- /dev/null +++ b/nitric/proto/secrets/v1/secrets.proto @@ -0,0 +1,60 @@ +syntax = "proto3"; +package nitric.proto.secrets.v1; + +//protoc plugin options for code generation +option go_package = "github.com/nitrictech/nitric/core/pkg/proto/secrets/v1;secretspb"; +option java_package = "io.nitric.proto.secrets.v1"; +option java_multiple_files = true; +option java_outer_classname = "SecretsService"; +option php_namespace = "Nitric\\Proto\\Secrets\\V1"; +option csharp_namespace = "Nitric.Proto.Secrets.v1"; + +// The Nitric Secret Service +service SecretManager { + // Updates a secret, creating a new one if it doesn't already exist + rpc Put (SecretPutRequest) returns (SecretPutResponse); + // Gets a secret from a Secret Store + rpc Access (SecretAccessRequest) returns (SecretAccessResponse); +} + +// Request to put a secret to a Secret Store +message SecretPutRequest { + // The Secret to put to the Secret store + Secret secret = 1; + // The value to assign to that secret + bytes value = 2; +} + +// Result from putting the secret to a Secret Store +message SecretPutResponse { + // The id of the secret + SecretVersion secret_version = 1; +} + +// Request to get a secret from a Secret Store +message SecretAccessRequest { + // The id of the secret + SecretVersion secret_version = 1; +} + +// The secret response +message SecretAccessResponse { + // The version of the secret that was requested + SecretVersion secret_version = 1; + // The value of the secret + bytes value = 2; +} + +// The secret container +message Secret { + // The secret name + string name = 1; +} + +// A version of a secret +message SecretVersion { + // Reference to the secret container + Secret secret = 1; + // The secret version + string version = 2; +} \ No newline at end of file diff --git a/nitric/proto/storage/v1/storage.proto b/nitric/proto/storage/v1/storage.proto new file mode 100644 index 0000000..afcc6ec --- /dev/null +++ b/nitric/proto/storage/v1/storage.proto @@ -0,0 +1,191 @@ +syntax = "proto3"; + +package nitric.proto.storage.v1; + +import "google/protobuf/duration.proto"; + +// protoc plugin options for code generation +option go_package = "github.com/nitrictech/nitric/core/pkg/proto/storage/v1;storagepb"; +option java_package = "io.nitric.proto.storage.v1"; +option java_multiple_files = true; +option java_outer_classname = "StorageService"; +option php_namespace = "Nitric\\Proto\\Storage\\V1"; +option csharp_namespace = "Nitric.Proto.Storage.v1"; + +// Services for storage and retrieval of blobs in the form of byte arrays, such as text and binary blobs. +service Storage { + // Retrieve an item from a bucket + rpc Read (StorageReadRequest) returns (StorageReadResponse); + // Store an item to a bucket + rpc Write (StorageWriteRequest) returns (StorageWriteResponse); + // Delete an item from a bucket + rpc Delete (StorageDeleteRequest) returns (StorageDeleteResponse); + // Generate a pre-signed URL for direct operations on an item + rpc PreSignUrl (StoragePreSignUrlRequest) returns (StoragePreSignUrlResponse); + // List blobs currently in the bucket + rpc ListBlobs (StorageListBlobsRequest) returns (StorageListBlobsResponse); + // Determine is an object exists in a bucket + rpc Exists (StorageExistsRequest) returns (StorageExistsResponse); +} + +service StorageListener { + // Listen for changes on a bucket + rpc Listen (stream ClientMessage) returns (stream ServerMessage); +} + +// ClientMessages are sent from the service to the nitric server +message ClientMessage { + // globally unique ID of the request/response pair + string id = 1; + + oneof content { + // Watch for changes on a bucket + RegistrationRequest registration_request = 2; + // Response to a blob event (change to a blob) + BlobEventResponse blob_event_response = 3; + } +} + +// ServerMessages are sent from the nitric server to the service +message ServerMessage { + // globally unique ID of the request/response pair + string id = 1; + + oneof content { + // Watch for changes on a bucket + RegistrationResponse registration_response = 2; + // Event for a blob in a bucket + BlobEventRequest blob_event_request = 3; + } +} + +message BlobEventRequest { + string bucket_name = 1; + + oneof event { + BlobEvent blob_event = 10; + } +} + +message BlobEvent { + // The key of the blob the event is for + string key = 1; + + // The type of event that occurred + BlobEventType type = 2; +} + +message BlobEventResponse { + bool success = 1; +} + +enum BlobEventType { + Created = 0; + Deleted = 1; +} + +message RegistrationRequest { + // Name of the bucket to watch + string bucket_name = 1; + + // Event type to listen for + BlobEventType blob_event_type = 2; + + // A blob key prefix to filter events by + string key_prefix_filter = 3; +} + +message RegistrationResponse { + // The ID of the registration + string id = 1; +} + +// Request to put (create/update) a storage item +message StorageWriteRequest { + // Nitric name of the bucket to store in + // this will be automatically resolved to the provider specific bucket identifier. + string bucket_name = 1; + // Key to store the item under + string key = 2; + // bytes array to store + bytes body = 3; +} + +// Result of putting a storage item +message StorageWriteResponse { +} + +// Request to retrieve a storage item +message StorageReadRequest { + // Nitric name of the bucket to retrieve from + // this will be automatically resolved to the provider specific bucket identifier. + string bucket_name = 1; + // Key of item to retrieve + string key = 2; +} + +// Returned storage item +message StorageReadResponse { + // The body bytes of the retrieved storage item + bytes body = 1; +} + +// Request to delete a storage item +message StorageDeleteRequest { + // Name of the bucket to delete from + string bucket_name = 1; + // Key of item to delete + string key = 2; +} + +// Result of deleting a storage item +message StorageDeleteResponse { +} + +// Request to generate a pre-signed URL for a blob to perform a specific operation, such as read or write. +message StoragePreSignUrlRequest { + // Nitric name of the bucket to retrieve from + // this will be automatically resolved to the provider specific bucket identifier. + string bucket_name = 1; + // Key of item to generate the signed URL for. + // The URL and the token it contains will only be valid for operations on this resource specifically. + string key = 2; + // Operation + enum Operation { + READ = 0; + WRITE = 1; + } + Operation operation = 3; + // Expiry defined as as protobuf duration + google.protobuf.Duration expiry = 4; +} + +message StoragePreSignUrlResponse { + // The pre-signed url, restricted to the operation, resource and expiry time specified in the request. + string url = 1; +} + +message StorageListBlobsRequest { + string bucket_name = 1; + + string prefix = 2; +} + +message Blob { + string key = 1; +} + +message StorageListBlobsResponse { + // keys of the blobs in the bucket + repeated Blob blobs = 1; +} + +message StorageExistsRequest { + string bucket_name = 1; + // Key of item to retrieve + string key = 2; +} + +message StorageExistsResponse { + bool exists = 1; +} diff --git a/nitric/proto/topics/v1/topics.proto b/nitric/proto/topics/v1/topics.proto new file mode 100644 index 0000000..643504a --- /dev/null +++ b/nitric/proto/topics/v1/topics.proto @@ -0,0 +1,94 @@ +syntax = "proto3"; +package nitric.proto.topics.v1; + +import "google/protobuf/duration.proto"; +import "google/protobuf/struct.proto"; + +// protoc plugin options for code generation +option go_package = "github.com/nitrictech/nitric/core/pkg/proto/topics/v1;topicspb"; +option java_package = "io.nitric.proto.topics.v1"; +option java_multiple_files = true; +option java_outer_classname = "TopicsService"; +option php_namespace = "Nitric\\Proto\\Topics\\V1"; +option csharp_namespace = "Nitric.Proto.Topics.v1"; + +// Service for publishing asynchronous messages +service Topics { + // Publishes a message to a given topic + rpc Publish (TopicPublishRequest) returns (TopicPublishResponse); +} + +// Service for subscribing to asynchronous messages +service Subscriber { + // Subscribe to a topic and handle incoming messages + rpc Subscribe (stream ClientMessage) returns (stream ServerMessage); +} + +// ClientMessage is the message sent from the service to the nitric server +message ClientMessage { + // globally unique ID of the request/response pair + string id = 1; + + oneof content { + // Register a subscription to a topic + RegistrationRequest registration_request = 2; + + // Handle a message received from a topic + MessageResponse message_response = 3; + } +} + +message MessageRequest { + string topic_name = 1; + + // Message Type + TopicMessage message = 2; +} + +message MessageResponse { + bool success = 1; +} + +// ServerMessage is the message sent from the nitric server to the service +message ServerMessage { + // globally unique ID of the request/response pair + string id = 1; + + oneof content { + // Response to a topic subscription request + RegistrationResponse registration_response = 2; + + // Response to a topic message request + MessageRequest message_request = 3; + } +} + +message RegistrationRequest { + string topic_name = 1; +} + +message RegistrationResponse { +} + +message TopicMessage { + // The topic message contents + oneof content { + google.protobuf.Struct struct_payload = 1; + } +} + +// Request to publish a message to a topic +message TopicPublishRequest { + // The name of the topic to publish the topic to + string topic_name = 1; + + // The message to be published + TopicMessage message = 2; + + // An optional delay specified in seconds (minimum 10 seconds) + google.protobuf.Duration delay = 3; +} + +// Result of publishing an topic +message TopicPublishResponse { +} diff --git a/nitric/proto/websockets/v1/websockets.proto b/nitric/proto/websockets/v1/websockets.proto new file mode 100644 index 0000000..d69ff56 --- /dev/null +++ b/nitric/proto/websockets/v1/websockets.proto @@ -0,0 +1,153 @@ +syntax = "proto3"; +package nitric.proto.websockets.v1; + +// protoc plugin options for code generation +option go_package = "github.com/nitrictech/nitric/core/pkg/proto/websockets/v1;websocketspb"; +option java_package = "io.nitric.proto.websockets.v1"; +option java_multiple_files = true; +option java_outer_classname = "WebsocketsService"; +option php_namespace = "Nitric\\Proto\\Websockets\\V1"; +option csharp_namespace = "Nitric.Proto.Websockets.v1"; + +service Websocket { + // Send a messages to a websocket + rpc SendMessage(WebsocketSendRequest) returns (WebsocketSendResponse); + + // Close a websocket connection + // This can be used to force a client to disconnect + rpc CloseConnection(WebsocketCloseConnectionRequest) returns (WebsocketCloseConnectionResponse); + + // Retrieve details about an API + rpc SocketDetails(WebsocketDetailsRequest) returns (WebsocketDetailsResponse); +} + +message WebsocketDetailsRequest { + string socket_name = 1; +} + +message WebsocketDetailsResponse { + string url = 1; +} + +service WebsocketHandler { + // Handle incoming websocket events + rpc HandleEvents (stream ClientMessage) returns (stream ServerMessage); +} + +message WebsocketSendRequest { + // The nitric name of the socket to send on + string socket_name = 1; + // The connection ID of the client to send to + string connection_id = 2; + // The data to send to the socket + bytes data = 3; +} + +message WebsocketSendResponse { +} + +message WebsocketCloseConnectionRequest { + // The nitric name of the socket to send on + string socket_name = 1; + // The connection ID of the client to send to + string connection_id = 2; +} + +message WebsocketCloseConnectionResponse { +} + + +// ClientMessages are sent from the service to the nitric server +message ClientMessage { + // Globally unique id to pair requests/responses + string id = 1; + + oneof content { + // Client initialisation request + // A worker will not be eligible for triggers + // until it has identified itself + RegistrationRequest registration_request = 2; + + // Client responding with result of a trigger + WebsocketEventResponse websocket_event_response = 3; + } +} + +enum WebsocketEventType { + // Specialised Event for handling new client connections + Connect = 0; + // Specialised Event for handling existing client connections + Disconnect = 1; + // All other types of events are messages + Message = 2; +} + +// Placeholder message +message RegistrationResponse { +} + +message RegistrationRequest { + // The nitric name of the socket that this worker listens on + string socket_name = 1; + // The type of event that this worker handles + WebsocketEventType event_type = 2; +} + +message WebsocketEventRequest { + // The nitric name of the socket that this worker listens on + string socket_name = 1; + + // The connection this trigger came from + string connection_id = 2; + + oneof websocket_event { + WebsocketConnectionEvent connection = 10; + WebsocketDisconnectionEvent disconnection = 11; + WebsocketMessageEvent message = 12; + } +} + +message QueryValue { + repeated string value = 1; +} + +// ServerMessages are sent from the nitric server to the service +message ServerMessage { + // Server message ID, used to pair requests/responses + string id = 1; + + oneof content { + // Server responding + // with client configuration details to an + // InitRequest + RegistrationResponse registration_response = 2; + + // Server requesting client to process an event + WebsocketEventRequest websocket_event_request = 3; + } +} + +message WebsocketEventResponse { + oneof websocket_response { + WebsocketConnectionResponse connection_response = 10; + // WebsocketDisconnectionResponse disconnection_response = 11; + // WebsocketMessageEventResponse message_response = 12; + } +} + +message WebsocketConnectionEvent { + // The query params available in the connection request + map query_params = 1; +} + +message WebsocketConnectionResponse { + bool reject = 1; +} + +message WebsocketDisconnectionEvent { +} + +message WebsocketMessageEvent { + // Data available on + bytes body = 1; +} diff --git a/src/Nitric.Sdk/Nitric.Sdk.csproj b/src/Nitric.Sdk/Nitric.Sdk.csproj index 097347c..ed75ad0 100644 --- a/src/Nitric.Sdk/Nitric.Sdk.csproj +++ b/src/Nitric.Sdk/Nitric.Sdk.csproj @@ -1,7 +1,7 @@ netstandard2.1 - 1.0.0 + 1.0.0-beta Nitric.Sdk Nitric Pty Ltd LICENSE.txt diff --git a/src/Nitric.Sdk/Nitric.cs b/src/Nitric.Sdk/Nitric.cs index 6825b41..edacc1e 100644 --- a/src/Nitric.Sdk/Nitric.cs +++ b/src/Nitric.Sdk/Nitric.cs @@ -14,6 +14,7 @@ using System; using System.Collections.Generic; using System.Linq; +using System.Runtime.InteropServices; using System.Threading.Tasks; using Nitric.Sdk.Resource; using Nitric.Sdk.Worker; @@ -51,7 +52,7 @@ public static void Run() Task.WaitAll(Workers.Select(worker => worker.Start()).ToArray()); } - private static T Cached(string name, Func make) where T : BaseResource + internal static T Register(string name, Func make) where T : BaseResource { var typeMap = Cache.GetValueOrDefault(typeof(T), new Dictionary()); var resource = typeMap!.GetValueOrDefault(name, make(name)) as T; @@ -77,21 +78,21 @@ private static T Cached(string name, Func make) where T : BaseReso /// /// The unique name of this API. /// - public static ApiResource Api(string name, ApiOptions options = null) => Cached(name, s => new ApiResource(s, options)); + public static ApiResource Api(string name, ApiOptions options = null) => Register(name, s => new ApiResource(s, options)); /// /// Declare a schedule. /// /// A short description of the schedule /// - public static ScheduleResource Schedule(string description) => Cached(description, s => new ScheduleResource(s)); + public static ScheduleResource Schedule(string description) => Register(description, s => new ScheduleResource(s)); /// /// Declare a bucket resources for file/blob storage. /// /// The unique name of the bucket within this application. /// A bucket resource, if the name has already been declared the same resource will be returned. - public static BucketResource Bucket(string name) => Cached(name, t => new BucketResource(t)); + public static BucketResource Bucket(string name) => Register(name, t => new BucketResource(t)); /// @@ -101,34 +102,49 @@ private static T Cached(string name, Func make) where T : BaseReso /// The type of values to be stored. /// A key value resource, if the name has already been declared the same resource will be returned. public static KeyValueStoreResource KV(string name) => - Cached(name, t => new KeyValueStoreResource(t)); + Register(name, t => new KeyValueStoreResource(t)); /// /// Declare a secret resource for accessing and putting secret values. /// /// The unique name of the secret within this application. /// A secret resource, if the name has already been declared the same resource will be returned. - public static SecretResource Secret(string name) => Cached(name, t => new SecretResource(t)); + public static SecretResource Secret(string name) => Register(name, t => new SecretResource(t)); /// /// Declare a queue resources for pull-based tasks and batch workloads. /// /// The unique name of the queue within this application. /// A queue resource, if the name has already been declared the same resource will be returned. - public static QueueResource Queue(string name) => Cached(name, n => new QueueResource(n)); + public static QueueResource Queue(string name) => Register(name, n => new QueueResource(n)); /// /// Declare a topic resource for push-based events and messaging. /// /// The unique name of the topic within this application. /// A topic resource, if the name has already been declared the same resource will be returned. - public static TopicResource Topic(string name) => Cached(name, t => new TopicResource(t)); + public static TopicResource Topic(string name) => Register(name, t => new TopicResource(t)); /// /// Declare a websocket resource for bidirectional HTTP communication. /// /// The unique name of the websocket within this application. /// A websocket resource, if the name has already been declared the same resource will be returned. - public static WebsocketResource Websocket(string name) => Cached(name, t => new WebsocketResource(t)); + public static WebsocketResource Websocket(string name) => Register(name, t => new WebsocketResource(t)); + + /// + /// Declare a new Oidc rule for API security. + /// + /// The name of the rule. + /// The OIDC issuer URI. + /// + /// + public static OidcScopes OidcRule(string name, string issuer, string[] audiences) + { + return scopes => + { + return new OidcOptions(name, issuer, audiences, scopes); + }; + } } } diff --git a/src/Nitric.Sdk/Proto/apis/v1/Apis.cs b/src/Nitric.Sdk/Proto/nitric/proto/apis/v1/Apis.cs similarity index 100% rename from src/Nitric.Sdk/Proto/apis/v1/Apis.cs rename to src/Nitric.Sdk/Proto/nitric/proto/apis/v1/Apis.cs diff --git a/src/Nitric.Sdk/Proto/apis/v1/ApisGrpc.cs b/src/Nitric.Sdk/Proto/nitric/proto/apis/v1/ApisGrpc.cs similarity index 100% rename from src/Nitric.Sdk/Proto/apis/v1/ApisGrpc.cs rename to src/Nitric.Sdk/Proto/nitric/proto/apis/v1/ApisGrpc.cs diff --git a/src/Nitric.Sdk/Proto/deployments/v1/Deployments.cs b/src/Nitric.Sdk/Proto/nitric/proto/deployments/v1/Deployments.cs similarity index 100% rename from src/Nitric.Sdk/Proto/deployments/v1/Deployments.cs rename to src/Nitric.Sdk/Proto/nitric/proto/deployments/v1/Deployments.cs diff --git a/src/Nitric.Sdk/Proto/deployments/v1/DeploymentsGrpc.cs b/src/Nitric.Sdk/Proto/nitric/proto/deployments/v1/DeploymentsGrpc.cs similarity index 100% rename from src/Nitric.Sdk/Proto/deployments/v1/DeploymentsGrpc.cs rename to src/Nitric.Sdk/Proto/nitric/proto/deployments/v1/DeploymentsGrpc.cs diff --git a/src/Nitric.Sdk/Proto/http/v1/Http.cs b/src/Nitric.Sdk/Proto/nitric/proto/http/v1/Http.cs similarity index 100% rename from src/Nitric.Sdk/Proto/http/v1/Http.cs rename to src/Nitric.Sdk/Proto/nitric/proto/http/v1/Http.cs diff --git a/src/Nitric.Sdk/Proto/http/v1/HttpGrpc.cs b/src/Nitric.Sdk/Proto/nitric/proto/http/v1/HttpGrpc.cs similarity index 100% rename from src/Nitric.Sdk/Proto/http/v1/HttpGrpc.cs rename to src/Nitric.Sdk/Proto/nitric/proto/http/v1/HttpGrpc.cs diff --git a/src/Nitric.Sdk/Proto/keyvalue/v1/Keyvalue.cs b/src/Nitric.Sdk/Proto/nitric/proto/keyvalue/v1/Keyvalue.cs similarity index 100% rename from src/Nitric.Sdk/Proto/keyvalue/v1/Keyvalue.cs rename to src/Nitric.Sdk/Proto/nitric/proto/keyvalue/v1/Keyvalue.cs diff --git a/src/Nitric.Sdk/Proto/keyvalue/v1/KeyvalueGrpc.cs b/src/Nitric.Sdk/Proto/nitric/proto/keyvalue/v1/KeyvalueGrpc.cs similarity index 100% rename from src/Nitric.Sdk/Proto/keyvalue/v1/KeyvalueGrpc.cs rename to src/Nitric.Sdk/Proto/nitric/proto/keyvalue/v1/KeyvalueGrpc.cs diff --git a/src/Nitric.Sdk/Proto/kvstore/v1/Kvstore.cs b/src/Nitric.Sdk/Proto/nitric/proto/kvstore/v1/Kvstore.cs similarity index 100% rename from src/Nitric.Sdk/Proto/kvstore/v1/Kvstore.cs rename to src/Nitric.Sdk/Proto/nitric/proto/kvstore/v1/Kvstore.cs diff --git a/src/Nitric.Sdk/Proto/kvstore/v1/KvstoreGrpc.cs b/src/Nitric.Sdk/Proto/nitric/proto/kvstore/v1/KvstoreGrpc.cs similarity index 100% rename from src/Nitric.Sdk/Proto/kvstore/v1/KvstoreGrpc.cs rename to src/Nitric.Sdk/Proto/nitric/proto/kvstore/v1/KvstoreGrpc.cs diff --git a/src/Nitric.Sdk/Proto/queues/v1/Queues.cs b/src/Nitric.Sdk/Proto/nitric/proto/queues/v1/Queues.cs similarity index 100% rename from src/Nitric.Sdk/Proto/queues/v1/Queues.cs rename to src/Nitric.Sdk/Proto/nitric/proto/queues/v1/Queues.cs diff --git a/src/Nitric.Sdk/Proto/queues/v1/QueuesGrpc.cs b/src/Nitric.Sdk/Proto/nitric/proto/queues/v1/QueuesGrpc.cs similarity index 100% rename from src/Nitric.Sdk/Proto/queues/v1/QueuesGrpc.cs rename to src/Nitric.Sdk/Proto/nitric/proto/queues/v1/QueuesGrpc.cs diff --git a/src/Nitric.Sdk/Proto/resources/v1/Resources.cs b/src/Nitric.Sdk/Proto/nitric/proto/resources/v1/Resources.cs similarity index 100% rename from src/Nitric.Sdk/Proto/resources/v1/Resources.cs rename to src/Nitric.Sdk/Proto/nitric/proto/resources/v1/Resources.cs diff --git a/src/Nitric.Sdk/Proto/resources/v1/ResourcesGrpc.cs b/src/Nitric.Sdk/Proto/nitric/proto/resources/v1/ResourcesGrpc.cs similarity index 100% rename from src/Nitric.Sdk/Proto/resources/v1/ResourcesGrpc.cs rename to src/Nitric.Sdk/Proto/nitric/proto/resources/v1/ResourcesGrpc.cs diff --git a/src/Nitric.Sdk/Proto/schedules/v1/Schedules.cs b/src/Nitric.Sdk/Proto/nitric/proto/schedules/v1/Schedules.cs similarity index 100% rename from src/Nitric.Sdk/Proto/schedules/v1/Schedules.cs rename to src/Nitric.Sdk/Proto/nitric/proto/schedules/v1/Schedules.cs diff --git a/src/Nitric.Sdk/Proto/schedules/v1/SchedulesGrpc.cs b/src/Nitric.Sdk/Proto/nitric/proto/schedules/v1/SchedulesGrpc.cs similarity index 100% rename from src/Nitric.Sdk/Proto/schedules/v1/SchedulesGrpc.cs rename to src/Nitric.Sdk/Proto/nitric/proto/schedules/v1/SchedulesGrpc.cs diff --git a/src/Nitric.Sdk/Proto/secrets/v1/Secrets.cs b/src/Nitric.Sdk/Proto/nitric/proto/secrets/v1/Secrets.cs similarity index 100% rename from src/Nitric.Sdk/Proto/secrets/v1/Secrets.cs rename to src/Nitric.Sdk/Proto/nitric/proto/secrets/v1/Secrets.cs diff --git a/src/Nitric.Sdk/Proto/secrets/v1/SecretsGrpc.cs b/src/Nitric.Sdk/Proto/nitric/proto/secrets/v1/SecretsGrpc.cs similarity index 100% rename from src/Nitric.Sdk/Proto/secrets/v1/SecretsGrpc.cs rename to src/Nitric.Sdk/Proto/nitric/proto/secrets/v1/SecretsGrpc.cs diff --git a/src/Nitric.Sdk/Proto/storage/v1/Storage.cs b/src/Nitric.Sdk/Proto/nitric/proto/storage/v1/Storage.cs similarity index 100% rename from src/Nitric.Sdk/Proto/storage/v1/Storage.cs rename to src/Nitric.Sdk/Proto/nitric/proto/storage/v1/Storage.cs diff --git a/src/Nitric.Sdk/Proto/storage/v1/StorageGrpc.cs b/src/Nitric.Sdk/Proto/nitric/proto/storage/v1/StorageGrpc.cs similarity index 100% rename from src/Nitric.Sdk/Proto/storage/v1/StorageGrpc.cs rename to src/Nitric.Sdk/Proto/nitric/proto/storage/v1/StorageGrpc.cs diff --git a/src/Nitric.Sdk/Proto/topics/v1/Topics.cs b/src/Nitric.Sdk/Proto/nitric/proto/topics/v1/Topics.cs similarity index 100% rename from src/Nitric.Sdk/Proto/topics/v1/Topics.cs rename to src/Nitric.Sdk/Proto/nitric/proto/topics/v1/Topics.cs diff --git a/src/Nitric.Sdk/Proto/topics/v1/TopicsGrpc.cs b/src/Nitric.Sdk/Proto/nitric/proto/topics/v1/TopicsGrpc.cs similarity index 100% rename from src/Nitric.Sdk/Proto/topics/v1/TopicsGrpc.cs rename to src/Nitric.Sdk/Proto/nitric/proto/topics/v1/TopicsGrpc.cs diff --git a/src/Nitric.Sdk/Proto/websockets/v1/Websockets.cs b/src/Nitric.Sdk/Proto/nitric/proto/websockets/v1/Websockets.cs similarity index 100% rename from src/Nitric.Sdk/Proto/websockets/v1/Websockets.cs rename to src/Nitric.Sdk/Proto/nitric/proto/websockets/v1/Websockets.cs diff --git a/src/Nitric.Sdk/Proto/websockets/v1/WebsocketsGrpc.cs b/src/Nitric.Sdk/Proto/nitric/proto/websockets/v1/WebsocketsGrpc.cs similarity index 100% rename from src/Nitric.Sdk/Proto/websockets/v1/WebsocketsGrpc.cs rename to src/Nitric.Sdk/Proto/nitric/proto/websockets/v1/WebsocketsGrpc.cs diff --git a/src/Nitric.Sdk/Resource/ApiResource.cs b/src/Nitric.Sdk/Resource/ApiResource.cs index 8e312bd..174a854 100644 --- a/src/Nitric.Sdk/Resource/ApiResource.cs +++ b/src/Nitric.Sdk/Resource/ApiResource.cs @@ -13,41 +13,17 @@ // limitations under the License. using System; using System.Linq; -using System.Collections.Generic; using Nitric.Proto.Resources.v1; using Nitric.Proto.Apis.v1; using Nitric.Sdk.Service; using Nitric.Sdk.Worker; using NitricResource = Nitric.Proto.Resources.v1.ResourceIdentifier; using ProtoApiResource = Nitric.Proto.Resources.v1.ApiResource; -using ProtoSecurityDefinition = Nitric.Proto.Resources.v1.ApiSecurityDefinitionResource; -using ProtoSecurityDefinitionJwt = Nitric.Proto.Resources.v1.ApiOpenIdConnectionDefinition; using System.Net.Http; +using System.Runtime.InteropServices; namespace Nitric.Sdk.Resource { - public abstract class SecurityDefinition - { - internal string Kind { get; private set; } - - internal SecurityDefinition(string kind) - { - this.Kind = kind; - } - } - - public class JwtSecurityDefinition : SecurityDefinition - { - internal string Issuer { get; private set; } - internal string[] Audiences { get; private set; } - - internal JwtSecurityDefinition(string Issuer, string[] Audiences) : base("jwt") - { - this.Issuer = Issuer; - this.Audiences = Audiences; - } - } - public class ApiDetails { internal string ID { get; set; } @@ -56,212 +32,235 @@ public class ApiDetails internal string URL { get; set; } } - public class ApiOptions { - public Dictionary SecurityDefinitions { get; private set; } - public Dictionary Security { get; private set; } + public OidcOptions[] Security { get; private set; } public string BasePath { get; private set; } public Middleware[] Middleware { get; private set; } public ApiOptions( - Dictionary securityDefinitions = null, - Dictionary security = null, + OidcOptions[] security = null, string basePath = "", Middleware[] middleware = null ) { - this.SecurityDefinitions = securityDefinitions ?? new Dictionary(); - this.Security = security ?? new Dictionary(); + this.Security = security ?? Array.Empty(); this.BasePath = basePath; this.Middleware = middleware ?? new Middleware[] { }; } } - public class ApiResource : BaseResource { - internal readonly ApiOptions Opts; + public readonly ApiOptions Opts; internal ApiResource(string name, ApiOptions options = null) : base(name, ResourceType.Api) { this.Opts = options ?? new ApiOptions(); } - internal ApiResource Method(string route, HttpMethod[] methods, Func handler) + internal void AttachOidc(OidcOptions opts) { - var opts = new ApiWorkerOptions - { - SecurityDisabled = true, - }; - - if (this.Opts.Security.Count > 0) - { - var security = this.Opts.Security.ToDictionary((kv) => kv.Key, kv => - { - var scopes = new ApiWorkerScopes(); - scopes.Scopes.Add(kv.Value); - - return scopes; - }); - - opts.Security.Add(security); - opts.SecurityDisabled = false; - } - - var registrationRequest = new RegistrationRequest - { - Api = this.Name, - Options = opts, - Path = route, - }; - - registrationRequest.Methods.AddRange(methods.Select((method) => method.Method).ToHashSet()); - - - var apiWorker = new ApiWorker(registrationRequest, handler); - - Nitric.RegisterWorker(apiWorker); - return this; + var oidcName = string.Format("{0}-{1}", opts.Name, this.Name); + Nitric.Register(oidcName, _ => new OidcResource(oidcName, this.Name, opts)); } - internal ApiResource Method(string route, HttpMethod[] methods, Middleware[] middleware) - { - var opts = new ApiWorkerOptions - { - SecurityDisabled = true, - }; - - if (this.Opts.Security.Count > 0) - { - var security = this.Opts.Security.ToDictionary((kv) => kv.Key, kv => - { - var scopes = new ApiWorkerScopes(); - scopes.Scopes.Add(kv.Value); - - return scopes; - }); - - opts.Security.Add(security); - opts.SecurityDisabled = false; - } - - var registrationRequest = new RegistrationRequest - { - Api = this.Name, - Options = opts, - Path = route, - }; - - registrationRequest.Methods.AddRange(methods.Select((method) => method.Method).ToHashSet()); - - - var apiWorker = new ApiWorker(registrationRequest, middleware); + /// + /// Create a new GET handler on the specified route. + /// + /// The path to match on. + /// The handler to run. + public void Get(string route, Func handler) => Route(route).Get(handler); - Nitric.RegisterWorker(apiWorker); - return this; - } + /// + /// Create a new GET handler on the specified route. + /// + /// The path to match on. + /// The handler to run. + public void Get(string route, Middleware[] handlers) => Route(route).Get(handlers); /// /// Create a new GET handler on the specified route. /// - /// - /// - public ApiResource Get(string route, Func handler) => Method(route, new HttpMethod[] { HttpMethod.Get }, handler); + /// The path to match on. + /// The handler to run. + /// Security rules to override API-level security. + public void Get(string route, Func handler, OidcOptions[] security) => Route(route, new RouteOptions(security: security)).Get(handler); /// /// Create a new GET handler on the specified route. /// - /// - /// - public ApiResource Get(string route, params Middleware[] handlers) => Method(route, new HttpMethod[] { HttpMethod.Get }, handlers); + /// The path to match on. + /// The handler to run. + /// Security rules to override API-level security. + public void Get(string route, Middleware[] handlers, OidcOptions[] security) => Route(route, new RouteOptions(security: security)).Get(handlers); + + /// + /// Create a new POST handler on the specified route. + /// + /// The path to match on. + /// The handler to run. + public void Post(string route, Func handler) => Route(route).Post(handler); + + /// + /// Create a new POST handler on the specified route. + /// + /// The path to match on. + /// The handler to run. + public void Post(string route, Middleware[] handlers) => Route(route).Post(handlers); /// /// Create a new POST handler on the specified route. /// - /// - /// - public ApiResource Post(string route, Func handler) => Method(route, new HttpMethod[] { HttpMethod.Post }, handler); + /// The path to match on. + /// The handler to run. + /// Security rules to override API-level security. + public void Post(string route, Func handler, OidcOptions[] security) => Route(route, new RouteOptions(security: security)).Post(handler); /// /// Create a new POST handler on the specified route. /// - /// - /// - public ApiResource Post(string route, params Middleware[] handlers) => Method(route, new HttpMethod[] { HttpMethod.Post }, handlers); + /// The path to match on. + /// The handler to run. + /// Security rules to override API-level security. + public void Post(string route, Middleware[] handlers, OidcOptions[] security) => Route(route, new RouteOptions(security: security)).Post(handlers); /// /// Create a new PUT handler on the specified route. /// - /// - /// - public ApiResource Put(string route, Func handler) => Method(route, new HttpMethod[] { HttpMethod.Put }, handler); + /// The path to match on. + /// The handler to run. + public void Put(string route, Func handler) => Route(route).Put(handler); /// /// Create a new PUT handler on the specified route. /// - /// - /// - public ApiResource Put(string route, params Middleware[] handlers) => Method(route, new HttpMethod[] { HttpMethod.Put }, handlers); + /// The path to match on. + /// The handler to run. + public void Put(string route, params Middleware[] handlers) => Route(route).Put(handlers); + + /// + /// Create a new PUT handler on the specified route. + /// + /// The path to match on. + /// The handler to run. + /// Security rules to override API-level security. + public void Put(string route, Func handler, OidcOptions[] security) => Route(route, new RouteOptions(security: security)).Put(handler); + + /// + /// Create a new PUT handler on the specified route. + /// + /// The path to match on. + /// The handler to run. + /// Security rules to override API-level security. + public void Put(string route, Middleware[] handlers, OidcOptions[] security) => Route(route, new RouteOptions(security: security)).Put(handlers); + + /// + /// Create a new DELETE handler on the specified route. + /// + /// The path to match on. + /// The handler to run. + public void Delete(string route, Func handler) => Route(route).Delete(handler); /// /// Create a new DELETE handler on the specified route. /// - /// - /// - public ApiResource Delete(string route, Func handler) => Method(route, new HttpMethod[] { HttpMethod.Delete }, handler); + /// The path to match on. + /// The handler to run. + public void Delete(string route, params Middleware[] handlers) => Route(route).Delete(handlers); /// /// Create a new DELETE handler on the specified route. /// - /// - /// - public ApiResource Delete(string route, params Middleware[] handlers) => Method(route, new HttpMethod[] { HttpMethod.Delete }, handlers); + /// The path to match on. + /// The handler to run. + /// Security rules to override API-level security. + public void Delete(string route, Func handler, OidcOptions[] security = null) => Route(route, new RouteOptions(security: security)).Delete(handler); + + /// + /// Create a new DELETE handler on the specified route. + /// + /// The path to match on. + /// The handler to run. + /// Security rules to override API-level security. + public void Delete(string route, Middleware[] handlers, OidcOptions[] security = null) => Route(route, new RouteOptions(security: security)).Delete(handlers); + + /// + /// Create a new OPTIONS handler on the specified route. + /// + /// The path to match on. + /// The handler to run. + public void Options(string route, Func handler) => Route(route).Options(handler); /// /// Create a new OPTIONS handler on the specified route. /// - /// - /// - public ApiResource Options(string route, Func handler) => Method(route, new HttpMethod[] { HttpMethod.Options }, handler); + /// The path to match on. + /// The handler to run. + public void Options(string route, params Middleware[] handlers) => Route(route).Options(handlers); /// /// Create a new OPTIONS handler on the specified route. /// - /// - /// - public ApiResource Options(string route, params Middleware[] handlers) => Method(route, new HttpMethod[] { HttpMethod.Options }, handlers); + /// The path to match on. + /// The handler to run. + /// Security rules to override API-level security. + public void Options(string route, Func handler, OidcOptions[] security) => Route(route, new RouteOptions(security: security)).Options(handler); + + /// + /// Create a new OPTIONS handler on the specified route. + /// + /// The path to match on. + /// The handler to run. + /// Security rules to override API-level security. + public void Options(string route, Middleware[] handlers, OidcOptions[] security) => Route(route, new RouteOptions(security: security)).Options(handlers); + + /// + /// Create a new handler on the specified route for every HTTP verb. + /// + /// The path to match on. + /// The handler to run. + public void All(string route, Func handler) => Route(route).All(handler); + + /// + /// Create a new handler on the specified route for every HTTP verb. + /// + /// The path to match on. + /// The handler to run. + public void All(string route, params Middleware[] handlers) => Route(route).All(handlers); /// /// Create a new handler on the specified route for every HTTP verb. /// - /// - /// - public ApiResource All(string route, Func handler) => Method(route, (HttpMethod[])Enum.GetValues(typeof(HttpMethod)), handler); + /// The path to match on. + /// The handler to run. + /// Security rules to override API-level security. + public void All(string route, Func handler, OidcOptions[] security) => Route(route, new RouteOptions(security: security)).All(handler); /// /// Create a new handler on the specified route for every HTTP verb. /// - /// - /// - public ApiResource All(string route, params Middleware[] handlers) => Method(route, (HttpMethod[])Enum.GetValues(typeof(HttpMethod)), handlers); + /// The path to match on. + /// The handler to run. + /// Security rules to override API-level security. + public void All(string route, Middleware[] handlers, OidcOptions[] security) => Route(route, new RouteOptions(security)).All(handlers); /// /// Create a new route on a specified path. /// /// An ApiRoute that handlers can be added to. - /// + /// The path to match on. public ApiRoute Route(string path) { - return new ApiRoute(this, this.Opts.BasePath + path, new RouteOptions()); + return new ApiRoute(this, this.Opts.BasePath + path, new RouteOptions(security: this.Opts.Security)); } /// /// Create a new route on a specified path. /// /// An ApiRoute that handlers can be added to. - /// - /// + /// The path to match on. + /// Optional middleware and security rules to apply to the route. public ApiRoute Route(string path, RouteOptions options) { return new ApiRoute(this, this.Opts.BasePath + path, options); @@ -272,61 +271,20 @@ internal override BaseResource Register() var resource = new NitricResource { Name = this.Name, Type = ResourceType.Api }; var apiResource = new ProtoApiResource(); - foreach (KeyValuePair kv in this.Opts.Security) + foreach (var oidcOption in this.Opts.Security) { - var scopes = new ApiScopes(); - - scopes.Scopes.Add(kv.Value); - - apiResource.Security.Add(kv.Key, scopes); - } + this.AttachOidc(oidcOption); - foreach (KeyValuePair kv in this.Opts.SecurityDefinitions) - { - var definition = new ProtoSecurityDefinition(); - - if (kv.Value.Kind == "jwt") - { - var jwtSecurityDefinition = kv.Value as JwtSecurityDefinition; - var secDef = new ProtoSecurityDefinitionJwt - { - Issuer = jwtSecurityDefinition.Issuer - }; - - secDef.Audiences.AddRange(jwtSecurityDefinition.Audiences); - - definition.Oidc = secDef; - } + var scopes = new ApiScopes(); + scopes.Scopes.Add(oidcOption.Scopes); + apiResource.Security.Add(oidcOption.Name, scopes); } var request = new ResourceDeclareRequest { Id = resource, Api = apiResource }; - BaseResource.client.Declare(request); + client.Declare(request); return this; } - - /// - /// Retrieve details about the deployed API at runtime. These details include: - /// - ID: the identifier for the resource. - /// - Provider: the cloud provider that this API is deployed to. - /// - Service: the cloud service that is running this API (i.e. AWS API Gateway). - /// - URL: the url of the deployed API. - /// - /// The details of the API - // public ApiDetails Details() { - // var resource = new NitricResource { Name = this.Name, Type = ResourceType.Api }; - - // var request = new ResourceDetailsRequest { Resource = resource }; - // var response = client.Details(request); - - // return new ApiDetails - // { - // ID = response.Id, - // Provider = response.Provider, - // Service = response.Service, - // URL = response.Api.Url, - // }; - // } } public class RouteOptions @@ -335,7 +293,16 @@ public class RouteOptions public Middleware[] Middlewares { get; set; } // Security rules to apply to this specific route - public Dictionary Security { get; set; } + public OidcOptions[] Security { get; set; } + + public RouteOptions( + OidcOptions[] security = null, + Middleware[] middleware = null + ) + { + this.Security = security ?? Array.Empty(); + this.Middlewares = middleware ?? new Middleware[] { }; + } } public class ApiRoute @@ -380,73 +347,102 @@ private Middleware[] ConcatMiddleware(Middleware[] mid /// /// Create a new GET handler on the specified route. /// - /// - public ApiResource Get(Func handler) => this.api.Method(this.Path, new HttpMethod[] { HttpMethod.Get }, ConcatMiddleware(handler)); + /// The handler to run. + public void Get(Func handler) => Method(this.Path, new HttpMethod[] { HttpMethod.Get }, this.Opts, ConcatMiddleware(handler)); /// /// Create a new GET middleware chain on the specified route. /// - /// - public ApiResource Get(params Middleware[] handlers) => this.api.Method(this.Path, new HttpMethod[] { HttpMethod.Get }, ConcatMiddleware(handlers)); + /// The handler to run. + public void Get(params Middleware[] handlers) => Method(this.Path, new HttpMethod[] { HttpMethod.Get }, this.Opts, ConcatMiddleware(handlers)); /// /// Create a new POST handler on the specified route. /// - /// - public ApiResource Post(Func handler) => this.api.Method(this.Path, new HttpMethod[] { HttpMethod.Post }, ConcatMiddleware(handler)); + /// The handler to run. + public void Post(Func handler) => Method(this.Path, new HttpMethod[] { HttpMethod.Post }, this.Opts, ConcatMiddleware(handler)); /// /// Create a new POST middleware chain on the specified route. /// - /// - public ApiResource Post(params Middleware[] handlers) => this.api.Method(this.Path, new HttpMethod[] { HttpMethod.Post }, ConcatMiddleware(handlers)); + /// The handler to run. + public void Post(params Middleware[] handlers) => Method(this.Path, new HttpMethod[] { HttpMethod.Post }, this.Opts, ConcatMiddleware(handlers)); /// /// Create a new PUT handler on the specified route. /// - /// - public ApiResource Put(Func handler) => this.api.Method(this.Path, new HttpMethod[] { HttpMethod.Put }, ConcatMiddleware(handler)); + /// The handler to run. + public void Put(Func handler) => Method(this.Path, new HttpMethod[] { HttpMethod.Put }, this.Opts, ConcatMiddleware(handler)); /// /// Create a new PUT middleware chain on the specified route. /// - /// - public ApiResource Put(params Middleware[] handlers) => this.api.Method(this.Path, new HttpMethod[] { HttpMethod.Post }, ConcatMiddleware(handlers)); + /// The handler to run. + public void Put(params Middleware[] handlers) => Method(this.Path, new HttpMethod[] { HttpMethod.Post }, this.Opts, ConcatMiddleware(handlers)); /// /// Create a new DELETE handler on the specified route. /// - /// - public ApiResource Delete(Func handler) => this.api.Method(this.Path, new HttpMethod[] { HttpMethod.Delete }, ConcatMiddleware(handler)); + /// The handler to run. + public void Delete(Func handler) => Method(this.Path, new HttpMethod[] { HttpMethod.Delete }, this.Opts, ConcatMiddleware(handler)); /// /// Create a new DELETE middleware chain on the specified route. /// - /// - public ApiResource Delete(params Middleware[] handlers) => this.api.Method(this.Path, new HttpMethod[] { HttpMethod.Delete }, ConcatMiddleware(handlers)); + /// The handler to run. + public void Delete(params Middleware[] handlers) => Method(this.Path, new HttpMethod[] { HttpMethod.Delete }, this.Opts, ConcatMiddleware(handlers)); /// /// Create a new OPTIONS handler on the specified route. /// - /// - public ApiResource Options(Func handler) => this.api.Method(this.Path, new HttpMethod[] { HttpMethod.Options }, ConcatMiddleware(handler)); + /// The handler to run. + public void Options(Func handler) => Method(this.Path, new HttpMethod[] { HttpMethod.Options }, this.Opts, ConcatMiddleware(handler)); /// /// Create a new OPTIONS middleware chain on the specified route. /// - /// - public ApiResource Options(params Middleware[] handlers) => this.api.Method(this.Path, new HttpMethod[] { HttpMethod.Options }, ConcatMiddleware(handlers)); + /// The handler to run. + public void Options(params Middleware[] handlers) => Method(this.Path, new HttpMethod[] { HttpMethod.Options }, this.Opts, ConcatMiddleware(handlers)); /// /// Create a new handler on the specified route for every HTTP verb. /// - /// - public ApiResource All(Func handler) => this.api.Method(this.Path, (HttpMethod[])Enum.GetValues(typeof(HttpMethod)), ConcatMiddleware(handler)); + /// The handler to run. + public void All(Func handler) => Method(this.Path, (HttpMethod[])Enum.GetValues(typeof(HttpMethod)), this.Opts, ConcatMiddleware(handler)); /// /// Create a new chain of middleware on the specified route for every HTTP verb. /// - /// - public ApiResource All(params Middleware[] handlers) => this.api.Method(this.Path, (HttpMethod[])Enum.GetValues(typeof(HttpMethod)), ConcatMiddleware(handlers)); + /// The handler to run. + public void All(params Middleware[] handlers) => Method(this.Path, (HttpMethod[])Enum.GetValues(typeof(HttpMethod)), this.Opts, ConcatMiddleware(handlers)); + + internal void Method(string route, HttpMethod[] methods, RouteOptions options, Middleware[] middlewares) + { + var opts = new ApiWorkerOptions + { + SecurityDisabled = options.Security.Count() == 0 + }; + + foreach (var oidcOption in options.Security) + { + var scopes = new ApiWorkerScopes(); + scopes.Scopes.Add(oidcOption.Scopes); + opts.Security.Add(oidcOption.Name, scopes); + this.api.AttachOidc(oidcOption); + } + + var registrationRequest = new RegistrationRequest + { + Api = this.api.Name, + Options = opts, + Path = route, + }; + + registrationRequest.Methods.AddRange(methods.Select((method) => method.Method).ToHashSet()); + + var apiWorker = new ApiWorker(registrationRequest, middlewares); + + Nitric.RegisterWorker(apiWorker); + } } } diff --git a/src/Nitric.Sdk/Resource/OidcResource.cs b/src/Nitric.Sdk/Resource/OidcResource.cs new file mode 100644 index 0000000..183bbdb --- /dev/null +++ b/src/Nitric.Sdk/Resource/OidcResource.cs @@ -0,0 +1,64 @@ +using Nitric.Proto.Resources.v1; + +namespace Nitric.Sdk.Resource +{ + public delegate OidcOptions OidcScopes(params string[] scopes); + + public class OidcOptions + { + public string Name { get; set; } + public string Issuer { get; set; } + public string[] Audiences { get; set; } + public string[] Scopes { get; set; } + + public OidcOptions(string name, string issuer, string[] audiences, string[] scopes) + { + this.Name = name; + this.Issuer = issuer; + this.Audiences = audiences; + this.Scopes = scopes; + } + } + + public class OidcResource : BaseResource + { + private string ApiName { get; set; } + private string Issuer { get; set; } + private string[] Audiences { get; set; } + private string RuleName { get; set; } + + public OidcResource(string name, string apiName, OidcOptions options) : base(name, ResourceType.ApiSecurityDefinition) + { + this.ApiName = apiName; + this.Issuer = options.Issuer; + this.Audiences = options.Audiences; + this.RuleName = options.Name; + } + + internal override BaseResource Register() + { + var resource = new ResourceIdentifier + { + Name = this.RuleName, + Type = ResourceType.ApiSecurityDefinition, + }; + + var oidcRes = new ApiOpenIdConnectionDefinition + { + Issuer = this.Issuer, + }; + oidcRes.Audiences.AddRange(this.Audiences); + + var secDef = new ApiSecurityDefinitionResource + { + ApiName = this.ApiName, + Oidc = oidcRes + }; + + var request = new ResourceDeclareRequest { Id = resource, ApiSecurityDefinition = secDef }; + BaseResource.client.Declare(request); + + return this; + } + } +} \ No newline at end of file diff --git a/src/Nitric.Sdk/Service/WebsocketContext.cs b/src/Nitric.Sdk/Service/WebsocketContext.cs index 17a65eb..c0fce3a 100644 --- a/src/Nitric.Sdk/Service/WebsocketContext.cs +++ b/src/Nitric.Sdk/Service/WebsocketContext.cs @@ -20,6 +20,7 @@ using WebsocketEventTypeProto = Nitric.Proto.Websockets.v1.WebsocketEventRequest.WebsocketEventOneofCase; using Google.Protobuf.Collections; using ProtoWebsocketEventType = Nitric.Proto.Websockets.v1.WebsocketEventType; +using Google.Api; namespace Nitric.Sdk.Service { @@ -141,11 +142,12 @@ public static WebsocketContext FromRequest(ServerMessage trigger) { var type = FromGrpcWebsocketNotificationType(trigger.WebsocketEventRequest.WebsocketEventCase); var queryParams = GetQueryParams(trigger.WebsocketEventRequest.Connection.QueryParams); + var body = trigger.WebsocketEventRequest.Message != null ? trigger.WebsocketEventRequest.Message.Body.ToByteArray() : new byte[0]; return new WebsocketContext( trigger.Id, new WebsocketRequest( - trigger.WebsocketEventRequest.Message.Body.ToByteArray(), + body, trigger.WebsocketEventRequest.SocketName, type, trigger.WebsocketEventRequest.ConnectionId, diff --git a/src/Nitric.Sdk/Worker/ApiWorker.cs b/src/Nitric.Sdk/Worker/ApiWorker.cs index ab5f06c..c83279b 100644 --- a/src/Nitric.Sdk/Worker/ApiWorker.cs +++ b/src/Nitric.Sdk/Worker/ApiWorker.cs @@ -25,34 +25,31 @@ namespace Nitric.Sdk.Worker public class ApiWorker : AbstractWorker { readonly private RegistrationRequest RegistrationRequest; + public GrpcClient GrpcClient { private get; set; } public ApiWorker(RegistrationRequest request, Func middleware) : base(middleware) { this.RegistrationRequest = request; + this.GrpcClient = new GrpcClient(GrpcChannelProvider.GetChannel()); } public ApiWorker(RegistrationRequest request, params Middleware[] middlewares) : base(middlewares) { this.RegistrationRequest = request; + this.GrpcClient = new GrpcClient(GrpcChannelProvider.GetChannel()); } - public override async Task Start() + public override async Task Start(CancellationToken cancellationToken = default) { - var client = new GrpcClient(GrpcChannelProvider.GetChannel()); - - var stream = client.Serve(); + var stream = this.GrpcClient.Serve(); await stream.RequestStream.WriteAsync(new ClientMessage { RegistrationRequest = RegistrationRequest }); - while (await stream.ResponseStream.MoveNext(CancellationToken.None)) + while (await stream.ResponseStream.MoveNext(cancellationToken)) { var req = stream.ResponseStream.Current; - if (req.RegistrationResponse != null) - { - // Schedule connected with Nitric server. - } - else if (req.HttpRequest != null) + if (req.HttpRequest != null) { var ctx = HttpContext.FromRequest(req); @@ -67,6 +64,8 @@ public override async Task Start() await stream.RequestStream.WriteAsync(ctx.ToResponse()); } + + cancellationToken.ThrowIfCancellationRequested(); } await stream.RequestStream.CompleteAsync(); diff --git a/src/Nitric.Sdk/Worker/BlobEventWorker.cs b/src/Nitric.Sdk/Worker/BlobEventWorker.cs index f958db0..ae26a04 100644 --- a/src/Nitric.Sdk/Worker/BlobEventWorker.cs +++ b/src/Nitric.Sdk/Worker/BlobEventWorker.cs @@ -18,7 +18,6 @@ using Nitric.Proto.Storage.v1; using GrpcClient = Nitric.Proto.Storage.v1.StorageListener.StorageListenerClient; using Nitric.Sdk.Service; -using Nitric.Sdk.Storage; using System; namespace Nitric.Sdk.Worker @@ -26,34 +25,31 @@ namespace Nitric.Sdk.Worker public class BlobEventWorker : AbstractWorker { readonly private RegistrationRequest RegistrationRequest; + public GrpcClient GrpcClient { private get; set; } public BlobEventWorker(RegistrationRequest request, Func middleware) : base(middleware) { this.RegistrationRequest = request; + this.GrpcClient = new GrpcClient(GrpcChannelProvider.GetChannel()); } public BlobEventWorker(RegistrationRequest request, params Middleware[] middlewares) : base(middlewares) { this.RegistrationRequest = request; + this.GrpcClient = new GrpcClient(GrpcChannelProvider.GetChannel()); } - public override async Task Start() + public override async Task Start(CancellationToken cancellationToken = default) { - var client = new GrpcClient(GrpcChannelProvider.GetChannel()); - - var stream = client.Listen(); + var stream = this.GrpcClient.Listen(); await stream.RequestStream.WriteAsync(new ClientMessage { RegistrationRequest = RegistrationRequest }); - while (await stream.ResponseStream.MoveNext(CancellationToken.None)) + while (await stream.ResponseStream.MoveNext(cancellationToken)) { var req = stream.ResponseStream.Current; - if (req.RegistrationResponse != null) - { - // Bucket listener connected with Nitric server. - } - else if (req.BlobEventRequest != null) + if (req.BlobEventRequest != null) { var ctx = BlobEventContext.FromRequest(req); @@ -69,6 +65,8 @@ public override async Task Start() await stream.RequestStream.WriteAsync(ctx.ToResponse()); } + + cancellationToken.ThrowIfCancellationRequested(); } await stream.RequestStream.CompleteAsync(); diff --git a/src/Nitric.Sdk/Worker/FileEventWorker.cs b/src/Nitric.Sdk/Worker/FileEventWorker.cs index f1392f8..46225e8 100644 --- a/src/Nitric.Sdk/Worker/FileEventWorker.cs +++ b/src/Nitric.Sdk/Worker/FileEventWorker.cs @@ -27,35 +27,33 @@ public class FileEventWorker : AbstractWorker { readonly private RegistrationRequest RegistrationRequest; readonly private Bucket bucket; + public GrpcClient GrpcClient { private get; set; } public FileEventWorker(RegistrationRequest request, Bucket bucket, Func middleware) : base(middleware) { this.RegistrationRequest = request; this.bucket = bucket; + this.GrpcClient = new GrpcClient(GrpcChannelProvider.GetChannel()); } - public FileEventWorker(RegistrationRequest request, params Middleware[] middlewares) : base(middlewares) + public FileEventWorker(RegistrationRequest request, Bucket bucket, params Middleware[] middlewares) : base(middlewares) { this.RegistrationRequest = request; + this.bucket = bucket; + this.GrpcClient = new GrpcClient(GrpcChannelProvider.GetChannel()); } - public override async Task Start() + public override async Task Start(CancellationToken cancellationToken = default) { - var client = new GrpcClient(GrpcChannelProvider.GetChannel()); - - var stream = client.Listen(); + var stream = this.GrpcClient.Listen(); await stream.RequestStream.WriteAsync(new ClientMessage { RegistrationRequest = RegistrationRequest }); - while (await stream.ResponseStream.MoveNext(CancellationToken.None)) + while (await stream.ResponseStream.MoveNext(cancellationToken)) { var req = stream.ResponseStream.Current; - if (req.RegistrationResponse != null) - { - // Bucket listener connected with Nitric server. - } - else if (req.BlobEventRequest != null) + if (req.BlobEventRequest != null) { var ctx = FileEventContext.FromRequest(req, this.bucket); @@ -71,6 +69,8 @@ public override async Task Start() await stream.RequestStream.WriteAsync(ctx.ToResponse()); } + + cancellationToken.ThrowIfCancellationRequested(); } await stream.RequestStream.CompleteAsync(); diff --git a/src/Nitric.Sdk/Worker/ScheduleWorker.cs b/src/Nitric.Sdk/Worker/ScheduleWorker.cs index 59f7340..fbcf686 100644 --- a/src/Nitric.Sdk/Worker/ScheduleWorker.cs +++ b/src/Nitric.Sdk/Worker/ScheduleWorker.cs @@ -25,34 +25,31 @@ namespace Nitric.Sdk.Worker public class ScheduleWorker : AbstractWorker { readonly private RegistrationRequest RegistrationRequest; + public GrpcClient GrpcClient { private get; set; } public ScheduleWorker(RegistrationRequest request, Func middleware) : base(middleware) { this.RegistrationRequest = request; + this.GrpcClient = new GrpcClient(GrpcChannelProvider.GetChannel()); } public ScheduleWorker(RegistrationRequest request, params Middleware[] middlewares) : base(middlewares) { this.RegistrationRequest = request; + this.GrpcClient = new GrpcClient(GrpcChannelProvider.GetChannel()); } - public override async Task Start() + public override async Task Start(CancellationToken cancellationToken = default) { - var client = new GrpcClient(GrpcChannelProvider.GetChannel()); - - var stream = client.Schedule(); + var stream = this.GrpcClient.Schedule(); await stream.RequestStream.WriteAsync(new ClientMessage { RegistrationRequest = RegistrationRequest }); - while (await stream.ResponseStream.MoveNext(CancellationToken.None)) + while (await stream.ResponseStream.MoveNext(cancellationToken)) { var req = stream.ResponseStream.Current; - if (req.RegistrationResponse != null) - { - // Schedule connected with Nitric server. - } - else if (req.IntervalRequest != null) + if (req.IntervalRequest != null) { var ctx = IntervalContext.FromRequest(req); @@ -67,6 +64,8 @@ public override async Task Start() await stream.RequestStream.WriteAsync(ctx.ToResponse()); } + + cancellationToken.ThrowIfCancellationRequested(); } await stream.RequestStream.CompleteAsync(); diff --git a/src/Nitric.Sdk/Worker/SubscriptionWorker.cs b/src/Nitric.Sdk/Worker/SubscriptionWorker.cs index 2b99897..e989f71 100644 --- a/src/Nitric.Sdk/Worker/SubscriptionWorker.cs +++ b/src/Nitric.Sdk/Worker/SubscriptionWorker.cs @@ -25,34 +25,31 @@ namespace Nitric.Sdk.Worker public class SubscriptionWorker : AbstractWorker> { readonly private RegistrationRequest RegistrationRequest; + public GrpcClient GrpcClient { private get; set; } public SubscriptionWorker(RegistrationRequest request, Func, MessageContext> middleware) : base(middleware) { this.RegistrationRequest = request; + this.GrpcClient = new GrpcClient(GrpcChannelProvider.GetChannel()); } public SubscriptionWorker(RegistrationRequest request, params Middleware>[] middlewares) : base(middlewares) { this.RegistrationRequest = request; + this.GrpcClient = new GrpcClient(GrpcChannelProvider.GetChannel()); } - public override async Task Start() + public override async Task Start(CancellationToken cancellationToken = default) { - var client = new GrpcClient(GrpcChannelProvider.GetChannel()); - - var stream = client.Subscribe(); + var stream = this.GrpcClient.Subscribe(); await stream.RequestStream.WriteAsync(new ClientMessage { RegistrationRequest = RegistrationRequest }); - while (await stream.ResponseStream.MoveNext(CancellationToken.None)) + while (await stream.ResponseStream.MoveNext(cancellationToken)) { var req = stream.ResponseStream.Current; - if (req.RegistrationResponse != null) - { - // Topic connected with Nitric Server. - } - else if (req.MessageRequest != null) + if (req.MessageRequest != null) { var ctx = MessageContext.FromRequest(req); @@ -68,6 +65,8 @@ public override async Task Start() await stream.RequestStream.WriteAsync(ctx.ToResponse()); } + + cancellationToken.ThrowIfCancellationRequested(); } await stream.RequestStream.CompleteAsync(); diff --git a/src/Nitric.Sdk/Worker/WebsocketWorker.cs b/src/Nitric.Sdk/Worker/WebsocketWorker.cs index 2372882..a2778ed 100644 --- a/src/Nitric.Sdk/Worker/WebsocketWorker.cs +++ b/src/Nitric.Sdk/Worker/WebsocketWorker.cs @@ -25,34 +25,31 @@ namespace Nitric.Sdk.Worker public class WebsocketWorker : AbstractWorker { readonly private RegistrationRequest RegistrationRequest; + public GrpcClient GrpcClient { private get; set; } public WebsocketWorker(RegistrationRequest request, Func middleware) : base(middleware) { this.RegistrationRequest = request; + this.GrpcClient = new GrpcClient(GrpcChannelProvider.GetChannel()); } public WebsocketWorker(RegistrationRequest request, params Middleware[] middlewares) : base(middlewares) { this.RegistrationRequest = request; + this.GrpcClient = new GrpcClient(GrpcChannelProvider.GetChannel()); } - public override async Task Start() + public override async Task Start(CancellationToken cancellationToken = default) { - var client = new GrpcClient(GrpcChannelProvider.GetChannel()); - - var stream = client.HandleEvents(); + var stream = this.GrpcClient.HandleEvents(); await stream.RequestStream.WriteAsync(new ClientMessage { RegistrationRequest = RegistrationRequest }); - while (await stream.ResponseStream.MoveNext(CancellationToken.None)) + while (await stream.ResponseStream.MoveNext(cancellationToken)) { var req = stream.ResponseStream.Current; - if (req.RegistrationResponse != null) - { - // Websocket connected with Nitric server. - } - else if (req.WebsocketEventRequest != null) + if (req.WebsocketEventRequest != null) { var ctx = WebsocketContext.FromRequest(req); @@ -68,6 +65,8 @@ public override async Task Start() await stream.RequestStream.WriteAsync(ctx.ToResponse()); } + + cancellationToken.ThrowIfCancellationRequested(); } await stream.RequestStream.CompleteAsync(); diff --git a/src/Nitric.Sdk/Worker/Worker.cs b/src/Nitric.Sdk/Worker/Worker.cs index 57fe7fa..11bcb58 100644 --- a/src/Nitric.Sdk/Worker/Worker.cs +++ b/src/Nitric.Sdk/Worker/Worker.cs @@ -17,12 +17,13 @@ using System.Collections.Generic; using Nitric.Sdk.Service; using System.Linq; +using System.Threading; namespace Nitric.Sdk.Worker { interface IWorker { - public Task Start(); + public Task Start(CancellationToken cancellationToken = default); } public abstract class AbstractWorker : IWorker @@ -58,7 +59,7 @@ public AbstractWorker(Func middleware) this.Middleware = middleware; } - public abstract Task Start(); + public abstract Task Start(CancellationToken cancellationToken = default); } } diff --git a/test/Nitric.Sdk.Test/KeyValueStore/KeyValueStoreClientTest.cs b/test/Nitric.Sdk.Test/KeyValueStore/KeyValueStoreClientTest.cs index ee66782..2bc73a5 100644 --- a/test/Nitric.Sdk.Test/KeyValueStore/KeyValueStoreClientTest.cs +++ b/test/Nitric.Sdk.Test/KeyValueStore/KeyValueStoreClientTest.cs @@ -12,33 +12,6 @@ namespace Nitric.Sdk.Test.KeyValueStore { - internal class FakeAsyncStreamReader : IAsyncStreamReader - { - private readonly List results; - private int index; - - public FakeAsyncStreamReader(List results) - { - index = 0; - this.results = results; - } - - public T Current => results[index]; - - public Task MoveNext(CancellationToken cancellationToken) - { - if (index == results.Count - 1) - { - return Task.FromResult(false); - } - - index += 1; - - return Task.FromResult(true); - } - } - - public class TestProfile { public string Name { get; set; } diff --git a/test/Nitric.Sdk.Test/Mocks.cs b/test/Nitric.Sdk.Test/Mocks.cs new file mode 100644 index 0000000..90aa3dd --- /dev/null +++ b/test/Nitric.Sdk.Test/Mocks.cs @@ -0,0 +1,48 @@ +using System.Collections.Generic; +using System.Threading; +using System.Threading.Tasks; +using Grpc.Core; + +namespace Nitric.Sdk.Test +{ + internal class FakeAsyncStreamReader : IAsyncStreamReader + { + private readonly List results; + private int index; + + public FakeAsyncStreamReader(List results) + { + index = 0; + this.results = results; + } + + public T Current => results[index]; + + public Task MoveNext(CancellationToken cancellationToken) + { + if (index == results.Count - 1) + { + return Task.FromResult(false); + } + + index += 1; + + return Task.FromResult(true); + } + } + + internal class FakeClientStreamWriter : IClientStreamWriter + { + WriteOptions IAsyncStreamWriter.WriteOptions { get => WriteOptions.Default; set {} } + + public Task CompleteAsync() + { + return Task.FromResult(true); + } + + public Task WriteAsync(T message) + { + return Task.FromResult(true); + } + } +} \ No newline at end of file diff --git a/test/Nitric.Sdk.Test/Resource/ApiResourceTest.cs b/test/Nitric.Sdk.Test/Resource/ApiResourceTest.cs new file mode 100644 index 0000000..e69de29 diff --git a/test/Nitric.Sdk.Test/Storage/StorageClientTest.cs b/test/Nitric.Sdk.Test/Storage/StorageClientTest.cs index 721053e..db407c5 100644 --- a/test/Nitric.Sdk.Test/Storage/StorageClientTest.cs +++ b/test/Nitric.Sdk.Test/Storage/StorageClientTest.cs @@ -19,6 +19,7 @@ using Moq; using Nitric.Proto.Storage.v1; using Nitric.Sdk.Common; +using Nitric.Sdk.Service; using Xunit; using GrpcClient = Nitric.Proto.Storage.v1.Storage.StorageClient; @@ -1054,5 +1055,57 @@ public async void TestGetDownloadUrlNonExistingKeyAsync() t => t.PreSignUrlAsync(It.IsAny(), null, null, It.IsAny()), Times.Once); } + + [Fact] + public void TestRegisterBlobEventWorkerOnWrite() + { + Func middleware = (ctx) => + { + return ctx; + }; + + var bucket = new Sdk.Storage.StorageClient().Bucket("test-bucket"); + + bucket.On(Service.BlobEventType.Write, "*", middleware); + } + + [Fact] + public void TestRegisterBlobEventWorkerOnDelete() + { + Func middleware = (ctx) => + { + return ctx; + }; + + var bucket = new Sdk.Storage.StorageClient().Bucket("test-bucket"); + + bucket.On(Service.BlobEventType.Delete, "*", middleware); + } + + [Fact] + public void TestRegisterBlobEventWorkerOnWriteWithMultipleMiddleware() + { + Middleware middleware = (ctx, next) => + { + return next(ctx); + }; + + var bucket = new Sdk.Storage.StorageClient().Bucket("test-bucket"); + + bucket.On(Service.BlobEventType.Write, "*", middleware, middleware); + } + + [Fact] + public void TestRegisterBlobEventWorkerOnDeleteWithMultipleMiddleware() + { + Middleware middleware = (ctx, next) => + { + return next(ctx); + }; + + var bucket = new Sdk.Storage.StorageClient().Bucket("test-bucket"); + + bucket.On(Service.BlobEventType.Delete, "*", middleware, middleware); + } } } \ No newline at end of file diff --git a/test/Nitric.Sdk.Test/Test.cs b/test/Nitric.Sdk.Test/Test.cs new file mode 100644 index 0000000..994c09f --- /dev/null +++ b/test/Nitric.Sdk.Test/Test.cs @@ -0,0 +1,24 @@ +using Nitric.Sdk.Resource; +using Nitric.Sdk.Service; + +namespace Test +{ + public class Application + { + public static void Main(string[] args) + { + var app = Nitric.Sdk.Nitric.Api("Blah"); + + var oidc = Nitric.Sdk.Nitric.OidcRule("ruleName", "issuer", new string[] { "audiences" }); + + var route = app.Route("/hello", new RouteOptions { Security = new OidcOptions[] { oidc("user.read") } }); + + route.Get((HttpContext ctx) => + { + ctx.Res.Text("Hello World"); + return ctx; + }); + + } + } +} diff --git a/test/Nitric.Sdk.Test/Worker/ApiWorkerTest.cs b/test/Nitric.Sdk.Test/Worker/ApiWorkerTest.cs new file mode 100644 index 0000000..1146348 --- /dev/null +++ b/test/Nitric.Sdk.Test/Worker/ApiWorkerTest.cs @@ -0,0 +1,168 @@ +using System; +using System.Collections.Generic; +using System.Threading; +using Google.Protobuf; +using Grpc.Core; +using Moq; +using Nitric.Proto.Apis.v1; +using Nitric.Sdk.Service; +using Nitric.Sdk.Worker; +using Xunit; + +using GrpcClient = Nitric.Proto.Apis.v1.Api.ApiClient; + +namespace Nitric.Sdk.Test.Worker +{ + public class ApiWorkerTest + { + [Fact] + public void TestApiWorkerBuildWithMiddleware() + { + Func middleware = (ctx) => + { + return ctx; + }; + + var registration = new RegistrationRequest + { + Api = "api-name", + Path = "/", + }; + + var worker = new ApiWorker(registration, middleware); + + Assert.NotNull(worker); + } + + [Fact] + public void TestApiWorkerBuildWithMultipleMiddleware() + { + Middleware middleware = (ctx, next) => + { + return next(ctx); + }; + + var registration = new RegistrationRequest + { + Api = "api-name", + Path = "/", + }; + + var worker = new ApiWorker(registration, middleware, middleware); + + Assert.NotNull(worker); + } + + [Fact] + public void TestApiWorkerBuildWithNoMiddleware() + { + Middleware middleware = (ctx, next) => + { + return next(ctx); + }; + + var registration = new RegistrationRequest + { + Api = "api-name", + Path = "/", + }; + + Assert.Throws(() => + { + var worker = new ApiWorker(registration); + }); + } + + [Fact] + public async void TestApiWorkerStart() + { + Middleware middleware = (ctx, next) => + { + var profile = ctx.Req.Json(); + Assert.Equal("John Smith", profile.Name); + Assert.Equal(21, profile.Age); + Assert.Equal("john.smith@email.com", profile.Contacts[0]); + return next(ctx); + }; + + var registration = new RegistrationRequest + { + Api = "api-name", + Path = "/", + }; + + var mockClientMessage = new FakeClientStreamWriter(); + + var body = ByteString.CopyFromUtf8("{\"name\":\"John Smith\",\"age\":21,\"contacts\":[\"john.smith@email.com\"]}"); + + var responseStream = new FakeAsyncStreamReader( + new List + { + new ServerMessage { Id = "id-1", RegistrationResponse = new RegistrationResponse { }}, + new ServerMessage { Id = "id-2", HttpRequest = new Proto.Apis.v1.HttpRequest { Body = body} }, + } + ); + + var resp = new AsyncDuplexStreamingCall(mockClientMessage, responseStream, null, null, null, null); + + Mock wc = new Mock(); + wc.Setup(e => + e.Serve(null, null, It.IsAny())) + .Returns(resp); + + var worker = new ApiWorker(registration, middleware) + { + GrpcClient = wc.Object + }; + + await worker.Start(); + + wc.Verify( + t => t.Serve(null, null, It.IsAny()), Times.Once); + } + + [Fact] + public async void TestScheduleWorkerStartsWithErrors() + { + Middleware middleware = (ctx, next) => + { + throw new ApplicationException("Expected test exception!"); + }; + + var registration = new RegistrationRequest + { + Api = "api-name", + Path = "/", + }; + + var mockClientMessage = new FakeClientStreamWriter(); + + var body = ByteString.CopyFromUtf8("{\"name\":\"John Smith\",\"age\":21,\"contacts\":[\"john.smith@email.com\"]}"); + + var responseStream = new FakeAsyncStreamReader( + new List + { + new ServerMessage { Id = "id-1", RegistrationResponse = new RegistrationResponse { }}, + new ServerMessage { Id = "id-2", HttpRequest = new Proto.Apis.v1.HttpRequest { Body = body} }, + } + ); + + var resp = new AsyncDuplexStreamingCall(mockClientMessage, responseStream, null, null, null, null); + + Mock wc = new Mock(); + wc.Setup(e => + e.Serve(null, null, It.IsAny())) + .Returns(resp); + + var worker = new ApiWorker(registration, middleware) + { + GrpcClient = wc.Object + }; + + await worker.Start(); + + wc.Verify( + t => t.Serve(null, null, It.IsAny()), Times.Once); + } + } +} \ No newline at end of file diff --git a/test/Nitric.Sdk.Test/Worker/BlobEventWorker.cs b/test/Nitric.Sdk.Test/Worker/BlobEventWorker.cs new file mode 100644 index 0000000..0da6c1e --- /dev/null +++ b/test/Nitric.Sdk.Test/Worker/BlobEventWorker.cs @@ -0,0 +1,202 @@ +using System; +using System.Collections.Generic; +using System.Threading; +using Grpc.Core; +using Moq; +using Nitric.Proto.Storage.v1; +using Nitric.Sdk.Service; +using Nitric.Sdk.Worker; +using Xunit; + +using GrpcClient = Nitric.Proto.Storage.v1.StorageListener.StorageListenerClient; + +namespace Nitric.Sdk.Test.Worker +{ + public class BlobEventWorkerTest + { + [Fact] + public void TestBlobEventWorkerBuildWithMiddleware() + { + Func middleware = (ctx) => + { + return ctx; + }; + + var registration = new RegistrationRequest + { + BucketName = "bucket-name", + BlobEventType = Proto.Storage.v1.BlobEventType.Created, + }; + + var worker = new BlobEventWorker(registration, middleware); + + Assert.NotNull(worker); + } + + [Fact] + public void TestBlobEventWorkerBuildWithMultipleMiddleware() + { + Middleware middleware = (ctx, next) => + { + return next(ctx); + }; + + var registration = new RegistrationRequest + { + BucketName = "bucket-name", + BlobEventType = Proto.Storage.v1.BlobEventType.Created, + }; + + var worker = new BlobEventWorker(registration, middleware, middleware); + + Assert.NotNull(worker); + } + + [Fact] + public void TestBlobEventWorkerBuildWithNoMiddleware() + { + Middleware middleware = (ctx, next) => + { + return next(ctx); + }; + + var registration = new RegistrationRequest + { + BucketName = "bucket-name", + BlobEventType = Proto.Storage.v1.BlobEventType.Created, + }; + + Assert.Throws(() => + { + var worker = new BlobEventWorker(registration); + }); + } + + [Fact] + public async void TestBlobEventWorkerStartCreated() + { + Middleware middleware = (ctx, next) => + { + Assert.Equal("test-file", ctx.Req.Key); + Assert.Equal(Service.BlobEventType.Write, ctx.Req.NotificationType); + return next(ctx); + }; + + var registration = new RegistrationRequest + { + BucketName = "BlobEvent-name", + BlobEventType = Proto.Storage.v1.BlobEventType.Created, + }; + + var mockClientMessage = new FakeClientStreamWriter(); + + var responseStream = new FakeAsyncStreamReader( + new List + { + new ServerMessage { Id = "id-1", RegistrationResponse = new RegistrationResponse { }}, + new ServerMessage { Id = "id-2", BlobEventRequest = new Proto.Storage.v1.BlobEventRequest { BucketName = "bucket-name", BlobEvent = new BlobEvent { Key="test-file", Type=Proto.Storage.v1.BlobEventType.Created} } }, } + ); + + var resp = new AsyncDuplexStreamingCall(mockClientMessage, responseStream, null, null, null, null); + + Mock wc = new Mock(); + wc.Setup(e => + e.Listen(null, null, It.IsAny())) + .Returns(resp); + + var worker = new BlobEventWorker(registration, middleware) + { + GrpcClient = wc.Object + }; + + await worker.Start(); + + wc.Verify( + t => t.Listen(null, null, It.IsAny()), Times.Once); + } + + [Fact] + public async void TestBlobEventWorkerStartDeleted() + { + Middleware middleware = (ctx, next) => + { + Assert.Equal("test-file", ctx.Req.Key); + Assert.Equal(Service.BlobEventType.Delete, ctx.Req.NotificationType); + return next(ctx); + }; + + var registration = new RegistrationRequest + { + BucketName = "BlobEvent-name", + BlobEventType = Proto.Storage.v1.BlobEventType.Created, + }; + + var mockClientMessage = new FakeClientStreamWriter(); + + var responseStream = new FakeAsyncStreamReader( + new List + { + new ServerMessage { Id = "id-1", RegistrationResponse = new RegistrationResponse { }}, + new ServerMessage { Id = "id-2", BlobEventRequest = new Proto.Storage.v1.BlobEventRequest { BucketName = "bucket-name", BlobEvent = new BlobEvent { Key="test-file", Type=Proto.Storage.v1.BlobEventType.Deleted} } }, } + ); + + var resp = new AsyncDuplexStreamingCall(mockClientMessage, responseStream, null, null, null, null); + + Mock wc = new Mock(); + wc.Setup(e => + e.Listen(null, null, It.IsAny())) + .Returns(resp); + + var worker = new BlobEventWorker(registration, middleware) + { + GrpcClient = wc.Object + }; + + await worker.Start(); + + wc.Verify( + t => t.Listen(null, null, It.IsAny()), Times.Once); + } + + [Fact] + public async void TestBlobEventWorkerStartsWithErrors() + { + Middleware middleware = (ctx, next) => + { + throw new ApplicationException("Expected test exception!"); + }; + + var registration = new RegistrationRequest + { + BucketName = "BlobEvent-name", + BlobEventType = Proto.Storage.v1.BlobEventType.Created, + }; + + var mockClientMessage = new FakeClientStreamWriter(); + + var responseStream = new FakeAsyncStreamReader( + new List + { + new ServerMessage { Id = "id-1", RegistrationResponse = new RegistrationResponse { }}, + new ServerMessage { Id = "id-2", BlobEventRequest = new Proto.Storage.v1.BlobEventRequest { BucketName = "bucket-name", BlobEvent = new BlobEvent { Key="test-file", Type=Proto.Storage.v1.BlobEventType.Created} } }, } + ); + + var resp = new AsyncDuplexStreamingCall(mockClientMessage, responseStream, null, null, null, null); + + Mock wc = new Mock(); + wc.Setup(e => + e.Listen(null, null, It.IsAny())) + .Returns(resp); + + var worker = new BlobEventWorker(registration, middleware) + { + GrpcClient = wc.Object + }; + + await worker.Start(); + + wc.Verify( + t => t.Listen(null, null, It.IsAny()), Times.Once); + } + } +} \ No newline at end of file diff --git a/test/Nitric.Sdk.Test/Worker/FileEventWorker.cs b/test/Nitric.Sdk.Test/Worker/FileEventWorker.cs new file mode 100644 index 0000000..dc334bd --- /dev/null +++ b/test/Nitric.Sdk.Test/Worker/FileEventWorker.cs @@ -0,0 +1,215 @@ +using System; +using System.Collections.Generic; +using System.Threading; +using Grpc.Core; +using Moq; +using Nitric.Proto.Storage.v1; +using Nitric.Sdk.Service; +using Nitric.Sdk.Storage; +using Nitric.Sdk.Worker; +using Xunit; + +using GrpcClient = Nitric.Proto.Storage.v1.StorageListener.StorageListenerClient; + +namespace Nitric.Sdk.Test.Worker +{ + public class FileEventWorkerTest + { + [Fact] + public void TestFileEventWorkerBuildWithMiddleware() + { + Func middleware = (ctx) => + { + return ctx; + }; + + var registration = new RegistrationRequest + { + BucketName = "bucket-name", + BlobEventType = Proto.Storage.v1.BlobEventType.Created, + }; + + var bucket = new StorageClient().Bucket("bucket-name"); + + var worker = new FileEventWorker(registration, bucket, middleware); + + Assert.NotNull(worker); + } + + [Fact] + public void TestFileEventWorkerBuildWithMultipleMiddleware() + { + Middleware middleware = (ctx, next) => + { + return next(ctx); + }; + + var registration = new RegistrationRequest + { + BucketName = "bucket-name", + BlobEventType = Proto.Storage.v1.BlobEventType.Created, + }; + + var bucket = new StorageClient().Bucket("bucket-name"); + + var worker = new FileEventWorker(registration, bucket, middleware, middleware); + + Assert.NotNull(worker); + } + + [Fact] + public void TestFileEventWorkerBuildWithNoMiddleware() + { + Middleware middleware = (ctx, next) => + { + return next(ctx); + }; + + var registration = new RegistrationRequest + { + BucketName = "bucket-name", + BlobEventType = Proto.Storage.v1.BlobEventType.Created, + }; + + var bucket = new StorageClient().Bucket("bucket-name"); + + Assert.Throws(() => + { + var worker = new FileEventWorker(registration, bucket); + }); + } + + [Fact] + public async void TestFileEventWorkerStartCreated() + { + Middleware middleware = (ctx, next) => + { + Assert.Equal("test-file", ctx.Req.File.Name); + Assert.Equal(Service.BlobEventType.Write, ctx.Req.NotificationType); + return next(ctx); + }; + + var registration = new RegistrationRequest + { + BucketName = "BlobEvent-name", + BlobEventType = Proto.Storage.v1.BlobEventType.Created, + }; + + var mockClientMessage = new FakeClientStreamWriter(); + + var responseStream = new FakeAsyncStreamReader( + new List + { + new ServerMessage { Id = "id-1", RegistrationResponse = new RegistrationResponse { }}, + new ServerMessage { Id = "id-2", BlobEventRequest = new Proto.Storage.v1.BlobEventRequest { BucketName = "bucket-name", BlobEvent = new BlobEvent { Key="test-file", Type=Proto.Storage.v1.BlobEventType.Created} } }, } + ); + + var resp = new AsyncDuplexStreamingCall(mockClientMessage, responseStream, null, null, null, null); + + Mock wc = new Mock(); + wc.Setup(e => + e.Listen(null, null, It.IsAny())) + .Returns(resp); + + var bucket = new StorageClient().Bucket("bucket-name"); + + var worker = new FileEventWorker(registration, bucket, middleware) + { + GrpcClient = wc.Object + }; + + await worker.Start(); + + wc.Verify( + t => t.Listen(null, null, It.IsAny()), Times.Once); + } + + [Fact] + public async void TestFileEventWorkerStartDeleted() + { + Middleware middleware = (ctx, next) => + { + Assert.Equal("test-file", ctx.Req.File.Name); + Assert.Equal(Service.BlobEventType.Delete, ctx.Req.NotificationType); + return next(ctx); + }; + + var registration = new RegistrationRequest + { + BucketName = "BlobEvent-name", + BlobEventType = Proto.Storage.v1.BlobEventType.Created, + }; + + var mockClientMessage = new FakeClientStreamWriter(); + + var responseStream = new FakeAsyncStreamReader( + new List + { + new ServerMessage { Id = "id-1", RegistrationResponse = new RegistrationResponse { }}, + new ServerMessage { Id = "id-2", BlobEventRequest = new Proto.Storage.v1.BlobEventRequest { BucketName = "bucket-name", BlobEvent = new BlobEvent { Key="test-file", Type=Proto.Storage.v1.BlobEventType.Deleted} } }, } + ); + + var resp = new AsyncDuplexStreamingCall(mockClientMessage, responseStream, null, null, null, null); + + Mock wc = new Mock(); + wc.Setup(e => + e.Listen(null, null, It.IsAny())) + .Returns(resp); + + var bucket = new StorageClient().Bucket("bucket-name"); + + var worker = new FileEventWorker(registration, bucket, middleware) + { + GrpcClient = wc.Object + }; + + await worker.Start(); + + wc.Verify( + t => t.Listen(null, null, It.IsAny()), Times.Once); + } + + [Fact] + public async void TestFileEventWorkerStartsWithErrors() + { + Middleware middleware = (ctx, next) => + { + throw new ApplicationException("Expected test exception!"); + }; + + var registration = new RegistrationRequest + { + BucketName = "BlobEvent-name", + BlobEventType = Proto.Storage.v1.BlobEventType.Created, + }; + + var mockClientMessage = new FakeClientStreamWriter(); + + var responseStream = new FakeAsyncStreamReader( + new List + { + new ServerMessage { Id = "id-1", RegistrationResponse = new RegistrationResponse { }}, + new ServerMessage { Id = "id-2", BlobEventRequest = new Proto.Storage.v1.BlobEventRequest { BucketName = "bucket-name", BlobEvent = new BlobEvent { Key="test-file", Type=Proto.Storage.v1.BlobEventType.Created} } }, } + ); + + var resp = new AsyncDuplexStreamingCall(mockClientMessage, responseStream, null, null, null, null); + + Mock wc = new Mock(); + wc.Setup(e => + e.Listen(null, null, It.IsAny())) + .Returns(resp); + + var bucket = new StorageClient().Bucket("bucket-name"); + + var worker = new FileEventWorker(registration, bucket, middleware) + { + GrpcClient = wc.Object + }; + + await worker.Start(); + + wc.Verify( + t => t.Listen(null, null, It.IsAny()), Times.Once); + } + } +} \ No newline at end of file diff --git a/test/Nitric.Sdk.Test/Worker/ScheduleWorkerTest.cs b/test/Nitric.Sdk.Test/Worker/ScheduleWorkerTest.cs new file mode 100644 index 0000000..327bf88 --- /dev/null +++ b/test/Nitric.Sdk.Test/Worker/ScheduleWorkerTest.cs @@ -0,0 +1,160 @@ +using System; +using System.Collections.Generic; +using System.Threading; +using Grpc.Core; +using Moq; +using Nitric.Proto.Schedules.v1; +using Nitric.Sdk.Service; +using Nitric.Sdk.Worker; +using Xunit; + +using GrpcClient = Nitric.Proto.Schedules.v1.Schedules.SchedulesClient; + +namespace Nitric.Sdk.Test.Worker +{ + public class ScheduleWorkerTest + { + [Fact] + public void TestScheduleWorkerBuildWithMiddleware() + { + Func middleware = (ctx) => + { + return ctx; + }; + + var registration = new RegistrationRequest + { + ScheduleName = "schedule-name", + Cron = new ScheduleCron { Expression = "* * * * *" } + }; + + var worker = new ScheduleWorker(registration, middleware); + + Assert.NotNull(worker); + } + + [Fact] + public void TestScheduleWorkerBuildWithMultipleMiddleware() + { + Middleware middleware = (ctx, next) => + { + return next(ctx); + }; + + var registration = new RegistrationRequest + { + ScheduleName = "schedule-name", + Cron = new ScheduleCron { Expression = "* * * * *" } + }; + + var worker = new ScheduleWorker(registration, middleware, middleware); + + Assert.NotNull(worker); + } + + [Fact] + public void TestScheduleWorkerBuildWithNoMiddleware() + { + Middleware middleware = (ctx, next) => + { + return next(ctx); + }; + + var registration = new RegistrationRequest + { + ScheduleName = "schedule-name", + Cron = new ScheduleCron { Expression = "* * * * *" } + }; + + Assert.Throws(() => + { + var worker = new ScheduleWorker(registration); + }); + } + + [Fact] + public async void TestScheduleWorkerStart() + { + Middleware middleware = (ctx, next) => + { + Assert.Equal("schedule-name", ctx.Req.ScheduleName); + return next(ctx); + }; + + var registration = new RegistrationRequest + { + ScheduleName = "schedule-name", + Cron = new ScheduleCron { Expression = "* * * * *" } + }; + + var mockClientMessage = new FakeClientStreamWriter(); + + var responseStream = new FakeAsyncStreamReader( + new List + { + new ServerMessage { Id = "id-1", RegistrationResponse = new RegistrationResponse { }}, + new ServerMessage { Id = "id-2", IntervalRequest = new Proto.Schedules.v1.IntervalRequest { ScheduleName = "schedule-name" } }, + } + ); + + var resp = new AsyncDuplexStreamingCall(mockClientMessage, responseStream, null, null, null, null); + + Mock wc = new Mock(); + wc.Setup(e => + e.Schedule(null, null, It.IsAny())) + .Returns(resp); + + var worker = new ScheduleWorker(registration, middleware) + { + GrpcClient = wc.Object + }; + + await worker.Start(); + + wc.Verify( + t => t.Schedule(null, null, It.IsAny()), Times.Once); + } + + [Fact] + public async void TestScheduleWorkerStartsWithErrors() + { + Middleware middleware = (ctx, next) => + { + throw new ApplicationException("Expected test exception!"); + }; + + var registration = new RegistrationRequest + { + ScheduleName = "schedule-name", + Cron = new ScheduleCron { Expression = "* * * * *" } + }; + + var mockClientMessage = new FakeClientStreamWriter(); + + var responseStream = new FakeAsyncStreamReader( + new List + { + new ServerMessage { Id = "id-1", RegistrationResponse = new RegistrationResponse { }}, + new ServerMessage { Id = "id-2", IntervalRequest = new Proto.Schedules.v1.IntervalRequest { ScheduleName = "schedule-name" } }, + } + ); + + var resp = new AsyncDuplexStreamingCall(mockClientMessage, responseStream, null, null, null, null); + + Mock wc = new Mock(); + wc.Setup(e => + e.Schedule(null, null, It.IsAny())) + .Returns(resp); + + var worker = new ScheduleWorker(registration, middleware) + { + GrpcClient = wc.Object + }; + + await worker.Start(); + + wc.Verify( + t => t.Schedule(null, null, It.IsAny()), Times.Once); + } + } +} \ No newline at end of file diff --git a/test/Nitric.Sdk.Test/Worker/SubscriptionWorkerTest.cs b/test/Nitric.Sdk.Test/Worker/SubscriptionWorkerTest.cs new file mode 100644 index 0000000..2f87d09 --- /dev/null +++ b/test/Nitric.Sdk.Test/Worker/SubscriptionWorkerTest.cs @@ -0,0 +1,192 @@ +using System; +using System.Collections.Generic; +using System.ComponentModel; +using System.Threading; +using Grpc.Core; +using Moq; +using Nitric.Proto.Topics.v1; +using Nitric.Sdk.Common; +using Nitric.Sdk.Service; +using Nitric.Sdk.Worker; +using Xunit; + +using GrpcClient = Nitric.Proto.Topics.v1.Subscriber.SubscriberClient; + +namespace Nitric.Sdk.Test.Worker +{ + public class TestProfile + { + public string Name { get; set; } + public int Age { get; set; } + public List Contacts { get; set; } + + } + public class SubscriptionWorkerTest + { + [Fact] + public void TestSubscriptionWorkerBuildWithMiddleware() + { + Func, MessageContext> middleware = (ctx) => + { + return ctx; + }; + + var registration = new RegistrationRequest + { + TopicName = "topic-name", + }; + + var worker = new SubscriptionWorker(registration, middleware); + + Assert.NotNull(worker); + } + + [Fact] + public void TestSubscriptionWorkerBuildWithMultipleMiddleware() + { + Middleware> middleware = (ctx, next) => + { + return next(ctx); + }; + + var registration = new RegistrationRequest + { + TopicName = "topic-name", + }; + + var worker = new SubscriptionWorker(registration, middleware, middleware); + + Assert.NotNull(worker); + } + + [Fact] + public void TestSubscriptionWorkerBuildWithNoMiddleware() + { + var registration = new RegistrationRequest + { + TopicName = "topic-name", + }; + + Assert.Throws(() => + { + var worker = new SubscriptionWorker(registration); + }); + } + + [Fact] + public async void TestSubscriptionWorkerStart() + { + Middleware> middleware = (ctx, next) => + { + Assert.Equal("topic-name", ctx.Req.TopicName); + Assert.Equal("John Smith", ctx.Req.Message.Name); + Assert.Equal(21, ctx.Req.Message.Age); + Assert.Equal("john.smith@email.com", ctx.Req.Message.Contacts[0]); + return next(ctx); + }; + + var registration = new RegistrationRequest + { + TopicName = "topic-name", + }; + + var mockClientMessage = new FakeClientStreamWriter(); + + var responseStream = new FakeAsyncStreamReader( + new List + { + new ServerMessage { Id = "id-1", RegistrationResponse = new RegistrationResponse() }, + new ServerMessage + { + Id = "id-2", MessageRequest = new MessageRequest + { + TopicName = "topic-name", + Message = new TopicMessage + { + StructPayload = Struct.FromJsonSerializable(new TestProfile + { + Name = "John Smith", + Age = 21, + Contacts = new List { "john.smith@email.com" }, + }) + }, + }, + }, + } + ); + + var resp = new AsyncDuplexStreamingCall(mockClientMessage, responseStream, null, null, null, null); + + Mock wc = new Mock(); + wc.Setup(e => + e.Subscribe(null, null, It.IsAny())) + .Returns(resp); + + var worker = new SubscriptionWorker(registration, middleware) + { + GrpcClient = wc.Object + }; + + await worker.Start(); + + wc.Verify( + t => t.Subscribe(null, null, It.IsAny()), Times.Once); + } + + [Fact] + public async void TestSubscriptionWorkerStartsWithErrors() + { + Middleware> middleware = (ctx, next) => + { + throw new ApplicationException("Expected test exception!"); + }; + + var registration = new RegistrationRequest + { + TopicName = "topic-name", + }; + + var mockClientMessage = new FakeClientStreamWriter(); + + var responseStream = new FakeAsyncStreamReader( + new List + { + new ServerMessage { Id = "id-1", RegistrationResponse = new RegistrationResponse { }}, + new ServerMessage + { + Id = "id-2", MessageRequest = new MessageRequest + { + TopicName = "schedule-name", + Message = new TopicMessage + { + StructPayload = Struct.FromJsonSerializable(new TestProfile + { + Name = "John Smith", + Age = 21, + Contacts = new List { "john.smith@email.com" }, + }) + }, + }, + }, + } + ); + + var resp = new AsyncDuplexStreamingCall(mockClientMessage, responseStream, null, null, null, null); + + Mock wc = new Mock(); + wc.Setup(e => + e.Subscribe(null, null, It.IsAny())) + .Returns(resp); + + var worker = new SubscriptionWorker(registration, middleware) + { + GrpcClient = wc.Object + }; + + await worker.Start(); + + wc.Verify( + t => t.Subscribe(null, null, It.IsAny()), Times.Once); + } + } +} \ No newline at end of file diff --git a/test/Nitric.Sdk.Test/Worker/WebsocketWorkerTest.cs b/test/Nitric.Sdk.Test/Worker/WebsocketWorkerTest.cs new file mode 100644 index 0000000..7cb67b9 --- /dev/null +++ b/test/Nitric.Sdk.Test/Worker/WebsocketWorkerTest.cs @@ -0,0 +1,174 @@ +using System; +using System.Collections.Generic; +using System.Threading; +using Grpc.Core; +using Moq; +using Nitric.Proto.Websockets.v1; +using Nitric.Sdk.Service; +using Nitric.Sdk.Worker; +using Xunit; + +using GrpcClient = Nitric.Proto.Websockets.v1.WebsocketHandler.WebsocketHandlerClient; + +namespace Nitric.Sdk.Test.Worker +{ + public class WebsocketWorkerTest + { + [Fact] + public void TestWebsocketWorkerBuildWithMiddleware() + { + Func middleware = (ctx) => + { + return ctx; + }; + + var registration = new RegistrationRequest + { + SocketName = "websocket-name", + }; + + var worker = new WebsocketWorker(registration, middleware); + + Assert.NotNull(worker); + } + + [Fact] + public void TestWebsocketWorkerBuildWithMultipleMiddleware() + { + Middleware middleware = (ctx, next) => + { + return next(ctx); + }; + + var registration = new RegistrationRequest + { + SocketName = "websocket-name", + }; + + var worker = new WebsocketWorker(registration, middleware, middleware); + + Assert.NotNull(worker); + } + + [Fact] + public void TestWebsocketWorkerBuildWithNoMiddleware() + { + Middleware middleware = (ctx, next) => + { + return next(ctx); + }; + + var registration = new RegistrationRequest + { + SocketName = "websocket-name", + }; + + Assert.Throws(() => + { + var worker = new WebsocketWorker(registration); + }); + } + + [Fact] + public async void TestWebsocketWorkerStart() + { + Middleware middleware = (ctx, next) => + { + Assert.Equal("websocket-name", ctx.Req.SocketName); + Assert.Equal("connection-1234", ctx.Req.ConnectionId); + return next(ctx); + }; + + var registration = new RegistrationRequest + { + SocketName = "websocket-name", + }; + + var mockClientMessage = new FakeClientStreamWriter(); + + var responseStream = new FakeAsyncStreamReader( + new List + { + new ServerMessage { Id = "id-1", RegistrationResponse = new RegistrationResponse { }}, + new ServerMessage + { + Id = "id-2", + WebsocketEventRequest = new WebsocketEventRequest + { + SocketName = "websocket-name", + ConnectionId = "connection-1234", + Connection = new WebsocketConnectionEvent() + }, + }, + } + ); + + var resp = new AsyncDuplexStreamingCall(mockClientMessage, responseStream, null, null, null, null); + + Mock wc = new Mock(); + wc.Setup(e => + e.HandleEvents(null, null, It.IsAny())) + .Returns(resp); + + var worker = new WebsocketWorker(registration, middleware) + { + GrpcClient = wc.Object + }; + + await worker.Start(); + + wc.Verify( + t => t.HandleEvents(null, null, It.IsAny()), Times.Once); + } + + [Fact] + public async void TestWebsocketWorkerStartsWithErrors() + { + Middleware middleware = (ctx, next) => + { + throw new ApplicationException("Expected test exception!"); + }; + + var registration = new RegistrationRequest + { + SocketName = "websocket-name", + }; + + var mockClientMessage = new FakeClientStreamWriter(); + + var responseStream = new FakeAsyncStreamReader( + new List + { + new ServerMessage { Id = "id-1", RegistrationResponse = new RegistrationResponse { }}, + new ServerMessage + { + Id = "id-2", + WebsocketEventRequest = new WebsocketEventRequest + { + SocketName = "websocket-name", + ConnectionId = "connection-1234", + Connection = new WebsocketConnectionEvent() + }, + }, + } + ); + + var resp = new AsyncDuplexStreamingCall(mockClientMessage, responseStream, null, null, null, null); + + Mock wc = new Mock(); + wc.Setup(e => + e.HandleEvents(null, null, It.IsAny())) + .Returns(resp); + + var worker = new WebsocketWorker(registration, middleware) + { + GrpcClient = wc.Object + }; + + await worker.Start(); + + wc.Verify( + t => t.HandleEvents(null, null, It.IsAny()), Times.Once); + } + } +} \ No newline at end of file diff --git a/test/Nitric.Sdk.Test/examples/ExamplesTest.cs b/test/Nitric.Sdk.Test/examples/ExamplesTest.cs deleted file mode 100644 index 411eccd..0000000 --- a/test/Nitric.Sdk.Test/examples/ExamplesTest.cs +++ /dev/null @@ -1,330 +0,0 @@ -// Copyright 2021, Nitric Technologies Pty Ltd. -// -// 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. - -using Moq; -using Examples; -using Nitric.Proto.Document.v1; -using Nitric.Proto.Event.v1; -using Nitric.Proto.Queue.v1; -using Nitric.Proto.Secret.v1; -using Nitric.Proto.Storage.v1; -using Grpc.Core; -using Google.Protobuf.WellKnownTypes; -using Xunit; -using System.Collections.Generic; -using Google.Protobuf.Collections; -using System; -using Nitric.Sdk.Common.Util; -using Environment = System.Environment; - -[assembly: CollectionBehavior(DisableTestParallelization = true)] - -namespace Nitric.Test.Examples -{ - [Collection("Examples")] - public class DocumentsExamplesTest : IDisposable - { - private readonly Server server; - private readonly Mock mockServer; - - public DocumentsExamplesTest() - { - var value = new Value - { - StringValue = "document" - }; - - var content = new Struct(); - content.Fields.Add("test", value); - - var document = new Document - { - Content = content, - }; - var documentGetResponse = new DocumentGetResponse - { - Document = document, - }; - - //Setup a mock server for the snippets to hit - mockServer = new Mock(); - mockServer.Setup(e => e.Delete(It.IsAny(), It.IsAny())) - .ReturnsAsync(new DocumentDeleteResponse()) - .Verifiable(); - mockServer.Setup(e => e.Get(It.IsAny(), It.IsAny())) - .ReturnsAsync(documentGetResponse) - .Verifiable(); - mockServer.Setup(e => e.Set(It.IsAny(), It.IsAny())) - .ReturnsAsync(new DocumentSetResponse()) - .Verifiable(); - mockServer.Setup(e => e.Query(It.IsAny(), It.IsAny())) - .ReturnsAsync(new DocumentQueryResponse()) - .Verifiable(); - this.server = new Server - { - Services = { DocumentService.BindService(mockServer.Object) }, - Ports = { new ServerPort("localhost", 50051, ServerCredentials.Insecure) } - }; - server.Start(); - } - - [Fact] - public void TestDocumentExamples() - { - //Call functions - DeleteExample.DeleteFile(); - GetExample.GetFile(); - SetExample.SetFile(); - PagedResultsExample.PagedResults(); - QueryExample.Query(); - QueryFilterExample.QueryFilter(); - QueryLimitsExample.QueryLimits(); - SubDocQueryExample.QueryDocCol(); - } - - public void Dispose() - { - //Verify all the functions were called - mockServer.Verify(e => e.Delete(It.IsAny(), It.IsAny()), - Times.Once); - mockServer.Verify(e => e.Get(It.IsAny(), It.IsAny()), Times.Once); - mockServer.Verify(e => e.Set(It.IsAny(), It.IsAny()), Times.Once); - mockServer.Verify(e => e.Query(It.IsAny(), It.IsAny()), - Times.Exactly(6)); - - this.server.KillAsync().Wait(); - } - } - - [Collection("Examples")] - public class EventsExamplesTest : IDisposable - { - private Server server; - private Mock mockServer; - - public EventsExamplesTest() - { - //Setup a mock server for the snippets to hit - Environment.SetEnvironmentVariable("SERVICE_ADDRESS", "127.0.0.1:50052"); - mockServer = new Mock(); - mockServer.Setup(e => e.Publish(It.IsAny(), It.IsAny())) - .ReturnsAsync(new EventPublishResponse()) - .Verifiable(); - this.server = new Server - { - Services = { EventService.BindService(mockServer.Object) }, - Ports = { new ServerPort("localhost", 50052, ServerCredentials.Insecure) } - }; - server.Start(); - } - - [Fact] - public void TestEventsExample() - { - //Call functions - EventIdsExample.EventIdsTopic(); - PublishExample.PublishTopic(); - - //Verify all the functions were called - mockServer.Verify(e => e.Publish(It.IsAny(), It.IsAny()), - Times.Exactly(2)); - } - - public void Dispose() - { - //Verify all the functions were called - mockServer.Verify(e => e.Publish(It.IsAny(), It.IsAny()), - Times.Exactly(2)); - - this.server.KillAsync().Wait(); - } - } - - [Collection("Examples")] - public class QueuesExamplesTest : IDisposable - { - private readonly Server server; - private readonly Mock mockServer = null; - - public QueuesExamplesTest() - { - var taskToReturn = new NitricTask - { - Id = "32", - LeaseId = "1", - Payload = Utils.ObjToStruct(new Dictionary()), - PayloadType = "Dictionary" - }; - - var tasks = new RepeatedField { taskToReturn }; - - var queueReceiveResponse = new QueueReceiveResponse(); - queueReceiveResponse.Tasks.AddRange(tasks); - - //Setup a mock server for the snippets to hit - mockServer = new Mock(); - mockServer.Setup(e => e.Send(It.IsAny(), It.IsAny())) - .ReturnsAsync(new QueueSendResponse()) - .Verifiable(); - mockServer.Setup(e => e.Receive(It.IsAny(), It.IsAny())) - .ReturnsAsync(queueReceiveResponse) - .Verifiable(); - mockServer.Setup(e => e.Complete(It.IsAny(), It.IsAny())) - .ReturnsAsync(new QueueCompleteResponse()) - .Verifiable(); - Environment.SetEnvironmentVariable("SERVICE_ADDRESS", "127.0.0.1:50053"); - this.server = new Server - { - Services = { QueueService.BindService(mockServer.Object) }, - Ports = { new ServerPort("localhost", 50053, ServerCredentials.Insecure) } - }; - server.Start(); - } - - [Fact] - public void TestQueuesExample() - { - //Call functions - ReceiveExample.ReceiveTask(); - SendExample.SendTask(); - } - - public void Dispose() - { - //Verify all the functions were called - mockServer.Verify(e => e.Send(It.IsAny(), It.IsAny()), Times.Once); - mockServer.Verify(e => e.Receive(It.IsAny(), It.IsAny()), - Times.Once); - mockServer.Verify(e => e.Complete(It.IsAny(), It.IsAny()), - Times.Once); - - this.server.KillAsync().Wait(); - } - } - - [Collection("Examples")] - public class SecretsExamplesTest : IDisposable - { - Server server = null; - Mock mockServer = null; - - public SecretsExamplesTest() - { - var secretPutResponse = new SecretPutResponse - { - SecretVersion = new Proto.Secret.v1.SecretVersion - { - Secret = new Proto.Secret.v1.Secret - { - Name = "test-secret", - }, - Version = "test-version", - } - }; - var secretAccessResponse = new SecretAccessResponse - { - SecretVersion = new Proto.Secret.v1.SecretVersion - { - Secret = new Proto.Secret.v1.Secret - { - Name = "test-secret", - }, - Version = "test-version", - } - }; - Environment.SetEnvironmentVariable("SERVICE_ADDRESS", "127.0.0.1:50054"); - //Setup a mock server for the snippets to hit - mockServer = new Mock(); - mockServer.Setup(e => e.Access(It.IsAny(), It.IsAny())) - .ReturnsAsync(secretAccessResponse) - .Verifiable(); - mockServer.Setup(e => e.Put(It.IsAny(), It.IsAny())) - .ReturnsAsync(secretPutResponse) - .Verifiable(); - this.server = new Server - { - Services = { SecretService.BindService(mockServer.Object) }, - Ports = { new ServerPort("localhost", 50054, ServerCredentials.Insecure) } - }; - server.Start(); - } - - [Fact] - public void TestSecretsExample() - { - //Call functions - AccessExample.AccessSecret(); - PutExample.PutSecret(); - } - - public void Dispose() - { - //Verify all the functions were called - mockServer.Verify(e => e.Access(It.IsAny(), It.IsAny()), - Times.Once); - mockServer.Verify(e => e.Put(It.IsAny(), It.IsAny()), Times.Once); - - this.server.KillAsync().Wait(); - } - } - - [Collection("Examples")] - public class StorageExamplesTest : IDisposable - { - Server server = null; - Mock mockServer = null; - - public StorageExamplesTest() - { - //Setup a mock server for the snippets to hit - mockServer = new Mock(); - mockServer.Setup(e => e.Write(It.IsAny(), It.IsAny())) - .ReturnsAsync(new StorageWriteResponse()) - .Verifiable(); - mockServer.Setup(e => e.Read(It.IsAny(), It.IsAny())) - .ReturnsAsync(new StorageReadResponse()) - .Verifiable(); - mockServer.Setup(e => e.Delete(It.IsAny(), It.IsAny())) - .ReturnsAsync(new StorageDeleteResponse()) - .Verifiable(); - Environment.SetEnvironmentVariable("SERVICE_ADDRESS", "127.0.0.1:50055"); - this.server = new Server - { - Services = { StorageService.BindService(mockServer.Object) }, - Ports = { new ServerPort("localhost", 50055, ServerCredentials.Insecure) } - }; - server.Start(); - } - - [Fact] - public void TestStorageExamples() - { - //Call functions - DeleteExamples.DeleteFile(); - ReadExample.ReadFile(); - WriteExample.WriteFile(); - } - - public void Dispose() - { - //Verify all the functions were called - mockServer.Verify(e => e.Write(It.IsAny(), It.IsAny()), Times.Once); - mockServer.Verify(e => e.Read(It.IsAny(), It.IsAny()), Times.Once); - mockServer.Verify(e => e.Delete(It.IsAny(), It.IsAny()), - Times.Once); - - this.server.KillAsync().Wait(); - } - } -} diff --git a/test/Nitric.Sdk.Test/examples/documents/Delete.cs b/test/Nitric.Sdk.Test/examples/documents/Delete.cs deleted file mode 100644 index fd34c79..0000000 --- a/test/Nitric.Sdk.Test/examples/documents/Delete.cs +++ /dev/null @@ -1,34 +0,0 @@ -// Copyright 2021, Nitric Technologies Pty Ltd. -// -// 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. - -// [START import] -using System.Collections.Generic; -using Nitric.Sdk.Document; -// [END import] -namespace Examples -{ - class DeleteExample - { - public static void DeleteFile() - { - // [START snippet] - var docs = new DocumentsClient(); - - var document = docs.Collection>("products").Doc("nitric"); - - document.Delete(); - // [END snippet] - } - } -} diff --git a/test/Nitric.Sdk.Test/examples/documents/Get.cs b/test/Nitric.Sdk.Test/examples/documents/Get.cs deleted file mode 100644 index 25ec3f8..0000000 --- a/test/Nitric.Sdk.Test/examples/documents/Get.cs +++ /dev/null @@ -1,34 +0,0 @@ -// Copyright 2021, Nitric Technologies Pty Ltd. -// -// 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. - -// [START import] -using System.Collections.Generic; -using Nitric.Sdk.Document; -// [END import] -namespace Examples -{ - class GetExample - { - public static void GetFile() - { - // [START snippet] - var docs = new DocumentsClient(); - - var document = docs.Collection>("products").Doc("nitric"); - - var product = document.Get(); - // [END snippet] - } - } -} diff --git a/test/Nitric.Sdk.Test/examples/documents/PagedResults.cs b/test/Nitric.Sdk.Test/examples/documents/PagedResults.cs deleted file mode 100644 index 9624509..0000000 --- a/test/Nitric.Sdk.Test/examples/documents/PagedResults.cs +++ /dev/null @@ -1,41 +0,0 @@ -// Copyright 2021, Nitric Technologies Pty Ltd. -// -// 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. - -// [START import] -using System.Collections.Generic; -using Nitric.Sdk.Document; -// [END import] -namespace Examples -{ - class PagedResultsExample - { - public static void PagedResults() - { - // [START snippet] - var docs = new DocumentsClient(); - - var query = docs.Collection>("Customers") - .Query() - .Where("active", "==", "true") - .Limit(100); - - // Fetch first page - var results = query.Fetch(); - - // Fetch next page - results = query.PagingFrom(results.PagingToken).Fetch(); - // [END snippet] - } - } -} diff --git a/test/Nitric.Sdk.Test/examples/documents/Query.cs b/test/Nitric.Sdk.Test/examples/documents/Query.cs deleted file mode 100644 index 4d7ad10..0000000 --- a/test/Nitric.Sdk.Test/examples/documents/Query.cs +++ /dev/null @@ -1,34 +0,0 @@ -// Copyright 2021, Nitric Technologies Pty Ltd. -// -// 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. - -// [START import] -using System.Collections.Generic; -using Nitric.Sdk.Document; -// [END import] -namespace Examples -{ - class QueryExample - { - public static void Query() - { - // [START snippet] - var docs = new DocumentsClient(); - - var query = docs.Collection>("customers").Query(); - - var results = query.Fetch(); - // [END snippet] - } - } -} diff --git a/test/Nitric.Sdk.Test/examples/documents/QueryFilter.cs b/test/Nitric.Sdk.Test/examples/documents/QueryFilter.cs deleted file mode 100644 index d32dc61..0000000 --- a/test/Nitric.Sdk.Test/examples/documents/QueryFilter.cs +++ /dev/null @@ -1,36 +0,0 @@ -// Copyright 2021, Nitric Technologies Pty Ltd. -// -// 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. - -// [START import] -using System.Collections.Generic; -using Nitric.Sdk.Document; -// [END import] -namespace Examples -{ - class QueryFilterExample - { - public static void QueryFilter() - { - // [START snippet] - var docs = new DocumentsClient(); - - var query = docs.Collection>("Customers").Query() - .Where("country", "==", "US") - .Where("age", ">=", "21"); - - var results = query.Fetch(); - // [END snippet] - } - } -} diff --git a/test/Nitric.Sdk.Test/examples/documents/QueryLimits.cs b/test/Nitric.Sdk.Test/examples/documents/QueryLimits.cs deleted file mode 100644 index e90eaca..0000000 --- a/test/Nitric.Sdk.Test/examples/documents/QueryLimits.cs +++ /dev/null @@ -1,36 +0,0 @@ -// Copyright 2021, Nitric Technologies Pty Ltd. -// -// 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. - -// [START import] -using System.Collections.Generic; -using Nitric.Sdk.Document; -// [END import] -namespace Examples -{ - class QueryLimitsExample - { - public static void QueryLimits() - { - // [START snippet] - var docs = new DocumentsClient(); - - var query = docs.Collection>("Customers") - .Query() - .Limit(1000); - - var results = query.Fetch(); - // [END snippet] - } - } -} diff --git a/test/Nitric.Sdk.Test/examples/documents/Refs.cs b/test/Nitric.Sdk.Test/examples/documents/Refs.cs deleted file mode 100644 index 675dbd0..0000000 --- a/test/Nitric.Sdk.Test/examples/documents/Refs.cs +++ /dev/null @@ -1,36 +0,0 @@ -// Copyright 2021, Nitric Technologies Pty Ltd. -// -// 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. - -// [START import] -using System.Collections.Generic; -using Nitric.Sdk.Document; -// [END import] -namespace Examples -{ - class RefsExample - { - public static void RefDocs() - { - // [START snippet] - var docs = new DocumentsClient(); - - // create a reference to a collection named 'products' - var collection = docs.Collection>("products"); - - // create a reference to a document with the id 'nitric' - var nitric = collection.Doc("nitric"); - // [END snippet] - } - } -} diff --git a/test/Nitric.Sdk.Test/examples/documents/Set.cs b/test/Nitric.Sdk.Test/examples/documents/Set.cs deleted file mode 100644 index 63ad30f..0000000 --- a/test/Nitric.Sdk.Test/examples/documents/Set.cs +++ /dev/null @@ -1,39 +0,0 @@ -// Copyright 2021, Nitric Technologies Pty Ltd. -// -// 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. - -// [START import] -using System.Collections.Generic; -using Nitric.Sdk.Document; -// [END import] -namespace Examples -{ - class SetExample - { - public static void SetFile() - { - // [START snippet] - var docs = new DocumentsClient(); - - var document = docs.Collection>("products").Doc("nitric"); - - var product = new Dictionary(); - product.Add("id", "nitric"); - product.Add("name", "Nitric Framework"); - product.Add("description", "A development framework"); - - document.Set(product); - // [END snippet] - } - } -} diff --git a/test/Nitric.Sdk.Test/examples/documents/SubColQuery.cs b/test/Nitric.Sdk.Test/examples/documents/SubColQuery.cs deleted file mode 100644 index 99c84a6..0000000 --- a/test/Nitric.Sdk.Test/examples/documents/SubColQuery.cs +++ /dev/null @@ -1,38 +0,0 @@ -// Copyright 2021, Nitric Technologies Pty Ltd. -// -// 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. - -/* TEST CURRENTLY WON'T WORK WITHOUT SUBCOLLECTION QUERYS -// [START import] -using System.Collections.Generic; -using Nitric.Api.Document; -// [END import] -namespace DocumentsExamples -{ - class SubColQueryExample - { - public static void QuerySubCol() - { - // [START snippet] - var docs = new Documents(); - - var query = docs.Collection>("customers") - .Collection("Orders") - .Query(); - - var results = query.Fetch(); ; - // [END snippet] - } - } -} -*/ \ No newline at end of file diff --git a/test/Nitric.Sdk.Test/examples/documents/SubDocQuery.cs b/test/Nitric.Sdk.Test/examples/documents/SubDocQuery.cs deleted file mode 100644 index bbbcff1..0000000 --- a/test/Nitric.Sdk.Test/examples/documents/SubDocQuery.cs +++ /dev/null @@ -1,37 +0,0 @@ -// Copyright 2021, Nitric Technologies Pty Ltd. -// -// 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. - -// [START import] -using System.Collections.Generic; -using Nitric.Sdk.Document; -// [END import] -namespace Examples -{ - class SubDocQueryExample - { - public static void QueryDocCol() - { - // [START snippet] - var docs = new DocumentsClient(); - - var query = docs.Collection>("customers") - .Doc("apple") - .Collection("Orders") - .Query(); - - var results = query.Fetch(); - // [END snippet] - } - } -} diff --git a/test/Nitric.Sdk.Test/examples/events/EventIDs.cs b/test/Nitric.Sdk.Test/examples/events/EventIDs.cs deleted file mode 100644 index b5a7364..0000000 --- a/test/Nitric.Sdk.Test/examples/events/EventIDs.cs +++ /dev/null @@ -1,39 +0,0 @@ -// Copyright 2021, Nitric Technologies Pty Ltd. -// -// 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. - -// [START import] - -using System.Collections.Generic; -using Nitric.Sdk.Event; - -// [END import] - -namespace Examples -{ - class EventIdsExample - { - public static void EventIdsTopic() - { - // [START snippet] - //Build the payload - var examplePayload = new Dictionary { { "Content", "of event" } }; - - var topic = new EventsClient().Topic("my-topic"); - - //Publish the topic - topic.Publish(new Event { Id = "1234", Payload = examplePayload }); - // [END snippet] - } - } -} diff --git a/test/Nitric.Sdk.Test/examples/events/Publish.cs b/test/Nitric.Sdk.Test/examples/events/Publish.cs deleted file mode 100644 index 3d38025..0000000 --- a/test/Nitric.Sdk.Test/examples/events/Publish.cs +++ /dev/null @@ -1,40 +0,0 @@ -// Copyright 2021, Nitric Technologies Pty Ltd. -// -// 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. - -// [START import] - -using System.Collections.Generic; -using Nitric.Sdk.Event; - -// [END import] - -namespace Examples -{ - class PublishExample - { - public static void PublishTopic() - { - // [START snippet] - //Build the payload - var examplePayload = new Dictionary(); - examplePayload.Add("Content", "of event"); - - var topic = new EventsClient().Topic("my-topic"); - - //Publish the topic - topic.Publish(new Event { Payload = examplePayload }); - // [END snippet] - } - } -} diff --git a/test/Nitric.Sdk.Test/examples/queues/Receive.cs b/test/Nitric.Sdk.Test/examples/queues/Receive.cs deleted file mode 100644 index 6ce038f..0000000 --- a/test/Nitric.Sdk.Test/examples/queues/Receive.cs +++ /dev/null @@ -1,40 +0,0 @@ -// Copyright 2021, Nitric Technologies Pty Ltd. -// -// 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. - -// [START import] -using Nitric.Sdk.Queue; -// [END import] - -namespace Examples -{ - class ReceiveExample - { - public static void ReceiveTask() - { - // [START snippet] - var queue = new QueuesClient().Queue("my-queue"); - - var tasks = queue.Receive(10); - - foreach (ReceivedTask task in tasks) - { - // Process tasks - - // Complete the task - task.Complete(); - } - // [END snippet] - } - } -} diff --git a/test/Nitric.Sdk.Test/examples/queues/Send.cs b/test/Nitric.Sdk.Test/examples/queues/Send.cs deleted file mode 100644 index 21d2e71..0000000 --- a/test/Nitric.Sdk.Test/examples/queues/Send.cs +++ /dev/null @@ -1,36 +0,0 @@ -// Copyright 2021, Nitric Technologies Pty Ltd. -// -// 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. - -// [START import] - -using Nitric.Sdk.Queue; - -// [END import] - -namespace Examples -{ - class SendExample - { - public static void SendTask() - { - // [START snippet] - var queue = new QueuesClient().Queue("my-queue"); - - var task = new Task { Id = "my-task" }; - - queue.Send(task); - // [END snippet] - } - } -} diff --git a/test/Nitric.Sdk.Test/examples/secrets/Access.cs b/test/Nitric.Sdk.Test/examples/secrets/Access.cs deleted file mode 100644 index 5bf6fba..0000000 --- a/test/Nitric.Sdk.Test/examples/secrets/Access.cs +++ /dev/null @@ -1,35 +0,0 @@ -// Copyright 2021, Nitric Technologies Pty Ltd. -// -// 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. - -// [START import] -using Nitric.Sdk.Secret; -// [END import] -namespace Examples -{ - class AccessExample - { - public static void AccessSecret() - { - // [START snippet] - var secrets = new SecretsClient(); - - var value = secrets.Secret("database.password") - .Latest() - .Access(); - - var password = value.ValueText; - // [END snippet] - } - } -} diff --git a/test/Nitric.Sdk.Test/examples/secrets/Latest.cs b/test/Nitric.Sdk.Test/examples/secrets/Latest.cs deleted file mode 100644 index 53de894..0000000 --- a/test/Nitric.Sdk.Test/examples/secrets/Latest.cs +++ /dev/null @@ -1,31 +0,0 @@ -// Copyright 2021, Nitric Technologies Pty Ltd. -// -// 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. - -// [START import] -using Nitric.Sdk.Secret; -// [END import] -namespace Examples -{ - class LatestExample - { - public static void LatestSecret() - { - // [START snippet] - var secrets = new SecretsClient(); - - var latest = secrets.Secret("database.password").Latest(); - // [END snippet] - } - } -} diff --git a/test/Nitric.Sdk.Test/examples/secrets/Put.cs b/test/Nitric.Sdk.Test/examples/secrets/Put.cs deleted file mode 100644 index bd5c0f1..0000000 --- a/test/Nitric.Sdk.Test/examples/secrets/Put.cs +++ /dev/null @@ -1,34 +0,0 @@ -// Copyright 2021, Nitric Technologies Pty Ltd. -// -// 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. - -// [START import] -using Nitric.Sdk.Secret; -// [END import] -namespace Examples -{ - class PutExample - { - public static void PutSecret() - { - // [START snippet] - var secrets = new SecretsClient(); - - var newPassword = "qxGJp9rWMbYvPEsNFXzukQa!"; - - // Store the new password value, making it the latest version - secrets.Secret("database.password").Put(newPassword); - // [END snippet] - } - } -} diff --git a/test/Nitric.Sdk.Test/examples/storage/Delete.cs b/test/Nitric.Sdk.Test/examples/storage/Delete.cs deleted file mode 100644 index b36bf05..0000000 --- a/test/Nitric.Sdk.Test/examples/storage/Delete.cs +++ /dev/null @@ -1,31 +0,0 @@ -// Copyright 2021, Nitric Technologies Pty Ltd. -// -// 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. - -// [START import] -using Nitric.Sdk.Storage; -// [END import] - -namespace Examples -{ - class DeleteExamples - { - public static void DeleteFile() - { - // [START snippet] - var bucket = new Storage().Bucket("my-bucket"); - bucket.File("/path/to/file").Delete(); - // [END snipppet] - } - } -} diff --git a/test/Nitric.Sdk.Test/examples/storage/Read.cs b/test/Nitric.Sdk.Test/examples/storage/Read.cs deleted file mode 100644 index 8c4cb42..0000000 --- a/test/Nitric.Sdk.Test/examples/storage/Read.cs +++ /dev/null @@ -1,31 +0,0 @@ -// Copyright 2021, Nitric Technologies Pty Ltd. -// -// 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. - -// [START import] -using Nitric.Sdk.Storage; -// [END import] - -namespace Examples -{ - class ReadExample - { - public static void ReadFile() - { - // [START snippet] - var bucket = new Storage().Bucket("my-bucket"); - var file = bucket.File("/path/to/file").Read(); - // [END snipppet] - } - } -} diff --git a/test/Nitric.Sdk.Test/examples/storage/Write.cs b/test/Nitric.Sdk.Test/examples/storage/Write.cs deleted file mode 100644 index b363c5c..0000000 --- a/test/Nitric.Sdk.Test/examples/storage/Write.cs +++ /dev/null @@ -1,34 +0,0 @@ -// Copyright 2021, Nitric Technologies Pty Ltd. -// -// 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. - -// [START import] -using System.Text; -using Nitric.Sdk.Storage; -// [END import] - -namespace Examples -{ - class WriteExample - { - public static void WriteFile() - { - // [START snippet] - var data = Encoding.UTF8.GetBytes("Hello World"); - - var bucket = new Storage().Bucket("my-bucket"); - bucket.File("/path/to/file").Write(data); - // [END snippet] - } - } -} From 4f3f6b4e2160d7d351d3324302be4a3f989aa7fa Mon Sep 17 00:00:00 2001 From: Rak Siva Date: Tue, 12 Mar 2024 09:30:59 -0600 Subject: [PATCH 16/34] wip: issues with api.route("/test"); --- src/Nitric.Sdk/Resource/ApiResource.cs | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/src/Nitric.Sdk/Resource/ApiResource.cs b/src/Nitric.Sdk/Resource/ApiResource.cs index 174a854..2909dd9 100644 --- a/src/Nitric.Sdk/Resource/ApiResource.cs +++ b/src/Nitric.Sdk/Resource/ApiResource.cs @@ -46,7 +46,7 @@ public ApiOptions( { this.Security = security ?? Array.Empty(); this.BasePath = basePath; - this.Middleware = middleware ?? new Middleware[] { }; + this.Middleware = middleware ?? Array.Empty>(); } } @@ -321,12 +321,13 @@ internal ApiRoute(ApiResource api, string path, RouteOptions opts) this.api = api; this.Path = path; - var composedMiddleware = this.api.Opts.Middleware.Concat(opts.Middlewares).ToArray(); - this.Opts = new RouteOptions - { - Middlewares = composedMiddleware, - Security = opts.Security - }; + var composedMiddleware = (this.api.Opts.Middleware ?? Enumerable.Empty>()) + .Concat(opts.Middlewares ?? Enumerable.Empty>()) + .ToArray(); this.Opts = new RouteOptions + { + Middlewares = composedMiddleware, + Security = opts.Security + }; } private Middleware[] ConcatMiddleware(Func handler) From 33e1331fc77cf05402cfe97c83e02b28b05c126e Mon Sep 17 00:00:00 2001 From: Ryan Cartwright Date: Wed, 13 Mar 2024 17:15:46 +1100 Subject: [PATCH 17/34] add middlewares when creating api route --- src/Nitric.Sdk/Resource/ApiResource.cs | 32 ++++++++++++++++++-------- 1 file changed, 23 insertions(+), 9 deletions(-) diff --git a/src/Nitric.Sdk/Resource/ApiResource.cs b/src/Nitric.Sdk/Resource/ApiResource.cs index 2909dd9..c28fa72 100644 --- a/src/Nitric.Sdk/Resource/ApiResource.cs +++ b/src/Nitric.Sdk/Resource/ApiResource.cs @@ -56,7 +56,7 @@ public class ApiResource : BaseResource internal ApiResource(string name, ApiOptions options = null) : base(name, ResourceType.Api) { - this.Opts = options ?? new ApiOptions(); + Opts = options ?? new ApiOptions(); } internal void AttachOidc(OidcOptions opts) @@ -321,13 +321,15 @@ internal ApiRoute(ApiResource api, string path, RouteOptions opts) this.api = api; this.Path = path; - var composedMiddleware = (this.api.Opts.Middleware ?? Enumerable.Empty>()) - .Concat(opts.Middlewares ?? Enumerable.Empty>()) - .ToArray(); this.Opts = new RouteOptions - { - Middlewares = composedMiddleware, - Security = opts.Security - }; + var composedMiddleware = this.api.Opts.Middleware + .Concat(opts.Middlewares) + .ToArray(); + + this.Opts = new RouteOptions + { + Middlewares = composedMiddleware, + Security = opts.Security + }; } private Middleware[] ConcatMiddleware(Func handler) @@ -405,6 +407,18 @@ private Middleware[] ConcatMiddleware(Middleware[] mid /// The handler to run. public void Options(params Middleware[] handlers) => Method(this.Path, new HttpMethod[] { HttpMethod.Options }, this.Opts, ConcatMiddleware(handlers)); + /// + /// Create a new OPTIONS handler on the specified route. + /// + /// + public void Patch(Func handler) => Method(new HttpMethod[] { HttpMethod.Patch }, ConcatMiddleware(handler)); + + /// + /// Create a new OPTIONS middleware chain on the specified route. + /// + /// + public void Patch(params Middleware[] handlers) => Method(new HttpMethod[] { HttpMethod.Patch }, ConcatMiddleware(handlers)); + /// /// Create a new handler on the specified route for every HTTP verb. /// @@ -446,4 +460,4 @@ internal void Method(string route, HttpMethod[] methods, RouteOptions options, M Nitric.RegisterWorker(apiWorker); } } -} +} \ No newline at end of file From a114a1a5aaf66c345705e81b9c2b25097cd9c814 Mon Sep 17 00:00:00 2001 From: Rak Siva Date: Wed, 13 Mar 2024 13:19:48 -0600 Subject: [PATCH 18/34] minor fix to route.all --- src/Nitric.Sdk/Resource/ApiResource.cs | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/src/Nitric.Sdk/Resource/ApiResource.cs b/src/Nitric.Sdk/Resource/ApiResource.cs index c28fa72..2e75c37 100644 --- a/src/Nitric.Sdk/Resource/ApiResource.cs +++ b/src/Nitric.Sdk/Resource/ApiResource.cs @@ -419,6 +419,16 @@ private Middleware[] ConcatMiddleware(Middleware[] mid /// public void Patch(params Middleware[] handlers) => Method(new HttpMethod[] { HttpMethod.Patch }, ConcatMiddleware(handlers)); + HttpMethod[] httpMethods = new HttpMethod[] + { + HttpMethod.Get, + HttpMethod.Post, + HttpMethod.Put, + HttpMethod.Delete, + HttpMethod.Head, + HttpMethod.Options, + HttpMethod.Patch + }; /// /// Create a new handler on the specified route for every HTTP verb. /// From a2a03edc22cb996412e287dfd163cebd77f8272a Mon Sep 17 00:00:00 2001 From: Ryan Cartwright Date: Thu, 27 Feb 2025 23:48:32 +1100 Subject: [PATCH 19/34] add sql support --- makefile | 2 +- nitric/proto/apis/v1/apis.proto | 2 +- nitric/proto/batch/v1/batch.proto | 96 + nitric/proto/deployments/v1/deployments.proto | 42 +- nitric/proto/http/v1/http.proto | 2 +- nitric/proto/keyvalue/v1/keyvalue.proto | 2 +- nitric/proto/kvstore/v1/kvstore.proto | 2 +- nitric/proto/resources/v1/resources.proto | 27 +- nitric/proto/sql/v1/sql.proto | 26 + src/Nitric.Sdk/Nitric.Sdk.csproj | 8 +- src/Nitric.Sdk/Nitric.cs | 8 +- .../Proto/nitric/proto/apis/v1/Apis.cs | 8 +- .../Proto/nitric/proto/batch/v1/Batch.cs | 2275 +++++++++++++++++ .../Proto/nitric/proto/batch/v1/BatchGrpc.cs | 260 ++ .../proto/deployments/v1/Deployments.cs | 1085 +++++++- .../Proto/nitric/proto/http/v1/Http.cs | 8 +- .../nitric/proto/keyvalue/v1/Keyvalue.cs | 10 +- .../Proto/nitric/proto/kvstore/v1/Kvstore.cs | 10 +- .../nitric/proto/resources/v1/Resources.cs | 723 +++++- .../Proto/nitric/proto/sql/v1/Sql.cs | 402 +++ .../Proto/nitric/proto/sql/v1/SqlGrpc.cs | 174 ++ src/Nitric.Sdk/Resource/ApiResource.cs | 5 +- src/Nitric.Sdk/Resource/BucketResource.cs | 12 +- .../Resource/KeyValueStoreResource.cs | 12 +- src/Nitric.Sdk/Resource/ScheduleResource.cs | 1 - src/Nitric.Sdk/Resource/SecretResource.cs | 9 +- src/Nitric.Sdk/Resource/SqlResource.cs | 79 + src/Nitric.Sdk/Resource/TopicResource.cs | 7 +- src/Nitric.Sdk/Resource/WebsocketResource.cs | 1 - .../Resource/ApiResourceTest.cs | 0 test/Nitric.Sdk.Test/Test.cs | 24 - 31 files changed, 5088 insertions(+), 234 deletions(-) create mode 100644 nitric/proto/batch/v1/batch.proto create mode 100644 nitric/proto/sql/v1/sql.proto create mode 100644 src/Nitric.Sdk/Proto/nitric/proto/batch/v1/Batch.cs create mode 100644 src/Nitric.Sdk/Proto/nitric/proto/batch/v1/BatchGrpc.cs create mode 100644 src/Nitric.Sdk/Proto/nitric/proto/sql/v1/Sql.cs create mode 100644 src/Nitric.Sdk/Proto/nitric/proto/sql/v1/SqlGrpc.cs create mode 100644 src/Nitric.Sdk/Resource/SqlResource.cs delete mode 100644 test/Nitric.Sdk.Test/Resource/ApiResourceTest.cs delete mode 100644 test/Nitric.Sdk.Test/Test.cs diff --git a/makefile b/makefile index 36e111b..95f1653 100644 --- a/makefile +++ b/makefile @@ -1,7 +1,7 @@ .PHONY: test # the version of of https://github.com/nitrictech/nitric to use in base client generation. -NITRIC_VERSION := 1.1.1 +NITRIC_VERSION := 1.17.0 generate: clean download build diff --git a/nitric/proto/apis/v1/apis.proto b/nitric/proto/apis/v1/apis.proto index 02fc8ae..1428d69 100644 --- a/nitric/proto/apis/v1/apis.proto +++ b/nitric/proto/apis/v1/apis.proto @@ -5,7 +5,7 @@ package nitric.proto.apis.v1; option go_package = "github.com/nitrictech/nitric/core/pkg/proto/apis/v1;apispb"; option java_package = "io.nitric.proto.apis.v1"; option java_multiple_files = true; -option java_outer_classname = "Apis"; +option java_outer_classname = "ApisService"; option php_namespace = "Nitric\\Proto\\Apis\\V1"; option csharp_namespace = "Nitric.Proto.Apis.v1"; diff --git a/nitric/proto/batch/v1/batch.proto b/nitric/proto/batch/v1/batch.proto new file mode 100644 index 0000000..48c4152 --- /dev/null +++ b/nitric/proto/batch/v1/batch.proto @@ -0,0 +1,96 @@ +syntax = "proto3"; +package nitric.proto.batch.v1; + +import "google/protobuf/struct.proto"; + +// protoc plugin options for code generation +option go_package = "github.com/nitrictech/nitric/core/pkg/proto/batch/v1;batchpb"; +option java_package = "io.nitric.proto.batch.v1"; +option java_multiple_files = true; +option java_outer_classname = "BatchService"; +option php_namespace = "Nitric\\Proto\\Batch\\V1"; +option csharp_namespace = "Nitric.Proto.Batch.v1"; + +// Service for processing jobs +service Job { + rpc HandleJob(stream ClientMessage) returns (stream ServerMessage); +} + +// Service for submitting jobs to be processed +service Batch { + rpc SubmitJob(JobSubmitRequest) returns (JobSubmitResponse); +} + +message ClientMessage { + // globally unique ID of the request/response pair + string id = 1; + + oneof content { + // Register a handler for a job + RegistrationRequest registration_request = 2; + + // Handle a job submission + JobResponse job_response = 3; + } +} + +message JobRequest { + string job_name = 1; + + JobData data = 2; +} + +message JobData { + oneof data { + google.protobuf.Struct struct = 1; + } +} + +message JobResponse { + // Mark if the job was successfully processed + bool success = 1; +} + +message RegistrationRequest { + string job_name = 1; + + // Register with default requirements + JobResourceRequirements requirements = 2; +} + +message RegistrationResponse { +} + +message JobResourceRequirements { + // The number of CPUs to allocate for the job + float cpus = 1; + // The amount of memory to allocate for the job + int64 memory = 2; + // The number of GPUs to allocate for the job + int64 gpus = 3; +} + +// ServerMessage is the message sent from the nitric server to the service +message ServerMessage { + // globally unique ID of the request/response pair + string id = 1; + + oneof content { + // + RegistrationResponse registration_response = 2; + + // Request to a job handler + JobRequest job_request = 3; + } +} + +message JobSubmitRequest { + // The name of the job that should handle the data + string job_name = 1; + + // The data to be processed by the job + JobData data = 2; +} + +message JobSubmitResponse { +} diff --git a/nitric/proto/deployments/v1/deployments.proto b/nitric/proto/deployments/v1/deployments.proto index c63c6e9..3735708 100644 --- a/nitric/proto/deployments/v1/deployments.proto +++ b/nitric/proto/deployments/v1/deployments.proto @@ -3,6 +3,7 @@ syntax = "proto3"; package nitric.proto.deployments.v1; import "google/protobuf/struct.proto"; +import "nitric/proto/batch/v1/batch.proto"; import "nitric/proto/resources/v1/resources.proto"; import "nitric/proto/storage/v1/storage.proto"; @@ -10,7 +11,7 @@ import "nitric/proto/storage/v1/storage.proto"; option go_package = "github.com/nitrictech/nitric/core/pkg/proto/deployments/v1;deploymentspb"; option java_package = "io.nitric.proto.deployments.v1"; option java_multiple_files = true; -option java_outer_classname = "Deployments"; +option java_outer_classname = "DeploymentsService"; option php_namespace = "Nitric\\Proto\\Deployments\\V1"; option csharp_namespace = "Nitric.Proto.Deployments.v1"; @@ -63,7 +64,7 @@ enum ResourceDeploymentAction { enum ResourceDeploymentStatus { // The action hasn't started, usually due to a dependency PENDING = 0; - // The action in currently in-flight, e.g. waiting for cloud provder to provision a resource + // The action in currently in-flight, e.g. waiting for cloud provider to provision a resource IN_PROGRESS = 1; // The action has been applied successfully SUCCESS = 2; @@ -161,6 +162,34 @@ message Service { map env = 14; } +message Job { + // The name of the job to create + string name = 1; + + // The default resource requirements of the job + nitric.proto.batch.v1.JobResourceRequirements requirements = 2; +} + +message Batch { + // Source of the service + oneof source { + // Image URI for this batch service + ImageSource image = 1; + } + + // A simple type property + // describes the requested type of batch that this should be + // for this project, a provider can implement how this request is satisfied + // in any way + string type = 10; + + // Environment variables for this Batch + map env = 11; + + // Jobs that are defined in this Batch + repeated Job jobs = 12; +} + message Bucket { repeated BucketListener listeners = 1; } @@ -257,6 +286,13 @@ message Schedule { } } +message SqlDatabase { + oneof migrations { + // The URI of a docker image to use to execute the migrations for this database + string image_uri = 1; + } +} + message ScheduleEvery { // rate string e.g. '5 minutes'. Value frequencies are 'minutes', 'hours', 'days'. string rate = 1; @@ -282,6 +318,8 @@ message Resource { Websocket websocket = 18; Http http = 19; Queue queue = 20; + SqlDatabase sql_database = 21; + Batch batch = 22; } } diff --git a/nitric/proto/http/v1/http.proto b/nitric/proto/http/v1/http.proto index b64e6d1..24feec3 100644 --- a/nitric/proto/http/v1/http.proto +++ b/nitric/proto/http/v1/http.proto @@ -5,7 +5,7 @@ package nitric.proto.http.v1; option go_package = "github.com/nitrictech/nitric/core/pkg/proto/http/v1;httppb"; option java_package = "io.nitric.proto.http.v1"; option java_multiple_files = true; -option java_outer_classname = "Https"; +option java_outer_classname = "HttpService"; option php_namespace = "Nitric\\Proto\\Http\\V1"; option csharp_namespace = "Nitric.Proto.Http.v1"; diff --git a/nitric/proto/keyvalue/v1/keyvalue.proto b/nitric/proto/keyvalue/v1/keyvalue.proto index 1ef0e29..816b4b3 100644 --- a/nitric/proto/keyvalue/v1/keyvalue.proto +++ b/nitric/proto/keyvalue/v1/keyvalue.proto @@ -8,7 +8,7 @@ import "google/protobuf/struct.proto"; option go_package = "github.com/nitrictech/nitric/core/pkg/proto/keyvalue/v1;KeyValuepb"; option java_package = "io.nitric.proto.keyvalue.v1"; option java_multiple_files = true; -option java_outer_classname = "KeyValue"; +option java_outer_classname = "KeyValueService"; option php_namespace = "Nitric\\Proto\\KeyValue\\V1"; option csharp_namespace = "Nitric.Proto.KeyValue.v1"; diff --git a/nitric/proto/kvstore/v1/kvstore.proto b/nitric/proto/kvstore/v1/kvstore.proto index 6171ebd..6c7c279 100644 --- a/nitric/proto/kvstore/v1/kvstore.proto +++ b/nitric/proto/kvstore/v1/kvstore.proto @@ -8,7 +8,7 @@ import "google/protobuf/struct.proto"; option go_package = "github.com/nitrictech/nitric/core/pkg/proto/kvstore/v1;kvstorepb"; option java_package = "io.nitric.proto.kvstore.v1"; option java_multiple_files = true; -option java_outer_classname = "KvStore"; +option java_outer_classname = "KvStoreService"; option php_namespace = "Nitric\\Proto\\KvStore\\V1"; option csharp_namespace = "Nitric.Proto.KvStore.v1"; diff --git a/nitric/proto/resources/v1/resources.proto b/nitric/proto/resources/v1/resources.proto index 4fa5a3b..980ce2b 100644 --- a/nitric/proto/resources/v1/resources.proto +++ b/nitric/proto/resources/v1/resources.proto @@ -5,7 +5,7 @@ package nitric.proto.resources.v1; option go_package = "github.com/nitrictech/nitric/core/pkg/proto/resources/v1;resourcespb"; option java_package = "io.nitric.proto.resources.v1"; option java_multiple_files = true; -option java_outer_classname = "Resources"; +option java_outer_classname = "ResourcesService"; option php_namespace = "Nitric\\Proto\\Resources\\V1"; option csharp_namespace = "Nitric.Proto.Resources.v1"; @@ -39,6 +39,10 @@ enum ResourceType { Http = 11; ApiSecurityDefinition = 12; Queue = 13; + SqlDatabase = 14; + // Batches represent a collection of jobs + Batch = 15; + Job = 16; } // Unique identifier for a resource within a nitric application. @@ -59,6 +63,8 @@ message ResourceDeclareRequest { ApiResource api = 15; ApiSecurityDefinitionResource api_security_definition = 16; QueueResource queue = 17; + SqlDatabaseResource sql_database = 18; + JobResource job = 19; } } @@ -73,6 +79,22 @@ message KeyValueStoreResource { message SecretResource { } +message JobResource { +} + +message SqlDatabaseMigrations { + oneof migrations { + // The path to this databases SQL migrations + // Valid values are file://relative/path/to/migrations as a directory or dockerfile://path/to/migrations.dockerfile to hint at a docker image build + // Paths should be relative to the root of the application (nitric.yaml file location) + string migrations_path = 1; + } +} + +message SqlDatabaseResource { + SqlDatabaseMigrations migrations = 1; +} + message ApiOpenIdConnectionDefinition { string issuer = 1; repeated string audiences = 2; @@ -121,6 +143,9 @@ enum Action { // Queue Permissions: 6XX QueueEnqueue = 600; QueueDequeue = 601; + + // Job Permissions: 7XX + JobSubmit = 700; } message ResourceDeclareResponse { diff --git a/nitric/proto/sql/v1/sql.proto b/nitric/proto/sql/v1/sql.proto new file mode 100644 index 0000000..fb8a1ba --- /dev/null +++ b/nitric/proto/sql/v1/sql.proto @@ -0,0 +1,26 @@ +syntax = "proto3"; +package nitric.proto.sql.v1; + +//protoc plugin options for code generation +option go_package = "github.com/nitrictech/nitric/core/pkg/proto/sql/v1;sqlpb"; +option java_package = "io.nitric.proto.sql.v1"; +option java_multiple_files = true; +option java_outer_classname = "SqlService"; +option php_namespace = "Nitric\\Proto\\Sql\\V1"; +option csharp_namespace = "Nitric.Proto.Sql.v1"; + +// The Nitric Secret Service +service Sql { + // Retrieve the connection string for a given database + rpc ConnectionString (SqlConnectionStringRequest) returns (SqlConnectionStringResponse); +} + +message SqlConnectionStringRequest { + // The name of the database to retrieve the connection string for + string database_name = 1; +} + +message SqlConnectionStringResponse { + // The connection string for the database + string connection_string = 1; +} diff --git a/src/Nitric.Sdk/Nitric.Sdk.csproj b/src/Nitric.Sdk/Nitric.Sdk.csproj index ed75ad0..f54a641 100644 --- a/src/Nitric.Sdk/Nitric.Sdk.csproj +++ b/src/Nitric.Sdk/Nitric.Sdk.csproj @@ -1,7 +1,7 @@ netstandard2.1 - 1.0.0-beta + 1.0.0-a Nitric.Sdk Nitric Pty Ltd LICENSE.txt @@ -26,13 +26,7 @@ - - - - - - diff --git a/src/Nitric.Sdk/Nitric.cs b/src/Nitric.Sdk/Nitric.cs index edacc1e..a563a75 100644 --- a/src/Nitric.Sdk/Nitric.cs +++ b/src/Nitric.Sdk/Nitric.cs @@ -14,7 +14,6 @@ using System; using System.Collections.Generic; using System.Linq; -using System.Runtime.InteropServices; using System.Threading.Tasks; using Nitric.Sdk.Resource; using Nitric.Sdk.Worker; @@ -146,5 +145,12 @@ public static OidcScopes OidcRule(string name, string issuer, string[] audiences return new OidcOptions(name, issuer, audiences, scopes); }; } + + /// + /// Declare a SQL resource to access a relational database. + /// + /// The unique name of the database within this application. + /// A SQL resource, if the name has already been declared the same resource will be returned. + public static SqlResource Sql(string name, string migrations = "") => Register(name, t => new SqlResource(t, migrations)); } } diff --git a/src/Nitric.Sdk/Proto/nitric/proto/apis/v1/Apis.cs b/src/Nitric.Sdk/Proto/nitric/proto/apis/v1/Apis.cs index 65a7543..3dbd2bf 100644 --- a/src/Nitric.Sdk/Proto/nitric/proto/apis/v1/Apis.cs +++ b/src/Nitric.Sdk/Proto/nitric/proto/apis/v1/Apis.cs @@ -64,10 +64,10 @@ static ApisReflection() { "bnRNZXNzYWdlGiMubml0cmljLnByb3RvLmFwaXMudjEuU2VydmVyTWVzc2Fn", "ZSgBMAESXwoKQXBpRGV0YWlscxInLm5pdHJpYy5wcm90by5hcGlzLnYxLkFw", "aURldGFpbHNSZXF1ZXN0Gigubml0cmljLnByb3RvLmFwaXMudjEuQXBpRGV0", - "YWlsc1Jlc3BvbnNlQosBChdpby5uaXRyaWMucHJvdG8uYXBpcy52MUIEQXBp", - "c1ABWjpnaXRodWIuY29tL25pdHJpY3RlY2gvbml0cmljL2NvcmUvcGtnL3By", - "b3RvL2FwaXMvdjE7YXBpc3BiqgIUTml0cmljLlByb3RvLkFwaXMudjHKAhRO", - "aXRyaWNcUHJvdG9cQXBpc1xWMWIGcHJvdG8z")); + "YWlsc1Jlc3BvbnNlQpIBChdpby5uaXRyaWMucHJvdG8uYXBpcy52MUILQXBp", + "c1NlcnZpY2VQAVo6Z2l0aHViLmNvbS9uaXRyaWN0ZWNoL25pdHJpYy9jb3Jl", + "L3BrZy9wcm90by9hcGlzL3YxO2FwaXNwYqoCFE5pdHJpYy5Qcm90by5BcGlz", + "LnYxygIUTml0cmljXFByb3RvXEFwaXNcVjFiBnByb3RvMw==")); descriptor = pbr::FileDescriptor.FromGeneratedCode(descriptorData, new pbr::FileDescriptor[] { }, new pbr::GeneratedClrTypeInfo(null, null, new pbr::GeneratedClrTypeInfo[] { diff --git a/src/Nitric.Sdk/Proto/nitric/proto/batch/v1/Batch.cs b/src/Nitric.Sdk/Proto/nitric/proto/batch/v1/Batch.cs new file mode 100644 index 0000000..dea7f7e --- /dev/null +++ b/src/Nitric.Sdk/Proto/nitric/proto/batch/v1/Batch.cs @@ -0,0 +1,2275 @@ +// +// Generated by the protocol buffer compiler. DO NOT EDIT! +// source: nitric/proto/batch/v1/batch.proto +// +#pragma warning disable 1591, 0612, 3021 +#region Designer generated code + +using pb = global::Google.Protobuf; +using pbc = global::Google.Protobuf.Collections; +using pbr = global::Google.Protobuf.Reflection; +using scg = global::System.Collections.Generic; +namespace Nitric.Proto.Batch.v1 { + + /// Holder for reflection information generated from nitric/proto/batch/v1/batch.proto + public static partial class BatchReflection { + + #region Descriptor + /// File descriptor for nitric/proto/batch/v1/batch.proto + public static pbr::FileDescriptor Descriptor { + get { return descriptor; } + } + private static pbr::FileDescriptor descriptor; + + static BatchReflection() { + byte[] descriptorData = global::System.Convert.FromBase64String( + string.Concat( + "CiFuaXRyaWMvcHJvdG8vYmF0Y2gvdjEvYmF0Y2gucHJvdG8SFW5pdHJpYy5w", + "cm90by5iYXRjaC52MRocZ29vZ2xlL3Byb3RvYnVmL3N0cnVjdC5wcm90byKu", + "AQoNQ2xpZW50TWVzc2FnZRIKCgJpZBgBIAEoCRJKChRyZWdpc3RyYXRpb25f", + "cmVxdWVzdBgCIAEoCzIqLm5pdHJpYy5wcm90by5iYXRjaC52MS5SZWdpc3Ry", + "YXRpb25SZXF1ZXN0SAASOgoMam9iX3Jlc3BvbnNlGAMgASgLMiIubml0cmlj", + "LnByb3RvLmJhdGNoLnYxLkpvYlJlc3BvbnNlSABCCQoHY29udGVudCJMCgpK", + "b2JSZXF1ZXN0EhAKCGpvYl9uYW1lGAEgASgJEiwKBGRhdGEYAiABKAsyHi5u", + "aXRyaWMucHJvdG8uYmF0Y2gudjEuSm9iRGF0YSI8CgdKb2JEYXRhEikKBnN0", + "cnVjdBgBIAEoCzIXLmdvb2dsZS5wcm90b2J1Zi5TdHJ1Y3RIAEIGCgRkYXRh", + "Ih4KC0pvYlJlc3BvbnNlEg8KB3N1Y2Nlc3MYASABKAgibQoTUmVnaXN0cmF0", + "aW9uUmVxdWVzdBIQCghqb2JfbmFtZRgBIAEoCRJECgxyZXF1aXJlbWVudHMY", + "AiABKAsyLi5uaXRyaWMucHJvdG8uYmF0Y2gudjEuSm9iUmVzb3VyY2VSZXF1", + "aXJlbWVudHMiFgoUUmVnaXN0cmF0aW9uUmVzcG9uc2UiRQoXSm9iUmVzb3Vy", + "Y2VSZXF1aXJlbWVudHMSDAoEY3B1cxgBIAEoAhIOCgZtZW1vcnkYAiABKAMS", + "DAoEZ3B1cxgDIAEoAyKuAQoNU2VydmVyTWVzc2FnZRIKCgJpZBgBIAEoCRJM", + "ChVyZWdpc3RyYXRpb25fcmVzcG9uc2UYAiABKAsyKy5uaXRyaWMucHJvdG8u", + "YmF0Y2gudjEuUmVnaXN0cmF0aW9uUmVzcG9uc2VIABI4Cgtqb2JfcmVxdWVz", + "dBgDIAEoCzIhLm5pdHJpYy5wcm90by5iYXRjaC52MS5Kb2JSZXF1ZXN0SABC", + "CQoHY29udGVudCJSChBKb2JTdWJtaXRSZXF1ZXN0EhAKCGpvYl9uYW1lGAEg", + "ASgJEiwKBGRhdGEYAiABKAsyHi5uaXRyaWMucHJvdG8uYmF0Y2gudjEuSm9i", + "RGF0YSITChFKb2JTdWJtaXRSZXNwb25zZTJiCgNKb2ISWwoJSGFuZGxlSm9i", + "EiQubml0cmljLnByb3RvLmJhdGNoLnYxLkNsaWVudE1lc3NhZ2UaJC5uaXRy", + "aWMucHJvdG8uYmF0Y2gudjEuU2VydmVyTWVzc2FnZSgBMAEyZwoFQmF0Y2gS", + "XgoJU3VibWl0Sm9iEicubml0cmljLnByb3RvLmJhdGNoLnYxLkpvYlN1Ym1p", + "dFJlcXVlc3QaKC5uaXRyaWMucHJvdG8uYmF0Y2gudjEuSm9iU3VibWl0UmVz", + "cG9uc2VCmAEKGGlvLm5pdHJpYy5wcm90by5iYXRjaC52MUIMQmF0Y2hTZXJ2", + "aWNlUAFaPGdpdGh1Yi5jb20vbml0cmljdGVjaC9uaXRyaWMvY29yZS9wa2cv", + "cHJvdG8vYmF0Y2gvdjE7YmF0Y2hwYqoCFU5pdHJpYy5Qcm90by5CYXRjaC52", + "McoCFU5pdHJpY1xQcm90b1xCYXRjaFxWMWIGcHJvdG8z")); + descriptor = pbr::FileDescriptor.FromGeneratedCode(descriptorData, + new pbr::FileDescriptor[] { global::Google.Protobuf.WellKnownTypes.StructReflection.Descriptor, }, + new pbr::GeneratedClrTypeInfo(null, null, new pbr::GeneratedClrTypeInfo[] { + new pbr::GeneratedClrTypeInfo(typeof(global::Nitric.Proto.Batch.v1.ClientMessage), global::Nitric.Proto.Batch.v1.ClientMessage.Parser, new[]{ "Id", "RegistrationRequest", "JobResponse" }, new[]{ "Content" }, null, null, null), + new pbr::GeneratedClrTypeInfo(typeof(global::Nitric.Proto.Batch.v1.JobRequest), global::Nitric.Proto.Batch.v1.JobRequest.Parser, new[]{ "JobName", "Data" }, null, null, null, null), + new pbr::GeneratedClrTypeInfo(typeof(global::Nitric.Proto.Batch.v1.JobData), global::Nitric.Proto.Batch.v1.JobData.Parser, new[]{ "Struct" }, new[]{ "Data" }, null, null, null), + new pbr::GeneratedClrTypeInfo(typeof(global::Nitric.Proto.Batch.v1.JobResponse), global::Nitric.Proto.Batch.v1.JobResponse.Parser, new[]{ "Success" }, null, null, null, null), + new pbr::GeneratedClrTypeInfo(typeof(global::Nitric.Proto.Batch.v1.RegistrationRequest), global::Nitric.Proto.Batch.v1.RegistrationRequest.Parser, new[]{ "JobName", "Requirements" }, null, null, null, null), + new pbr::GeneratedClrTypeInfo(typeof(global::Nitric.Proto.Batch.v1.RegistrationResponse), global::Nitric.Proto.Batch.v1.RegistrationResponse.Parser, null, null, null, null, null), + new pbr::GeneratedClrTypeInfo(typeof(global::Nitric.Proto.Batch.v1.JobResourceRequirements), global::Nitric.Proto.Batch.v1.JobResourceRequirements.Parser, new[]{ "Cpus", "Memory", "Gpus" }, null, null, null, null), + new pbr::GeneratedClrTypeInfo(typeof(global::Nitric.Proto.Batch.v1.ServerMessage), global::Nitric.Proto.Batch.v1.ServerMessage.Parser, new[]{ "Id", "RegistrationResponse", "JobRequest" }, new[]{ "Content" }, null, null, null), + new pbr::GeneratedClrTypeInfo(typeof(global::Nitric.Proto.Batch.v1.JobSubmitRequest), global::Nitric.Proto.Batch.v1.JobSubmitRequest.Parser, new[]{ "JobName", "Data" }, null, null, null, null), + new pbr::GeneratedClrTypeInfo(typeof(global::Nitric.Proto.Batch.v1.JobSubmitResponse), global::Nitric.Proto.Batch.v1.JobSubmitResponse.Parser, null, null, null, null, null) + })); + } + #endregion + + } + #region Messages + public sealed partial class ClientMessage : pb::IMessage + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + , pb::IBufferMessage + #endif + { + private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new ClientMessage()); + private pb::UnknownFieldSet _unknownFields; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public static pb::MessageParser Parser { get { return _parser; } } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public static pbr::MessageDescriptor Descriptor { + get { return global::Nitric.Proto.Batch.v1.BatchReflection.Descriptor.MessageTypes[0]; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + pbr::MessageDescriptor pb::IMessage.Descriptor { + get { return Descriptor; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public ClientMessage() { + OnConstruction(); + } + + partial void OnConstruction(); + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public ClientMessage(ClientMessage other) : this() { + id_ = other.id_; + switch (other.ContentCase) { + case ContentOneofCase.RegistrationRequest: + RegistrationRequest = other.RegistrationRequest.Clone(); + break; + case ContentOneofCase.JobResponse: + JobResponse = other.JobResponse.Clone(); + break; + } + + _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public ClientMessage Clone() { + return new ClientMessage(this); + } + + /// Field number for the "id" field. + public const int IdFieldNumber = 1; + private string id_ = ""; + /// + /// globally unique ID of the request/response pair + /// + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public string Id { + get { return id_; } + set { + id_ = pb::ProtoPreconditions.CheckNotNull(value, "value"); + } + } + + /// Field number for the "registration_request" field. + public const int RegistrationRequestFieldNumber = 2; + /// + /// Register a handler for a job + /// + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public global::Nitric.Proto.Batch.v1.RegistrationRequest RegistrationRequest { + get { return contentCase_ == ContentOneofCase.RegistrationRequest ? (global::Nitric.Proto.Batch.v1.RegistrationRequest) content_ : null; } + set { + content_ = value; + contentCase_ = value == null ? ContentOneofCase.None : ContentOneofCase.RegistrationRequest; + } + } + + /// Field number for the "job_response" field. + public const int JobResponseFieldNumber = 3; + /// + /// Handle a job submission + /// + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public global::Nitric.Proto.Batch.v1.JobResponse JobResponse { + get { return contentCase_ == ContentOneofCase.JobResponse ? (global::Nitric.Proto.Batch.v1.JobResponse) content_ : null; } + set { + content_ = value; + contentCase_ = value == null ? ContentOneofCase.None : ContentOneofCase.JobResponse; + } + } + + private object content_; + /// Enum of possible cases for the "content" oneof. + public enum ContentOneofCase { + None = 0, + RegistrationRequest = 2, + JobResponse = 3, + } + private ContentOneofCase contentCase_ = ContentOneofCase.None; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public ContentOneofCase ContentCase { + get { return contentCase_; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public void ClearContent() { + contentCase_ = ContentOneofCase.None; + content_ = null; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public override bool Equals(object other) { + return Equals(other as ClientMessage); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public bool Equals(ClientMessage other) { + if (ReferenceEquals(other, null)) { + return false; + } + if (ReferenceEquals(other, this)) { + return true; + } + if (Id != other.Id) return false; + if (!object.Equals(RegistrationRequest, other.RegistrationRequest)) return false; + if (!object.Equals(JobResponse, other.JobResponse)) return false; + if (ContentCase != other.ContentCase) return false; + return Equals(_unknownFields, other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public override int GetHashCode() { + int hash = 1; + if (Id.Length != 0) hash ^= Id.GetHashCode(); + if (contentCase_ == ContentOneofCase.RegistrationRequest) hash ^= RegistrationRequest.GetHashCode(); + if (contentCase_ == ContentOneofCase.JobResponse) hash ^= JobResponse.GetHashCode(); + hash ^= (int) contentCase_; + if (_unknownFields != null) { + hash ^= _unknownFields.GetHashCode(); + } + return hash; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public override string ToString() { + return pb::JsonFormatter.ToDiagnosticString(this); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public void WriteTo(pb::CodedOutputStream output) { + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + output.WriteRawMessage(this); + #else + if (Id.Length != 0) { + output.WriteRawTag(10); + output.WriteString(Id); + } + if (contentCase_ == ContentOneofCase.RegistrationRequest) { + output.WriteRawTag(18); + output.WriteMessage(RegistrationRequest); + } + if (contentCase_ == ContentOneofCase.JobResponse) { + output.WriteRawTag(26); + output.WriteMessage(JobResponse); + } + if (_unknownFields != null) { + _unknownFields.WriteTo(output); + } + #endif + } + + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + void pb::IBufferMessage.InternalWriteTo(ref pb::WriteContext output) { + if (Id.Length != 0) { + output.WriteRawTag(10); + output.WriteString(Id); + } + if (contentCase_ == ContentOneofCase.RegistrationRequest) { + output.WriteRawTag(18); + output.WriteMessage(RegistrationRequest); + } + if (contentCase_ == ContentOneofCase.JobResponse) { + output.WriteRawTag(26); + output.WriteMessage(JobResponse); + } + if (_unknownFields != null) { + _unknownFields.WriteTo(ref output); + } + } + #endif + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public int CalculateSize() { + int size = 0; + if (Id.Length != 0) { + size += 1 + pb::CodedOutputStream.ComputeStringSize(Id); + } + if (contentCase_ == ContentOneofCase.RegistrationRequest) { + size += 1 + pb::CodedOutputStream.ComputeMessageSize(RegistrationRequest); + } + if (contentCase_ == ContentOneofCase.JobResponse) { + size += 1 + pb::CodedOutputStream.ComputeMessageSize(JobResponse); + } + if (_unknownFields != null) { + size += _unknownFields.CalculateSize(); + } + return size; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public void MergeFrom(ClientMessage other) { + if (other == null) { + return; + } + if (other.Id.Length != 0) { + Id = other.Id; + } + switch (other.ContentCase) { + case ContentOneofCase.RegistrationRequest: + if (RegistrationRequest == null) { + RegistrationRequest = new global::Nitric.Proto.Batch.v1.RegistrationRequest(); + } + RegistrationRequest.MergeFrom(other.RegistrationRequest); + break; + case ContentOneofCase.JobResponse: + if (JobResponse == null) { + JobResponse = new global::Nitric.Proto.Batch.v1.JobResponse(); + } + JobResponse.MergeFrom(other.JobResponse); + break; + } + + _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public void MergeFrom(pb::CodedInputStream input) { + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + input.ReadRawMessage(this); + #else + uint tag; + while ((tag = input.ReadTag()) != 0) { + switch(tag) { + default: + _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input); + break; + case 10: { + Id = input.ReadString(); + break; + } + case 18: { + global::Nitric.Proto.Batch.v1.RegistrationRequest subBuilder = new global::Nitric.Proto.Batch.v1.RegistrationRequest(); + if (contentCase_ == ContentOneofCase.RegistrationRequest) { + subBuilder.MergeFrom(RegistrationRequest); + } + input.ReadMessage(subBuilder); + RegistrationRequest = subBuilder; + break; + } + case 26: { + global::Nitric.Proto.Batch.v1.JobResponse subBuilder = new global::Nitric.Proto.Batch.v1.JobResponse(); + if (contentCase_ == ContentOneofCase.JobResponse) { + subBuilder.MergeFrom(JobResponse); + } + input.ReadMessage(subBuilder); + JobResponse = subBuilder; + break; + } + } + } + #endif + } + + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + void pb::IBufferMessage.InternalMergeFrom(ref pb::ParseContext input) { + uint tag; + while ((tag = input.ReadTag()) != 0) { + switch(tag) { + default: + _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, ref input); + break; + case 10: { + Id = input.ReadString(); + break; + } + case 18: { + global::Nitric.Proto.Batch.v1.RegistrationRequest subBuilder = new global::Nitric.Proto.Batch.v1.RegistrationRequest(); + if (contentCase_ == ContentOneofCase.RegistrationRequest) { + subBuilder.MergeFrom(RegistrationRequest); + } + input.ReadMessage(subBuilder); + RegistrationRequest = subBuilder; + break; + } + case 26: { + global::Nitric.Proto.Batch.v1.JobResponse subBuilder = new global::Nitric.Proto.Batch.v1.JobResponse(); + if (contentCase_ == ContentOneofCase.JobResponse) { + subBuilder.MergeFrom(JobResponse); + } + input.ReadMessage(subBuilder); + JobResponse = subBuilder; + break; + } + } + } + } + #endif + + } + + public sealed partial class JobRequest : pb::IMessage + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + , pb::IBufferMessage + #endif + { + private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new JobRequest()); + private pb::UnknownFieldSet _unknownFields; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public static pb::MessageParser Parser { get { return _parser; } } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public static pbr::MessageDescriptor Descriptor { + get { return global::Nitric.Proto.Batch.v1.BatchReflection.Descriptor.MessageTypes[1]; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + pbr::MessageDescriptor pb::IMessage.Descriptor { + get { return Descriptor; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public JobRequest() { + OnConstruction(); + } + + partial void OnConstruction(); + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public JobRequest(JobRequest other) : this() { + jobName_ = other.jobName_; + data_ = other.data_ != null ? other.data_.Clone() : null; + _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public JobRequest Clone() { + return new JobRequest(this); + } + + /// Field number for the "job_name" field. + public const int JobNameFieldNumber = 1; + private string jobName_ = ""; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public string JobName { + get { return jobName_; } + set { + jobName_ = pb::ProtoPreconditions.CheckNotNull(value, "value"); + } + } + + /// Field number for the "data" field. + public const int DataFieldNumber = 2; + private global::Nitric.Proto.Batch.v1.JobData data_; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public global::Nitric.Proto.Batch.v1.JobData Data { + get { return data_; } + set { + data_ = value; + } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public override bool Equals(object other) { + return Equals(other as JobRequest); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public bool Equals(JobRequest other) { + if (ReferenceEquals(other, null)) { + return false; + } + if (ReferenceEquals(other, this)) { + return true; + } + if (JobName != other.JobName) return false; + if (!object.Equals(Data, other.Data)) return false; + return Equals(_unknownFields, other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public override int GetHashCode() { + int hash = 1; + if (JobName.Length != 0) hash ^= JobName.GetHashCode(); + if (data_ != null) hash ^= Data.GetHashCode(); + if (_unknownFields != null) { + hash ^= _unknownFields.GetHashCode(); + } + return hash; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public override string ToString() { + return pb::JsonFormatter.ToDiagnosticString(this); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public void WriteTo(pb::CodedOutputStream output) { + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + output.WriteRawMessage(this); + #else + if (JobName.Length != 0) { + output.WriteRawTag(10); + output.WriteString(JobName); + } + if (data_ != null) { + output.WriteRawTag(18); + output.WriteMessage(Data); + } + if (_unknownFields != null) { + _unknownFields.WriteTo(output); + } + #endif + } + + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + void pb::IBufferMessage.InternalWriteTo(ref pb::WriteContext output) { + if (JobName.Length != 0) { + output.WriteRawTag(10); + output.WriteString(JobName); + } + if (data_ != null) { + output.WriteRawTag(18); + output.WriteMessage(Data); + } + if (_unknownFields != null) { + _unknownFields.WriteTo(ref output); + } + } + #endif + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public int CalculateSize() { + int size = 0; + if (JobName.Length != 0) { + size += 1 + pb::CodedOutputStream.ComputeStringSize(JobName); + } + if (data_ != null) { + size += 1 + pb::CodedOutputStream.ComputeMessageSize(Data); + } + if (_unknownFields != null) { + size += _unknownFields.CalculateSize(); + } + return size; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public void MergeFrom(JobRequest other) { + if (other == null) { + return; + } + if (other.JobName.Length != 0) { + JobName = other.JobName; + } + if (other.data_ != null) { + if (data_ == null) { + Data = new global::Nitric.Proto.Batch.v1.JobData(); + } + Data.MergeFrom(other.Data); + } + _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public void MergeFrom(pb::CodedInputStream input) { + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + input.ReadRawMessage(this); + #else + uint tag; + while ((tag = input.ReadTag()) != 0) { + switch(tag) { + default: + _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input); + break; + case 10: { + JobName = input.ReadString(); + break; + } + case 18: { + if (data_ == null) { + Data = new global::Nitric.Proto.Batch.v1.JobData(); + } + input.ReadMessage(Data); + break; + } + } + } + #endif + } + + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + void pb::IBufferMessage.InternalMergeFrom(ref pb::ParseContext input) { + uint tag; + while ((tag = input.ReadTag()) != 0) { + switch(tag) { + default: + _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, ref input); + break; + case 10: { + JobName = input.ReadString(); + break; + } + case 18: { + if (data_ == null) { + Data = new global::Nitric.Proto.Batch.v1.JobData(); + } + input.ReadMessage(Data); + break; + } + } + } + } + #endif + + } + + public sealed partial class JobData : pb::IMessage + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + , pb::IBufferMessage + #endif + { + private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new JobData()); + private pb::UnknownFieldSet _unknownFields; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public static pb::MessageParser Parser { get { return _parser; } } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public static pbr::MessageDescriptor Descriptor { + get { return global::Nitric.Proto.Batch.v1.BatchReflection.Descriptor.MessageTypes[2]; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + pbr::MessageDescriptor pb::IMessage.Descriptor { + get { return Descriptor; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public JobData() { + OnConstruction(); + } + + partial void OnConstruction(); + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public JobData(JobData other) : this() { + switch (other.DataCase) { + case DataOneofCase.Struct: + Struct = other.Struct.Clone(); + break; + } + + _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public JobData Clone() { + return new JobData(this); + } + + /// Field number for the "struct" field. + public const int StructFieldNumber = 1; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public global::Google.Protobuf.WellKnownTypes.Struct Struct { + get { return dataCase_ == DataOneofCase.Struct ? (global::Google.Protobuf.WellKnownTypes.Struct) data_ : null; } + set { + data_ = value; + dataCase_ = value == null ? DataOneofCase.None : DataOneofCase.Struct; + } + } + + private object data_; + /// Enum of possible cases for the "data" oneof. + public enum DataOneofCase { + None = 0, + Struct = 1, + } + private DataOneofCase dataCase_ = DataOneofCase.None; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public DataOneofCase DataCase { + get { return dataCase_; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public void ClearData() { + dataCase_ = DataOneofCase.None; + data_ = null; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public override bool Equals(object other) { + return Equals(other as JobData); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public bool Equals(JobData other) { + if (ReferenceEquals(other, null)) { + return false; + } + if (ReferenceEquals(other, this)) { + return true; + } + if (!object.Equals(Struct, other.Struct)) return false; + if (DataCase != other.DataCase) return false; + return Equals(_unknownFields, other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public override int GetHashCode() { + int hash = 1; + if (dataCase_ == DataOneofCase.Struct) hash ^= Struct.GetHashCode(); + hash ^= (int) dataCase_; + if (_unknownFields != null) { + hash ^= _unknownFields.GetHashCode(); + } + return hash; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public override string ToString() { + return pb::JsonFormatter.ToDiagnosticString(this); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public void WriteTo(pb::CodedOutputStream output) { + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + output.WriteRawMessage(this); + #else + if (dataCase_ == DataOneofCase.Struct) { + output.WriteRawTag(10); + output.WriteMessage(Struct); + } + if (_unknownFields != null) { + _unknownFields.WriteTo(output); + } + #endif + } + + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + void pb::IBufferMessage.InternalWriteTo(ref pb::WriteContext output) { + if (dataCase_ == DataOneofCase.Struct) { + output.WriteRawTag(10); + output.WriteMessage(Struct); + } + if (_unknownFields != null) { + _unknownFields.WriteTo(ref output); + } + } + #endif + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public int CalculateSize() { + int size = 0; + if (dataCase_ == DataOneofCase.Struct) { + size += 1 + pb::CodedOutputStream.ComputeMessageSize(Struct); + } + if (_unknownFields != null) { + size += _unknownFields.CalculateSize(); + } + return size; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public void MergeFrom(JobData other) { + if (other == null) { + return; + } + switch (other.DataCase) { + case DataOneofCase.Struct: + if (Struct == null) { + Struct = new global::Google.Protobuf.WellKnownTypes.Struct(); + } + Struct.MergeFrom(other.Struct); + break; + } + + _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public void MergeFrom(pb::CodedInputStream input) { + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + input.ReadRawMessage(this); + #else + uint tag; + while ((tag = input.ReadTag()) != 0) { + switch(tag) { + default: + _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input); + break; + case 10: { + global::Google.Protobuf.WellKnownTypes.Struct subBuilder = new global::Google.Protobuf.WellKnownTypes.Struct(); + if (dataCase_ == DataOneofCase.Struct) { + subBuilder.MergeFrom(Struct); + } + input.ReadMessage(subBuilder); + Struct = subBuilder; + break; + } + } + } + #endif + } + + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + void pb::IBufferMessage.InternalMergeFrom(ref pb::ParseContext input) { + uint tag; + while ((tag = input.ReadTag()) != 0) { + switch(tag) { + default: + _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, ref input); + break; + case 10: { + global::Google.Protobuf.WellKnownTypes.Struct subBuilder = new global::Google.Protobuf.WellKnownTypes.Struct(); + if (dataCase_ == DataOneofCase.Struct) { + subBuilder.MergeFrom(Struct); + } + input.ReadMessage(subBuilder); + Struct = subBuilder; + break; + } + } + } + } + #endif + + } + + public sealed partial class JobResponse : pb::IMessage + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + , pb::IBufferMessage + #endif + { + private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new JobResponse()); + private pb::UnknownFieldSet _unknownFields; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public static pb::MessageParser Parser { get { return _parser; } } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public static pbr::MessageDescriptor Descriptor { + get { return global::Nitric.Proto.Batch.v1.BatchReflection.Descriptor.MessageTypes[3]; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + pbr::MessageDescriptor pb::IMessage.Descriptor { + get { return Descriptor; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public JobResponse() { + OnConstruction(); + } + + partial void OnConstruction(); + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public JobResponse(JobResponse other) : this() { + success_ = other.success_; + _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public JobResponse Clone() { + return new JobResponse(this); + } + + /// Field number for the "success" field. + public const int SuccessFieldNumber = 1; + private bool success_; + /// + /// Mark if the job was successfully processed + /// + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public bool Success { + get { return success_; } + set { + success_ = value; + } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public override bool Equals(object other) { + return Equals(other as JobResponse); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public bool Equals(JobResponse other) { + if (ReferenceEquals(other, null)) { + return false; + } + if (ReferenceEquals(other, this)) { + return true; + } + if (Success != other.Success) return false; + return Equals(_unknownFields, other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public override int GetHashCode() { + int hash = 1; + if (Success != false) hash ^= Success.GetHashCode(); + if (_unknownFields != null) { + hash ^= _unknownFields.GetHashCode(); + } + return hash; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public override string ToString() { + return pb::JsonFormatter.ToDiagnosticString(this); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public void WriteTo(pb::CodedOutputStream output) { + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + output.WriteRawMessage(this); + #else + if (Success != false) { + output.WriteRawTag(8); + output.WriteBool(Success); + } + if (_unknownFields != null) { + _unknownFields.WriteTo(output); + } + #endif + } + + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + void pb::IBufferMessage.InternalWriteTo(ref pb::WriteContext output) { + if (Success != false) { + output.WriteRawTag(8); + output.WriteBool(Success); + } + if (_unknownFields != null) { + _unknownFields.WriteTo(ref output); + } + } + #endif + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public int CalculateSize() { + int size = 0; + if (Success != false) { + size += 1 + 1; + } + if (_unknownFields != null) { + size += _unknownFields.CalculateSize(); + } + return size; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public void MergeFrom(JobResponse other) { + if (other == null) { + return; + } + if (other.Success != false) { + Success = other.Success; + } + _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public void MergeFrom(pb::CodedInputStream input) { + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + input.ReadRawMessage(this); + #else + uint tag; + while ((tag = input.ReadTag()) != 0) { + switch(tag) { + default: + _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input); + break; + case 8: { + Success = input.ReadBool(); + break; + } + } + } + #endif + } + + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + void pb::IBufferMessage.InternalMergeFrom(ref pb::ParseContext input) { + uint tag; + while ((tag = input.ReadTag()) != 0) { + switch(tag) { + default: + _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, ref input); + break; + case 8: { + Success = input.ReadBool(); + break; + } + } + } + } + #endif + + } + + public sealed partial class RegistrationRequest : pb::IMessage + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + , pb::IBufferMessage + #endif + { + private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new RegistrationRequest()); + private pb::UnknownFieldSet _unknownFields; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public static pb::MessageParser Parser { get { return _parser; } } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public static pbr::MessageDescriptor Descriptor { + get { return global::Nitric.Proto.Batch.v1.BatchReflection.Descriptor.MessageTypes[4]; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + pbr::MessageDescriptor pb::IMessage.Descriptor { + get { return Descriptor; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public RegistrationRequest() { + OnConstruction(); + } + + partial void OnConstruction(); + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public RegistrationRequest(RegistrationRequest other) : this() { + jobName_ = other.jobName_; + requirements_ = other.requirements_ != null ? other.requirements_.Clone() : null; + _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public RegistrationRequest Clone() { + return new RegistrationRequest(this); + } + + /// Field number for the "job_name" field. + public const int JobNameFieldNumber = 1; + private string jobName_ = ""; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public string JobName { + get { return jobName_; } + set { + jobName_ = pb::ProtoPreconditions.CheckNotNull(value, "value"); + } + } + + /// Field number for the "requirements" field. + public const int RequirementsFieldNumber = 2; + private global::Nitric.Proto.Batch.v1.JobResourceRequirements requirements_; + /// + /// Register with default requirements + /// + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public global::Nitric.Proto.Batch.v1.JobResourceRequirements Requirements { + get { return requirements_; } + set { + requirements_ = value; + } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public override bool Equals(object other) { + return Equals(other as RegistrationRequest); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public bool Equals(RegistrationRequest other) { + if (ReferenceEquals(other, null)) { + return false; + } + if (ReferenceEquals(other, this)) { + return true; + } + if (JobName != other.JobName) return false; + if (!object.Equals(Requirements, other.Requirements)) return false; + return Equals(_unknownFields, other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public override int GetHashCode() { + int hash = 1; + if (JobName.Length != 0) hash ^= JobName.GetHashCode(); + if (requirements_ != null) hash ^= Requirements.GetHashCode(); + if (_unknownFields != null) { + hash ^= _unknownFields.GetHashCode(); + } + return hash; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public override string ToString() { + return pb::JsonFormatter.ToDiagnosticString(this); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public void WriteTo(pb::CodedOutputStream output) { + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + output.WriteRawMessage(this); + #else + if (JobName.Length != 0) { + output.WriteRawTag(10); + output.WriteString(JobName); + } + if (requirements_ != null) { + output.WriteRawTag(18); + output.WriteMessage(Requirements); + } + if (_unknownFields != null) { + _unknownFields.WriteTo(output); + } + #endif + } + + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + void pb::IBufferMessage.InternalWriteTo(ref pb::WriteContext output) { + if (JobName.Length != 0) { + output.WriteRawTag(10); + output.WriteString(JobName); + } + if (requirements_ != null) { + output.WriteRawTag(18); + output.WriteMessage(Requirements); + } + if (_unknownFields != null) { + _unknownFields.WriteTo(ref output); + } + } + #endif + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public int CalculateSize() { + int size = 0; + if (JobName.Length != 0) { + size += 1 + pb::CodedOutputStream.ComputeStringSize(JobName); + } + if (requirements_ != null) { + size += 1 + pb::CodedOutputStream.ComputeMessageSize(Requirements); + } + if (_unknownFields != null) { + size += _unknownFields.CalculateSize(); + } + return size; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public void MergeFrom(RegistrationRequest other) { + if (other == null) { + return; + } + if (other.JobName.Length != 0) { + JobName = other.JobName; + } + if (other.requirements_ != null) { + if (requirements_ == null) { + Requirements = new global::Nitric.Proto.Batch.v1.JobResourceRequirements(); + } + Requirements.MergeFrom(other.Requirements); + } + _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public void MergeFrom(pb::CodedInputStream input) { + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + input.ReadRawMessage(this); + #else + uint tag; + while ((tag = input.ReadTag()) != 0) { + switch(tag) { + default: + _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input); + break; + case 10: { + JobName = input.ReadString(); + break; + } + case 18: { + if (requirements_ == null) { + Requirements = new global::Nitric.Proto.Batch.v1.JobResourceRequirements(); + } + input.ReadMessage(Requirements); + break; + } + } + } + #endif + } + + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + void pb::IBufferMessage.InternalMergeFrom(ref pb::ParseContext input) { + uint tag; + while ((tag = input.ReadTag()) != 0) { + switch(tag) { + default: + _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, ref input); + break; + case 10: { + JobName = input.ReadString(); + break; + } + case 18: { + if (requirements_ == null) { + Requirements = new global::Nitric.Proto.Batch.v1.JobResourceRequirements(); + } + input.ReadMessage(Requirements); + break; + } + } + } + } + #endif + + } + + public sealed partial class RegistrationResponse : pb::IMessage + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + , pb::IBufferMessage + #endif + { + private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new RegistrationResponse()); + private pb::UnknownFieldSet _unknownFields; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public static pb::MessageParser Parser { get { return _parser; } } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public static pbr::MessageDescriptor Descriptor { + get { return global::Nitric.Proto.Batch.v1.BatchReflection.Descriptor.MessageTypes[5]; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + pbr::MessageDescriptor pb::IMessage.Descriptor { + get { return Descriptor; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public RegistrationResponse() { + OnConstruction(); + } + + partial void OnConstruction(); + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public RegistrationResponse(RegistrationResponse other) : this() { + _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public RegistrationResponse Clone() { + return new RegistrationResponse(this); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public override bool Equals(object other) { + return Equals(other as RegistrationResponse); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public bool Equals(RegistrationResponse other) { + if (ReferenceEquals(other, null)) { + return false; + } + if (ReferenceEquals(other, this)) { + return true; + } + return Equals(_unknownFields, other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public override int GetHashCode() { + int hash = 1; + if (_unknownFields != null) { + hash ^= _unknownFields.GetHashCode(); + } + return hash; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public override string ToString() { + return pb::JsonFormatter.ToDiagnosticString(this); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public void WriteTo(pb::CodedOutputStream output) { + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + output.WriteRawMessage(this); + #else + if (_unknownFields != null) { + _unknownFields.WriteTo(output); + } + #endif + } + + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + void pb::IBufferMessage.InternalWriteTo(ref pb::WriteContext output) { + if (_unknownFields != null) { + _unknownFields.WriteTo(ref output); + } + } + #endif + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public int CalculateSize() { + int size = 0; + if (_unknownFields != null) { + size += _unknownFields.CalculateSize(); + } + return size; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public void MergeFrom(RegistrationResponse other) { + if (other == null) { + return; + } + _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public void MergeFrom(pb::CodedInputStream input) { + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + input.ReadRawMessage(this); + #else + uint tag; + while ((tag = input.ReadTag()) != 0) { + switch(tag) { + default: + _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input); + break; + } + } + #endif + } + + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + void pb::IBufferMessage.InternalMergeFrom(ref pb::ParseContext input) { + uint tag; + while ((tag = input.ReadTag()) != 0) { + switch(tag) { + default: + _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, ref input); + break; + } + } + } + #endif + + } + + public sealed partial class JobResourceRequirements : pb::IMessage + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + , pb::IBufferMessage + #endif + { + private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new JobResourceRequirements()); + private pb::UnknownFieldSet _unknownFields; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public static pb::MessageParser Parser { get { return _parser; } } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public static pbr::MessageDescriptor Descriptor { + get { return global::Nitric.Proto.Batch.v1.BatchReflection.Descriptor.MessageTypes[6]; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + pbr::MessageDescriptor pb::IMessage.Descriptor { + get { return Descriptor; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public JobResourceRequirements() { + OnConstruction(); + } + + partial void OnConstruction(); + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public JobResourceRequirements(JobResourceRequirements other) : this() { + cpus_ = other.cpus_; + memory_ = other.memory_; + gpus_ = other.gpus_; + _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public JobResourceRequirements Clone() { + return new JobResourceRequirements(this); + } + + /// Field number for the "cpus" field. + public const int CpusFieldNumber = 1; + private float cpus_; + /// + /// The number of CPUs to allocate for the job + /// + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public float Cpus { + get { return cpus_; } + set { + cpus_ = value; + } + } + + /// Field number for the "memory" field. + public const int MemoryFieldNumber = 2; + private long memory_; + /// + /// The amount of memory to allocate for the job + /// + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public long Memory { + get { return memory_; } + set { + memory_ = value; + } + } + + /// Field number for the "gpus" field. + public const int GpusFieldNumber = 3; + private long gpus_; + /// + /// The number of GPUs to allocate for the job + /// + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public long Gpus { + get { return gpus_; } + set { + gpus_ = value; + } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public override bool Equals(object other) { + return Equals(other as JobResourceRequirements); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public bool Equals(JobResourceRequirements other) { + if (ReferenceEquals(other, null)) { + return false; + } + if (ReferenceEquals(other, this)) { + return true; + } + if (!pbc::ProtobufEqualityComparers.BitwiseSingleEqualityComparer.Equals(Cpus, other.Cpus)) return false; + if (Memory != other.Memory) return false; + if (Gpus != other.Gpus) return false; + return Equals(_unknownFields, other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public override int GetHashCode() { + int hash = 1; + if (Cpus != 0F) hash ^= pbc::ProtobufEqualityComparers.BitwiseSingleEqualityComparer.GetHashCode(Cpus); + if (Memory != 0L) hash ^= Memory.GetHashCode(); + if (Gpus != 0L) hash ^= Gpus.GetHashCode(); + if (_unknownFields != null) { + hash ^= _unknownFields.GetHashCode(); + } + return hash; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public override string ToString() { + return pb::JsonFormatter.ToDiagnosticString(this); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public void WriteTo(pb::CodedOutputStream output) { + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + output.WriteRawMessage(this); + #else + if (Cpus != 0F) { + output.WriteRawTag(13); + output.WriteFloat(Cpus); + } + if (Memory != 0L) { + output.WriteRawTag(16); + output.WriteInt64(Memory); + } + if (Gpus != 0L) { + output.WriteRawTag(24); + output.WriteInt64(Gpus); + } + if (_unknownFields != null) { + _unknownFields.WriteTo(output); + } + #endif + } + + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + void pb::IBufferMessage.InternalWriteTo(ref pb::WriteContext output) { + if (Cpus != 0F) { + output.WriteRawTag(13); + output.WriteFloat(Cpus); + } + if (Memory != 0L) { + output.WriteRawTag(16); + output.WriteInt64(Memory); + } + if (Gpus != 0L) { + output.WriteRawTag(24); + output.WriteInt64(Gpus); + } + if (_unknownFields != null) { + _unknownFields.WriteTo(ref output); + } + } + #endif + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public int CalculateSize() { + int size = 0; + if (Cpus != 0F) { + size += 1 + 4; + } + if (Memory != 0L) { + size += 1 + pb::CodedOutputStream.ComputeInt64Size(Memory); + } + if (Gpus != 0L) { + size += 1 + pb::CodedOutputStream.ComputeInt64Size(Gpus); + } + if (_unknownFields != null) { + size += _unknownFields.CalculateSize(); + } + return size; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public void MergeFrom(JobResourceRequirements other) { + if (other == null) { + return; + } + if (other.Cpus != 0F) { + Cpus = other.Cpus; + } + if (other.Memory != 0L) { + Memory = other.Memory; + } + if (other.Gpus != 0L) { + Gpus = other.Gpus; + } + _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public void MergeFrom(pb::CodedInputStream input) { + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + input.ReadRawMessage(this); + #else + uint tag; + while ((tag = input.ReadTag()) != 0) { + switch(tag) { + default: + _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input); + break; + case 13: { + Cpus = input.ReadFloat(); + break; + } + case 16: { + Memory = input.ReadInt64(); + break; + } + case 24: { + Gpus = input.ReadInt64(); + break; + } + } + } + #endif + } + + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + void pb::IBufferMessage.InternalMergeFrom(ref pb::ParseContext input) { + uint tag; + while ((tag = input.ReadTag()) != 0) { + switch(tag) { + default: + _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, ref input); + break; + case 13: { + Cpus = input.ReadFloat(); + break; + } + case 16: { + Memory = input.ReadInt64(); + break; + } + case 24: { + Gpus = input.ReadInt64(); + break; + } + } + } + } + #endif + + } + + /// + /// ServerMessage is the message sent from the nitric server to the service + /// + public sealed partial class ServerMessage : pb::IMessage + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + , pb::IBufferMessage + #endif + { + private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new ServerMessage()); + private pb::UnknownFieldSet _unknownFields; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public static pb::MessageParser Parser { get { return _parser; } } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public static pbr::MessageDescriptor Descriptor { + get { return global::Nitric.Proto.Batch.v1.BatchReflection.Descriptor.MessageTypes[7]; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + pbr::MessageDescriptor pb::IMessage.Descriptor { + get { return Descriptor; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public ServerMessage() { + OnConstruction(); + } + + partial void OnConstruction(); + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public ServerMessage(ServerMessage other) : this() { + id_ = other.id_; + switch (other.ContentCase) { + case ContentOneofCase.RegistrationResponse: + RegistrationResponse = other.RegistrationResponse.Clone(); + break; + case ContentOneofCase.JobRequest: + JobRequest = other.JobRequest.Clone(); + break; + } + + _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public ServerMessage Clone() { + return new ServerMessage(this); + } + + /// Field number for the "id" field. + public const int IdFieldNumber = 1; + private string id_ = ""; + /// + /// globally unique ID of the request/response pair + /// + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public string Id { + get { return id_; } + set { + id_ = pb::ProtoPreconditions.CheckNotNull(value, "value"); + } + } + + /// Field number for the "registration_response" field. + public const int RegistrationResponseFieldNumber = 2; + /// + /// + /// + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public global::Nitric.Proto.Batch.v1.RegistrationResponse RegistrationResponse { + get { return contentCase_ == ContentOneofCase.RegistrationResponse ? (global::Nitric.Proto.Batch.v1.RegistrationResponse) content_ : null; } + set { + content_ = value; + contentCase_ = value == null ? ContentOneofCase.None : ContentOneofCase.RegistrationResponse; + } + } + + /// Field number for the "job_request" field. + public const int JobRequestFieldNumber = 3; + /// + /// Request to a job handler + /// + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public global::Nitric.Proto.Batch.v1.JobRequest JobRequest { + get { return contentCase_ == ContentOneofCase.JobRequest ? (global::Nitric.Proto.Batch.v1.JobRequest) content_ : null; } + set { + content_ = value; + contentCase_ = value == null ? ContentOneofCase.None : ContentOneofCase.JobRequest; + } + } + + private object content_; + /// Enum of possible cases for the "content" oneof. + public enum ContentOneofCase { + None = 0, + RegistrationResponse = 2, + JobRequest = 3, + } + private ContentOneofCase contentCase_ = ContentOneofCase.None; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public ContentOneofCase ContentCase { + get { return contentCase_; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public void ClearContent() { + contentCase_ = ContentOneofCase.None; + content_ = null; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public override bool Equals(object other) { + return Equals(other as ServerMessage); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public bool Equals(ServerMessage other) { + if (ReferenceEquals(other, null)) { + return false; + } + if (ReferenceEquals(other, this)) { + return true; + } + if (Id != other.Id) return false; + if (!object.Equals(RegistrationResponse, other.RegistrationResponse)) return false; + if (!object.Equals(JobRequest, other.JobRequest)) return false; + if (ContentCase != other.ContentCase) return false; + return Equals(_unknownFields, other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public override int GetHashCode() { + int hash = 1; + if (Id.Length != 0) hash ^= Id.GetHashCode(); + if (contentCase_ == ContentOneofCase.RegistrationResponse) hash ^= RegistrationResponse.GetHashCode(); + if (contentCase_ == ContentOneofCase.JobRequest) hash ^= JobRequest.GetHashCode(); + hash ^= (int) contentCase_; + if (_unknownFields != null) { + hash ^= _unknownFields.GetHashCode(); + } + return hash; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public override string ToString() { + return pb::JsonFormatter.ToDiagnosticString(this); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public void WriteTo(pb::CodedOutputStream output) { + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + output.WriteRawMessage(this); + #else + if (Id.Length != 0) { + output.WriteRawTag(10); + output.WriteString(Id); + } + if (contentCase_ == ContentOneofCase.RegistrationResponse) { + output.WriteRawTag(18); + output.WriteMessage(RegistrationResponse); + } + if (contentCase_ == ContentOneofCase.JobRequest) { + output.WriteRawTag(26); + output.WriteMessage(JobRequest); + } + if (_unknownFields != null) { + _unknownFields.WriteTo(output); + } + #endif + } + + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + void pb::IBufferMessage.InternalWriteTo(ref pb::WriteContext output) { + if (Id.Length != 0) { + output.WriteRawTag(10); + output.WriteString(Id); + } + if (contentCase_ == ContentOneofCase.RegistrationResponse) { + output.WriteRawTag(18); + output.WriteMessage(RegistrationResponse); + } + if (contentCase_ == ContentOneofCase.JobRequest) { + output.WriteRawTag(26); + output.WriteMessage(JobRequest); + } + if (_unknownFields != null) { + _unknownFields.WriteTo(ref output); + } + } + #endif + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public int CalculateSize() { + int size = 0; + if (Id.Length != 0) { + size += 1 + pb::CodedOutputStream.ComputeStringSize(Id); + } + if (contentCase_ == ContentOneofCase.RegistrationResponse) { + size += 1 + pb::CodedOutputStream.ComputeMessageSize(RegistrationResponse); + } + if (contentCase_ == ContentOneofCase.JobRequest) { + size += 1 + pb::CodedOutputStream.ComputeMessageSize(JobRequest); + } + if (_unknownFields != null) { + size += _unknownFields.CalculateSize(); + } + return size; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public void MergeFrom(ServerMessage other) { + if (other == null) { + return; + } + if (other.Id.Length != 0) { + Id = other.Id; + } + switch (other.ContentCase) { + case ContentOneofCase.RegistrationResponse: + if (RegistrationResponse == null) { + RegistrationResponse = new global::Nitric.Proto.Batch.v1.RegistrationResponse(); + } + RegistrationResponse.MergeFrom(other.RegistrationResponse); + break; + case ContentOneofCase.JobRequest: + if (JobRequest == null) { + JobRequest = new global::Nitric.Proto.Batch.v1.JobRequest(); + } + JobRequest.MergeFrom(other.JobRequest); + break; + } + + _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public void MergeFrom(pb::CodedInputStream input) { + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + input.ReadRawMessage(this); + #else + uint tag; + while ((tag = input.ReadTag()) != 0) { + switch(tag) { + default: + _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input); + break; + case 10: { + Id = input.ReadString(); + break; + } + case 18: { + global::Nitric.Proto.Batch.v1.RegistrationResponse subBuilder = new global::Nitric.Proto.Batch.v1.RegistrationResponse(); + if (contentCase_ == ContentOneofCase.RegistrationResponse) { + subBuilder.MergeFrom(RegistrationResponse); + } + input.ReadMessage(subBuilder); + RegistrationResponse = subBuilder; + break; + } + case 26: { + global::Nitric.Proto.Batch.v1.JobRequest subBuilder = new global::Nitric.Proto.Batch.v1.JobRequest(); + if (contentCase_ == ContentOneofCase.JobRequest) { + subBuilder.MergeFrom(JobRequest); + } + input.ReadMessage(subBuilder); + JobRequest = subBuilder; + break; + } + } + } + #endif + } + + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + void pb::IBufferMessage.InternalMergeFrom(ref pb::ParseContext input) { + uint tag; + while ((tag = input.ReadTag()) != 0) { + switch(tag) { + default: + _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, ref input); + break; + case 10: { + Id = input.ReadString(); + break; + } + case 18: { + global::Nitric.Proto.Batch.v1.RegistrationResponse subBuilder = new global::Nitric.Proto.Batch.v1.RegistrationResponse(); + if (contentCase_ == ContentOneofCase.RegistrationResponse) { + subBuilder.MergeFrom(RegistrationResponse); + } + input.ReadMessage(subBuilder); + RegistrationResponse = subBuilder; + break; + } + case 26: { + global::Nitric.Proto.Batch.v1.JobRequest subBuilder = new global::Nitric.Proto.Batch.v1.JobRequest(); + if (contentCase_ == ContentOneofCase.JobRequest) { + subBuilder.MergeFrom(JobRequest); + } + input.ReadMessage(subBuilder); + JobRequest = subBuilder; + break; + } + } + } + } + #endif + + } + + public sealed partial class JobSubmitRequest : pb::IMessage + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + , pb::IBufferMessage + #endif + { + private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new JobSubmitRequest()); + private pb::UnknownFieldSet _unknownFields; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public static pb::MessageParser Parser { get { return _parser; } } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public static pbr::MessageDescriptor Descriptor { + get { return global::Nitric.Proto.Batch.v1.BatchReflection.Descriptor.MessageTypes[8]; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + pbr::MessageDescriptor pb::IMessage.Descriptor { + get { return Descriptor; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public JobSubmitRequest() { + OnConstruction(); + } + + partial void OnConstruction(); + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public JobSubmitRequest(JobSubmitRequest other) : this() { + jobName_ = other.jobName_; + data_ = other.data_ != null ? other.data_.Clone() : null; + _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public JobSubmitRequest Clone() { + return new JobSubmitRequest(this); + } + + /// Field number for the "job_name" field. + public const int JobNameFieldNumber = 1; + private string jobName_ = ""; + /// + /// The name of the job that should handle the data + /// + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public string JobName { + get { return jobName_; } + set { + jobName_ = pb::ProtoPreconditions.CheckNotNull(value, "value"); + } + } + + /// Field number for the "data" field. + public const int DataFieldNumber = 2; + private global::Nitric.Proto.Batch.v1.JobData data_; + /// + /// The data to be processed by the job + /// + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public global::Nitric.Proto.Batch.v1.JobData Data { + get { return data_; } + set { + data_ = value; + } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public override bool Equals(object other) { + return Equals(other as JobSubmitRequest); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public bool Equals(JobSubmitRequest other) { + if (ReferenceEquals(other, null)) { + return false; + } + if (ReferenceEquals(other, this)) { + return true; + } + if (JobName != other.JobName) return false; + if (!object.Equals(Data, other.Data)) return false; + return Equals(_unknownFields, other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public override int GetHashCode() { + int hash = 1; + if (JobName.Length != 0) hash ^= JobName.GetHashCode(); + if (data_ != null) hash ^= Data.GetHashCode(); + if (_unknownFields != null) { + hash ^= _unknownFields.GetHashCode(); + } + return hash; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public override string ToString() { + return pb::JsonFormatter.ToDiagnosticString(this); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public void WriteTo(pb::CodedOutputStream output) { + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + output.WriteRawMessage(this); + #else + if (JobName.Length != 0) { + output.WriteRawTag(10); + output.WriteString(JobName); + } + if (data_ != null) { + output.WriteRawTag(18); + output.WriteMessage(Data); + } + if (_unknownFields != null) { + _unknownFields.WriteTo(output); + } + #endif + } + + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + void pb::IBufferMessage.InternalWriteTo(ref pb::WriteContext output) { + if (JobName.Length != 0) { + output.WriteRawTag(10); + output.WriteString(JobName); + } + if (data_ != null) { + output.WriteRawTag(18); + output.WriteMessage(Data); + } + if (_unknownFields != null) { + _unknownFields.WriteTo(ref output); + } + } + #endif + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public int CalculateSize() { + int size = 0; + if (JobName.Length != 0) { + size += 1 + pb::CodedOutputStream.ComputeStringSize(JobName); + } + if (data_ != null) { + size += 1 + pb::CodedOutputStream.ComputeMessageSize(Data); + } + if (_unknownFields != null) { + size += _unknownFields.CalculateSize(); + } + return size; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public void MergeFrom(JobSubmitRequest other) { + if (other == null) { + return; + } + if (other.JobName.Length != 0) { + JobName = other.JobName; + } + if (other.data_ != null) { + if (data_ == null) { + Data = new global::Nitric.Proto.Batch.v1.JobData(); + } + Data.MergeFrom(other.Data); + } + _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public void MergeFrom(pb::CodedInputStream input) { + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + input.ReadRawMessage(this); + #else + uint tag; + while ((tag = input.ReadTag()) != 0) { + switch(tag) { + default: + _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input); + break; + case 10: { + JobName = input.ReadString(); + break; + } + case 18: { + if (data_ == null) { + Data = new global::Nitric.Proto.Batch.v1.JobData(); + } + input.ReadMessage(Data); + break; + } + } + } + #endif + } + + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + void pb::IBufferMessage.InternalMergeFrom(ref pb::ParseContext input) { + uint tag; + while ((tag = input.ReadTag()) != 0) { + switch(tag) { + default: + _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, ref input); + break; + case 10: { + JobName = input.ReadString(); + break; + } + case 18: { + if (data_ == null) { + Data = new global::Nitric.Proto.Batch.v1.JobData(); + } + input.ReadMessage(Data); + break; + } + } + } + } + #endif + + } + + public sealed partial class JobSubmitResponse : pb::IMessage + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + , pb::IBufferMessage + #endif + { + private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new JobSubmitResponse()); + private pb::UnknownFieldSet _unknownFields; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public static pb::MessageParser Parser { get { return _parser; } } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public static pbr::MessageDescriptor Descriptor { + get { return global::Nitric.Proto.Batch.v1.BatchReflection.Descriptor.MessageTypes[9]; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + pbr::MessageDescriptor pb::IMessage.Descriptor { + get { return Descriptor; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public JobSubmitResponse() { + OnConstruction(); + } + + partial void OnConstruction(); + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public JobSubmitResponse(JobSubmitResponse other) : this() { + _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public JobSubmitResponse Clone() { + return new JobSubmitResponse(this); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public override bool Equals(object other) { + return Equals(other as JobSubmitResponse); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public bool Equals(JobSubmitResponse other) { + if (ReferenceEquals(other, null)) { + return false; + } + if (ReferenceEquals(other, this)) { + return true; + } + return Equals(_unknownFields, other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public override int GetHashCode() { + int hash = 1; + if (_unknownFields != null) { + hash ^= _unknownFields.GetHashCode(); + } + return hash; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public override string ToString() { + return pb::JsonFormatter.ToDiagnosticString(this); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public void WriteTo(pb::CodedOutputStream output) { + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + output.WriteRawMessage(this); + #else + if (_unknownFields != null) { + _unknownFields.WriteTo(output); + } + #endif + } + + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + void pb::IBufferMessage.InternalWriteTo(ref pb::WriteContext output) { + if (_unknownFields != null) { + _unknownFields.WriteTo(ref output); + } + } + #endif + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public int CalculateSize() { + int size = 0; + if (_unknownFields != null) { + size += _unknownFields.CalculateSize(); + } + return size; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public void MergeFrom(JobSubmitResponse other) { + if (other == null) { + return; + } + _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public void MergeFrom(pb::CodedInputStream input) { + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + input.ReadRawMessage(this); + #else + uint tag; + while ((tag = input.ReadTag()) != 0) { + switch(tag) { + default: + _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input); + break; + } + } + #endif + } + + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + void pb::IBufferMessage.InternalMergeFrom(ref pb::ParseContext input) { + uint tag; + while ((tag = input.ReadTag()) != 0) { + switch(tag) { + default: + _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, ref input); + break; + } + } + } + #endif + + } + + #endregion + +} + +#endregion Designer generated code diff --git a/src/Nitric.Sdk/Proto/nitric/proto/batch/v1/BatchGrpc.cs b/src/Nitric.Sdk/Proto/nitric/proto/batch/v1/BatchGrpc.cs new file mode 100644 index 0000000..d2d255d --- /dev/null +++ b/src/Nitric.Sdk/Proto/nitric/proto/batch/v1/BatchGrpc.cs @@ -0,0 +1,260 @@ +// +// Generated by the protocol buffer compiler. DO NOT EDIT! +// source: nitric/proto/batch/v1/batch.proto +// +#pragma warning disable 0414, 1591 +#region Designer generated code + +using grpc = global::Grpc.Core; + +namespace Nitric.Proto.Batch.v1 { + /// + /// Service for processing jobs + /// + public static partial class Job + { + static readonly string __ServiceName = "nitric.proto.batch.v1.Job"; + + static void __Helper_SerializeMessage(global::Google.Protobuf.IMessage message, grpc::SerializationContext context) + { + #if !GRPC_DISABLE_PROTOBUF_BUFFER_SERIALIZATION + if (message is global::Google.Protobuf.IBufferMessage) + { + context.SetPayloadLength(message.CalculateSize()); + global::Google.Protobuf.MessageExtensions.WriteTo(message, context.GetBufferWriter()); + context.Complete(); + return; + } + #endif + context.Complete(global::Google.Protobuf.MessageExtensions.ToByteArray(message)); + } + + static class __Helper_MessageCache + { + public static readonly bool IsBufferMessage = global::System.Reflection.IntrospectionExtensions.GetTypeInfo(typeof(global::Google.Protobuf.IBufferMessage)).IsAssignableFrom(typeof(T)); + } + + static T __Helper_DeserializeMessage(grpc::DeserializationContext context, global::Google.Protobuf.MessageParser parser) where T : global::Google.Protobuf.IMessage + { + #if !GRPC_DISABLE_PROTOBUF_BUFFER_SERIALIZATION + if (__Helper_MessageCache.IsBufferMessage) + { + return parser.ParseFrom(context.PayloadAsReadOnlySequence()); + } + #endif + return parser.ParseFrom(context.PayloadAsNewBuffer()); + } + + static readonly grpc::Marshaller __Marshaller_nitric_proto_batch_v1_ClientMessage = grpc::Marshallers.Create(__Helper_SerializeMessage, context => __Helper_DeserializeMessage(context, global::Nitric.Proto.Batch.v1.ClientMessage.Parser)); + static readonly grpc::Marshaller __Marshaller_nitric_proto_batch_v1_ServerMessage = grpc::Marshallers.Create(__Helper_SerializeMessage, context => __Helper_DeserializeMessage(context, global::Nitric.Proto.Batch.v1.ServerMessage.Parser)); + + static readonly grpc::Method __Method_HandleJob = new grpc::Method( + grpc::MethodType.DuplexStreaming, + __ServiceName, + "HandleJob", + __Marshaller_nitric_proto_batch_v1_ClientMessage, + __Marshaller_nitric_proto_batch_v1_ServerMessage); + + /// Service descriptor + public static global::Google.Protobuf.Reflection.ServiceDescriptor Descriptor + { + get { return global::Nitric.Proto.Batch.v1.BatchReflection.Descriptor.Services[0]; } + } + + /// Base class for server-side implementations of Job + [grpc::BindServiceMethod(typeof(Job), "BindService")] + public abstract partial class JobBase + { + public virtual global::System.Threading.Tasks.Task HandleJob(grpc::IAsyncStreamReader requestStream, grpc::IServerStreamWriter responseStream, grpc::ServerCallContext context) + { + throw new grpc::RpcException(new grpc::Status(grpc::StatusCode.Unimplemented, "")); + } + + } + + /// Client for Job + public partial class JobClient : grpc::ClientBase + { + /// Creates a new client for Job + /// The channel to use to make remote calls. + public JobClient(grpc::ChannelBase channel) : base(channel) + { + } + /// Creates a new client for Job that uses a custom CallInvoker. + /// The callInvoker to use to make remote calls. + public JobClient(grpc::CallInvoker callInvoker) : base(callInvoker) + { + } + /// Protected parameterless constructor to allow creation of test doubles. + protected JobClient() : base() + { + } + /// Protected constructor to allow creation of configured clients. + /// The client configuration. + protected JobClient(ClientBaseConfiguration configuration) : base(configuration) + { + } + + public virtual grpc::AsyncDuplexStreamingCall HandleJob(grpc::Metadata headers = null, global::System.DateTime? deadline = null, global::System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken)) + { + return HandleJob(new grpc::CallOptions(headers, deadline, cancellationToken)); + } + public virtual grpc::AsyncDuplexStreamingCall HandleJob(grpc::CallOptions options) + { + return CallInvoker.AsyncDuplexStreamingCall(__Method_HandleJob, null, options); + } + /// Creates a new instance of client from given ClientBaseConfiguration. + protected override JobClient NewInstance(ClientBaseConfiguration configuration) + { + return new JobClient(configuration); + } + } + + /// Creates service definition that can be registered with a server + /// An object implementing the server-side handling logic. + public static grpc::ServerServiceDefinition BindService(JobBase serviceImpl) + { + return grpc::ServerServiceDefinition.CreateBuilder() + .AddMethod(__Method_HandleJob, serviceImpl.HandleJob).Build(); + } + + /// Register service method with a service binder with or without implementation. Useful when customizing the service binding logic. + /// Note: this method is part of an experimental API that can change or be removed without any prior notice. + /// Service methods will be bound by calling AddMethod on this object. + /// An object implementing the server-side handling logic. + public static void BindService(grpc::ServiceBinderBase serviceBinder, JobBase serviceImpl) + { + serviceBinder.AddMethod(__Method_HandleJob, serviceImpl == null ? null : new grpc::DuplexStreamingServerMethod(serviceImpl.HandleJob)); + } + + } + /// + /// Service for submitting jobs to be processed + /// + public static partial class Batch + { + static readonly string __ServiceName = "nitric.proto.batch.v1.Batch"; + + static void __Helper_SerializeMessage(global::Google.Protobuf.IMessage message, grpc::SerializationContext context) + { + #if !GRPC_DISABLE_PROTOBUF_BUFFER_SERIALIZATION + if (message is global::Google.Protobuf.IBufferMessage) + { + context.SetPayloadLength(message.CalculateSize()); + global::Google.Protobuf.MessageExtensions.WriteTo(message, context.GetBufferWriter()); + context.Complete(); + return; + } + #endif + context.Complete(global::Google.Protobuf.MessageExtensions.ToByteArray(message)); + } + + static class __Helper_MessageCache + { + public static readonly bool IsBufferMessage = global::System.Reflection.IntrospectionExtensions.GetTypeInfo(typeof(global::Google.Protobuf.IBufferMessage)).IsAssignableFrom(typeof(T)); + } + + static T __Helper_DeserializeMessage(grpc::DeserializationContext context, global::Google.Protobuf.MessageParser parser) where T : global::Google.Protobuf.IMessage + { + #if !GRPC_DISABLE_PROTOBUF_BUFFER_SERIALIZATION + if (__Helper_MessageCache.IsBufferMessage) + { + return parser.ParseFrom(context.PayloadAsReadOnlySequence()); + } + #endif + return parser.ParseFrom(context.PayloadAsNewBuffer()); + } + + static readonly grpc::Marshaller __Marshaller_nitric_proto_batch_v1_JobSubmitRequest = grpc::Marshallers.Create(__Helper_SerializeMessage, context => __Helper_DeserializeMessage(context, global::Nitric.Proto.Batch.v1.JobSubmitRequest.Parser)); + static readonly grpc::Marshaller __Marshaller_nitric_proto_batch_v1_JobSubmitResponse = grpc::Marshallers.Create(__Helper_SerializeMessage, context => __Helper_DeserializeMessage(context, global::Nitric.Proto.Batch.v1.JobSubmitResponse.Parser)); + + static readonly grpc::Method __Method_SubmitJob = new grpc::Method( + grpc::MethodType.Unary, + __ServiceName, + "SubmitJob", + __Marshaller_nitric_proto_batch_v1_JobSubmitRequest, + __Marshaller_nitric_proto_batch_v1_JobSubmitResponse); + + /// Service descriptor + public static global::Google.Protobuf.Reflection.ServiceDescriptor Descriptor + { + get { return global::Nitric.Proto.Batch.v1.BatchReflection.Descriptor.Services[1]; } + } + + /// Base class for server-side implementations of Batch + [grpc::BindServiceMethod(typeof(Batch), "BindService")] + public abstract partial class BatchBase + { + public virtual global::System.Threading.Tasks.Task SubmitJob(global::Nitric.Proto.Batch.v1.JobSubmitRequest request, grpc::ServerCallContext context) + { + throw new grpc::RpcException(new grpc::Status(grpc::StatusCode.Unimplemented, "")); + } + + } + + /// Client for Batch + public partial class BatchClient : grpc::ClientBase + { + /// Creates a new client for Batch + /// The channel to use to make remote calls. + public BatchClient(grpc::ChannelBase channel) : base(channel) + { + } + /// Creates a new client for Batch that uses a custom CallInvoker. + /// The callInvoker to use to make remote calls. + public BatchClient(grpc::CallInvoker callInvoker) : base(callInvoker) + { + } + /// Protected parameterless constructor to allow creation of test doubles. + protected BatchClient() : base() + { + } + /// Protected constructor to allow creation of configured clients. + /// The client configuration. + protected BatchClient(ClientBaseConfiguration configuration) : base(configuration) + { + } + + public virtual global::Nitric.Proto.Batch.v1.JobSubmitResponse SubmitJob(global::Nitric.Proto.Batch.v1.JobSubmitRequest request, grpc::Metadata headers = null, global::System.DateTime? deadline = null, global::System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken)) + { + return SubmitJob(request, new grpc::CallOptions(headers, deadline, cancellationToken)); + } + public virtual global::Nitric.Proto.Batch.v1.JobSubmitResponse SubmitJob(global::Nitric.Proto.Batch.v1.JobSubmitRequest request, grpc::CallOptions options) + { + return CallInvoker.BlockingUnaryCall(__Method_SubmitJob, null, options, request); + } + public virtual grpc::AsyncUnaryCall SubmitJobAsync(global::Nitric.Proto.Batch.v1.JobSubmitRequest request, grpc::Metadata headers = null, global::System.DateTime? deadline = null, global::System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken)) + { + return SubmitJobAsync(request, new grpc::CallOptions(headers, deadline, cancellationToken)); + } + public virtual grpc::AsyncUnaryCall SubmitJobAsync(global::Nitric.Proto.Batch.v1.JobSubmitRequest request, grpc::CallOptions options) + { + return CallInvoker.AsyncUnaryCall(__Method_SubmitJob, null, options, request); + } + /// Creates a new instance of client from given ClientBaseConfiguration. + protected override BatchClient NewInstance(ClientBaseConfiguration configuration) + { + return new BatchClient(configuration); + } + } + + /// Creates service definition that can be registered with a server + /// An object implementing the server-side handling logic. + public static grpc::ServerServiceDefinition BindService(BatchBase serviceImpl) + { + return grpc::ServerServiceDefinition.CreateBuilder() + .AddMethod(__Method_SubmitJob, serviceImpl.SubmitJob).Build(); + } + + /// Register service method with a service binder with or without implementation. Useful when customizing the service binding logic. + /// Note: this method is part of an experimental API that can change or be removed without any prior notice. + /// Service methods will be bound by calling AddMethod on this object. + /// An object implementing the server-side handling logic. + public static void BindService(grpc::ServiceBinderBase serviceBinder, BatchBase serviceImpl) + { + serviceBinder.AddMethod(__Method_SubmitJob, serviceImpl == null ? null : new grpc::UnaryServerMethod(serviceImpl.SubmitJob)); + } + + } +} +#endregion diff --git a/src/Nitric.Sdk/Proto/nitric/proto/deployments/v1/Deployments.cs b/src/Nitric.Sdk/Proto/nitric/proto/deployments/v1/Deployments.cs index 2977214..ebe6a0d 100644 --- a/src/Nitric.Sdk/Proto/nitric/proto/deployments/v1/Deployments.cs +++ b/src/Nitric.Sdk/Proto/nitric/proto/deployments/v1/Deployments.cs @@ -26,98 +26,110 @@ static DeploymentsReflection() { string.Concat( "Ci1uaXRyaWMvcHJvdG8vZGVwbG95bWVudHMvdjEvZGVwbG95bWVudHMucHJv", "dG8SG25pdHJpYy5wcm90by5kZXBsb3ltZW50cy52MRocZ29vZ2xlL3Byb3Rv", - "YnVmL3N0cnVjdC5wcm90bxopbml0cmljL3Byb3RvL3Jlc291cmNlcy92MS9y", - "ZXNvdXJjZXMucHJvdG8aJW5pdHJpYy9wcm90by9zdG9yYWdlL3YxL3N0b3Jh", - "Z2UucHJvdG8iiAEKE0RlcGxveW1lbnRVcFJlcXVlc3QSLwoEc3BlYxgBIAEo", - "CzIhLm5pdHJpYy5wcm90by5kZXBsb3ltZW50cy52MS5TcGVjEisKCmF0dHJp", - "YnV0ZXMYAiABKAsyFy5nb29nbGUucHJvdG9idWYuU3RydWN0EhMKC2ludGVy", - "YWN0aXZlGAMgASgIIqkBChFEZXBsb3ltZW50VXBFdmVudBIRCgdtZXNzYWdl", - "GAEgASgJSAASPQoGdXBkYXRlGAIgASgLMisubml0cmljLnByb3RvLmRlcGxv", - "eW1lbnRzLnYxLlJlc291cmNlVXBkYXRlSAASNwoGcmVzdWx0GAMgASgLMiUu", - "bml0cmljLnByb3RvLmRlcGxveW1lbnRzLnYxLlVwUmVzdWx0SABCCQoHY29u", - "dGVudCKAAgoOUmVzb3VyY2VVcGRhdGUSOQoCaWQYASABKAsyLS5uaXRyaWMu", - "cHJvdG8ucmVzb3VyY2VzLnYxLlJlc291cmNlSWRlbnRpZmllchJFCgZhY3Rp", - "b24YAyABKA4yNS5uaXRyaWMucHJvdG8uZGVwbG95bWVudHMudjEuUmVzb3Vy", - "Y2VEZXBsb3ltZW50QWN0aW9uEkUKBnN0YXR1cxgEIAEoDjI1Lm5pdHJpYy5w", - "cm90by5kZXBsb3ltZW50cy52MS5SZXNvdXJjZURlcGxveW1lbnRTdGF0dXMS", - "FAoMc3ViX3Jlc291cmNlGAUgASgJEg8KB21lc3NhZ2UYBiABKAkiNgoIVXBS", - "ZXN1bHQSDwoHc3VjY2VzcxgBIAEoCBIOCgR0ZXh0GAIgASgJSABCCQoHY29u", - "dGVudCJZChVEZXBsb3ltZW50RG93blJlcXVlc3QSKwoKYXR0cmlidXRlcxgB", - "IAEoCzIXLmdvb2dsZS5wcm90b2J1Zi5TdHJ1Y3QSEwoLaW50ZXJhY3RpdmUY", - "AiABKAgirQEKE0RlcGxveW1lbnREb3duRXZlbnQSEQoHbWVzc2FnZRgBIAEo", - "CUgAEjkKBnJlc3VsdBgCIAEoCzInLm5pdHJpYy5wcm90by5kZXBsb3ltZW50", - "cy52MS5Eb3duUmVzdWx0SAASPQoGdXBkYXRlGAMgASgLMisubml0cmljLnBy", - "b3RvLmRlcGxveW1lbnRzLnYxLlJlc291cmNlVXBkYXRlSABCCQoHY29udGVu", - "dCIMCgpEb3duUmVzdWx0IhoKC0ltYWdlU291cmNlEgsKA3VyaRgBIAEoCSL+", - "AQoHU2VydmljZRI5CgVpbWFnZRgBIAEoCzIoLm5pdHJpYy5wcm90by5kZXBs", - "b3ltZW50cy52MS5JbWFnZVNvdXJjZUgAEg8KB3dvcmtlcnMYCiABKAUSEwoH", - "dGltZW91dBgLIAEoBUICGAESEgoGbWVtb3J5GAwgASgFQgIYARIMCgR0eXBl", - "GA0gASgJEjoKA2VudhgOIAMoCzItLm5pdHJpYy5wcm90by5kZXBsb3ltZW50", - "cy52MS5TZXJ2aWNlLkVudkVudHJ5GioKCEVudkVudHJ5EgsKA2tleRgBIAEo", - "CRINCgV2YWx1ZRgCIAEoCToCOAFCCAoGc291cmNlIkgKBkJ1Y2tldBI+Cgls", - "aXN0ZW5lcnMYASADKAsyKy5uaXRyaWMucHJvdG8uZGVwbG95bWVudHMudjEu", - "QnVja2V0TGlzdGVuZXIiawoOQnVja2V0TGlzdGVuZXISPAoGY29uZmlnGAEg", - "ASgLMiwubml0cmljLnByb3RvLnN0b3JhZ2UudjEuUmVnaXN0cmF0aW9uUmVx", - "dWVzdBIRCgdzZXJ2aWNlGAIgASgJSABCCAoGdGFyZ2V0Ik8KBVRvcGljEkYK", - "DXN1YnNjcmlwdGlvbnMYASADKAsyLy5uaXRyaWMucHJvdG8uZGVwbG95bWVu", - "dHMudjEuU3Vic2NyaXB0aW9uVGFyZ2V0IgcKBVF1ZXVlIg8KDUtleVZhbHVl", - "U3RvcmUiCAoGU2VjcmV0IjEKElN1YnNjcmlwdGlvblRhcmdldBIRCgdzZXJ2", - "aWNlGAEgASgJSABCCAoGdGFyZ2V0IlQKEVRvcGljU3Vic2NyaXB0aW9uEj8K", - "BnRhcmdldBgBIAEoCzIvLm5pdHJpYy5wcm90by5kZXBsb3ltZW50cy52MS5T", - "dWJzY3JpcHRpb25UYXJnZXQiKQoKSHR0cFRhcmdldBIRCgdzZXJ2aWNlGAEg", - "ASgJSABCCAoGdGFyZ2V0Ij8KBEh0dHASNwoGdGFyZ2V0GAEgASgLMicubml0", - "cmljLnByb3RvLmRlcGxveW1lbnRzLnYxLkh0dHBUYXJnZXQiJAoDQXBpEhEK", - "B29wZW5hcGkYASABKAlIAEIKCghkb2N1bWVudCLgAQoJV2Vic29ja2V0EkQK", - "DmNvbm5lY3RfdGFyZ2V0GAEgASgLMiwubml0cmljLnByb3RvLmRlcGxveW1l", - "bnRzLnYxLldlYnNvY2tldFRhcmdldBJHChFkaXNjb25uZWN0X3RhcmdldBgC", - "IAEoCzIsLm5pdHJpYy5wcm90by5kZXBsb3ltZW50cy52MS5XZWJzb2NrZXRU", - "YXJnZXQSRAoObWVzc2FnZV90YXJnZXQYAyABKAsyLC5uaXRyaWMucHJvdG8u", - "ZGVwbG95bWVudHMudjEuV2Vic29ja2V0VGFyZ2V0Ii4KD1dlYnNvY2tldFRh", - "cmdldBIRCgdzZXJ2aWNlGAEgASgJSABCCAoGdGFyZ2V0Ii0KDlNjaGVkdWxl", - "VGFyZ2V0EhEKB3NlcnZpY2UYASABKAlIAEIICgZ0YXJnZXQiygEKCFNjaGVk", - "dWxlEjsKBnRhcmdldBgBIAEoCzIrLm5pdHJpYy5wcm90by5kZXBsb3ltZW50", - "cy52MS5TY2hlZHVsZVRhcmdldBI7CgVldmVyeRgKIAEoCzIqLm5pdHJpYy5w", - "cm90by5kZXBsb3ltZW50cy52MS5TY2hlZHVsZUV2ZXJ5SAASOQoEY3JvbhgL", - "IAEoCzIpLm5pdHJpYy5wcm90by5kZXBsb3ltZW50cy52MS5TY2hlZHVsZUNy", - "b25IAEIJCgdjYWRlbmNlIh0KDVNjaGVkdWxlRXZlcnkSDAoEcmF0ZRgBIAEo", - "CSIiCgxTY2hlZHVsZUNyb24SEgoKZXhwcmVzc2lvbhgBIAEoCSK6BQoIUmVz", - "b3VyY2USOQoCaWQYASABKAsyLS5uaXRyaWMucHJvdG8ucmVzb3VyY2VzLnYx", - "LlJlc291cmNlSWRlbnRpZmllchI3CgdzZXJ2aWNlGAogASgLMiQubml0cmlj", - "LnByb3RvLmRlcGxveW1lbnRzLnYxLlNlcnZpY2VIABI1CgZidWNrZXQYCyAB", - "KAsyIy5uaXRyaWMucHJvdG8uZGVwbG95bWVudHMudjEuQnVja2V0SAASMwoF", - "dG9waWMYDCABKAsyIi5uaXRyaWMucHJvdG8uZGVwbG95bWVudHMudjEuVG9w", - "aWNIABIvCgNhcGkYDSABKAsyIC5uaXRyaWMucHJvdG8uZGVwbG95bWVudHMu", - "djEuQXBpSAASNQoGcG9saWN5GA4gASgLMiMubml0cmljLnByb3RvLmRlcGxv", - "eW1lbnRzLnYxLlBvbGljeUgAEjkKCHNjaGVkdWxlGA8gASgLMiUubml0cmlj", - "LnByb3RvLmRlcGxveW1lbnRzLnYxLlNjaGVkdWxlSAASRQoPa2V5X3ZhbHVl", - "X3N0b3JlGBAgASgLMioubml0cmljLnByb3RvLmRlcGxveW1lbnRzLnYxLktl", - "eVZhbHVlU3RvcmVIABI1CgZzZWNyZXQYESABKAsyIy5uaXRyaWMucHJvdG8u", - "ZGVwbG95bWVudHMudjEuU2VjcmV0SAASOwoJd2Vic29ja2V0GBIgASgLMiYu", - "bml0cmljLnByb3RvLmRlcGxveW1lbnRzLnYxLldlYnNvY2tldEgAEjEKBGh0", - "dHAYEyABKAsyIS5uaXRyaWMucHJvdG8uZGVwbG95bWVudHMudjEuSHR0cEgA", - "EjMKBXF1ZXVlGBQgASgLMiIubml0cmljLnByb3RvLmRlcGxveW1lbnRzLnYx", - "LlF1ZXVlSABCCAoGY29uZmlnIrEBCgZQb2xpY3kSOQoKcHJpbmNpcGFscxgB", - "IAMoCzIlLm5pdHJpYy5wcm90by5kZXBsb3ltZW50cy52MS5SZXNvdXJjZRIy", - "CgdhY3Rpb25zGAIgAygOMiEubml0cmljLnByb3RvLnJlc291cmNlcy52MS5B", - "Y3Rpb24SOAoJcmVzb3VyY2VzGAMgAygLMiUubml0cmljLnByb3RvLmRlcGxv", - "eW1lbnRzLnYxLlJlc291cmNlIkAKBFNwZWMSOAoJcmVzb3VyY2VzGAEgAygL", - "MiUubml0cmljLnByb3RvLmRlcGxveW1lbnRzLnYxLlJlc291cmNlKlUKGFJl", - "c291cmNlRGVwbG95bWVudEFjdGlvbhIKCgZDUkVBVEUQABIKCgZVUERBVEUQ", - "ARILCgdSRVBMQUNFEAISCAoEU0FNRRADEgoKBkRFTEVURRAEKlEKGFJlc291", - "cmNlRGVwbG95bWVudFN0YXR1cxILCgdQRU5ESU5HEAASDwoLSU5fUFJPR1JF", - "U1MQARILCgdTVUNDRVNTEAISCgoGRkFJTEVEEAMy5gEKCkRlcGxveW1lbnQS", - "aAoCVXASMC5uaXRyaWMucHJvdG8uZGVwbG95bWVudHMudjEuRGVwbG95bWVu", - "dFVwUmVxdWVzdBouLm5pdHJpYy5wcm90by5kZXBsb3ltZW50cy52MS5EZXBs", - "b3ltZW50VXBFdmVudDABEm4KBERvd24SMi5uaXRyaWMucHJvdG8uZGVwbG95", - "bWVudHMudjEuRGVwbG95bWVudERvd25SZXF1ZXN0GjAubml0cmljLnByb3Rv", - "LmRlcGxveW1lbnRzLnYxLkRlcGxveW1lbnREb3duRXZlbnQwAUK1AQoeaW8u", - "bml0cmljLnByb3RvLmRlcGxveW1lbnRzLnYxQgtEZXBsb3ltZW50c1ABWkhn", - "aXRodWIuY29tL25pdHJpY3RlY2gvbml0cmljL2NvcmUvcGtnL3Byb3RvL2Rl", - "cGxveW1lbnRzL3YxO2RlcGxveW1lbnRzcGKqAhtOaXRyaWMuUHJvdG8uRGVw", - "bG95bWVudHMudjHKAhtOaXRyaWNcUHJvdG9cRGVwbG95bWVudHNcVjFiBnBy", - "b3RvMw==")); + "YnVmL3N0cnVjdC5wcm90bxohbml0cmljL3Byb3RvL2JhdGNoL3YxL2JhdGNo", + "LnByb3RvGiluaXRyaWMvcHJvdG8vcmVzb3VyY2VzL3YxL3Jlc291cmNlcy5w", + "cm90bxolbml0cmljL3Byb3RvL3N0b3JhZ2UvdjEvc3RvcmFnZS5wcm90byKI", + "AQoTRGVwbG95bWVudFVwUmVxdWVzdBIvCgRzcGVjGAEgASgLMiEubml0cmlj", + "LnByb3RvLmRlcGxveW1lbnRzLnYxLlNwZWMSKwoKYXR0cmlidXRlcxgCIAEo", + "CzIXLmdvb2dsZS5wcm90b2J1Zi5TdHJ1Y3QSEwoLaW50ZXJhY3RpdmUYAyAB", + "KAgiqQEKEURlcGxveW1lbnRVcEV2ZW50EhEKB21lc3NhZ2UYASABKAlIABI9", + "CgZ1cGRhdGUYAiABKAsyKy5uaXRyaWMucHJvdG8uZGVwbG95bWVudHMudjEu", + "UmVzb3VyY2VVcGRhdGVIABI3CgZyZXN1bHQYAyABKAsyJS5uaXRyaWMucHJv", + "dG8uZGVwbG95bWVudHMudjEuVXBSZXN1bHRIAEIJCgdjb250ZW50IoACCg5S", + "ZXNvdXJjZVVwZGF0ZRI5CgJpZBgBIAEoCzItLm5pdHJpYy5wcm90by5yZXNv", + "dXJjZXMudjEuUmVzb3VyY2VJZGVudGlmaWVyEkUKBmFjdGlvbhgDIAEoDjI1", + "Lm5pdHJpYy5wcm90by5kZXBsb3ltZW50cy52MS5SZXNvdXJjZURlcGxveW1l", + "bnRBY3Rpb24SRQoGc3RhdHVzGAQgASgOMjUubml0cmljLnByb3RvLmRlcGxv", + "eW1lbnRzLnYxLlJlc291cmNlRGVwbG95bWVudFN0YXR1cxIUCgxzdWJfcmVz", + "b3VyY2UYBSABKAkSDwoHbWVzc2FnZRgGIAEoCSI2CghVcFJlc3VsdBIPCgdz", + "dWNjZXNzGAEgASgIEg4KBHRleHQYAiABKAlIAEIJCgdjb250ZW50IlkKFURl", + "cGxveW1lbnREb3duUmVxdWVzdBIrCgphdHRyaWJ1dGVzGAEgASgLMhcuZ29v", + "Z2xlLnByb3RvYnVmLlN0cnVjdBITCgtpbnRlcmFjdGl2ZRgCIAEoCCKtAQoT", + "RGVwbG95bWVudERvd25FdmVudBIRCgdtZXNzYWdlGAEgASgJSAASOQoGcmVz", + "dWx0GAIgASgLMicubml0cmljLnByb3RvLmRlcGxveW1lbnRzLnYxLkRvd25S", + "ZXN1bHRIABI9CgZ1cGRhdGUYAyABKAsyKy5uaXRyaWMucHJvdG8uZGVwbG95", + "bWVudHMudjEuUmVzb3VyY2VVcGRhdGVIAEIJCgdjb250ZW50IgwKCkRvd25S", + "ZXN1bHQiGgoLSW1hZ2VTb3VyY2USCwoDdXJpGAEgASgJIv4BCgdTZXJ2aWNl", + "EjkKBWltYWdlGAEgASgLMigubml0cmljLnByb3RvLmRlcGxveW1lbnRzLnYx", + "LkltYWdlU291cmNlSAASDwoHd29ya2VycxgKIAEoBRITCgd0aW1lb3V0GAsg", + "ASgFQgIYARISCgZtZW1vcnkYDCABKAVCAhgBEgwKBHR5cGUYDSABKAkSOgoD", + "ZW52GA4gAygLMi0ubml0cmljLnByb3RvLmRlcGxveW1lbnRzLnYxLlNlcnZp", + "Y2UuRW52RW50cnkaKgoIRW52RW50cnkSCwoDa2V5GAEgASgJEg0KBXZhbHVl", + "GAIgASgJOgI4AUIICgZzb3VyY2UiWQoDSm9iEgwKBG5hbWUYASABKAkSRAoM", + "cmVxdWlyZW1lbnRzGAIgASgLMi4ubml0cmljLnByb3RvLmJhdGNoLnYxLkpv", + "YlJlc291cmNlUmVxdWlyZW1lbnRzIvABCgVCYXRjaBI5CgVpbWFnZRgBIAEo", + "CzIoLm5pdHJpYy5wcm90by5kZXBsb3ltZW50cy52MS5JbWFnZVNvdXJjZUgA", + "EgwKBHR5cGUYCiABKAkSOAoDZW52GAsgAygLMisubml0cmljLnByb3RvLmRl", + "cGxveW1lbnRzLnYxLkJhdGNoLkVudkVudHJ5Ei4KBGpvYnMYDCADKAsyIC5u", + "aXRyaWMucHJvdG8uZGVwbG95bWVudHMudjEuSm9iGioKCEVudkVudHJ5EgsK", + "A2tleRgBIAEoCRINCgV2YWx1ZRgCIAEoCToCOAFCCAoGc291cmNlIkgKBkJ1", + "Y2tldBI+CglsaXN0ZW5lcnMYASADKAsyKy5uaXRyaWMucHJvdG8uZGVwbG95", + "bWVudHMudjEuQnVja2V0TGlzdGVuZXIiawoOQnVja2V0TGlzdGVuZXISPAoG", + "Y29uZmlnGAEgASgLMiwubml0cmljLnByb3RvLnN0b3JhZ2UudjEuUmVnaXN0", + "cmF0aW9uUmVxdWVzdBIRCgdzZXJ2aWNlGAIgASgJSABCCAoGdGFyZ2V0Ik8K", + "BVRvcGljEkYKDXN1YnNjcmlwdGlvbnMYASADKAsyLy5uaXRyaWMucHJvdG8u", + "ZGVwbG95bWVudHMudjEuU3Vic2NyaXB0aW9uVGFyZ2V0IgcKBVF1ZXVlIg8K", + "DUtleVZhbHVlU3RvcmUiCAoGU2VjcmV0IjEKElN1YnNjcmlwdGlvblRhcmdl", + "dBIRCgdzZXJ2aWNlGAEgASgJSABCCAoGdGFyZ2V0IlQKEVRvcGljU3Vic2Ny", + "aXB0aW9uEj8KBnRhcmdldBgBIAEoCzIvLm5pdHJpYy5wcm90by5kZXBsb3lt", + "ZW50cy52MS5TdWJzY3JpcHRpb25UYXJnZXQiKQoKSHR0cFRhcmdldBIRCgdz", + "ZXJ2aWNlGAEgASgJSABCCAoGdGFyZ2V0Ij8KBEh0dHASNwoGdGFyZ2V0GAEg", + "ASgLMicubml0cmljLnByb3RvLmRlcGxveW1lbnRzLnYxLkh0dHBUYXJnZXQi", + "JAoDQXBpEhEKB29wZW5hcGkYASABKAlIAEIKCghkb2N1bWVudCLgAQoJV2Vi", + "c29ja2V0EkQKDmNvbm5lY3RfdGFyZ2V0GAEgASgLMiwubml0cmljLnByb3Rv", + "LmRlcGxveW1lbnRzLnYxLldlYnNvY2tldFRhcmdldBJHChFkaXNjb25uZWN0", + "X3RhcmdldBgCIAEoCzIsLm5pdHJpYy5wcm90by5kZXBsb3ltZW50cy52MS5X", + "ZWJzb2NrZXRUYXJnZXQSRAoObWVzc2FnZV90YXJnZXQYAyABKAsyLC5uaXRy", + "aWMucHJvdG8uZGVwbG95bWVudHMudjEuV2Vic29ja2V0VGFyZ2V0Ii4KD1dl", + "YnNvY2tldFRhcmdldBIRCgdzZXJ2aWNlGAEgASgJSABCCAoGdGFyZ2V0Ii0K", + "DlNjaGVkdWxlVGFyZ2V0EhEKB3NlcnZpY2UYASABKAlIAEIICgZ0YXJnZXQi", + "ygEKCFNjaGVkdWxlEjsKBnRhcmdldBgBIAEoCzIrLm5pdHJpYy5wcm90by5k", + "ZXBsb3ltZW50cy52MS5TY2hlZHVsZVRhcmdldBI7CgVldmVyeRgKIAEoCzIq", + "Lm5pdHJpYy5wcm90by5kZXBsb3ltZW50cy52MS5TY2hlZHVsZUV2ZXJ5SAAS", + "OQoEY3JvbhgLIAEoCzIpLm5pdHJpYy5wcm90by5kZXBsb3ltZW50cy52MS5T", + "Y2hlZHVsZUNyb25IAEIJCgdjYWRlbmNlIjAKC1NxbERhdGFiYXNlEhMKCWlt", + "YWdlX3VyaRgBIAEoCUgAQgwKCm1pZ3JhdGlvbnMiHQoNU2NoZWR1bGVFdmVy", + "eRIMCgRyYXRlGAEgASgJIiIKDFNjaGVkdWxlQ3JvbhISCgpleHByZXNzaW9u", + "GAEgASgJIrEGCghSZXNvdXJjZRI5CgJpZBgBIAEoCzItLm5pdHJpYy5wcm90", + "by5yZXNvdXJjZXMudjEuUmVzb3VyY2VJZGVudGlmaWVyEjcKB3NlcnZpY2UY", + "CiABKAsyJC5uaXRyaWMucHJvdG8uZGVwbG95bWVudHMudjEuU2VydmljZUgA", + "EjUKBmJ1Y2tldBgLIAEoCzIjLm5pdHJpYy5wcm90by5kZXBsb3ltZW50cy52", + "MS5CdWNrZXRIABIzCgV0b3BpYxgMIAEoCzIiLm5pdHJpYy5wcm90by5kZXBs", + "b3ltZW50cy52MS5Ub3BpY0gAEi8KA2FwaRgNIAEoCzIgLm5pdHJpYy5wcm90", + "by5kZXBsb3ltZW50cy52MS5BcGlIABI1CgZwb2xpY3kYDiABKAsyIy5uaXRy", + "aWMucHJvdG8uZGVwbG95bWVudHMudjEuUG9saWN5SAASOQoIc2NoZWR1bGUY", + "DyABKAsyJS5uaXRyaWMucHJvdG8uZGVwbG95bWVudHMudjEuU2NoZWR1bGVI", + "ABJFCg9rZXlfdmFsdWVfc3RvcmUYECABKAsyKi5uaXRyaWMucHJvdG8uZGVw", + "bG95bWVudHMudjEuS2V5VmFsdWVTdG9yZUgAEjUKBnNlY3JldBgRIAEoCzIj", + "Lm5pdHJpYy5wcm90by5kZXBsb3ltZW50cy52MS5TZWNyZXRIABI7Cgl3ZWJz", + "b2NrZXQYEiABKAsyJi5uaXRyaWMucHJvdG8uZGVwbG95bWVudHMudjEuV2Vi", + "c29ja2V0SAASMQoEaHR0cBgTIAEoCzIhLm5pdHJpYy5wcm90by5kZXBsb3lt", + "ZW50cy52MS5IdHRwSAASMwoFcXVldWUYFCABKAsyIi5uaXRyaWMucHJvdG8u", + "ZGVwbG95bWVudHMudjEuUXVldWVIABJACgxzcWxfZGF0YWJhc2UYFSABKAsy", + "KC5uaXRyaWMucHJvdG8uZGVwbG95bWVudHMudjEuU3FsRGF0YWJhc2VIABIz", + "CgViYXRjaBgWIAEoCzIiLm5pdHJpYy5wcm90by5kZXBsb3ltZW50cy52MS5C", + "YXRjaEgAQggKBmNvbmZpZyKxAQoGUG9saWN5EjkKCnByaW5jaXBhbHMYASAD", + "KAsyJS5uaXRyaWMucHJvdG8uZGVwbG95bWVudHMudjEuUmVzb3VyY2USMgoH", + "YWN0aW9ucxgCIAMoDjIhLm5pdHJpYy5wcm90by5yZXNvdXJjZXMudjEuQWN0", + "aW9uEjgKCXJlc291cmNlcxgDIAMoCzIlLm5pdHJpYy5wcm90by5kZXBsb3lt", + "ZW50cy52MS5SZXNvdXJjZSJACgRTcGVjEjgKCXJlc291cmNlcxgBIAMoCzIl", + "Lm5pdHJpYy5wcm90by5kZXBsb3ltZW50cy52MS5SZXNvdXJjZSpVChhSZXNv", + "dXJjZURlcGxveW1lbnRBY3Rpb24SCgoGQ1JFQVRFEAASCgoGVVBEQVRFEAES", + "CwoHUkVQTEFDRRACEggKBFNBTUUQAxIKCgZERUxFVEUQBCpRChhSZXNvdXJj", + "ZURlcGxveW1lbnRTdGF0dXMSCwoHUEVORElORxAAEg8KC0lOX1BST0dSRVNT", + "EAESCwoHU1VDQ0VTUxACEgoKBkZBSUxFRBADMuYBCgpEZXBsb3ltZW50EmgK", + "AlVwEjAubml0cmljLnByb3RvLmRlcGxveW1lbnRzLnYxLkRlcGxveW1lbnRV", + "cFJlcXVlc3QaLi5uaXRyaWMucHJvdG8uZGVwbG95bWVudHMudjEuRGVwbG95", + "bWVudFVwRXZlbnQwARJuCgREb3duEjIubml0cmljLnByb3RvLmRlcGxveW1l", + "bnRzLnYxLkRlcGxveW1lbnREb3duUmVxdWVzdBowLm5pdHJpYy5wcm90by5k", + "ZXBsb3ltZW50cy52MS5EZXBsb3ltZW50RG93bkV2ZW50MAFCvAEKHmlvLm5p", + "dHJpYy5wcm90by5kZXBsb3ltZW50cy52MUISRGVwbG95bWVudHNTZXJ2aWNl", + "UAFaSGdpdGh1Yi5jb20vbml0cmljdGVjaC9uaXRyaWMvY29yZS9wa2cvcHJv", + "dG8vZGVwbG95bWVudHMvdjE7ZGVwbG95bWVudHNwYqoCG05pdHJpYy5Qcm90", + "by5EZXBsb3ltZW50cy52McoCG05pdHJpY1xQcm90b1xEZXBsb3ltZW50c1xW", + "MWIGcHJvdG8z")); descriptor = pbr::FileDescriptor.FromGeneratedCode(descriptorData, - new pbr::FileDescriptor[] { global::Google.Protobuf.WellKnownTypes.StructReflection.Descriptor, global::Nitric.Proto.Resources.v1.ResourcesReflection.Descriptor, global::Nitric.Proto.Storage.v1.StorageReflection.Descriptor, }, + new pbr::FileDescriptor[] { global::Google.Protobuf.WellKnownTypes.StructReflection.Descriptor, global::Nitric.Proto.Batch.v1.BatchReflection.Descriptor, global::Nitric.Proto.Resources.v1.ResourcesReflection.Descriptor, global::Nitric.Proto.Storage.v1.StorageReflection.Descriptor, }, new pbr::GeneratedClrTypeInfo(new[] {typeof(global::Nitric.Proto.Deployments.v1.ResourceDeploymentAction), typeof(global::Nitric.Proto.Deployments.v1.ResourceDeploymentStatus), }, null, new pbr::GeneratedClrTypeInfo[] { new pbr::GeneratedClrTypeInfo(typeof(global::Nitric.Proto.Deployments.v1.DeploymentUpRequest), global::Nitric.Proto.Deployments.v1.DeploymentUpRequest.Parser, new[]{ "Spec", "Attributes", "Interactive" }, null, null, null, null), new pbr::GeneratedClrTypeInfo(typeof(global::Nitric.Proto.Deployments.v1.DeploymentUpEvent), global::Nitric.Proto.Deployments.v1.DeploymentUpEvent.Parser, new[]{ "Message", "Update", "Result" }, new[]{ "Content" }, null, null, null), @@ -128,6 +140,8 @@ static DeploymentsReflection() { new pbr::GeneratedClrTypeInfo(typeof(global::Nitric.Proto.Deployments.v1.DownResult), global::Nitric.Proto.Deployments.v1.DownResult.Parser, null, null, null, null, null), new pbr::GeneratedClrTypeInfo(typeof(global::Nitric.Proto.Deployments.v1.ImageSource), global::Nitric.Proto.Deployments.v1.ImageSource.Parser, new[]{ "Uri" }, null, null, null, null), new pbr::GeneratedClrTypeInfo(typeof(global::Nitric.Proto.Deployments.v1.Service), global::Nitric.Proto.Deployments.v1.Service.Parser, new[]{ "Image", "Workers", "Timeout", "Memory", "Type", "Env" }, new[]{ "Source" }, null, null, new pbr::GeneratedClrTypeInfo[] { null, }), + new pbr::GeneratedClrTypeInfo(typeof(global::Nitric.Proto.Deployments.v1.Job), global::Nitric.Proto.Deployments.v1.Job.Parser, new[]{ "Name", "Requirements" }, null, null, null, null), + new pbr::GeneratedClrTypeInfo(typeof(global::Nitric.Proto.Deployments.v1.Batch), global::Nitric.Proto.Deployments.v1.Batch.Parser, new[]{ "Image", "Type", "Env", "Jobs" }, new[]{ "Source" }, null, null, new pbr::GeneratedClrTypeInfo[] { null, }), new pbr::GeneratedClrTypeInfo(typeof(global::Nitric.Proto.Deployments.v1.Bucket), global::Nitric.Proto.Deployments.v1.Bucket.Parser, new[]{ "Listeners" }, null, null, null, null), new pbr::GeneratedClrTypeInfo(typeof(global::Nitric.Proto.Deployments.v1.BucketListener), global::Nitric.Proto.Deployments.v1.BucketListener.Parser, new[]{ "Config", "Service" }, new[]{ "Target" }, null, null, null), new pbr::GeneratedClrTypeInfo(typeof(global::Nitric.Proto.Deployments.v1.Topic), global::Nitric.Proto.Deployments.v1.Topic.Parser, new[]{ "Subscriptions" }, null, null, null, null), @@ -143,9 +157,10 @@ static DeploymentsReflection() { new pbr::GeneratedClrTypeInfo(typeof(global::Nitric.Proto.Deployments.v1.WebsocketTarget), global::Nitric.Proto.Deployments.v1.WebsocketTarget.Parser, new[]{ "Service" }, new[]{ "Target" }, null, null, null), new pbr::GeneratedClrTypeInfo(typeof(global::Nitric.Proto.Deployments.v1.ScheduleTarget), global::Nitric.Proto.Deployments.v1.ScheduleTarget.Parser, new[]{ "Service" }, new[]{ "Target" }, null, null, null), new pbr::GeneratedClrTypeInfo(typeof(global::Nitric.Proto.Deployments.v1.Schedule), global::Nitric.Proto.Deployments.v1.Schedule.Parser, new[]{ "Target", "Every", "Cron" }, new[]{ "Cadence" }, null, null, null), + new pbr::GeneratedClrTypeInfo(typeof(global::Nitric.Proto.Deployments.v1.SqlDatabase), global::Nitric.Proto.Deployments.v1.SqlDatabase.Parser, new[]{ "ImageUri" }, new[]{ "Migrations" }, null, null, null), new pbr::GeneratedClrTypeInfo(typeof(global::Nitric.Proto.Deployments.v1.ScheduleEvery), global::Nitric.Proto.Deployments.v1.ScheduleEvery.Parser, new[]{ "Rate" }, null, null, null, null), new pbr::GeneratedClrTypeInfo(typeof(global::Nitric.Proto.Deployments.v1.ScheduleCron), global::Nitric.Proto.Deployments.v1.ScheduleCron.Parser, new[]{ "Expression" }, null, null, null, null), - new pbr::GeneratedClrTypeInfo(typeof(global::Nitric.Proto.Deployments.v1.Resource), global::Nitric.Proto.Deployments.v1.Resource.Parser, new[]{ "Id", "Service", "Bucket", "Topic", "Api", "Policy", "Schedule", "KeyValueStore", "Secret", "Websocket", "Http", "Queue" }, new[]{ "Config" }, null, null, null), + new pbr::GeneratedClrTypeInfo(typeof(global::Nitric.Proto.Deployments.v1.Resource), global::Nitric.Proto.Deployments.v1.Resource.Parser, new[]{ "Id", "Service", "Bucket", "Topic", "Api", "Policy", "Schedule", "KeyValueStore", "Secret", "Websocket", "Http", "Queue", "SqlDatabase", "Batch" }, new[]{ "Config" }, null, null, null), new pbr::GeneratedClrTypeInfo(typeof(global::Nitric.Proto.Deployments.v1.Policy), global::Nitric.Proto.Deployments.v1.Policy.Parser, new[]{ "Principals", "Actions", "Resources" }, null, null, null, null), new pbr::GeneratedClrTypeInfo(typeof(global::Nitric.Proto.Deployments.v1.Spec), global::Nitric.Proto.Deployments.v1.Spec.Parser, new[]{ "Resources" }, null, null, null, null) })); @@ -183,7 +198,7 @@ public enum ResourceDeploymentStatus { /// [pbr::OriginalName("PENDING")] Pending = 0, /// - /// The action in currently in-flight, e.g. waiting for cloud provder to provision a resource + /// The action in currently in-flight, e.g. waiting for cloud provider to provision a resource /// [pbr::OriginalName("IN_PROGRESS")] InProgress = 1, /// @@ -2619,6 +2634,543 @@ public void MergeFrom(pb::CodedInputStream input) { } + public sealed partial class Job : pb::IMessage + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + , pb::IBufferMessage + #endif + { + private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new Job()); + private pb::UnknownFieldSet _unknownFields; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public static pb::MessageParser Parser { get { return _parser; } } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public static pbr::MessageDescriptor Descriptor { + get { return global::Nitric.Proto.Deployments.v1.DeploymentsReflection.Descriptor.MessageTypes[9]; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + pbr::MessageDescriptor pb::IMessage.Descriptor { + get { return Descriptor; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public Job() { + OnConstruction(); + } + + partial void OnConstruction(); + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public Job(Job other) : this() { + name_ = other.name_; + requirements_ = other.requirements_ != null ? other.requirements_.Clone() : null; + _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public Job Clone() { + return new Job(this); + } + + /// Field number for the "name" field. + public const int NameFieldNumber = 1; + private string name_ = ""; + /// + /// The name of the job to create + /// + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public string Name { + get { return name_; } + set { + name_ = pb::ProtoPreconditions.CheckNotNull(value, "value"); + } + } + + /// Field number for the "requirements" field. + public const int RequirementsFieldNumber = 2; + private global::Nitric.Proto.Batch.v1.JobResourceRequirements requirements_; + /// + /// The default resource requirements of the job + /// + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public global::Nitric.Proto.Batch.v1.JobResourceRequirements Requirements { + get { return requirements_; } + set { + requirements_ = value; + } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public override bool Equals(object other) { + return Equals(other as Job); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public bool Equals(Job other) { + if (ReferenceEquals(other, null)) { + return false; + } + if (ReferenceEquals(other, this)) { + return true; + } + if (Name != other.Name) return false; + if (!object.Equals(Requirements, other.Requirements)) return false; + return Equals(_unknownFields, other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public override int GetHashCode() { + int hash = 1; + if (Name.Length != 0) hash ^= Name.GetHashCode(); + if (requirements_ != null) hash ^= Requirements.GetHashCode(); + if (_unknownFields != null) { + hash ^= _unknownFields.GetHashCode(); + } + return hash; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public override string ToString() { + return pb::JsonFormatter.ToDiagnosticString(this); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public void WriteTo(pb::CodedOutputStream output) { + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + output.WriteRawMessage(this); + #else + if (Name.Length != 0) { + output.WriteRawTag(10); + output.WriteString(Name); + } + if (requirements_ != null) { + output.WriteRawTag(18); + output.WriteMessage(Requirements); + } + if (_unknownFields != null) { + _unknownFields.WriteTo(output); + } + #endif + } + + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + void pb::IBufferMessage.InternalWriteTo(ref pb::WriteContext output) { + if (Name.Length != 0) { + output.WriteRawTag(10); + output.WriteString(Name); + } + if (requirements_ != null) { + output.WriteRawTag(18); + output.WriteMessage(Requirements); + } + if (_unknownFields != null) { + _unknownFields.WriteTo(ref output); + } + } + #endif + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public int CalculateSize() { + int size = 0; + if (Name.Length != 0) { + size += 1 + pb::CodedOutputStream.ComputeStringSize(Name); + } + if (requirements_ != null) { + size += 1 + pb::CodedOutputStream.ComputeMessageSize(Requirements); + } + if (_unknownFields != null) { + size += _unknownFields.CalculateSize(); + } + return size; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public void MergeFrom(Job other) { + if (other == null) { + return; + } + if (other.Name.Length != 0) { + Name = other.Name; + } + if (other.requirements_ != null) { + if (requirements_ == null) { + Requirements = new global::Nitric.Proto.Batch.v1.JobResourceRequirements(); + } + Requirements.MergeFrom(other.Requirements); + } + _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public void MergeFrom(pb::CodedInputStream input) { + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + input.ReadRawMessage(this); + #else + uint tag; + while ((tag = input.ReadTag()) != 0) { + switch(tag) { + default: + _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input); + break; + case 10: { + Name = input.ReadString(); + break; + } + case 18: { + if (requirements_ == null) { + Requirements = new global::Nitric.Proto.Batch.v1.JobResourceRequirements(); + } + input.ReadMessage(Requirements); + break; + } + } + } + #endif + } + + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + void pb::IBufferMessage.InternalMergeFrom(ref pb::ParseContext input) { + uint tag; + while ((tag = input.ReadTag()) != 0) { + switch(tag) { + default: + _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, ref input); + break; + case 10: { + Name = input.ReadString(); + break; + } + case 18: { + if (requirements_ == null) { + Requirements = new global::Nitric.Proto.Batch.v1.JobResourceRequirements(); + } + input.ReadMessage(Requirements); + break; + } + } + } + } + #endif + + } + + public sealed partial class Batch : pb::IMessage + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + , pb::IBufferMessage + #endif + { + private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new Batch()); + private pb::UnknownFieldSet _unknownFields; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public static pb::MessageParser Parser { get { return _parser; } } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public static pbr::MessageDescriptor Descriptor { + get { return global::Nitric.Proto.Deployments.v1.DeploymentsReflection.Descriptor.MessageTypes[10]; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + pbr::MessageDescriptor pb::IMessage.Descriptor { + get { return Descriptor; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public Batch() { + OnConstruction(); + } + + partial void OnConstruction(); + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public Batch(Batch other) : this() { + type_ = other.type_; + env_ = other.env_.Clone(); + jobs_ = other.jobs_.Clone(); + switch (other.SourceCase) { + case SourceOneofCase.Image: + Image = other.Image.Clone(); + break; + } + + _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public Batch Clone() { + return new Batch(this); + } + + /// Field number for the "image" field. + public const int ImageFieldNumber = 1; + /// + /// Image URI for this batch service + /// + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public global::Nitric.Proto.Deployments.v1.ImageSource Image { + get { return sourceCase_ == SourceOneofCase.Image ? (global::Nitric.Proto.Deployments.v1.ImageSource) source_ : null; } + set { + source_ = value; + sourceCase_ = value == null ? SourceOneofCase.None : SourceOneofCase.Image; + } + } + + /// Field number for the "type" field. + public const int TypeFieldNumber = 10; + private string type_ = ""; + /// + /// A simple type property + /// describes the requested type of batch that this should be + /// for this project, a provider can implement how this request is satisfied + /// in any way + /// + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public string Type { + get { return type_; } + set { + type_ = pb::ProtoPreconditions.CheckNotNull(value, "value"); + } + } + + /// Field number for the "env" field. + public const int EnvFieldNumber = 11; + private static readonly pbc::MapField.Codec _map_env_codec + = new pbc::MapField.Codec(pb::FieldCodec.ForString(10, ""), pb::FieldCodec.ForString(18, ""), 90); + private readonly pbc::MapField env_ = new pbc::MapField(); + /// + /// Environment variables for this Batch + /// + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public pbc::MapField Env { + get { return env_; } + } + + /// Field number for the "jobs" field. + public const int JobsFieldNumber = 12; + private static readonly pb::FieldCodec _repeated_jobs_codec + = pb::FieldCodec.ForMessage(98, global::Nitric.Proto.Deployments.v1.Job.Parser); + private readonly pbc::RepeatedField jobs_ = new pbc::RepeatedField(); + /// + /// Jobs that are defined in this Batch + /// + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public pbc::RepeatedField Jobs { + get { return jobs_; } + } + + private object source_; + /// Enum of possible cases for the "source" oneof. + public enum SourceOneofCase { + None = 0, + Image = 1, + } + private SourceOneofCase sourceCase_ = SourceOneofCase.None; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public SourceOneofCase SourceCase { + get { return sourceCase_; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public void ClearSource() { + sourceCase_ = SourceOneofCase.None; + source_ = null; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public override bool Equals(object other) { + return Equals(other as Batch); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public bool Equals(Batch other) { + if (ReferenceEquals(other, null)) { + return false; + } + if (ReferenceEquals(other, this)) { + return true; + } + if (!object.Equals(Image, other.Image)) return false; + if (Type != other.Type) return false; + if (!Env.Equals(other.Env)) return false; + if(!jobs_.Equals(other.jobs_)) return false; + if (SourceCase != other.SourceCase) return false; + return Equals(_unknownFields, other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public override int GetHashCode() { + int hash = 1; + if (sourceCase_ == SourceOneofCase.Image) hash ^= Image.GetHashCode(); + if (Type.Length != 0) hash ^= Type.GetHashCode(); + hash ^= Env.GetHashCode(); + hash ^= jobs_.GetHashCode(); + hash ^= (int) sourceCase_; + if (_unknownFields != null) { + hash ^= _unknownFields.GetHashCode(); + } + return hash; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public override string ToString() { + return pb::JsonFormatter.ToDiagnosticString(this); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public void WriteTo(pb::CodedOutputStream output) { + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + output.WriteRawMessage(this); + #else + if (sourceCase_ == SourceOneofCase.Image) { + output.WriteRawTag(10); + output.WriteMessage(Image); + } + if (Type.Length != 0) { + output.WriteRawTag(82); + output.WriteString(Type); + } + env_.WriteTo(output, _map_env_codec); + jobs_.WriteTo(output, _repeated_jobs_codec); + if (_unknownFields != null) { + _unknownFields.WriteTo(output); + } + #endif + } + + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + void pb::IBufferMessage.InternalWriteTo(ref pb::WriteContext output) { + if (sourceCase_ == SourceOneofCase.Image) { + output.WriteRawTag(10); + output.WriteMessage(Image); + } + if (Type.Length != 0) { + output.WriteRawTag(82); + output.WriteString(Type); + } + env_.WriteTo(ref output, _map_env_codec); + jobs_.WriteTo(ref output, _repeated_jobs_codec); + if (_unknownFields != null) { + _unknownFields.WriteTo(ref output); + } + } + #endif + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public int CalculateSize() { + int size = 0; + if (sourceCase_ == SourceOneofCase.Image) { + size += 1 + pb::CodedOutputStream.ComputeMessageSize(Image); + } + if (Type.Length != 0) { + size += 1 + pb::CodedOutputStream.ComputeStringSize(Type); + } + size += env_.CalculateSize(_map_env_codec); + size += jobs_.CalculateSize(_repeated_jobs_codec); + if (_unknownFields != null) { + size += _unknownFields.CalculateSize(); + } + return size; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public void MergeFrom(Batch other) { + if (other == null) { + return; + } + if (other.Type.Length != 0) { + Type = other.Type; + } + env_.Add(other.env_); + jobs_.Add(other.jobs_); + switch (other.SourceCase) { + case SourceOneofCase.Image: + if (Image == null) { + Image = new global::Nitric.Proto.Deployments.v1.ImageSource(); + } + Image.MergeFrom(other.Image); + break; + } + + _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public void MergeFrom(pb::CodedInputStream input) { + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + input.ReadRawMessage(this); + #else + uint tag; + while ((tag = input.ReadTag()) != 0) { + switch(tag) { + default: + _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input); + break; + case 10: { + global::Nitric.Proto.Deployments.v1.ImageSource subBuilder = new global::Nitric.Proto.Deployments.v1.ImageSource(); + if (sourceCase_ == SourceOneofCase.Image) { + subBuilder.MergeFrom(Image); + } + input.ReadMessage(subBuilder); + Image = subBuilder; + break; + } + case 82: { + Type = input.ReadString(); + break; + } + case 90: { + env_.AddEntriesFrom(input, _map_env_codec); + break; + } + case 98: { + jobs_.AddEntriesFrom(input, _repeated_jobs_codec); + break; + } + } + } + #endif + } + + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + void pb::IBufferMessage.InternalMergeFrom(ref pb::ParseContext input) { + uint tag; + while ((tag = input.ReadTag()) != 0) { + switch(tag) { + default: + _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, ref input); + break; + case 10: { + global::Nitric.Proto.Deployments.v1.ImageSource subBuilder = new global::Nitric.Proto.Deployments.v1.ImageSource(); + if (sourceCase_ == SourceOneofCase.Image) { + subBuilder.MergeFrom(Image); + } + input.ReadMessage(subBuilder); + Image = subBuilder; + break; + } + case 82: { + Type = input.ReadString(); + break; + } + case 90: { + env_.AddEntriesFrom(ref input, _map_env_codec); + break; + } + case 98: { + jobs_.AddEntriesFrom(ref input, _repeated_jobs_codec); + break; + } + } + } + } + #endif + + } + public sealed partial class Bucket : pb::IMessage #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE , pb::IBufferMessage @@ -2631,7 +3183,7 @@ public sealed partial class Bucket : pb::IMessage [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public static pbr::MessageDescriptor Descriptor { - get { return global::Nitric.Proto.Deployments.v1.DeploymentsReflection.Descriptor.MessageTypes[9]; } + get { return global::Nitric.Proto.Deployments.v1.DeploymentsReflection.Descriptor.MessageTypes[11]; } } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] @@ -2792,7 +3344,7 @@ public sealed partial class BucketListener : pb::IMessage [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public static pbr::MessageDescriptor Descriptor { - get { return global::Nitric.Proto.Deployments.v1.DeploymentsReflection.Descriptor.MessageTypes[10]; } + get { return global::Nitric.Proto.Deployments.v1.DeploymentsReflection.Descriptor.MessageTypes[12]; } } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] @@ -3040,7 +3592,7 @@ public sealed partial class Topic : pb::IMessage [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public static pbr::MessageDescriptor Descriptor { - get { return global::Nitric.Proto.Deployments.v1.DeploymentsReflection.Descriptor.MessageTypes[11]; } + get { return global::Nitric.Proto.Deployments.v1.DeploymentsReflection.Descriptor.MessageTypes[13]; } } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] @@ -3201,7 +3753,7 @@ public sealed partial class Queue : pb::IMessage [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public static pbr::MessageDescriptor Descriptor { - get { return global::Nitric.Proto.Deployments.v1.DeploymentsReflection.Descriptor.MessageTypes[12]; } + get { return global::Nitric.Proto.Deployments.v1.DeploymentsReflection.Descriptor.MessageTypes[14]; } } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] @@ -3337,7 +3889,7 @@ public sealed partial class KeyValueStore : pb::IMessage [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public static pbr::MessageDescriptor Descriptor { - get { return global::Nitric.Proto.Deployments.v1.DeploymentsReflection.Descriptor.MessageTypes[13]; } + get { return global::Nitric.Proto.Deployments.v1.DeploymentsReflection.Descriptor.MessageTypes[15]; } } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] @@ -3473,7 +4025,7 @@ public sealed partial class Secret : pb::IMessage [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public static pbr::MessageDescriptor Descriptor { - get { return global::Nitric.Proto.Deployments.v1.DeploymentsReflection.Descriptor.MessageTypes[14]; } + get { return global::Nitric.Proto.Deployments.v1.DeploymentsReflection.Descriptor.MessageTypes[16]; } } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] @@ -3609,7 +4161,7 @@ public sealed partial class SubscriptionTarget : pb::IMessage [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public static pbr::MessageDescriptor Descriptor { - get { return global::Nitric.Proto.Deployments.v1.DeploymentsReflection.Descriptor.MessageTypes[16]; } + get { return global::Nitric.Proto.Deployments.v1.DeploymentsReflection.Descriptor.MessageTypes[18]; } } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] @@ -3993,7 +4545,7 @@ public sealed partial class HttpTarget : pb::IMessage [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public static pbr::MessageDescriptor Descriptor { - get { return global::Nitric.Proto.Deployments.v1.DeploymentsReflection.Descriptor.MessageTypes[17]; } + get { return global::Nitric.Proto.Deployments.v1.DeploymentsReflection.Descriptor.MessageTypes[19]; } } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] @@ -4199,7 +4751,7 @@ public sealed partial class Http : pb::IMessage [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public static pbr::MessageDescriptor Descriptor { - get { return global::Nitric.Proto.Deployments.v1.DeploymentsReflection.Descriptor.MessageTypes[18]; } + get { return global::Nitric.Proto.Deployments.v1.DeploymentsReflection.Descriptor.MessageTypes[20]; } } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] @@ -4380,7 +4932,7 @@ public sealed partial class Api : pb::IMessage [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public static pbr::MessageDescriptor Descriptor { - get { return global::Nitric.Proto.Deployments.v1.DeploymentsReflection.Descriptor.MessageTypes[19]; } + get { return global::Nitric.Proto.Deployments.v1.DeploymentsReflection.Descriptor.MessageTypes[21]; } } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] @@ -4587,7 +5139,7 @@ public sealed partial class Websocket : pb::IMessage [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public static pbr::MessageDescriptor Descriptor { - get { return global::Nitric.Proto.Deployments.v1.DeploymentsReflection.Descriptor.MessageTypes[20]; } + get { return global::Nitric.Proto.Deployments.v1.DeploymentsReflection.Descriptor.MessageTypes[22]; } } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] @@ -4867,7 +5419,7 @@ public sealed partial class WebsocketTarget : pb::IMessage [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public static pbr::MessageDescriptor Descriptor { - get { return global::Nitric.Proto.Deployments.v1.DeploymentsReflection.Descriptor.MessageTypes[21]; } + get { return global::Nitric.Proto.Deployments.v1.DeploymentsReflection.Descriptor.MessageTypes[23]; } } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] @@ -5070,7 +5622,7 @@ public sealed partial class ScheduleTarget : pb::IMessage [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public static pbr::MessageDescriptor Descriptor { - get { return global::Nitric.Proto.Deployments.v1.DeploymentsReflection.Descriptor.MessageTypes[22]; } + get { return global::Nitric.Proto.Deployments.v1.DeploymentsReflection.Descriptor.MessageTypes[24]; } } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] @@ -5273,7 +5825,7 @@ public sealed partial class Schedule : pb::IMessage [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public static pbr::MessageDescriptor Descriptor { - get { return global::Nitric.Proto.Deployments.v1.DeploymentsReflection.Descriptor.MessageTypes[23]; } + get { return global::Nitric.Proto.Deployments.v1.DeploymentsReflection.Descriptor.MessageTypes[25]; } } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] @@ -5571,6 +6123,209 @@ public void MergeFrom(pb::CodedInputStream input) { } + public sealed partial class SqlDatabase : pb::IMessage + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + , pb::IBufferMessage + #endif + { + private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new SqlDatabase()); + private pb::UnknownFieldSet _unknownFields; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public static pb::MessageParser Parser { get { return _parser; } } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public static pbr::MessageDescriptor Descriptor { + get { return global::Nitric.Proto.Deployments.v1.DeploymentsReflection.Descriptor.MessageTypes[26]; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + pbr::MessageDescriptor pb::IMessage.Descriptor { + get { return Descriptor; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public SqlDatabase() { + OnConstruction(); + } + + partial void OnConstruction(); + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public SqlDatabase(SqlDatabase other) : this() { + switch (other.MigrationsCase) { + case MigrationsOneofCase.ImageUri: + ImageUri = other.ImageUri; + break; + } + + _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public SqlDatabase Clone() { + return new SqlDatabase(this); + } + + /// Field number for the "image_uri" field. + public const int ImageUriFieldNumber = 1; + /// + /// The URI of a docker image to use to execute the migrations for this database + /// + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public string ImageUri { + get { return migrationsCase_ == MigrationsOneofCase.ImageUri ? (string) migrations_ : ""; } + set { + migrations_ = pb::ProtoPreconditions.CheckNotNull(value, "value"); + migrationsCase_ = MigrationsOneofCase.ImageUri; + } + } + + private object migrations_; + /// Enum of possible cases for the "migrations" oneof. + public enum MigrationsOneofCase { + None = 0, + ImageUri = 1, + } + private MigrationsOneofCase migrationsCase_ = MigrationsOneofCase.None; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public MigrationsOneofCase MigrationsCase { + get { return migrationsCase_; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public void ClearMigrations() { + migrationsCase_ = MigrationsOneofCase.None; + migrations_ = null; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public override bool Equals(object other) { + return Equals(other as SqlDatabase); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public bool Equals(SqlDatabase other) { + if (ReferenceEquals(other, null)) { + return false; + } + if (ReferenceEquals(other, this)) { + return true; + } + if (ImageUri != other.ImageUri) return false; + if (MigrationsCase != other.MigrationsCase) return false; + return Equals(_unknownFields, other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public override int GetHashCode() { + int hash = 1; + if (migrationsCase_ == MigrationsOneofCase.ImageUri) hash ^= ImageUri.GetHashCode(); + hash ^= (int) migrationsCase_; + if (_unknownFields != null) { + hash ^= _unknownFields.GetHashCode(); + } + return hash; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public override string ToString() { + return pb::JsonFormatter.ToDiagnosticString(this); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public void WriteTo(pb::CodedOutputStream output) { + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + output.WriteRawMessage(this); + #else + if (migrationsCase_ == MigrationsOneofCase.ImageUri) { + output.WriteRawTag(10); + output.WriteString(ImageUri); + } + if (_unknownFields != null) { + _unknownFields.WriteTo(output); + } + #endif + } + + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + void pb::IBufferMessage.InternalWriteTo(ref pb::WriteContext output) { + if (migrationsCase_ == MigrationsOneofCase.ImageUri) { + output.WriteRawTag(10); + output.WriteString(ImageUri); + } + if (_unknownFields != null) { + _unknownFields.WriteTo(ref output); + } + } + #endif + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public int CalculateSize() { + int size = 0; + if (migrationsCase_ == MigrationsOneofCase.ImageUri) { + size += 1 + pb::CodedOutputStream.ComputeStringSize(ImageUri); + } + if (_unknownFields != null) { + size += _unknownFields.CalculateSize(); + } + return size; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public void MergeFrom(SqlDatabase other) { + if (other == null) { + return; + } + switch (other.MigrationsCase) { + case MigrationsOneofCase.ImageUri: + ImageUri = other.ImageUri; + break; + } + + _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public void MergeFrom(pb::CodedInputStream input) { + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + input.ReadRawMessage(this); + #else + uint tag; + while ((tag = input.ReadTag()) != 0) { + switch(tag) { + default: + _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input); + break; + case 10: { + ImageUri = input.ReadString(); + break; + } + } + } + #endif + } + + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + void pb::IBufferMessage.InternalMergeFrom(ref pb::ParseContext input) { + uint tag; + while ((tag = input.ReadTag()) != 0) { + switch(tag) { + default: + _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, ref input); + break; + case 10: { + ImageUri = input.ReadString(); + break; + } + } + } + } + #endif + + } + public sealed partial class ScheduleEvery : pb::IMessage #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE , pb::IBufferMessage @@ -5583,7 +6338,7 @@ public sealed partial class ScheduleEvery : pb::IMessage [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public static pbr::MessageDescriptor Descriptor { - get { return global::Nitric.Proto.Deployments.v1.DeploymentsReflection.Descriptor.MessageTypes[24]; } + get { return global::Nitric.Proto.Deployments.v1.DeploymentsReflection.Descriptor.MessageTypes[27]; } } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] @@ -5758,7 +6513,7 @@ public sealed partial class ScheduleCron : pb::IMessage [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public static pbr::MessageDescriptor Descriptor { - get { return global::Nitric.Proto.Deployments.v1.DeploymentsReflection.Descriptor.MessageTypes[25]; } + get { return global::Nitric.Proto.Deployments.v1.DeploymentsReflection.Descriptor.MessageTypes[28]; } } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] @@ -5933,7 +6688,7 @@ public sealed partial class Resource : pb::IMessage [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public static pbr::MessageDescriptor Descriptor { - get { return global::Nitric.Proto.Deployments.v1.DeploymentsReflection.Descriptor.MessageTypes[26]; } + get { return global::Nitric.Proto.Deployments.v1.DeploymentsReflection.Descriptor.MessageTypes[29]; } } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] @@ -5985,6 +6740,12 @@ public Resource(Resource other) : this() { case ConfigOneofCase.Queue: Queue = other.Queue.Clone(); break; + case ConfigOneofCase.SqlDatabase: + SqlDatabase = other.SqlDatabase.Clone(); + break; + case ConfigOneofCase.Batch: + Batch = other.Batch.Clone(); + break; } _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields); @@ -6127,6 +6888,28 @@ public Resource Clone() { } } + /// Field number for the "sql_database" field. + public const int SqlDatabaseFieldNumber = 21; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public global::Nitric.Proto.Deployments.v1.SqlDatabase SqlDatabase { + get { return configCase_ == ConfigOneofCase.SqlDatabase ? (global::Nitric.Proto.Deployments.v1.SqlDatabase) config_ : null; } + set { + config_ = value; + configCase_ = value == null ? ConfigOneofCase.None : ConfigOneofCase.SqlDatabase; + } + } + + /// Field number for the "batch" field. + public const int BatchFieldNumber = 22; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public global::Nitric.Proto.Deployments.v1.Batch Batch { + get { return configCase_ == ConfigOneofCase.Batch ? (global::Nitric.Proto.Deployments.v1.Batch) config_ : null; } + set { + config_ = value; + configCase_ = value == null ? ConfigOneofCase.None : ConfigOneofCase.Batch; + } + } + private object config_; /// Enum of possible cases for the "config" oneof. public enum ConfigOneofCase { @@ -6142,6 +6925,8 @@ public enum ConfigOneofCase { Websocket = 18, Http = 19, Queue = 20, + SqlDatabase = 21, + Batch = 22, } private ConfigOneofCase configCase_ = ConfigOneofCase.None; [global::System.Diagnostics.DebuggerNonUserCodeAttribute] @@ -6180,6 +6965,8 @@ public bool Equals(Resource other) { if (!object.Equals(Websocket, other.Websocket)) return false; if (!object.Equals(Http, other.Http)) return false; if (!object.Equals(Queue, other.Queue)) return false; + if (!object.Equals(SqlDatabase, other.SqlDatabase)) return false; + if (!object.Equals(Batch, other.Batch)) return false; if (ConfigCase != other.ConfigCase) return false; return Equals(_unknownFields, other._unknownFields); } @@ -6199,6 +6986,8 @@ public override int GetHashCode() { if (configCase_ == ConfigOneofCase.Websocket) hash ^= Websocket.GetHashCode(); if (configCase_ == ConfigOneofCase.Http) hash ^= Http.GetHashCode(); if (configCase_ == ConfigOneofCase.Queue) hash ^= Queue.GetHashCode(); + if (configCase_ == ConfigOneofCase.SqlDatabase) hash ^= SqlDatabase.GetHashCode(); + if (configCase_ == ConfigOneofCase.Batch) hash ^= Batch.GetHashCode(); hash ^= (int) configCase_; if (_unknownFields != null) { hash ^= _unknownFields.GetHashCode(); @@ -6264,6 +7053,14 @@ public void WriteTo(pb::CodedOutputStream output) { output.WriteRawTag(162, 1); output.WriteMessage(Queue); } + if (configCase_ == ConfigOneofCase.SqlDatabase) { + output.WriteRawTag(170, 1); + output.WriteMessage(SqlDatabase); + } + if (configCase_ == ConfigOneofCase.Batch) { + output.WriteRawTag(178, 1); + output.WriteMessage(Batch); + } if (_unknownFields != null) { _unknownFields.WriteTo(output); } @@ -6321,6 +7118,14 @@ public void WriteTo(pb::CodedOutputStream output) { output.WriteRawTag(162, 1); output.WriteMessage(Queue); } + if (configCase_ == ConfigOneofCase.SqlDatabase) { + output.WriteRawTag(170, 1); + output.WriteMessage(SqlDatabase); + } + if (configCase_ == ConfigOneofCase.Batch) { + output.WriteRawTag(178, 1); + output.WriteMessage(Batch); + } if (_unknownFields != null) { _unknownFields.WriteTo(ref output); } @@ -6366,6 +7171,12 @@ public int CalculateSize() { if (configCase_ == ConfigOneofCase.Queue) { size += 2 + pb::CodedOutputStream.ComputeMessageSize(Queue); } + if (configCase_ == ConfigOneofCase.SqlDatabase) { + size += 2 + pb::CodedOutputStream.ComputeMessageSize(SqlDatabase); + } + if (configCase_ == ConfigOneofCase.Batch) { + size += 2 + pb::CodedOutputStream.ComputeMessageSize(Batch); + } if (_unknownFields != null) { size += _unknownFields.CalculateSize(); } @@ -6450,6 +7261,18 @@ public void MergeFrom(Resource other) { } Queue.MergeFrom(other.Queue); break; + case ConfigOneofCase.SqlDatabase: + if (SqlDatabase == null) { + SqlDatabase = new global::Nitric.Proto.Deployments.v1.SqlDatabase(); + } + SqlDatabase.MergeFrom(other.SqlDatabase); + break; + case ConfigOneofCase.Batch: + if (Batch == null) { + Batch = new global::Nitric.Proto.Deployments.v1.Batch(); + } + Batch.MergeFrom(other.Batch); + break; } _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields); @@ -6572,6 +7395,24 @@ public void MergeFrom(pb::CodedInputStream input) { Queue = subBuilder; break; } + case 170: { + global::Nitric.Proto.Deployments.v1.SqlDatabase subBuilder = new global::Nitric.Proto.Deployments.v1.SqlDatabase(); + if (configCase_ == ConfigOneofCase.SqlDatabase) { + subBuilder.MergeFrom(SqlDatabase); + } + input.ReadMessage(subBuilder); + SqlDatabase = subBuilder; + break; + } + case 178: { + global::Nitric.Proto.Deployments.v1.Batch subBuilder = new global::Nitric.Proto.Deployments.v1.Batch(); + if (configCase_ == ConfigOneofCase.Batch) { + subBuilder.MergeFrom(Batch); + } + input.ReadMessage(subBuilder); + Batch = subBuilder; + break; + } } } #endif @@ -6692,6 +7533,24 @@ public void MergeFrom(pb::CodedInputStream input) { Queue = subBuilder; break; } + case 170: { + global::Nitric.Proto.Deployments.v1.SqlDatabase subBuilder = new global::Nitric.Proto.Deployments.v1.SqlDatabase(); + if (configCase_ == ConfigOneofCase.SqlDatabase) { + subBuilder.MergeFrom(SqlDatabase); + } + input.ReadMessage(subBuilder); + SqlDatabase = subBuilder; + break; + } + case 178: { + global::Nitric.Proto.Deployments.v1.Batch subBuilder = new global::Nitric.Proto.Deployments.v1.Batch(); + if (configCase_ == ConfigOneofCase.Batch) { + subBuilder.MergeFrom(Batch); + } + input.ReadMessage(subBuilder); + Batch = subBuilder; + break; + } } } } @@ -6715,7 +7574,7 @@ public sealed partial class Policy : pb::IMessage [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public static pbr::MessageDescriptor Descriptor { - get { return global::Nitric.Proto.Deployments.v1.DeploymentsReflection.Descriptor.MessageTypes[27]; } + get { return global::Nitric.Proto.Deployments.v1.DeploymentsReflection.Descriptor.MessageTypes[30]; } } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] @@ -6928,7 +7787,7 @@ public sealed partial class Spec : pb::IMessage [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public static pbr::MessageDescriptor Descriptor { - get { return global::Nitric.Proto.Deployments.v1.DeploymentsReflection.Descriptor.MessageTypes[28]; } + get { return global::Nitric.Proto.Deployments.v1.DeploymentsReflection.Descriptor.MessageTypes[31]; } } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] diff --git a/src/Nitric.Sdk/Proto/nitric/proto/http/v1/Http.cs b/src/Nitric.Sdk/Proto/nitric/proto/http/v1/Http.cs index 7806b81..fec619a 100644 --- a/src/Nitric.Sdk/Proto/nitric/proto/http/v1/Http.cs +++ b/src/Nitric.Sdk/Proto/nitric/proto/http/v1/Http.cs @@ -30,10 +30,10 @@ static HttpReflection() { "cnZlck1lc3NhZ2UiIAoQSHR0cFByb3h5UmVxdWVzdBIMCgRob3N0GAEgASgJ", "Ml0KBEh0dHASVQoFUHJveHkSIy5uaXRyaWMucHJvdG8uaHR0cC52MS5DbGll", "bnRNZXNzYWdlGiMubml0cmljLnByb3RvLmh0dHAudjEuU2VydmVyTWVzc2Fn", - "ZSgBMAFCjAEKF2lvLm5pdHJpYy5wcm90by5odHRwLnYxQgVIdHRwc1ABWjpn", - "aXRodWIuY29tL25pdHJpY3RlY2gvbml0cmljL2NvcmUvcGtnL3Byb3RvL2h0", - "dHAvdjE7aHR0cHBiqgIUTml0cmljLlByb3RvLkh0dHAudjHKAhROaXRyaWNc", - "UHJvdG9cSHR0cFxWMWIGcHJvdG8z")); + "ZSgBMAFCkgEKF2lvLm5pdHJpYy5wcm90by5odHRwLnYxQgtIdHRwU2Vydmlj", + "ZVABWjpnaXRodWIuY29tL25pdHJpY3RlY2gvbml0cmljL2NvcmUvcGtnL3By", + "b3RvL2h0dHAvdjE7aHR0cHBiqgIUTml0cmljLlByb3RvLkh0dHAudjHKAhRO", + "aXRyaWNcUHJvdG9cSHR0cFxWMWIGcHJvdG8z")); descriptor = pbr::FileDescriptor.FromGeneratedCode(descriptorData, new pbr::FileDescriptor[] { }, new pbr::GeneratedClrTypeInfo(null, null, new pbr::GeneratedClrTypeInfo[] { diff --git a/src/Nitric.Sdk/Proto/nitric/proto/keyvalue/v1/Keyvalue.cs b/src/Nitric.Sdk/Proto/nitric/proto/keyvalue/v1/Keyvalue.cs index 6dfb686..c914017 100644 --- a/src/Nitric.Sdk/Proto/nitric/proto/keyvalue/v1/Keyvalue.cs +++ b/src/Nitric.Sdk/Proto/nitric/proto/keyvalue/v1/Keyvalue.cs @@ -45,11 +45,11 @@ static KeyvalueReflection() { "cmljLnByb3RvLktleVZhbHVlLnYxLktleVZhbHVlU2V0UmVzcG9uc2USawoG", "RGVsZXRlEi8ubml0cmljLnByb3RvLktleVZhbHVlLnYxLktleVZhbHVlRGVs", "ZXRlUmVxdWVzdBowLm5pdHJpYy5wcm90by5LZXlWYWx1ZS52MS5LZXlWYWx1", - "ZURlbGV0ZVJlc3BvbnNlQqMBChtpby5uaXRyaWMucHJvdG8ua2V5dmFsdWUu", - "djFCCEtleVZhbHVlUAFaQmdpdGh1Yi5jb20vbml0cmljdGVjaC9uaXRyaWMv", - "Y29yZS9wa2cvcHJvdG8va2V5dmFsdWUvdjE7S2V5VmFsdWVwYqoCGE5pdHJp", - "Yy5Qcm90by5LZXlWYWx1ZS52McoCGE5pdHJpY1xQcm90b1xLZXlWYWx1ZVxW", - "MWIGcHJvdG8z")); + "ZURlbGV0ZVJlc3BvbnNlQqoBChtpby5uaXRyaWMucHJvdG8ua2V5dmFsdWUu", + "djFCD0tleVZhbHVlU2VydmljZVABWkJnaXRodWIuY29tL25pdHJpY3RlY2gv", + "bml0cmljL2NvcmUvcGtnL3Byb3RvL2tleXZhbHVlL3YxO0tleVZhbHVlcGKq", + "AhhOaXRyaWMuUHJvdG8uS2V5VmFsdWUudjHKAhhOaXRyaWNcUHJvdG9cS2V5", + "VmFsdWVcVjFiBnByb3RvMw==")); descriptor = pbr::FileDescriptor.FromGeneratedCode(descriptorData, new pbr::FileDescriptor[] { global::Google.Protobuf.WellKnownTypes.StructReflection.Descriptor, }, new pbr::GeneratedClrTypeInfo(null, null, new pbr::GeneratedClrTypeInfo[] { diff --git a/src/Nitric.Sdk/Proto/nitric/proto/kvstore/v1/Kvstore.cs b/src/Nitric.Sdk/Proto/nitric/proto/kvstore/v1/Kvstore.cs index de182a4..23a64db 100644 --- a/src/Nitric.Sdk/Proto/nitric/proto/kvstore/v1/Kvstore.cs +++ b/src/Nitric.Sdk/Proto/nitric/proto/kvstore/v1/Kvstore.cs @@ -51,11 +51,11 @@ static KvstoreReflection() { "aXRyaWMucHJvdG8ua3ZzdG9yZS52MS5LdlN0b3JlRGVsZXRlS2V5UmVzcG9u", "c2USbwoIU2NhbktleXMSLy5uaXRyaWMucHJvdG8ua3ZzdG9yZS52MS5LdlN0", "b3JlU2NhbktleXNSZXF1ZXN0GjAubml0cmljLnByb3RvLmt2c3RvcmUudjEu", - "S3ZTdG9yZVNjYW5LZXlzUmVzcG9uc2UwAUKdAQoaaW8ubml0cmljLnByb3Rv", - "Lmt2c3RvcmUudjFCB0t2U3RvcmVQAVpAZ2l0aHViLmNvbS9uaXRyaWN0ZWNo", - "L25pdHJpYy9jb3JlL3BrZy9wcm90by9rdnN0b3JlL3YxO2t2c3RvcmVwYqoC", - "F05pdHJpYy5Qcm90by5LdlN0b3JlLnYxygIXTml0cmljXFByb3RvXEt2U3Rv", - "cmVcVjFiBnByb3RvMw==")); + "S3ZTdG9yZVNjYW5LZXlzUmVzcG9uc2UwAUKkAQoaaW8ubml0cmljLnByb3Rv", + "Lmt2c3RvcmUudjFCDkt2U3RvcmVTZXJ2aWNlUAFaQGdpdGh1Yi5jb20vbml0", + "cmljdGVjaC9uaXRyaWMvY29yZS9wa2cvcHJvdG8va3ZzdG9yZS92MTtrdnN0", + "b3JlcGKqAhdOaXRyaWMuUHJvdG8uS3ZTdG9yZS52McoCF05pdHJpY1xQcm90", + "b1xLdlN0b3JlXFYxYgZwcm90bzM=")); descriptor = pbr::FileDescriptor.FromGeneratedCode(descriptorData, new pbr::FileDescriptor[] { global::Google.Protobuf.WellKnownTypes.StructReflection.Descriptor, }, new pbr::GeneratedClrTypeInfo(null, null, new pbr::GeneratedClrTypeInfo[] { diff --git a/src/Nitric.Sdk/Proto/nitric/proto/resources/v1/Resources.cs b/src/Nitric.Sdk/Proto/nitric/proto/resources/v1/Resources.cs index cb7581f..5f1ad06 100644 --- a/src/Nitric.Sdk/Proto/nitric/proto/resources/v1/Resources.cs +++ b/src/Nitric.Sdk/Proto/nitric/proto/resources/v1/Resources.cs @@ -32,7 +32,7 @@ static ResourcesReflection() { "KAsyLS5uaXRyaWMucHJvdG8ucmVzb3VyY2VzLnYxLlJlc291cmNlSWRlbnRp", "ZmllciJZChJSZXNvdXJjZUlkZW50aWZpZXISNQoEdHlwZRgBIAEoDjInLm5p", "dHJpYy5wcm90by5yZXNvdXJjZXMudjEuUmVzb3VyY2VUeXBlEgwKBG5hbWUY", - "AiABKAki6wQKFlJlc291cmNlRGVjbGFyZVJlcXVlc3QSOQoCaWQYASABKAsy", + "AiABKAki6gUKFlJlc291cmNlRGVjbGFyZVJlcXVlc3QSOQoCaWQYASABKAsy", "LS5uaXRyaWMucHJvdG8ucmVzb3VyY2VzLnYxLlJlc291cmNlSWRlbnRpZmll", "chI7CgZwb2xpY3kYCiABKAsyKS5uaXRyaWMucHJvdG8ucmVzb3VyY2VzLnYx", "LlBvbGljeVJlc291cmNlSAASOwoGYnVja2V0GAsgASgLMikubml0cmljLnBy", @@ -45,48 +45,59 @@ static ResourcesReflection() { "MS5BcGlSZXNvdXJjZUgAElsKF2FwaV9zZWN1cml0eV9kZWZpbml0aW9uGBAg", "ASgLMjgubml0cmljLnByb3RvLnJlc291cmNlcy52MS5BcGlTZWN1cml0eURl", "ZmluaXRpb25SZXNvdXJjZUgAEjkKBXF1ZXVlGBEgASgLMigubml0cmljLnBy", - "b3RvLnJlc291cmNlcy52MS5RdWV1ZVJlc291cmNlSABCCAoGY29uZmlnIhAK", - "DkJ1Y2tldFJlc291cmNlIg8KDVRvcGljUmVzb3VyY2UiDwoNUXVldWVSZXNv", - "dXJjZSIXChVLZXlWYWx1ZVN0b3JlUmVzb3VyY2UiEAoOU2VjcmV0UmVzb3Vy", - "Y2UiQgodQXBpT3BlbklkQ29ubmVjdGlvbkRlZmluaXRpb24SDgoGaXNzdWVy", - "GAEgASgJEhEKCWF1ZGllbmNlcxgCIAMoCSKJAQodQXBpU2VjdXJpdHlEZWZp", - "bml0aW9uUmVzb3VyY2USEAoIYXBpX25hbWUYASABKAkSSAoEb2lkYxgCIAEo", - "CzI4Lm5pdHJpYy5wcm90by5yZXNvdXJjZXMudjEuQXBpT3BlbklkQ29ubmVj", - "dGlvbkRlZmluaXRpb25IAEIMCgpkZWZpbml0aW9uIhsKCUFwaVNjb3BlcxIO", - "CgZzY29wZXMYASADKAkirAEKC0FwaVJlc291cmNlEkYKCHNlY3VyaXR5GAEg", - "AygLMjQubml0cmljLnByb3RvLnJlc291cmNlcy52MS5BcGlSZXNvdXJjZS5T", - "ZWN1cml0eUVudHJ5GlUKDVNlY3VyaXR5RW50cnkSCwoDa2V5GAEgASgJEjMK", - "BXZhbHVlGAIgASgLMiQubml0cmljLnByb3RvLnJlc291cmNlcy52MS5BcGlT", - "Y29wZXM6AjgBIhkKF1Jlc291cmNlRGVjbGFyZVJlc3BvbnNlKtkBCgxSZXNv", - "dXJjZVR5cGUSBwoDQXBpEAASCwoHU2VydmljZRABEgoKBkJ1Y2tldBACEgkK", - "BVRvcGljEAMSDAoIU2NoZWR1bGUQBBIQCgxTdWJzY3JpcHRpb24QBRIRCg1L", - "ZXlWYWx1ZVN0b3JlEAYSCgoGUG9saWN5EAcSCgoGU2VjcmV0EAgSEgoOQnVj", - "a2V0TGlzdGVuZXIQCRINCglXZWJzb2NrZXQQChIICgRIdHRwEAsSGQoVQXBp", - "U2VjdXJpdHlEZWZpbml0aW9uEAwSCQoFUXVldWUQDSqVAgoGQWN0aW9uEhIK", - "DkJ1Y2tldEZpbGVMaXN0EAASEQoNQnVja2V0RmlsZUdldBABEhEKDUJ1Y2tl", - "dEZpbGVQdXQQAhIUChBCdWNrZXRGaWxlRGVsZXRlEAMSEQoMVG9waWNQdWJs", - "aXNoEMgBEhYKEUtleVZhbHVlU3RvcmVSZWFkEKwCEhcKEktleVZhbHVlU3Rv", - "cmVXcml0ZRCtAhIYChNLZXlWYWx1ZVN0b3JlRGVsZXRlEK4CEg4KCVNlY3Jl", - "dFB1dBCQAxIRCgxTZWNyZXRBY2Nlc3MQkQMSFAoPV2Vic29ja2V0TWFuYWdl", - "EPQDEhEKDFF1ZXVlRW5xdWV1ZRDYBBIRCgxRdWV1ZURlcXVldWUQ2QQyfQoJ", - "UmVzb3VyY2VzEnAKB0RlY2xhcmUSMS5uaXRyaWMucHJvdG8ucmVzb3VyY2Vz", - "LnYxLlJlc291cmNlRGVjbGFyZVJlcXVlc3QaMi5uaXRyaWMucHJvdG8ucmVz", - "b3VyY2VzLnYxLlJlc291cmNlRGVjbGFyZVJlc3BvbnNlQqkBChxpby5uaXRy", - "aWMucHJvdG8ucmVzb3VyY2VzLnYxQglSZXNvdXJjZXNQAVpEZ2l0aHViLmNv", - "bS9uaXRyaWN0ZWNoL25pdHJpYy9jb3JlL3BrZy9wcm90by9yZXNvdXJjZXMv", - "djE7cmVzb3VyY2VzcGKqAhlOaXRyaWMuUHJvdG8uUmVzb3VyY2VzLnYxygIZ", - "Tml0cmljXFByb3RvXFJlc291cmNlc1xWMWIGcHJvdG8z")); + "b3RvLnJlc291cmNlcy52MS5RdWV1ZVJlc291cmNlSAASRgoMc3FsX2RhdGFi", + "YXNlGBIgASgLMi4ubml0cmljLnByb3RvLnJlc291cmNlcy52MS5TcWxEYXRh", + "YmFzZVJlc291cmNlSAASNQoDam9iGBMgASgLMiYubml0cmljLnByb3RvLnJl", + "c291cmNlcy52MS5Kb2JSZXNvdXJjZUgAQggKBmNvbmZpZyIQCg5CdWNrZXRS", + "ZXNvdXJjZSIPCg1Ub3BpY1Jlc291cmNlIg8KDVF1ZXVlUmVzb3VyY2UiFwoV", + "S2V5VmFsdWVTdG9yZVJlc291cmNlIhAKDlNlY3JldFJlc291cmNlIg0KC0pv", + "YlJlc291cmNlIkAKFVNxbERhdGFiYXNlTWlncmF0aW9ucxIZCg9taWdyYXRp", + "b25zX3BhdGgYASABKAlIAEIMCgptaWdyYXRpb25zIlsKE1NxbERhdGFiYXNl", + "UmVzb3VyY2USRAoKbWlncmF0aW9ucxgBIAEoCzIwLm5pdHJpYy5wcm90by5y", + "ZXNvdXJjZXMudjEuU3FsRGF0YWJhc2VNaWdyYXRpb25zIkIKHUFwaU9wZW5J", + "ZENvbm5lY3Rpb25EZWZpbml0aW9uEg4KBmlzc3VlchgBIAEoCRIRCglhdWRp", + "ZW5jZXMYAiADKAkiiQEKHUFwaVNlY3VyaXR5RGVmaW5pdGlvblJlc291cmNl", + "EhAKCGFwaV9uYW1lGAEgASgJEkgKBG9pZGMYAiABKAsyOC5uaXRyaWMucHJv", + "dG8ucmVzb3VyY2VzLnYxLkFwaU9wZW5JZENvbm5lY3Rpb25EZWZpbml0aW9u", + "SABCDAoKZGVmaW5pdGlvbiIbCglBcGlTY29wZXMSDgoGc2NvcGVzGAEgAygJ", + "IqwBCgtBcGlSZXNvdXJjZRJGCghzZWN1cml0eRgBIAMoCzI0Lm5pdHJpYy5w", + "cm90by5yZXNvdXJjZXMudjEuQXBpUmVzb3VyY2UuU2VjdXJpdHlFbnRyeRpV", + "Cg1TZWN1cml0eUVudHJ5EgsKA2tleRgBIAEoCRIzCgV2YWx1ZRgCIAEoCzIk", + "Lm5pdHJpYy5wcm90by5yZXNvdXJjZXMudjEuQXBpU2NvcGVzOgI4ASIZChdS", + "ZXNvdXJjZURlY2xhcmVSZXNwb25zZSr+AQoMUmVzb3VyY2VUeXBlEgcKA0Fw", + "aRAAEgsKB1NlcnZpY2UQARIKCgZCdWNrZXQQAhIJCgVUb3BpYxADEgwKCFNj", + "aGVkdWxlEAQSEAoMU3Vic2NyaXB0aW9uEAUSEQoNS2V5VmFsdWVTdG9yZRAG", + "EgoKBlBvbGljeRAHEgoKBlNlY3JldBAIEhIKDkJ1Y2tldExpc3RlbmVyEAkS", + "DQoJV2Vic29ja2V0EAoSCAoESHR0cBALEhkKFUFwaVNlY3VyaXR5RGVmaW5p", + "dGlvbhAMEgkKBVF1ZXVlEA0SDwoLU3FsRGF0YWJhc2UQDhIJCgVCYXRjaBAP", + "EgcKA0pvYhAQKqUCCgZBY3Rpb24SEgoOQnVja2V0RmlsZUxpc3QQABIRCg1C", + "dWNrZXRGaWxlR2V0EAESEQoNQnVja2V0RmlsZVB1dBACEhQKEEJ1Y2tldEZp", + "bGVEZWxldGUQAxIRCgxUb3BpY1B1Ymxpc2gQyAESFgoRS2V5VmFsdWVTdG9y", + "ZVJlYWQQrAISFwoSS2V5VmFsdWVTdG9yZVdyaXRlEK0CEhgKE0tleVZhbHVl", + "U3RvcmVEZWxldGUQrgISDgoJU2VjcmV0UHV0EJADEhEKDFNlY3JldEFjY2Vz", + "cxCRAxIUCg9XZWJzb2NrZXRNYW5hZ2UQ9AMSEQoMUXVldWVFbnF1ZXVlENgE", + "EhEKDFF1ZXVlRGVxdWV1ZRDZBBIOCglKb2JTdWJtaXQQvAUyfQoJUmVzb3Vy", + "Y2VzEnAKB0RlY2xhcmUSMS5uaXRyaWMucHJvdG8ucmVzb3VyY2VzLnYxLlJl", + "c291cmNlRGVjbGFyZVJlcXVlc3QaMi5uaXRyaWMucHJvdG8ucmVzb3VyY2Vz", + "LnYxLlJlc291cmNlRGVjbGFyZVJlc3BvbnNlQrABChxpby5uaXRyaWMucHJv", + "dG8ucmVzb3VyY2VzLnYxQhBSZXNvdXJjZXNTZXJ2aWNlUAFaRGdpdGh1Yi5j", + "b20vbml0cmljdGVjaC9uaXRyaWMvY29yZS9wa2cvcHJvdG8vcmVzb3VyY2Vz", + "L3YxO3Jlc291cmNlc3BiqgIZTml0cmljLlByb3RvLlJlc291cmNlcy52McoC", + "GU5pdHJpY1xQcm90b1xSZXNvdXJjZXNcVjFiBnByb3RvMw==")); descriptor = pbr::FileDescriptor.FromGeneratedCode(descriptorData, new pbr::FileDescriptor[] { }, new pbr::GeneratedClrTypeInfo(new[] {typeof(global::Nitric.Proto.Resources.v1.ResourceType), typeof(global::Nitric.Proto.Resources.v1.Action), }, null, new pbr::GeneratedClrTypeInfo[] { new pbr::GeneratedClrTypeInfo(typeof(global::Nitric.Proto.Resources.v1.PolicyResource), global::Nitric.Proto.Resources.v1.PolicyResource.Parser, new[]{ "Principals", "Actions", "Resources" }, null, null, null, null), new pbr::GeneratedClrTypeInfo(typeof(global::Nitric.Proto.Resources.v1.ResourceIdentifier), global::Nitric.Proto.Resources.v1.ResourceIdentifier.Parser, new[]{ "Type", "Name" }, null, null, null, null), - new pbr::GeneratedClrTypeInfo(typeof(global::Nitric.Proto.Resources.v1.ResourceDeclareRequest), global::Nitric.Proto.Resources.v1.ResourceDeclareRequest.Parser, new[]{ "Id", "Policy", "Bucket", "Topic", "KeyValueStore", "Secret", "Api", "ApiSecurityDefinition", "Queue" }, new[]{ "Config" }, null, null, null), + new pbr::GeneratedClrTypeInfo(typeof(global::Nitric.Proto.Resources.v1.ResourceDeclareRequest), global::Nitric.Proto.Resources.v1.ResourceDeclareRequest.Parser, new[]{ "Id", "Policy", "Bucket", "Topic", "KeyValueStore", "Secret", "Api", "ApiSecurityDefinition", "Queue", "SqlDatabase", "Job" }, new[]{ "Config" }, null, null, null), new pbr::GeneratedClrTypeInfo(typeof(global::Nitric.Proto.Resources.v1.BucketResource), global::Nitric.Proto.Resources.v1.BucketResource.Parser, null, null, null, null, null), new pbr::GeneratedClrTypeInfo(typeof(global::Nitric.Proto.Resources.v1.TopicResource), global::Nitric.Proto.Resources.v1.TopicResource.Parser, null, null, null, null, null), new pbr::GeneratedClrTypeInfo(typeof(global::Nitric.Proto.Resources.v1.QueueResource), global::Nitric.Proto.Resources.v1.QueueResource.Parser, null, null, null, null, null), new pbr::GeneratedClrTypeInfo(typeof(global::Nitric.Proto.Resources.v1.KeyValueStoreResource), global::Nitric.Proto.Resources.v1.KeyValueStoreResource.Parser, null, null, null, null, null), new pbr::GeneratedClrTypeInfo(typeof(global::Nitric.Proto.Resources.v1.SecretResource), global::Nitric.Proto.Resources.v1.SecretResource.Parser, null, null, null, null, null), + new pbr::GeneratedClrTypeInfo(typeof(global::Nitric.Proto.Resources.v1.JobResource), global::Nitric.Proto.Resources.v1.JobResource.Parser, null, null, null, null, null), + new pbr::GeneratedClrTypeInfo(typeof(global::Nitric.Proto.Resources.v1.SqlDatabaseMigrations), global::Nitric.Proto.Resources.v1.SqlDatabaseMigrations.Parser, new[]{ "MigrationsPath" }, new[]{ "Migrations" }, null, null, null), + new pbr::GeneratedClrTypeInfo(typeof(global::Nitric.Proto.Resources.v1.SqlDatabaseResource), global::Nitric.Proto.Resources.v1.SqlDatabaseResource.Parser, new[]{ "Migrations" }, null, null, null, null), new pbr::GeneratedClrTypeInfo(typeof(global::Nitric.Proto.Resources.v1.ApiOpenIdConnectionDefinition), global::Nitric.Proto.Resources.v1.ApiOpenIdConnectionDefinition.Parser, new[]{ "Issuer", "Audiences" }, null, null, null, null), new pbr::GeneratedClrTypeInfo(typeof(global::Nitric.Proto.Resources.v1.ApiSecurityDefinitionResource), global::Nitric.Proto.Resources.v1.ApiSecurityDefinitionResource.Parser, new[]{ "ApiName", "Oidc" }, new[]{ "Definition" }, null, null, null), new pbr::GeneratedClrTypeInfo(typeof(global::Nitric.Proto.Resources.v1.ApiScopes), global::Nitric.Proto.Resources.v1.ApiScopes.Parser, new[]{ "Scopes" }, null, null, null, null), @@ -113,6 +124,12 @@ public enum ResourceType { [pbr::OriginalName("Http")] Http = 11, [pbr::OriginalName("ApiSecurityDefinition")] ApiSecurityDefinition = 12, [pbr::OriginalName("Queue")] Queue = 13, + [pbr::OriginalName("SqlDatabase")] SqlDatabase = 14, + /// + /// Batches represent a collection of jobs + /// + [pbr::OriginalName("Batch")] Batch = 15, + [pbr::OriginalName("Job")] Job = 16, } public enum Action { @@ -147,6 +164,10 @@ public enum Action { /// [pbr::OriginalName("QueueEnqueue")] QueueEnqueue = 600, [pbr::OriginalName("QueueDequeue")] QueueDequeue = 601, + /// + /// Job Permissions: 7XX + /// + [pbr::OriginalName("JobSubmit")] JobSubmit = 700, } #endregion @@ -631,6 +652,12 @@ public ResourceDeclareRequest(ResourceDeclareRequest other) : this() { case ConfigOneofCase.Queue: Queue = other.Queue.Clone(); break; + case ConfigOneofCase.SqlDatabase: + SqlDatabase = other.SqlDatabase.Clone(); + break; + case ConfigOneofCase.Job: + Job = other.Job.Clone(); + break; } _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields); @@ -740,6 +767,28 @@ public ResourceDeclareRequest Clone() { } } + /// Field number for the "sql_database" field. + public const int SqlDatabaseFieldNumber = 18; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public global::Nitric.Proto.Resources.v1.SqlDatabaseResource SqlDatabase { + get { return configCase_ == ConfigOneofCase.SqlDatabase ? (global::Nitric.Proto.Resources.v1.SqlDatabaseResource) config_ : null; } + set { + config_ = value; + configCase_ = value == null ? ConfigOneofCase.None : ConfigOneofCase.SqlDatabase; + } + } + + /// Field number for the "job" field. + public const int JobFieldNumber = 19; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public global::Nitric.Proto.Resources.v1.JobResource Job { + get { return configCase_ == ConfigOneofCase.Job ? (global::Nitric.Proto.Resources.v1.JobResource) config_ : null; } + set { + config_ = value; + configCase_ = value == null ? ConfigOneofCase.None : ConfigOneofCase.Job; + } + } + private object config_; /// Enum of possible cases for the "config" oneof. public enum ConfigOneofCase { @@ -752,6 +801,8 @@ public enum ConfigOneofCase { Api = 15, ApiSecurityDefinition = 16, Queue = 17, + SqlDatabase = 18, + Job = 19, } private ConfigOneofCase configCase_ = ConfigOneofCase.None; [global::System.Diagnostics.DebuggerNonUserCodeAttribute] @@ -787,6 +838,8 @@ public bool Equals(ResourceDeclareRequest other) { if (!object.Equals(Api, other.Api)) return false; if (!object.Equals(ApiSecurityDefinition, other.ApiSecurityDefinition)) return false; if (!object.Equals(Queue, other.Queue)) return false; + if (!object.Equals(SqlDatabase, other.SqlDatabase)) return false; + if (!object.Equals(Job, other.Job)) return false; if (ConfigCase != other.ConfigCase) return false; return Equals(_unknownFields, other._unknownFields); } @@ -803,6 +856,8 @@ public override int GetHashCode() { if (configCase_ == ConfigOneofCase.Api) hash ^= Api.GetHashCode(); if (configCase_ == ConfigOneofCase.ApiSecurityDefinition) hash ^= ApiSecurityDefinition.GetHashCode(); if (configCase_ == ConfigOneofCase.Queue) hash ^= Queue.GetHashCode(); + if (configCase_ == ConfigOneofCase.SqlDatabase) hash ^= SqlDatabase.GetHashCode(); + if (configCase_ == ConfigOneofCase.Job) hash ^= Job.GetHashCode(); hash ^= (int) configCase_; if (_unknownFields != null) { hash ^= _unknownFields.GetHashCode(); @@ -856,6 +911,14 @@ public void WriteTo(pb::CodedOutputStream output) { output.WriteRawTag(138, 1); output.WriteMessage(Queue); } + if (configCase_ == ConfigOneofCase.SqlDatabase) { + output.WriteRawTag(146, 1); + output.WriteMessage(SqlDatabase); + } + if (configCase_ == ConfigOneofCase.Job) { + output.WriteRawTag(154, 1); + output.WriteMessage(Job); + } if (_unknownFields != null) { _unknownFields.WriteTo(output); } @@ -901,6 +964,14 @@ public void WriteTo(pb::CodedOutputStream output) { output.WriteRawTag(138, 1); output.WriteMessage(Queue); } + if (configCase_ == ConfigOneofCase.SqlDatabase) { + output.WriteRawTag(146, 1); + output.WriteMessage(SqlDatabase); + } + if (configCase_ == ConfigOneofCase.Job) { + output.WriteRawTag(154, 1); + output.WriteMessage(Job); + } if (_unknownFields != null) { _unknownFields.WriteTo(ref output); } @@ -937,6 +1008,12 @@ public int CalculateSize() { if (configCase_ == ConfigOneofCase.Queue) { size += 2 + pb::CodedOutputStream.ComputeMessageSize(Queue); } + if (configCase_ == ConfigOneofCase.SqlDatabase) { + size += 2 + pb::CodedOutputStream.ComputeMessageSize(SqlDatabase); + } + if (configCase_ == ConfigOneofCase.Job) { + size += 2 + pb::CodedOutputStream.ComputeMessageSize(Job); + } if (_unknownFields != null) { size += _unknownFields.CalculateSize(); } @@ -1003,6 +1080,18 @@ public void MergeFrom(ResourceDeclareRequest other) { } Queue.MergeFrom(other.Queue); break; + case ConfigOneofCase.SqlDatabase: + if (SqlDatabase == null) { + SqlDatabase = new global::Nitric.Proto.Resources.v1.SqlDatabaseResource(); + } + SqlDatabase.MergeFrom(other.SqlDatabase); + break; + case ConfigOneofCase.Job: + if (Job == null) { + Job = new global::Nitric.Proto.Resources.v1.JobResource(); + } + Job.MergeFrom(other.Job); + break; } _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields); @@ -1098,6 +1187,24 @@ public void MergeFrom(pb::CodedInputStream input) { Queue = subBuilder; break; } + case 146: { + global::Nitric.Proto.Resources.v1.SqlDatabaseResource subBuilder = new global::Nitric.Proto.Resources.v1.SqlDatabaseResource(); + if (configCase_ == ConfigOneofCase.SqlDatabase) { + subBuilder.MergeFrom(SqlDatabase); + } + input.ReadMessage(subBuilder); + SqlDatabase = subBuilder; + break; + } + case 154: { + global::Nitric.Proto.Resources.v1.JobResource subBuilder = new global::Nitric.Proto.Resources.v1.JobResource(); + if (configCase_ == ConfigOneofCase.Job) { + subBuilder.MergeFrom(Job); + } + input.ReadMessage(subBuilder); + Job = subBuilder; + break; + } } } #endif @@ -1191,6 +1298,24 @@ public void MergeFrom(pb::CodedInputStream input) { Queue = subBuilder; break; } + case 146: { + global::Nitric.Proto.Resources.v1.SqlDatabaseResource subBuilder = new global::Nitric.Proto.Resources.v1.SqlDatabaseResource(); + if (configCase_ == ConfigOneofCase.SqlDatabase) { + subBuilder.MergeFrom(SqlDatabase); + } + input.ReadMessage(subBuilder); + SqlDatabase = subBuilder; + break; + } + case 154: { + global::Nitric.Proto.Resources.v1.JobResource subBuilder = new global::Nitric.Proto.Resources.v1.JobResource(); + if (configCase_ == ConfigOneofCase.Job) { + subBuilder.MergeFrom(Job); + } + input.ReadMessage(subBuilder); + Job = subBuilder; + break; + } } } } @@ -1878,6 +2003,528 @@ public void MergeFrom(pb::CodedInputStream input) { } + public sealed partial class JobResource : pb::IMessage + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + , pb::IBufferMessage + #endif + { + private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new JobResource()); + private pb::UnknownFieldSet _unknownFields; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public static pb::MessageParser Parser { get { return _parser; } } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public static pbr::MessageDescriptor Descriptor { + get { return global::Nitric.Proto.Resources.v1.ResourcesReflection.Descriptor.MessageTypes[8]; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + pbr::MessageDescriptor pb::IMessage.Descriptor { + get { return Descriptor; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public JobResource() { + OnConstruction(); + } + + partial void OnConstruction(); + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public JobResource(JobResource other) : this() { + _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public JobResource Clone() { + return new JobResource(this); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public override bool Equals(object other) { + return Equals(other as JobResource); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public bool Equals(JobResource other) { + if (ReferenceEquals(other, null)) { + return false; + } + if (ReferenceEquals(other, this)) { + return true; + } + return Equals(_unknownFields, other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public override int GetHashCode() { + int hash = 1; + if (_unknownFields != null) { + hash ^= _unknownFields.GetHashCode(); + } + return hash; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public override string ToString() { + return pb::JsonFormatter.ToDiagnosticString(this); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public void WriteTo(pb::CodedOutputStream output) { + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + output.WriteRawMessage(this); + #else + if (_unknownFields != null) { + _unknownFields.WriteTo(output); + } + #endif + } + + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + void pb::IBufferMessage.InternalWriteTo(ref pb::WriteContext output) { + if (_unknownFields != null) { + _unknownFields.WriteTo(ref output); + } + } + #endif + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public int CalculateSize() { + int size = 0; + if (_unknownFields != null) { + size += _unknownFields.CalculateSize(); + } + return size; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public void MergeFrom(JobResource other) { + if (other == null) { + return; + } + _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public void MergeFrom(pb::CodedInputStream input) { + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + input.ReadRawMessage(this); + #else + uint tag; + while ((tag = input.ReadTag()) != 0) { + switch(tag) { + default: + _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input); + break; + } + } + #endif + } + + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + void pb::IBufferMessage.InternalMergeFrom(ref pb::ParseContext input) { + uint tag; + while ((tag = input.ReadTag()) != 0) { + switch(tag) { + default: + _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, ref input); + break; + } + } + } + #endif + + } + + public sealed partial class SqlDatabaseMigrations : pb::IMessage + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + , pb::IBufferMessage + #endif + { + private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new SqlDatabaseMigrations()); + private pb::UnknownFieldSet _unknownFields; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public static pb::MessageParser Parser { get { return _parser; } } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public static pbr::MessageDescriptor Descriptor { + get { return global::Nitric.Proto.Resources.v1.ResourcesReflection.Descriptor.MessageTypes[9]; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + pbr::MessageDescriptor pb::IMessage.Descriptor { + get { return Descriptor; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public SqlDatabaseMigrations() { + OnConstruction(); + } + + partial void OnConstruction(); + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public SqlDatabaseMigrations(SqlDatabaseMigrations other) : this() { + switch (other.MigrationsCase) { + case MigrationsOneofCase.MigrationsPath: + MigrationsPath = other.MigrationsPath; + break; + } + + _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public SqlDatabaseMigrations Clone() { + return new SqlDatabaseMigrations(this); + } + + /// Field number for the "migrations_path" field. + public const int MigrationsPathFieldNumber = 1; + /// + /// The path to this databases SQL migrations + /// Valid values are file://relative/path/to/migrations as a directory or dockerfile://path/to/migrations.dockerfile to hint at a docker image build + /// Paths should be relative to the root of the application (nitric.yaml file location) + /// + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public string MigrationsPath { + get { return migrationsCase_ == MigrationsOneofCase.MigrationsPath ? (string) migrations_ : ""; } + set { + migrations_ = pb::ProtoPreconditions.CheckNotNull(value, "value"); + migrationsCase_ = MigrationsOneofCase.MigrationsPath; + } + } + + private object migrations_; + /// Enum of possible cases for the "migrations" oneof. + public enum MigrationsOneofCase { + None = 0, + MigrationsPath = 1, + } + private MigrationsOneofCase migrationsCase_ = MigrationsOneofCase.None; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public MigrationsOneofCase MigrationsCase { + get { return migrationsCase_; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public void ClearMigrations() { + migrationsCase_ = MigrationsOneofCase.None; + migrations_ = null; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public override bool Equals(object other) { + return Equals(other as SqlDatabaseMigrations); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public bool Equals(SqlDatabaseMigrations other) { + if (ReferenceEquals(other, null)) { + return false; + } + if (ReferenceEquals(other, this)) { + return true; + } + if (MigrationsPath != other.MigrationsPath) return false; + if (MigrationsCase != other.MigrationsCase) return false; + return Equals(_unknownFields, other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public override int GetHashCode() { + int hash = 1; + if (migrationsCase_ == MigrationsOneofCase.MigrationsPath) hash ^= MigrationsPath.GetHashCode(); + hash ^= (int) migrationsCase_; + if (_unknownFields != null) { + hash ^= _unknownFields.GetHashCode(); + } + return hash; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public override string ToString() { + return pb::JsonFormatter.ToDiagnosticString(this); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public void WriteTo(pb::CodedOutputStream output) { + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + output.WriteRawMessage(this); + #else + if (migrationsCase_ == MigrationsOneofCase.MigrationsPath) { + output.WriteRawTag(10); + output.WriteString(MigrationsPath); + } + if (_unknownFields != null) { + _unknownFields.WriteTo(output); + } + #endif + } + + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + void pb::IBufferMessage.InternalWriteTo(ref pb::WriteContext output) { + if (migrationsCase_ == MigrationsOneofCase.MigrationsPath) { + output.WriteRawTag(10); + output.WriteString(MigrationsPath); + } + if (_unknownFields != null) { + _unknownFields.WriteTo(ref output); + } + } + #endif + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public int CalculateSize() { + int size = 0; + if (migrationsCase_ == MigrationsOneofCase.MigrationsPath) { + size += 1 + pb::CodedOutputStream.ComputeStringSize(MigrationsPath); + } + if (_unknownFields != null) { + size += _unknownFields.CalculateSize(); + } + return size; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public void MergeFrom(SqlDatabaseMigrations other) { + if (other == null) { + return; + } + switch (other.MigrationsCase) { + case MigrationsOneofCase.MigrationsPath: + MigrationsPath = other.MigrationsPath; + break; + } + + _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public void MergeFrom(pb::CodedInputStream input) { + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + input.ReadRawMessage(this); + #else + uint tag; + while ((tag = input.ReadTag()) != 0) { + switch(tag) { + default: + _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input); + break; + case 10: { + MigrationsPath = input.ReadString(); + break; + } + } + } + #endif + } + + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + void pb::IBufferMessage.InternalMergeFrom(ref pb::ParseContext input) { + uint tag; + while ((tag = input.ReadTag()) != 0) { + switch(tag) { + default: + _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, ref input); + break; + case 10: { + MigrationsPath = input.ReadString(); + break; + } + } + } + } + #endif + + } + + public sealed partial class SqlDatabaseResource : pb::IMessage + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + , pb::IBufferMessage + #endif + { + private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new SqlDatabaseResource()); + private pb::UnknownFieldSet _unknownFields; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public static pb::MessageParser Parser { get { return _parser; } } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public static pbr::MessageDescriptor Descriptor { + get { return global::Nitric.Proto.Resources.v1.ResourcesReflection.Descriptor.MessageTypes[10]; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + pbr::MessageDescriptor pb::IMessage.Descriptor { + get { return Descriptor; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public SqlDatabaseResource() { + OnConstruction(); + } + + partial void OnConstruction(); + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public SqlDatabaseResource(SqlDatabaseResource other) : this() { + migrations_ = other.migrations_ != null ? other.migrations_.Clone() : null; + _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public SqlDatabaseResource Clone() { + return new SqlDatabaseResource(this); + } + + /// Field number for the "migrations" field. + public const int MigrationsFieldNumber = 1; + private global::Nitric.Proto.Resources.v1.SqlDatabaseMigrations migrations_; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public global::Nitric.Proto.Resources.v1.SqlDatabaseMigrations Migrations { + get { return migrations_; } + set { + migrations_ = value; + } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public override bool Equals(object other) { + return Equals(other as SqlDatabaseResource); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public bool Equals(SqlDatabaseResource other) { + if (ReferenceEquals(other, null)) { + return false; + } + if (ReferenceEquals(other, this)) { + return true; + } + if (!object.Equals(Migrations, other.Migrations)) return false; + return Equals(_unknownFields, other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public override int GetHashCode() { + int hash = 1; + if (migrations_ != null) hash ^= Migrations.GetHashCode(); + if (_unknownFields != null) { + hash ^= _unknownFields.GetHashCode(); + } + return hash; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public override string ToString() { + return pb::JsonFormatter.ToDiagnosticString(this); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public void WriteTo(pb::CodedOutputStream output) { + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + output.WriteRawMessage(this); + #else + if (migrations_ != null) { + output.WriteRawTag(10); + output.WriteMessage(Migrations); + } + if (_unknownFields != null) { + _unknownFields.WriteTo(output); + } + #endif + } + + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + void pb::IBufferMessage.InternalWriteTo(ref pb::WriteContext output) { + if (migrations_ != null) { + output.WriteRawTag(10); + output.WriteMessage(Migrations); + } + if (_unknownFields != null) { + _unknownFields.WriteTo(ref output); + } + } + #endif + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public int CalculateSize() { + int size = 0; + if (migrations_ != null) { + size += 1 + pb::CodedOutputStream.ComputeMessageSize(Migrations); + } + if (_unknownFields != null) { + size += _unknownFields.CalculateSize(); + } + return size; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public void MergeFrom(SqlDatabaseResource other) { + if (other == null) { + return; + } + if (other.migrations_ != null) { + if (migrations_ == null) { + Migrations = new global::Nitric.Proto.Resources.v1.SqlDatabaseMigrations(); + } + Migrations.MergeFrom(other.Migrations); + } + _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public void MergeFrom(pb::CodedInputStream input) { + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + input.ReadRawMessage(this); + #else + uint tag; + while ((tag = input.ReadTag()) != 0) { + switch(tag) { + default: + _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input); + break; + case 10: { + if (migrations_ == null) { + Migrations = new global::Nitric.Proto.Resources.v1.SqlDatabaseMigrations(); + } + input.ReadMessage(Migrations); + break; + } + } + } + #endif + } + + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + void pb::IBufferMessage.InternalMergeFrom(ref pb::ParseContext input) { + uint tag; + while ((tag = input.ReadTag()) != 0) { + switch(tag) { + default: + _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, ref input); + break; + case 10: { + if (migrations_ == null) { + Migrations = new global::Nitric.Proto.Resources.v1.SqlDatabaseMigrations(); + } + input.ReadMessage(Migrations); + break; + } + } + } + } + #endif + + } + public sealed partial class ApiOpenIdConnectionDefinition : pb::IMessage #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE , pb::IBufferMessage @@ -1890,7 +2537,7 @@ public sealed partial class ApiOpenIdConnectionDefinition : pb::IMessage [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public static pbr::MessageDescriptor Descriptor { - get { return global::Nitric.Proto.Resources.v1.ResourcesReflection.Descriptor.MessageTypes[10]; } + get { return global::Nitric.Proto.Resources.v1.ResourcesReflection.Descriptor.MessageTypes[13]; } } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] @@ -2497,7 +3144,7 @@ public sealed partial class ApiResource : pb::IMessage [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public static pbr::MessageDescriptor Descriptor { - get { return global::Nitric.Proto.Resources.v1.ResourcesReflection.Descriptor.MessageTypes[11]; } + get { return global::Nitric.Proto.Resources.v1.ResourcesReflection.Descriptor.MessageTypes[14]; } } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] @@ -2662,7 +3309,7 @@ public sealed partial class ResourceDeclareResponse : pb::IMessage +// Generated by the protocol buffer compiler. DO NOT EDIT! +// source: nitric/proto/sql/v1/sql.proto +// +#pragma warning disable 1591, 0612, 3021 +#region Designer generated code + +using pb = global::Google.Protobuf; +using pbc = global::Google.Protobuf.Collections; +using pbr = global::Google.Protobuf.Reflection; +using scg = global::System.Collections.Generic; +namespace Nitric.Proto.Sql.v1 { + + /// Holder for reflection information generated from nitric/proto/sql/v1/sql.proto + public static partial class SqlReflection { + + #region Descriptor + /// File descriptor for nitric/proto/sql/v1/sql.proto + public static pbr::FileDescriptor Descriptor { + get { return descriptor; } + } + private static pbr::FileDescriptor descriptor; + + static SqlReflection() { + byte[] descriptorData = global::System.Convert.FromBase64String( + string.Concat( + "Ch1uaXRyaWMvcHJvdG8vc3FsL3YxL3NxbC5wcm90bxITbml0cmljLnByb3Rv", + "LnNxbC52MSIzChpTcWxDb25uZWN0aW9uU3RyaW5nUmVxdWVzdBIVCg1kYXRh", + "YmFzZV9uYW1lGAEgASgJIjgKG1NxbENvbm5lY3Rpb25TdHJpbmdSZXNwb25z", + "ZRIZChFjb25uZWN0aW9uX3N0cmluZxgBIAEoCTJ8CgNTcWwSdQoQQ29ubmVj", + "dGlvblN0cmluZxIvLm5pdHJpYy5wcm90by5zcWwudjEuU3FsQ29ubmVjdGlv", + "blN0cmluZ1JlcXVlc3QaMC5uaXRyaWMucHJvdG8uc3FsLnYxLlNxbENvbm5l", + "Y3Rpb25TdHJpbmdSZXNwb25zZUKMAQoWaW8ubml0cmljLnByb3RvLnNxbC52", + "MUIKU3FsU2VydmljZVABWjhnaXRodWIuY29tL25pdHJpY3RlY2gvbml0cmlj", + "L2NvcmUvcGtnL3Byb3RvL3NxbC92MTtzcWxwYqoCE05pdHJpYy5Qcm90by5T", + "cWwudjHKAhNOaXRyaWNcUHJvdG9cU3FsXFYxYgZwcm90bzM=")); + descriptor = pbr::FileDescriptor.FromGeneratedCode(descriptorData, + new pbr::FileDescriptor[] { }, + new pbr::GeneratedClrTypeInfo(null, null, new pbr::GeneratedClrTypeInfo[] { + new pbr::GeneratedClrTypeInfo(typeof(global::Nitric.Proto.Sql.v1.SqlConnectionStringRequest), global::Nitric.Proto.Sql.v1.SqlConnectionStringRequest.Parser, new[]{ "DatabaseName" }, null, null, null, null), + new pbr::GeneratedClrTypeInfo(typeof(global::Nitric.Proto.Sql.v1.SqlConnectionStringResponse), global::Nitric.Proto.Sql.v1.SqlConnectionStringResponse.Parser, new[]{ "ConnectionString" }, null, null, null, null) + })); + } + #endregion + + } + #region Messages + public sealed partial class SqlConnectionStringRequest : pb::IMessage + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + , pb::IBufferMessage + #endif + { + private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new SqlConnectionStringRequest()); + private pb::UnknownFieldSet _unknownFields; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public static pb::MessageParser Parser { get { return _parser; } } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public static pbr::MessageDescriptor Descriptor { + get { return global::Nitric.Proto.Sql.v1.SqlReflection.Descriptor.MessageTypes[0]; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + pbr::MessageDescriptor pb::IMessage.Descriptor { + get { return Descriptor; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public SqlConnectionStringRequest() { + OnConstruction(); + } + + partial void OnConstruction(); + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public SqlConnectionStringRequest(SqlConnectionStringRequest other) : this() { + databaseName_ = other.databaseName_; + _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public SqlConnectionStringRequest Clone() { + return new SqlConnectionStringRequest(this); + } + + /// Field number for the "database_name" field. + public const int DatabaseNameFieldNumber = 1; + private string databaseName_ = ""; + /// + /// The name of the database to retrieve the connection string for + /// + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public string DatabaseName { + get { return databaseName_; } + set { + databaseName_ = pb::ProtoPreconditions.CheckNotNull(value, "value"); + } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public override bool Equals(object other) { + return Equals(other as SqlConnectionStringRequest); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public bool Equals(SqlConnectionStringRequest other) { + if (ReferenceEquals(other, null)) { + return false; + } + if (ReferenceEquals(other, this)) { + return true; + } + if (DatabaseName != other.DatabaseName) return false; + return Equals(_unknownFields, other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public override int GetHashCode() { + int hash = 1; + if (DatabaseName.Length != 0) hash ^= DatabaseName.GetHashCode(); + if (_unknownFields != null) { + hash ^= _unknownFields.GetHashCode(); + } + return hash; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public override string ToString() { + return pb::JsonFormatter.ToDiagnosticString(this); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public void WriteTo(pb::CodedOutputStream output) { + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + output.WriteRawMessage(this); + #else + if (DatabaseName.Length != 0) { + output.WriteRawTag(10); + output.WriteString(DatabaseName); + } + if (_unknownFields != null) { + _unknownFields.WriteTo(output); + } + #endif + } + + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + void pb::IBufferMessage.InternalWriteTo(ref pb::WriteContext output) { + if (DatabaseName.Length != 0) { + output.WriteRawTag(10); + output.WriteString(DatabaseName); + } + if (_unknownFields != null) { + _unknownFields.WriteTo(ref output); + } + } + #endif + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public int CalculateSize() { + int size = 0; + if (DatabaseName.Length != 0) { + size += 1 + pb::CodedOutputStream.ComputeStringSize(DatabaseName); + } + if (_unknownFields != null) { + size += _unknownFields.CalculateSize(); + } + return size; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public void MergeFrom(SqlConnectionStringRequest other) { + if (other == null) { + return; + } + if (other.DatabaseName.Length != 0) { + DatabaseName = other.DatabaseName; + } + _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public void MergeFrom(pb::CodedInputStream input) { + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + input.ReadRawMessage(this); + #else + uint tag; + while ((tag = input.ReadTag()) != 0) { + switch(tag) { + default: + _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input); + break; + case 10: { + DatabaseName = input.ReadString(); + break; + } + } + } + #endif + } + + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + void pb::IBufferMessage.InternalMergeFrom(ref pb::ParseContext input) { + uint tag; + while ((tag = input.ReadTag()) != 0) { + switch(tag) { + default: + _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, ref input); + break; + case 10: { + DatabaseName = input.ReadString(); + break; + } + } + } + } + #endif + + } + + public sealed partial class SqlConnectionStringResponse : pb::IMessage + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + , pb::IBufferMessage + #endif + { + private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new SqlConnectionStringResponse()); + private pb::UnknownFieldSet _unknownFields; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public static pb::MessageParser Parser { get { return _parser; } } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public static pbr::MessageDescriptor Descriptor { + get { return global::Nitric.Proto.Sql.v1.SqlReflection.Descriptor.MessageTypes[1]; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + pbr::MessageDescriptor pb::IMessage.Descriptor { + get { return Descriptor; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public SqlConnectionStringResponse() { + OnConstruction(); + } + + partial void OnConstruction(); + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public SqlConnectionStringResponse(SqlConnectionStringResponse other) : this() { + connectionString_ = other.connectionString_; + _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public SqlConnectionStringResponse Clone() { + return new SqlConnectionStringResponse(this); + } + + /// Field number for the "connection_string" field. + public const int ConnectionStringFieldNumber = 1; + private string connectionString_ = ""; + /// + /// The connection string for the database + /// + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public string ConnectionString { + get { return connectionString_; } + set { + connectionString_ = pb::ProtoPreconditions.CheckNotNull(value, "value"); + } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public override bool Equals(object other) { + return Equals(other as SqlConnectionStringResponse); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public bool Equals(SqlConnectionStringResponse other) { + if (ReferenceEquals(other, null)) { + return false; + } + if (ReferenceEquals(other, this)) { + return true; + } + if (ConnectionString != other.ConnectionString) return false; + return Equals(_unknownFields, other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public override int GetHashCode() { + int hash = 1; + if (ConnectionString.Length != 0) hash ^= ConnectionString.GetHashCode(); + if (_unknownFields != null) { + hash ^= _unknownFields.GetHashCode(); + } + return hash; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public override string ToString() { + return pb::JsonFormatter.ToDiagnosticString(this); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public void WriteTo(pb::CodedOutputStream output) { + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + output.WriteRawMessage(this); + #else + if (ConnectionString.Length != 0) { + output.WriteRawTag(10); + output.WriteString(ConnectionString); + } + if (_unknownFields != null) { + _unknownFields.WriteTo(output); + } + #endif + } + + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + void pb::IBufferMessage.InternalWriteTo(ref pb::WriteContext output) { + if (ConnectionString.Length != 0) { + output.WriteRawTag(10); + output.WriteString(ConnectionString); + } + if (_unknownFields != null) { + _unknownFields.WriteTo(ref output); + } + } + #endif + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public int CalculateSize() { + int size = 0; + if (ConnectionString.Length != 0) { + size += 1 + pb::CodedOutputStream.ComputeStringSize(ConnectionString); + } + if (_unknownFields != null) { + size += _unknownFields.CalculateSize(); + } + return size; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public void MergeFrom(SqlConnectionStringResponse other) { + if (other == null) { + return; + } + if (other.ConnectionString.Length != 0) { + ConnectionString = other.ConnectionString; + } + _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public void MergeFrom(pb::CodedInputStream input) { + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + input.ReadRawMessage(this); + #else + uint tag; + while ((tag = input.ReadTag()) != 0) { + switch(tag) { + default: + _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input); + break; + case 10: { + ConnectionString = input.ReadString(); + break; + } + } + } + #endif + } + + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + void pb::IBufferMessage.InternalMergeFrom(ref pb::ParseContext input) { + uint tag; + while ((tag = input.ReadTag()) != 0) { + switch(tag) { + default: + _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, ref input); + break; + case 10: { + ConnectionString = input.ReadString(); + break; + } + } + } + } + #endif + + } + + #endregion + +} + +#endregion Designer generated code diff --git a/src/Nitric.Sdk/Proto/nitric/proto/sql/v1/SqlGrpc.cs b/src/Nitric.Sdk/Proto/nitric/proto/sql/v1/SqlGrpc.cs new file mode 100644 index 0000000..73dc6bb --- /dev/null +++ b/src/Nitric.Sdk/Proto/nitric/proto/sql/v1/SqlGrpc.cs @@ -0,0 +1,174 @@ +// +// Generated by the protocol buffer compiler. DO NOT EDIT! +// source: nitric/proto/sql/v1/sql.proto +// +#pragma warning disable 0414, 1591 +#region Designer generated code + +using grpc = global::Grpc.Core; + +namespace Nitric.Proto.Sql.v1 { + /// + /// The Nitric Secret Service + /// + public static partial class Sql + { + static readonly string __ServiceName = "nitric.proto.sql.v1.Sql"; + + static void __Helper_SerializeMessage(global::Google.Protobuf.IMessage message, grpc::SerializationContext context) + { + #if !GRPC_DISABLE_PROTOBUF_BUFFER_SERIALIZATION + if (message is global::Google.Protobuf.IBufferMessage) + { + context.SetPayloadLength(message.CalculateSize()); + global::Google.Protobuf.MessageExtensions.WriteTo(message, context.GetBufferWriter()); + context.Complete(); + return; + } + #endif + context.Complete(global::Google.Protobuf.MessageExtensions.ToByteArray(message)); + } + + static class __Helper_MessageCache + { + public static readonly bool IsBufferMessage = global::System.Reflection.IntrospectionExtensions.GetTypeInfo(typeof(global::Google.Protobuf.IBufferMessage)).IsAssignableFrom(typeof(T)); + } + + static T __Helper_DeserializeMessage(grpc::DeserializationContext context, global::Google.Protobuf.MessageParser parser) where T : global::Google.Protobuf.IMessage + { + #if !GRPC_DISABLE_PROTOBUF_BUFFER_SERIALIZATION + if (__Helper_MessageCache.IsBufferMessage) + { + return parser.ParseFrom(context.PayloadAsReadOnlySequence()); + } + #endif + return parser.ParseFrom(context.PayloadAsNewBuffer()); + } + + static readonly grpc::Marshaller __Marshaller_nitric_proto_sql_v1_SqlConnectionStringRequest = grpc::Marshallers.Create(__Helper_SerializeMessage, context => __Helper_DeserializeMessage(context, global::Nitric.Proto.Sql.v1.SqlConnectionStringRequest.Parser)); + static readonly grpc::Marshaller __Marshaller_nitric_proto_sql_v1_SqlConnectionStringResponse = grpc::Marshallers.Create(__Helper_SerializeMessage, context => __Helper_DeserializeMessage(context, global::Nitric.Proto.Sql.v1.SqlConnectionStringResponse.Parser)); + + static readonly grpc::Method __Method_ConnectionString = new grpc::Method( + grpc::MethodType.Unary, + __ServiceName, + "ConnectionString", + __Marshaller_nitric_proto_sql_v1_SqlConnectionStringRequest, + __Marshaller_nitric_proto_sql_v1_SqlConnectionStringResponse); + + /// Service descriptor + public static global::Google.Protobuf.Reflection.ServiceDescriptor Descriptor + { + get { return global::Nitric.Proto.Sql.v1.SqlReflection.Descriptor.Services[0]; } + } + + /// Base class for server-side implementations of Sql + [grpc::BindServiceMethod(typeof(Sql), "BindService")] + public abstract partial class SqlBase + { + /// + /// Retrieve the connection string for a given database + /// + /// The request received from the client. + /// The context of the server-side call handler being invoked. + /// The response to send back to the client (wrapped by a task). + public virtual global::System.Threading.Tasks.Task ConnectionString(global::Nitric.Proto.Sql.v1.SqlConnectionStringRequest request, grpc::ServerCallContext context) + { + throw new grpc::RpcException(new grpc::Status(grpc::StatusCode.Unimplemented, "")); + } + + } + + /// Client for Sql + public partial class SqlClient : grpc::ClientBase + { + /// Creates a new client for Sql + /// The channel to use to make remote calls. + public SqlClient(grpc::ChannelBase channel) : base(channel) + { + } + /// Creates a new client for Sql that uses a custom CallInvoker. + /// The callInvoker to use to make remote calls. + public SqlClient(grpc::CallInvoker callInvoker) : base(callInvoker) + { + } + /// Protected parameterless constructor to allow creation of test doubles. + protected SqlClient() : base() + { + } + /// Protected constructor to allow creation of configured clients. + /// The client configuration. + protected SqlClient(ClientBaseConfiguration configuration) : base(configuration) + { + } + + /// + /// Retrieve the connection string for a given database + /// + /// The request to send to the server. + /// The initial metadata to send with the call. This parameter is optional. + /// An optional deadline for the call. The call will be cancelled if deadline is hit. + /// An optional token for canceling the call. + /// The response received from the server. + public virtual global::Nitric.Proto.Sql.v1.SqlConnectionStringResponse ConnectionString(global::Nitric.Proto.Sql.v1.SqlConnectionStringRequest request, grpc::Metadata headers = null, global::System.DateTime? deadline = null, global::System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken)) + { + return ConnectionString(request, new grpc::CallOptions(headers, deadline, cancellationToken)); + } + /// + /// Retrieve the connection string for a given database + /// + /// The request to send to the server. + /// The options for the call. + /// The response received from the server. + public virtual global::Nitric.Proto.Sql.v1.SqlConnectionStringResponse ConnectionString(global::Nitric.Proto.Sql.v1.SqlConnectionStringRequest request, grpc::CallOptions options) + { + return CallInvoker.BlockingUnaryCall(__Method_ConnectionString, null, options, request); + } + /// + /// Retrieve the connection string for a given database + /// + /// The request to send to the server. + /// The initial metadata to send with the call. This parameter is optional. + /// An optional deadline for the call. The call will be cancelled if deadline is hit. + /// An optional token for canceling the call. + /// The call object. + public virtual grpc::AsyncUnaryCall ConnectionStringAsync(global::Nitric.Proto.Sql.v1.SqlConnectionStringRequest request, grpc::Metadata headers = null, global::System.DateTime? deadline = null, global::System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken)) + { + return ConnectionStringAsync(request, new grpc::CallOptions(headers, deadline, cancellationToken)); + } + /// + /// Retrieve the connection string for a given database + /// + /// The request to send to the server. + /// The options for the call. + /// The call object. + public virtual grpc::AsyncUnaryCall ConnectionStringAsync(global::Nitric.Proto.Sql.v1.SqlConnectionStringRequest request, grpc::CallOptions options) + { + return CallInvoker.AsyncUnaryCall(__Method_ConnectionString, null, options, request); + } + /// Creates a new instance of client from given ClientBaseConfiguration. + protected override SqlClient NewInstance(ClientBaseConfiguration configuration) + { + return new SqlClient(configuration); + } + } + + /// Creates service definition that can be registered with a server + /// An object implementing the server-side handling logic. + public static grpc::ServerServiceDefinition BindService(SqlBase serviceImpl) + { + return grpc::ServerServiceDefinition.CreateBuilder() + .AddMethod(__Method_ConnectionString, serviceImpl.ConnectionString).Build(); + } + + /// Register service method with a service binder with or without implementation. Useful when customizing the service binding logic. + /// Note: this method is part of an experimental API that can change or be removed without any prior notice. + /// Service methods will be bound by calling AddMethod on this object. + /// An object implementing the server-side handling logic. + public static void BindService(grpc::ServiceBinderBase serviceBinder, SqlBase serviceImpl) + { + serviceBinder.AddMethod(__Method_ConnectionString, serviceImpl == null ? null : new grpc::UnaryServerMethod(serviceImpl.ConnectionString)); + } + + } +} +#endregion diff --git a/src/Nitric.Sdk/Resource/ApiResource.cs b/src/Nitric.Sdk/Resource/ApiResource.cs index 2e75c37..ca75e5b 100644 --- a/src/Nitric.Sdk/Resource/ApiResource.cs +++ b/src/Nitric.Sdk/Resource/ApiResource.cs @@ -21,6 +21,7 @@ using ProtoApiResource = Nitric.Proto.Resources.v1.ApiResource; using System.Net.Http; using System.Runtime.InteropServices; +using System.Threading.Tasks; namespace Nitric.Sdk.Resource { @@ -411,13 +412,13 @@ private Middleware[] ConcatMiddleware(Middleware[] mid /// Create a new OPTIONS handler on the specified route. /// /// - public void Patch(Func handler) => Method(new HttpMethod[] { HttpMethod.Patch }, ConcatMiddleware(handler)); + public void Patch(Func handler) => Method(this.Path, new HttpMethod[] { HttpMethod.Patch }, this.Opts, ConcatMiddleware(handler)); /// /// Create a new OPTIONS middleware chain on the specified route. /// /// - public void Patch(params Middleware[] handlers) => Method(new HttpMethod[] { HttpMethod.Patch }, ConcatMiddleware(handlers)); + public void Patch(params Middleware[] handlers) => Method(this.Path, new HttpMethod[] { HttpMethod.Patch }, this.Opts, ConcatMiddleware(handlers)); HttpMethod[] httpMethods = new HttpMethod[] { diff --git a/src/Nitric.Sdk/Resource/BucketResource.cs b/src/Nitric.Sdk/Resource/BucketResource.cs index 60ca6ed..7645342 100644 --- a/src/Nitric.Sdk/Resource/BucketResource.cs +++ b/src/Nitric.Sdk/Resource/BucketResource.cs @@ -34,15 +34,15 @@ public enum BucketPermission /// /// Enables listing and reading files in the bucket. /// - Reading, + Read, /// /// Enables adding or updating files in the bucket. /// - Writing, + Write, /// /// Enables deleting files from the bucket. /// - Deleting + Delete } public class BucketResource : SecureResource @@ -63,15 +63,15 @@ protected override IEnumerable PermissionsToActions(IEnumerable> { { - BucketPermission.Reading, + BucketPermission.Read, new List { Action.BucketFileList, Action.BucketFileGet } }, { - BucketPermission.Writing, + BucketPermission.Write, new List { Action.BucketFilePut } }, { - BucketPermission.Deleting, + BucketPermission.Delete, new List { Action.BucketFileDelete } } }; diff --git a/src/Nitric.Sdk/Resource/KeyValueStoreResource.cs b/src/Nitric.Sdk/Resource/KeyValueStoreResource.cs index dd8f352..fdfe2c1 100644 --- a/src/Nitric.Sdk/Resource/KeyValueStoreResource.cs +++ b/src/Nitric.Sdk/Resource/KeyValueStoreResource.cs @@ -28,15 +28,15 @@ public enum KeyValueStorePermission /// /// Enables setting values to the key value store,. /// - Setting, + Set, /// /// Enables getting values from the key value store. /// - Getting, + Get, /// /// Enables deleting values from the key value store. /// - Deleting, + Delete, } public class KeyValueStoreResource : SecureResource @@ -57,15 +57,15 @@ protected override IEnumerable PermissionsToActions(IEnumerable> { { - KeyValueStorePermission.Setting, + KeyValueStorePermission.Set, new List { Action.KeyValueStoreWrite } }, { - KeyValueStorePermission.Getting, + KeyValueStorePermission.Get, new List { Action.KeyValueStoreRead } }, { - KeyValueStorePermission.Deleting, + KeyValueStorePermission.Delete, new List { Action.KeyValueStoreDelete } } }; diff --git a/src/Nitric.Sdk/Resource/ScheduleResource.cs b/src/Nitric.Sdk/Resource/ScheduleResource.cs index 396b12f..424fe10 100644 --- a/src/Nitric.Sdk/Resource/ScheduleResource.cs +++ b/src/Nitric.Sdk/Resource/ScheduleResource.cs @@ -16,7 +16,6 @@ using Nitric.Sdk.Worker; using Nitric.Proto.Schedules.v1; using Nitric.Proto.Resources.v1; -using NitricResource = Nitric.Proto.Resources.v1.ResourceIdentifier; using ResourceType = Nitric.Proto.Resources.v1.ResourceType; namespace Nitric.Sdk.Resource diff --git a/src/Nitric.Sdk/Resource/SecretResource.cs b/src/Nitric.Sdk/Resource/SecretResource.cs index 782d552..3fb7da6 100644 --- a/src/Nitric.Sdk/Resource/SecretResource.cs +++ b/src/Nitric.Sdk/Resource/SecretResource.cs @@ -16,7 +16,6 @@ using Nitric.Proto.Resources.v1; using Nitric.Sdk.Secret; using Action = Nitric.Proto.Resources.v1.Action; -using NitricResource = Nitric.Proto.Resources.v1.ResourceIdentifier; namespace Nitric.Sdk.Resource { @@ -28,11 +27,11 @@ public enum SecretPermission /// /// Enables putting secrets to the secret store. /// - Putting, + Put, /// /// Enables accessing secrets from the secret store. /// - Accessing + Access } public class SecretResource : SecureResource @@ -53,11 +52,11 @@ protected override IEnumerable PermissionsToActions(IEnumerable> { { - SecretPermission.Putting, + SecretPermission.Put, new List { Action.SecretPut } }, { - SecretPermission.Accessing, + SecretPermission.Access, new List { Action.SecretAccess } } }; diff --git a/src/Nitric.Sdk/Resource/SqlResource.cs b/src/Nitric.Sdk/Resource/SqlResource.cs new file mode 100644 index 0000000..6c81478 --- /dev/null +++ b/src/Nitric.Sdk/Resource/SqlResource.cs @@ -0,0 +1,79 @@ +// Copyright 2021, Nitric Technologies Pty Ltd. +// +// 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. +using System; +using Nitric.Proto.Sql.v1; +using GrpcClient = Nitric.Proto.Sql.v1.Sql.SqlClient; +using Nitric.Proto.Resources.v1; +using ResourceType = Nitric.Proto.Resources.v1.ResourceType; +using Nitric.Sdk.Common; +using System.Threading.Tasks; + +namespace Nitric.Sdk.Resource +{ + public class SqlResource : BaseResource + { + internal readonly GrpcClient Client; + + string Migrations; + + internal SqlResource(string name, string migrations, GrpcClient client = null) : base(name, ResourceType.SqlDatabase) + { + this.Client = client ?? new GrpcClient(GrpcChannelProvider.GetChannel()); + this.Migrations = migrations; + } + + internal override BaseResource Register() + { + var request = new ResourceDeclareRequest + { + Id = this.AsProtoResource(), + SqlDatabase = new SqlDatabaseResource + { + Migrations = new SqlDatabaseMigrations + { + MigrationsPath = this.Migrations + } + } + }; + BaseResource.client.Declare(request); + return this; + } + + /// + /// Retrieves the connection string of this SQL Database at runtime. + /// + /// The connection string of this SQL Database + public string ConnectionString() + { + var request = new SqlConnectionStringRequest { DatabaseName = this.Name }; + + var resp = this.Client.ConnectionString(request); + + return resp.ConnectionString; + } + + /// + /// Retrieves the connection string of this SQL Database at runtime. + /// + /// The connection string of this SQL Database + public async Task ConnectionStringAsync() + { + var request = new SqlConnectionStringRequest { DatabaseName = this.Name }; + + var resp = await this.Client.ConnectionStringAsync(request); + + return resp.ConnectionString; + } + } +} diff --git a/src/Nitric.Sdk/Resource/TopicResource.cs b/src/Nitric.Sdk/Resource/TopicResource.cs index e2e78a8..1e1524b 100644 --- a/src/Nitric.Sdk/Resource/TopicResource.cs +++ b/src/Nitric.Sdk/Resource/TopicResource.cs @@ -20,7 +20,6 @@ using Nitric.Sdk.Topics; using Nitric.Sdk.Worker; using Action = Nitric.Proto.Resources.v1.Action; -using NitricResource = Nitric.Proto.Resources.v1.ResourceIdentifier; using ResourceType = Nitric.Proto.Resources.v1.ResourceType; namespace Nitric.Sdk.Resource @@ -31,9 +30,9 @@ namespace Nitric.Sdk.Resource public enum TopicPermission { /// - /// Enables pushing new events to the topic. + /// Enables publishing new events to the topic. /// - Publishing + Publish } public class TopicResource : SecureResource @@ -54,7 +53,7 @@ protected override IEnumerable PermissionsToActions(IEnumerable> { { - TopicPermission.Publishing, + TopicPermission.Publish, new List { Action.TopicPublish } } }; diff --git a/src/Nitric.Sdk/Resource/WebsocketResource.cs b/src/Nitric.Sdk/Resource/WebsocketResource.cs index 13b8698..f6f3b3c 100644 --- a/src/Nitric.Sdk/Resource/WebsocketResource.cs +++ b/src/Nitric.Sdk/Resource/WebsocketResource.cs @@ -20,7 +20,6 @@ using Nitric.Sdk.Service; using Nitric.Sdk.Websocket; using Action = Nitric.Proto.Resources.v1.Action; -using NitricResource = Nitric.Proto.Resources.v1.ResourceIdentifier; using GrpcClient = Nitric.Proto.Websockets.v1.Websocket.WebsocketClient; using Nitric.Sdk.Worker; using Nitric.Proto.Websockets.v1; diff --git a/test/Nitric.Sdk.Test/Resource/ApiResourceTest.cs b/test/Nitric.Sdk.Test/Resource/ApiResourceTest.cs deleted file mode 100644 index e69de29..0000000 diff --git a/test/Nitric.Sdk.Test/Test.cs b/test/Nitric.Sdk.Test/Test.cs deleted file mode 100644 index 994c09f..0000000 --- a/test/Nitric.Sdk.Test/Test.cs +++ /dev/null @@ -1,24 +0,0 @@ -using Nitric.Sdk.Resource; -using Nitric.Sdk.Service; - -namespace Test -{ - public class Application - { - public static void Main(string[] args) - { - var app = Nitric.Sdk.Nitric.Api("Blah"); - - var oidc = Nitric.Sdk.Nitric.OidcRule("ruleName", "issuer", new string[] { "audiences" }); - - var route = app.Route("/hello", new RouteOptions { Security = new OidcOptions[] { oidc("user.read") } }); - - route.Get((HttpContext ctx) => - { - ctx.Res.Text("Hello World"); - return ctx; - }); - - } - } -} From 9dc3246006c62b0461a147503fda7058d2b7bb58 Mon Sep 17 00:00:00 2001 From: Ryan Cartwright Date: Wed, 5 Mar 2025 16:58:31 +1100 Subject: [PATCH 20/34] add batch resources --- src/Nitric.Sdk/Job/BatchClient.cs | 53 +++++++++ src/Nitric.Sdk/Job/Job.cs | 83 ++++++++++++++ src/Nitric.Sdk/Nitric.cs | 7 ++ src/Nitric.Sdk/Resource/BatchResource.cs | 127 ++++++++++++++++++++++ src/Nitric.Sdk/Resource/BucketResource.cs | 2 - src/Nitric.Sdk/Service/JobContext.cs | 105 ++++++++++++++++++ src/Nitric.Sdk/Worker/JobWorker.cs | 69 ++++++++++++ 7 files changed, 444 insertions(+), 2 deletions(-) create mode 100644 src/Nitric.Sdk/Job/BatchClient.cs create mode 100644 src/Nitric.Sdk/Job/Job.cs create mode 100644 src/Nitric.Sdk/Resource/BatchResource.cs create mode 100644 src/Nitric.Sdk/Service/JobContext.cs create mode 100644 src/Nitric.Sdk/Worker/JobWorker.cs diff --git a/src/Nitric.Sdk/Job/BatchClient.cs b/src/Nitric.Sdk/Job/BatchClient.cs new file mode 100644 index 0000000..da125fe --- /dev/null +++ b/src/Nitric.Sdk/Job/BatchClient.cs @@ -0,0 +1,53 @@ +// Copyright 2021, Nitric Technologies Pty Ltd. +// +// 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. + +using System; +using Nitric.Sdk.Common; +using GrpcClient = Nitric.Proto.Batch.v1.Batch.BatchClient; + +namespace Nitric.Sdk.Job +{ + /// + /// A batch client. + /// + public class BatchClient + { + internal readonly GrpcClient Client; + + /// + /// Create a new batch client. + /// + /// Optional internal gRPC client to reuse. + public BatchClient(GrpcClient client = null) + { + this.Client = client ?? new GrpcClient(GrpcChannelProvider.GetChannel()); + } + + /// + /// Create a reference to a job in a batch service. + /// + /// The name of the job. + /// The new job reference. + /// + public Job Job(string jobName) + { + if (string.IsNullOrEmpty(jobName)) + { + throw new ArgumentNullException(nameof(jobName)); + } + + return new Job(this, jobName); + } + } +} diff --git a/src/Nitric.Sdk/Job/Job.cs b/src/Nitric.Sdk/Job/Job.cs new file mode 100644 index 0000000..5c9f92a --- /dev/null +++ b/src/Nitric.Sdk/Job/Job.cs @@ -0,0 +1,83 @@ +// Copyright 2021, Nitric Technologies Pty Ltd. +// +// 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. + +using Nitric.Proto.Batch.v1; +using Nitric.Sdk.Common; + +namespace Nitric.Sdk.Job +{ + /// + /// A reference to a job. + /// + public class Job + { + internal readonly BatchClient Batch; + + /// + /// The name of the job. + /// + public string Name { get; private set; } + + internal Job(BatchClient batch, string name) + { + this.Batch = batch; + this.Name = name; + } + + /// + /// Submit a job to the batch service + /// + /// Data to submit to the job + public void Submit(T data) + { + var request = new JobSubmitRequest + { + JobName = this.Name, + Data = new JobData + { + Struct = Struct.FromJsonSerializable(data), + }, + }; + + this.Batch.Client.SubmitJob(request); + } + + /// + /// Submit a job to the batch service asynchronously + /// + /// Data to submit to the job + public async void SubmitAsync(T data) + { + var request = new JobSubmitRequest + { + JobName = this.Name, + Data = new JobData + { + Struct = Struct.FromJsonSerializable(data), + }, + }; + + await this.Batch.Client.SubmitJobAsync(request); + } + + /// + /// Return a string representation of the job. + /// + /// + public override string ToString() + { + return GetType().Name + "[name=" + Name + "]"; + } + } +} diff --git a/src/Nitric.Sdk/Nitric.cs b/src/Nitric.Sdk/Nitric.cs index a563a75..e6660ca 100644 --- a/src/Nitric.Sdk/Nitric.cs +++ b/src/Nitric.Sdk/Nitric.cs @@ -152,5 +152,12 @@ public static OidcScopes OidcRule(string name, string issuer, string[] audiences /// The unique name of the database within this application. /// A SQL resource, if the name has already been declared the same resource will be returned. public static SqlResource Sql(string name, string migrations = "") => Register(name, t => new SqlResource(t, migrations)); + + /// + /// Declare a websocket resource for bidirectional HTTP communication. + /// + /// The unique name of the websocket within this application. + /// A websocket resource, if the name has already been declared the same resource will be returned. + public static JobResource Job(string name) => Register(name, t => new JobResource(t)); } } diff --git a/src/Nitric.Sdk/Resource/BatchResource.cs b/src/Nitric.Sdk/Resource/BatchResource.cs new file mode 100644 index 0000000..683225e --- /dev/null +++ b/src/Nitric.Sdk/Resource/BatchResource.cs @@ -0,0 +1,127 @@ +// Copyright 2021, Nitric Technologies Pty Ltd. +// +// 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. +using System; +using Nitric.Sdk.Service; +using Nitric.Sdk.Worker; +using Nitric.Sdk.Job; +using Nitric.Proto.Batch.v1; +using Nitric.Proto.Resources.v1; +using ResourceType = Nitric.Proto.Resources.v1.ResourceType; +using System.Collections.Generic; +using Action = Nitric.Proto.Resources.v1.Action; +using System.Linq; + +namespace Nitric.Sdk.Resource +{ + /// + /// Available permissions for job resources. + /// + public enum JobPermission + { + /// + /// Enables submitting jobs to the batch service + /// + Submit, + } + + public class JobResourceRequirements + { + /// + /// The amount of CPUs to allocate for this job + /// + public int Cpus { get; private set; } + + /// + /// The amount of memory to allocate for this job (in MB) + /// + public int Memory { get; private set; } + + /// + /// + /// + public int Gpus { get; private set; } + + + + public JobResourceRequirements(int cpus = 1, int memory = 1024, int gpus = 0) + { + this.Cpus = cpus; + this.Memory = memory; + this.Gpus = gpus; + } + } + + public class JobResource : SecureResource + { + internal JobResource(string name) : base(name, ResourceType.Batch) + { + + } + + internal override BaseResource Register() + { + var request = new ResourceDeclareRequest { Id = this.AsProtoResource() }; + BaseResource.client.Declare(request); + return this; + } + + protected override IEnumerable PermissionsToActions(IEnumerable permissions) + { + var actionMap = new Dictionary> + { + { + JobPermission.Submit, + new List { Action.JobSubmit } + } + }; + + return permissions.Aggregate((IEnumerable)new List(), (acc, x) => acc.Concat(actionMap[x])).Distinct(); + } + + public void Handler(Func, JobContext> middlewares, JobResourceRequirements requirements = null) + { + requirements ??= new JobResourceRequirements(); + + var registrationRequest = new RegistrationRequest + { + JobName = this.Name, + Requirements = new Proto.Batch.v1.JobResourceRequirements + { + Cpus = requirements.Cpus, + Memory = requirements.Memory, + Gpus = requirements.Gpus, + } + }; + + var apiWorker = new JobWorker(registrationRequest, middlewares); + + Nitric.RegisterWorker(apiWorker); + } + + /// + /// Request specific access to this job. + /// + /// The permissions that the function has to access the job. + /// A reference to the job. + public Job Allow(JobPermission permission, params JobPermission[] permissions) + { + var allPerms = new List { permission }; + allPerms.AddRange(permissions); + + this.RegisterPolicy(allPerms); + + return BatchClient.Job(this.Name); + } + } +} diff --git a/src/Nitric.Sdk/Resource/BucketResource.cs b/src/Nitric.Sdk/Resource/BucketResource.cs index 7645342..82f9d58 100644 --- a/src/Nitric.Sdk/Resource/BucketResource.cs +++ b/src/Nitric.Sdk/Resource/BucketResource.cs @@ -21,8 +21,6 @@ using Nitric.Sdk.Worker; using Nitric.Proto.Storage.v1; using Action = Nitric.Proto.Resources.v1.Action; -using NitricResource = Nitric.Proto.Resources.v1.ResourceIdentifier; -using System.Runtime.InteropServices; namespace Nitric.Sdk.Resource { diff --git a/src/Nitric.Sdk/Service/JobContext.cs b/src/Nitric.Sdk/Service/JobContext.cs new file mode 100644 index 0000000..da27972 --- /dev/null +++ b/src/Nitric.Sdk/Service/JobContext.cs @@ -0,0 +1,105 @@ +// Copyright 2021, Nitric Technologies Pty Ltd. +// +// 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. + +using Nitric.Sdk.Common; +using Nitric.Proto.Batch.v1; +using ProtoMessageResponse = Nitric.Proto.Batch.v1.JobResponse; + +namespace Nitric.Sdk.Service +{ + /// + /// Represents an event pushed to a job via a publish. + /// + public class JobRequest : TriggerRequest + { + /// + /// The name of the job that this event belongs to + /// + public string JobName { get; private set; } + + public T Data { get; private set; } + + /// + /// Construct an event request + /// + /// The name of the job that this event belongs to + /// the event payload + public JobRequest(string jobName, JobData job) : base() + { + this.JobName = jobName; + this.Data = Struct.ToJsonSerializable(job.Struct); + } + } + + /// + /// Represents the results of processing an event. + /// + public class JobResponse : TriggerResponse + { + /// + /// Indicates whether the event was successfully processed. + /// + /// If this value is false, the event may be resent. + /// + public bool Success { get; set; } + + /// + /// Construct an event response. + /// + /// Indicates whether the event was successfully processed. + public JobResponse(bool success) + { + this.Success = success; + } + } + + /// + /// Represents the request/response context for an event. + /// + public class JobContext : TriggerContext, JobResponse> + { + /// + /// Construct a new EventContext. + /// + /// The request object + /// The response object + public JobContext(string id, JobRequest req, JobResponse res) : base(id, req, res) + { + } + + /// + /// Construct an event topic from a trigger request gRPC object. + /// + /// The trigger to convert into an EventContext. + /// the new event context + internal static JobContext FromRequest(ServerMessage trigger) + { + return new JobContext(trigger.Id, new JobRequest(trigger.JobRequest.JobName, trigger.JobRequest.Data), + new JobResponse(true)); + } + + /// + /// Create a gRPC trigger response from this context. + /// + /// + internal ClientMessage ToResponse() + { + return new ClientMessage + { + Id = Id, + JobResponse = new ProtoMessageResponse { Success = Res.Success }, + }; + } + } +} diff --git a/src/Nitric.Sdk/Worker/JobWorker.cs b/src/Nitric.Sdk/Worker/JobWorker.cs new file mode 100644 index 0000000..e48b4a4 --- /dev/null +++ b/src/Nitric.Sdk/Worker/JobWorker.cs @@ -0,0 +1,69 @@ +// Copyright 2021, Nitric Technologies Pty Ltd. +// +// 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. + +using System.Threading; +using System.Threading.Tasks; +using Nitric.Sdk.Common; +using Nitric.Proto.Batch.v1; +using GrpcClient = Nitric.Proto.Batch.v1.Job.JobClient; +using Nitric.Sdk.Service; +using System; + +namespace Nitric.Sdk.Worker +{ + public class JobWorker : AbstractWorker> + { + readonly private RegistrationRequest RegistrationRequest; + public GrpcClient GrpcClient { private get; set; } + + public JobWorker(RegistrationRequest request, Func, JobContext> middleware) : base(middleware) + { + this.RegistrationRequest = request; + this.GrpcClient = new GrpcClient(GrpcChannelProvider.GetChannel()); + } + + public override async Task Start(CancellationToken cancellationToken = default) + { + var stream = this.GrpcClient.HandleJob(); + + await stream.RequestStream.WriteAsync(new ClientMessage { RegistrationRequest = RegistrationRequest }); + + while (await stream.ResponseStream.MoveNext(cancellationToken)) + { + var req = stream.ResponseStream.Current; + + if (req.JobRequest != null) + { + var ctx = JobContext.FromRequest(req); + + try + { + ctx = this.Middleware(ctx); + } + catch (Exception) + { + ctx.Res.Success = false; + } + + await stream.RequestStream.WriteAsync(ctx.ToResponse()); + } + + cancellationToken.ThrowIfCancellationRequested(); + } + + await stream.RequestStream.CompleteAsync(); + } + } +} + From c7cce17a5903da519a81045601ba4f3875d011a1 Mon Sep 17 00:00:00 2001 From: Ryan Cartwright Date: Thu, 6 Mar 2025 22:59:34 +1100 Subject: [PATCH 21/34] add generic to batch jobs --- src/Nitric.Sdk/Nitric.cs | 8 ++++---- src/Nitric.Sdk/Resource/ApiResource.cs | 2 +- src/Nitric.Sdk/Resource/BatchResource.cs | 2 +- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/src/Nitric.Sdk/Nitric.cs b/src/Nitric.Sdk/Nitric.cs index e6660ca..817900c 100644 --- a/src/Nitric.Sdk/Nitric.cs +++ b/src/Nitric.Sdk/Nitric.cs @@ -154,10 +154,10 @@ public static OidcScopes OidcRule(string name, string issuer, string[] audiences public static SqlResource Sql(string name, string migrations = "") => Register(name, t => new SqlResource(t, migrations)); /// - /// Declare a websocket resource for bidirectional HTTP communication. + /// Declare a batch resource for long-running compute jobs. /// - /// The unique name of the websocket within this application. - /// A websocket resource, if the name has already been declared the same resource will be returned. - public static JobResource Job(string name) => Register(name, t => new JobResource(t)); + /// The unique name of the job within this application. + /// A job resource, if the name has already been declared the same resource will be returned. + public static JobResource Job(string name) => Register(name, t => new JobResource(t)); } } diff --git a/src/Nitric.Sdk/Resource/ApiResource.cs b/src/Nitric.Sdk/Resource/ApiResource.cs index ca75e5b..2f4e692 100644 --- a/src/Nitric.Sdk/Resource/ApiResource.cs +++ b/src/Nitric.Sdk/Resource/ApiResource.cs @@ -339,7 +339,7 @@ HttpContext ComposedMiddleware(HttpContext context, Func Allow(JobPermission permission, params JobPermission[] permissions this.RegisterPolicy(allPerms); - return BatchClient.Job(this.Name); + return new BatchClient().Job(this.Name); } } } From f6901c5abb5859cd24e3f46e53c7491aa6354244 Mon Sep 17 00:00:00 2001 From: Ryan Cartwright Date: Fri, 7 Mar 2025 14:41:15 +1100 Subject: [PATCH 22/34] remove API overloads with params to reduce typing issues --- src/Nitric.Sdk/Nitric.Sdk.csproj | 2 +- src/Nitric.Sdk/Resource/ApiResource.cs | 104 ++----------------- src/Nitric.Sdk/Resource/WebsocketResource.cs | 1 + 3 files changed, 12 insertions(+), 95 deletions(-) diff --git a/src/Nitric.Sdk/Nitric.Sdk.csproj b/src/Nitric.Sdk/Nitric.Sdk.csproj index f54a641..01c777b 100644 --- a/src/Nitric.Sdk/Nitric.Sdk.csproj +++ b/src/Nitric.Sdk/Nitric.Sdk.csproj @@ -1,7 +1,7 @@ netstandard2.1 - 1.0.0-a + 1.0.0 Nitric.Sdk Nitric Pty Ltd LICENSE.txt diff --git a/src/Nitric.Sdk/Resource/ApiResource.cs b/src/Nitric.Sdk/Resource/ApiResource.cs index 2f4e692..9508eb6 100644 --- a/src/Nitric.Sdk/Resource/ApiResource.cs +++ b/src/Nitric.Sdk/Resource/ApiResource.cs @@ -66,27 +66,13 @@ internal void AttachOidc(OidcOptions opts) Nitric.Register(oidcName, _ => new OidcResource(oidcName, this.Name, opts)); } - /// - /// Create a new GET handler on the specified route. - /// - /// The path to match on. - /// The handler to run. - public void Get(string route, Func handler) => Route(route).Get(handler); - - /// - /// Create a new GET handler on the specified route. - /// - /// The path to match on. - /// The handler to run. - public void Get(string route, Middleware[] handlers) => Route(route).Get(handlers); - /// /// Create a new GET handler on the specified route. /// /// The path to match on. /// The handler to run. /// Security rules to override API-level security. - public void Get(string route, Func handler, OidcOptions[] security) => Route(route, new RouteOptions(security: security)).Get(handler); + public void Get(string route, Func handler, OidcOptions[] security = null) => Route(route, new RouteOptions(security: security)).Get(handler); /// /// Create a new GET handler on the specified route. @@ -94,21 +80,7 @@ internal void AttachOidc(OidcOptions opts) /// The path to match on. /// The handler to run. /// Security rules to override API-level security. - public void Get(string route, Middleware[] handlers, OidcOptions[] security) => Route(route, new RouteOptions(security: security)).Get(handlers); - - /// - /// Create a new POST handler on the specified route. - /// - /// The path to match on. - /// The handler to run. - public void Post(string route, Func handler) => Route(route).Post(handler); - - /// - /// Create a new POST handler on the specified route. - /// - /// The path to match on. - /// The handler to run. - public void Post(string route, Middleware[] handlers) => Route(route).Post(handlers); + public void Get(string route, Middleware[] handlers, OidcOptions[] security = null) => Route(route, new RouteOptions(security: security)).Get(handlers); /// /// Create a new POST handler on the specified route. @@ -116,7 +88,7 @@ internal void AttachOidc(OidcOptions opts) /// The path to match on. /// The handler to run. /// Security rules to override API-level security. - public void Post(string route, Func handler, OidcOptions[] security) => Route(route, new RouteOptions(security: security)).Post(handler); + public void Post(string route, Func handler, OidcOptions[] security = null) => Route(route, new RouteOptions(security: security)).Post(handler); /// /// Create a new POST handler on the specified route. @@ -124,21 +96,7 @@ internal void AttachOidc(OidcOptions opts) /// The path to match on. /// The handler to run. /// Security rules to override API-level security. - public void Post(string route, Middleware[] handlers, OidcOptions[] security) => Route(route, new RouteOptions(security: security)).Post(handlers); - - /// - /// Create a new PUT handler on the specified route. - /// - /// The path to match on. - /// The handler to run. - public void Put(string route, Func handler) => Route(route).Put(handler); - - /// - /// Create a new PUT handler on the specified route. - /// - /// The path to match on. - /// The handler to run. - public void Put(string route, params Middleware[] handlers) => Route(route).Put(handlers); + public void Post(string route, Middleware[] handlers, OidcOptions[] security = null) => Route(route, new RouteOptions(security: security)).Post(handlers); /// /// Create a new PUT handler on the specified route. @@ -146,7 +104,7 @@ internal void AttachOidc(OidcOptions opts) /// The path to match on. /// The handler to run. /// Security rules to override API-level security. - public void Put(string route, Func handler, OidcOptions[] security) => Route(route, new RouteOptions(security: security)).Put(handler); + public void Put(string route, Func handler, OidcOptions[] security = null) => Route(route, new RouteOptions(security: security)).Put(handler); /// /// Create a new PUT handler on the specified route. @@ -154,21 +112,7 @@ internal void AttachOidc(OidcOptions opts) /// The path to match on. /// The handler to run. /// Security rules to override API-level security. - public void Put(string route, Middleware[] handlers, OidcOptions[] security) => Route(route, new RouteOptions(security: security)).Put(handlers); - - /// - /// Create a new DELETE handler on the specified route. - /// - /// The path to match on. - /// The handler to run. - public void Delete(string route, Func handler) => Route(route).Delete(handler); - - /// - /// Create a new DELETE handler on the specified route. - /// - /// The path to match on. - /// The handler to run. - public void Delete(string route, params Middleware[] handlers) => Route(route).Delete(handlers); + public void Put(string route, Middleware[] handlers, OidcOptions[] security = null) => Route(route, new RouteOptions(security: security)).Put(handlers); /// /// Create a new DELETE handler on the specified route. @@ -186,27 +130,13 @@ internal void AttachOidc(OidcOptions opts) /// Security rules to override API-level security. public void Delete(string route, Middleware[] handlers, OidcOptions[] security = null) => Route(route, new RouteOptions(security: security)).Delete(handlers); - /// - /// Create a new OPTIONS handler on the specified route. - /// - /// The path to match on. - /// The handler to run. - public void Options(string route, Func handler) => Route(route).Options(handler); - - /// - /// Create a new OPTIONS handler on the specified route. - /// - /// The path to match on. - /// The handler to run. - public void Options(string route, params Middleware[] handlers) => Route(route).Options(handlers); - /// /// Create a new OPTIONS handler on the specified route. /// /// The path to match on. /// The handler to run. /// Security rules to override API-level security. - public void Options(string route, Func handler, OidcOptions[] security) => Route(route, new RouteOptions(security: security)).Options(handler); + public void Options(string route, Func handler, OidcOptions[] security = null) => Route(route, new RouteOptions(security: security)).Options(handler); /// /// Create a new OPTIONS handler on the specified route. @@ -214,21 +144,7 @@ internal void AttachOidc(OidcOptions opts) /// The path to match on. /// The handler to run. /// Security rules to override API-level security. - public void Options(string route, Middleware[] handlers, OidcOptions[] security) => Route(route, new RouteOptions(security: security)).Options(handlers); - - /// - /// Create a new handler on the specified route for every HTTP verb. - /// - /// The path to match on. - /// The handler to run. - public void All(string route, Func handler) => Route(route).All(handler); - - /// - /// Create a new handler on the specified route for every HTTP verb. - /// - /// The path to match on. - /// The handler to run. - public void All(string route, params Middleware[] handlers) => Route(route).All(handlers); + public void Options(string route, Middleware[] handlers, OidcOptions[] security = null) => Route(route, new RouteOptions(security: security)).Options(handlers); /// /// Create a new handler on the specified route for every HTTP verb. @@ -236,7 +152,7 @@ internal void AttachOidc(OidcOptions opts) /// The path to match on. /// The handler to run. /// Security rules to override API-level security. - public void All(string route, Func handler, OidcOptions[] security) => Route(route, new RouteOptions(security: security)).All(handler); + public void All(string route, Func handler, OidcOptions[] security = null) => Route(route, new RouteOptions(security: security)).All(handler); /// /// Create a new handler on the specified route for every HTTP verb. @@ -244,7 +160,7 @@ internal void AttachOidc(OidcOptions opts) /// The path to match on. /// The handler to run. /// Security rules to override API-level security. - public void All(string route, Middleware[] handlers, OidcOptions[] security) => Route(route, new RouteOptions(security)).All(handlers); + public void All(string route, Middleware[] handlers, OidcOptions[] security = null) => Route(route, new RouteOptions(security)).All(handlers); /// /// Create a new route on a specified path. diff --git a/src/Nitric.Sdk/Resource/WebsocketResource.cs b/src/Nitric.Sdk/Resource/WebsocketResource.cs index f6f3b3c..ecb194d 100644 --- a/src/Nitric.Sdk/Resource/WebsocketResource.cs +++ b/src/Nitric.Sdk/Resource/WebsocketResource.cs @@ -23,6 +23,7 @@ using GrpcClient = Nitric.Proto.Websockets.v1.Websocket.WebsocketClient; using Nitric.Sdk.Worker; using Nitric.Proto.Websockets.v1; +using System.Threading.Tasks; namespace Nitric.Sdk.Resource { From b1c5b47acfedc24cb03918f2fea69c1f25b5366a Mon Sep 17 00:00:00 2001 From: Rak Siva Date: Mon, 10 Mar 2025 11:44:28 -0600 Subject: [PATCH 23/34] fix the order that middleware is executed. --- src/Nitric.Sdk/Resource/ApiResource.cs | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/Nitric.Sdk/Resource/ApiResource.cs b/src/Nitric.Sdk/Resource/ApiResource.cs index 9508eb6..c174c7f 100644 --- a/src/Nitric.Sdk/Resource/ApiResource.cs +++ b/src/Nitric.Sdk/Resource/ApiResource.cs @@ -382,7 +382,9 @@ internal void Method(string route, HttpMethod[] methods, RouteOptions options, M registrationRequest.Methods.AddRange(methods.Select((method) => method.Method).ToHashSet()); - var apiWorker = new ApiWorker(registrationRequest, middlewares); + var orderedMiddlewares = middlewares.Reverse().ToArray(); + + var apiWorker = new ApiWorker(registrationRequest, orderedMiddlewares); Nitric.RegisterWorker(apiWorker); } From c055263c1a727377ad25f9b6b5df3197ab5d3f4a Mon Sep 17 00:00:00 2001 From: Rak Siva Date: Mon, 10 Mar 2025 14:29:50 -0600 Subject: [PATCH 24/34] fix route.all by assigning correct HttpMethods --- src/Nitric.Sdk/Resource/ApiResource.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/Nitric.Sdk/Resource/ApiResource.cs b/src/Nitric.Sdk/Resource/ApiResource.cs index c174c7f..20f51e6 100644 --- a/src/Nitric.Sdk/Resource/ApiResource.cs +++ b/src/Nitric.Sdk/Resource/ApiResource.cs @@ -350,13 +350,13 @@ private Middleware[] ConcatMiddleware(Middleware[] mid /// Create a new handler on the specified route for every HTTP verb. /// /// The handler to run. - public void All(Func handler) => Method(this.Path, (HttpMethod[])Enum.GetValues(typeof(HttpMethod)), this.Opts, ConcatMiddleware(handler)); + public void All(Func handler) => Method(this.Path, httpMethods, this.Opts, ConcatMiddleware(handler)); /// /// Create a new chain of middleware on the specified route for every HTTP verb. /// /// The handler to run. - public void All(params Middleware[] handlers) => Method(this.Path, (HttpMethod[])Enum.GetValues(typeof(HttpMethod)), this.Opts, ConcatMiddleware(handlers)); + public void All(params Middleware[] handlers) => Method(this.Path, httpMethods, this.Opts, ConcatMiddleware(handlers)); internal void Method(string route, HttpMethod[] methods, RouteOptions options, Middleware[] middlewares) { From 5258030dc7c24708f8a1dd20ca26a2c26fcef274 Mon Sep 17 00:00:00 2001 From: Ryan Cartwright Date: Mon, 31 Mar 2025 19:50:19 +1100 Subject: [PATCH 25/34] remove wrapper clients --- src/Nitric.Sdk/Job/BatchClient.cs | 53 ------------------- src/Nitric.Sdk/Job/Job.cs | 11 ++-- src/Nitric.Sdk/KeyValueStore/KeyValueStore.cs | 23 ++++---- .../KeyValueStore/KeyValueStoreClient.cs | 52 ------------------ src/Nitric.Sdk/Queue/Message.cs | 4 +- src/Nitric.Sdk/Queue/Queue.cs | 15 +++--- src/Nitric.Sdk/Queue/QueuesClient.cs | 53 ------------------- src/Nitric.Sdk/Resource/BatchResource.cs | 10 ++-- src/Nitric.Sdk/Resource/BucketResource.cs | 10 +++- .../Resource/KeyValueStoreResource.cs | 15 ++++-- src/Nitric.Sdk/Resource/QueueResource.cs | 12 +++-- src/Nitric.Sdk/Resource/SecretResource.cs | 15 ++++-- src/Nitric.Sdk/Resource/SqlResource.cs | 16 +++--- src/Nitric.Sdk/Resource/TopicResource.cs | 9 +++- src/Nitric.Sdk/Resource/WebsocketResource.cs | 21 +++++--- src/Nitric.Sdk/Secret/Secret.cs | 16 +++--- src/Nitric.Sdk/Secret/SecretVersion.cs | 4 +- src/Nitric.Sdk/Secret/SecretsClient.cs | 53 ------------------- src/Nitric.Sdk/Storage/Bucket.cs | 12 ++--- src/Nitric.Sdk/Storage/File.cs | 22 ++++---- src/Nitric.Sdk/Storage/StorageClient.cs | 53 ------------------- src/Nitric.Sdk/Topics/Topic.cs | 13 ++--- src/Nitric.Sdk/Topics/TopicsClient.cs | 53 ------------------- src/Nitric.Sdk/Websocket/Connection.cs | 17 +++--- src/Nitric.Sdk/Websocket/WebsocketClient.cs | 44 --------------- test/Nitric.Sdk.Test/Test.cs | 20 +++++++ 26 files changed, 167 insertions(+), 459 deletions(-) delete mode 100644 src/Nitric.Sdk/Job/BatchClient.cs delete mode 100644 src/Nitric.Sdk/KeyValueStore/KeyValueStoreClient.cs delete mode 100644 src/Nitric.Sdk/Queue/QueuesClient.cs delete mode 100644 src/Nitric.Sdk/Secret/SecretsClient.cs delete mode 100644 src/Nitric.Sdk/Storage/StorageClient.cs delete mode 100644 src/Nitric.Sdk/Topics/TopicsClient.cs delete mode 100644 src/Nitric.Sdk/Websocket/WebsocketClient.cs create mode 100644 test/Nitric.Sdk.Test/Test.cs diff --git a/src/Nitric.Sdk/Job/BatchClient.cs b/src/Nitric.Sdk/Job/BatchClient.cs deleted file mode 100644 index da125fe..0000000 --- a/src/Nitric.Sdk/Job/BatchClient.cs +++ /dev/null @@ -1,53 +0,0 @@ -// Copyright 2021, Nitric Technologies Pty Ltd. -// -// 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. - -using System; -using Nitric.Sdk.Common; -using GrpcClient = Nitric.Proto.Batch.v1.Batch.BatchClient; - -namespace Nitric.Sdk.Job -{ - /// - /// A batch client. - /// - public class BatchClient - { - internal readonly GrpcClient Client; - - /// - /// Create a new batch client. - /// - /// Optional internal gRPC client to reuse. - public BatchClient(GrpcClient client = null) - { - this.Client = client ?? new GrpcClient(GrpcChannelProvider.GetChannel()); - } - - /// - /// Create a reference to a job in a batch service. - /// - /// The name of the job. - /// The new job reference. - /// - public Job Job(string jobName) - { - if (string.IsNullOrEmpty(jobName)) - { - throw new ArgumentNullException(nameof(jobName)); - } - - return new Job(this, jobName); - } - } -} diff --git a/src/Nitric.Sdk/Job/Job.cs b/src/Nitric.Sdk/Job/Job.cs index 5c9f92a..41a1ca6 100644 --- a/src/Nitric.Sdk/Job/Job.cs +++ b/src/Nitric.Sdk/Job/Job.cs @@ -14,6 +14,7 @@ using Nitric.Proto.Batch.v1; using Nitric.Sdk.Common; +using GrpcClient = Nitric.Proto.Batch.v1.Batch.BatchClient; namespace Nitric.Sdk.Job { @@ -22,16 +23,16 @@ namespace Nitric.Sdk.Job /// public class Job { - internal readonly BatchClient Batch; + internal readonly GrpcClient Client; /// /// The name of the job. /// public string Name { get; private set; } - internal Job(BatchClient batch, string name) + internal Job(GrpcClient batchClient, string name) { - this.Batch = batch; + this.Client = batchClient; this.Name = name; } @@ -50,7 +51,7 @@ public void Submit(T data) }, }; - this.Batch.Client.SubmitJob(request); + this.Client.SubmitJob(request); } /// @@ -68,7 +69,7 @@ public async void SubmitAsync(T data) }, }; - await this.Batch.Client.SubmitJobAsync(request); + await this.Client.SubmitJobAsync(request); } /// diff --git a/src/Nitric.Sdk/KeyValueStore/KeyValueStore.cs b/src/Nitric.Sdk/KeyValueStore/KeyValueStore.cs index f822904..62cd332 100644 --- a/src/Nitric.Sdk/KeyValueStore/KeyValueStore.cs +++ b/src/Nitric.Sdk/KeyValueStore/KeyValueStore.cs @@ -12,21 +12,22 @@ // See the License for the specific language governing permissions and // limitations under the License. -using System.Threading; +using System.Threading; using System.Threading.Tasks; using Nitric.Proto.KvStore.v1; using Nitric.Sdk.Common; +using GrpcClient = Nitric.Proto.KvStore.v1.KvStore.KvStoreClient; namespace Nitric.Sdk.KeyValueStore { public class KeyValueStore { public string Name; - private readonly KeyValueStoreClient KeyValueClient; + private readonly GrpcClient Client; - public KeyValueStore(KeyValueStoreClient client, string name) + public KeyValueStore(GrpcClient client, string name) { - this.KeyValueClient = client; + this.Client = client; this.Name = name; } @@ -48,7 +49,7 @@ public T Get(string key) try { - var resp = KeyValueClient.Client.GetValue(request); + var resp = this.Client.GetValue(request); return Struct.ToJsonSerializable(resp.Value.Content); } @@ -76,7 +77,7 @@ public async Task GetAsync(string key) try { - var resp = await KeyValueClient.Client.GetValueAsync(request); + var resp = await this.Client.GetValueAsync(request); return Struct.ToJsonSerializable(resp.Value.Content); } @@ -105,7 +106,7 @@ public void Set(string key, T value) try { - KeyValueClient.Client.SetValue(request); + this.Client.SetValue(request); } catch (Grpc.Core.RpcException re) { @@ -132,7 +133,7 @@ public async Task SetAsync(string key, T value) try { - await KeyValueClient.Client.SetValueAsync(request); + await this.Client.SetValueAsync(request); } catch (Grpc.Core.RpcException re) { @@ -157,7 +158,7 @@ public void Delete(string key) try { - KeyValueClient.Client.DeleteKey(request); + this.Client.DeleteKey(request); } catch (Grpc.Core.RpcException re) { @@ -182,7 +183,7 @@ public async Task DeleteAsync(string key) try { - await KeyValueClient.Client.DeleteKeyAsync(request); + await this.Client.DeleteKeyAsync(request); } catch (Grpc.Core.RpcException re) { @@ -203,7 +204,7 @@ public KeyValueKeysResponseStream Keys(string prefix = "") try { - var resp = KeyValueClient.Client.ScanKeys(request); + var resp = this.Client.ScanKeys(request); return new KeyValueKeysResponseStream(resp.ResponseStream); diff --git a/src/Nitric.Sdk/KeyValueStore/KeyValueStoreClient.cs b/src/Nitric.Sdk/KeyValueStore/KeyValueStoreClient.cs deleted file mode 100644 index 3647373..0000000 --- a/src/Nitric.Sdk/KeyValueStore/KeyValueStoreClient.cs +++ /dev/null @@ -1,52 +0,0 @@ -// Copyright 2021, Nitric Technologies Pty Ltd. -// -// 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. - -using System; -using Nitric.Sdk.Common; -using GrpcClient = Nitric.Proto.KvStore.v1.KvStore.KvStoreClient; - -namespace Nitric.Sdk.KeyValueStore -{ - public class KeyValueStoreClient - { - /// - /// Construct a new key value client. - /// - /// Optional gRPC client to reuse. - internal readonly GrpcClient Client; - - public KeyValueStoreClient(GrpcClient client = null) - { - this.Client = client ?? new GrpcClient(GrpcChannelProvider.GetChannel()); - } - - /// - /// Create a reference to the key value store from the key value service. - /// - /// The key value store name - /// The expected type for values in the key value store. - /// The collection reference. - /// - public KeyValueStore KV(string name) - { - if (string.IsNullOrEmpty(name)) - { - throw new ArgumentNullException(nameof(name)); - } - - return new KeyValueStore(this, name); - } - } -} - diff --git a/src/Nitric.Sdk/Queue/Message.cs b/src/Nitric.Sdk/Queue/Message.cs index b55b8c1..03b3305 100644 --- a/src/Nitric.Sdk/Queue/Message.cs +++ b/src/Nitric.Sdk/Queue/Message.cs @@ -57,7 +57,7 @@ public void Complete() try { - Queue.Queues.Client.Complete(request); + Queue.Client.Complete(request); } catch (Grpc.Core.RpcException re) { @@ -80,7 +80,7 @@ public async Task CompleteAsync() try { - await Queue.Queues.Client.CompleteAsync(request); + await Queue.Client.CompleteAsync(request); } catch (Grpc.Core.RpcException re) { diff --git a/src/Nitric.Sdk/Queue/Queue.cs b/src/Nitric.Sdk/Queue/Queue.cs index 09c40c8..b71e519 100644 --- a/src/Nitric.Sdk/Queue/Queue.cs +++ b/src/Nitric.Sdk/Queue/Queue.cs @@ -17,6 +17,7 @@ using Nitric.Sdk.Common; using Nitric.Proto.Queues.v1; using System.Threading.Tasks; +using GrpcClient = Nitric.Proto.Queues.v1.Queues.QueuesClient; namespace Nitric.Sdk.Queue { @@ -30,12 +31,12 @@ public class Queue /// public string Name { get; internal set; } - internal readonly QueuesClient Queues; + internal readonly GrpcClient Client; - internal Queue(QueuesClient client, string name) + internal Queue(GrpcClient client, string name) { this.Name = name; - this.Queues = client; + this.Client = client; } /// @@ -68,7 +69,7 @@ public List> Enqueue(T task, params T[] tasks) try { - var response = Queues.Client.Enqueue(request); + var response = this.Client.Enqueue(request); return response.FailedMessages.Select(failedMessage => new FailedMessage { @@ -112,7 +113,7 @@ public async Task>> EnqueueAsync(T task, params T[] tasks) try { - var response = await Queues.Client.EnqueueAsync(request); + var response = await this.Client.EnqueueAsync(request); return response.FailedMessages.Select(failedMessage => new FailedMessage { @@ -145,7 +146,7 @@ public List> Dequeue(int depth = 1) try { - var response = this.Queues.Client.Dequeue(request); + var response = this.Client.Dequeue(request); return response.Messages.Select(message => new ReceivedMessage { @@ -179,7 +180,7 @@ public async Task>> DequeueAsync(int depth = 1) try { - var response = await this.Queues.Client.DequeueAsync(request); + var response = await this.Client.DequeueAsync(request); return response.Messages.Select(message => new ReceivedMessage { diff --git a/src/Nitric.Sdk/Queue/QueuesClient.cs b/src/Nitric.Sdk/Queue/QueuesClient.cs deleted file mode 100644 index 3903b13..0000000 --- a/src/Nitric.Sdk/Queue/QueuesClient.cs +++ /dev/null @@ -1,53 +0,0 @@ -// Copyright 2021, Nitric Technologies Pty Ltd. -// -// 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. - -using GrpcClient = Nitric.Proto.Queues.v1.Queues.QueuesClient; -using Nitric.Sdk.Common; -using System; - -namespace Nitric.Sdk.Queue -{ - /// - /// A queues service client. - /// - public class QueuesClient - { - internal GrpcClient Client { get; private set; } - - /// - /// Create a new queues service client. - /// - /// - public QueuesClient(GrpcClient client = null) - { - this.Client = client ?? new GrpcClient(GrpcChannelProvider.GetChannel()); - } - - /// - /// Create a reference to the queue in the queues service. - /// - /// The queue's name - /// A new queue reference for sending or receiving tasks. - /// - public Queue Queue(string queueName) - { - if (string.IsNullOrEmpty(queueName)) - { - throw new ArgumentNullException(nameof(queueName)); - } - - return new Queue(this, queueName); - } - } -} diff --git a/src/Nitric.Sdk/Resource/BatchResource.cs b/src/Nitric.Sdk/Resource/BatchResource.cs index 9b84fa8..069940e 100644 --- a/src/Nitric.Sdk/Resource/BatchResource.cs +++ b/src/Nitric.Sdk/Resource/BatchResource.cs @@ -21,6 +21,8 @@ using System.Collections.Generic; using Action = Nitric.Proto.Resources.v1.Action; using System.Linq; +using GrpcClient = Nitric.Proto.Batch.v1.Batch.BatchClient; +using Nitric.Sdk.Common; namespace Nitric.Sdk.Resource { @@ -64,9 +66,11 @@ public JobResourceRequirements(int cpus = 1, int memory = 1024, int gpus = 0) public class JobResource : SecureResource { - internal JobResource(string name) : base(name, ResourceType.Batch) - { + internal readonly GrpcClient Client; + internal JobResource(string name, GrpcClient client = null) : base(name, ResourceType.Batch) + { + this.Client = client ?? new GrpcClient(GrpcChannelProvider.GetChannel()); } internal override BaseResource Register() @@ -121,7 +125,7 @@ public Job Allow(JobPermission permission, params JobPermission[] permissions this.RegisterPolicy(allPerms); - return new BatchClient().Job(this.Name); + return new Job(this.Client, this.Name); } } } diff --git a/src/Nitric.Sdk/Resource/BucketResource.cs b/src/Nitric.Sdk/Resource/BucketResource.cs index 82f9d58..3685b59 100644 --- a/src/Nitric.Sdk/Resource/BucketResource.cs +++ b/src/Nitric.Sdk/Resource/BucketResource.cs @@ -21,6 +21,8 @@ using Nitric.Sdk.Worker; using Nitric.Proto.Storage.v1; using Action = Nitric.Proto.Resources.v1.Action; +using Nitric.Sdk.Common; +using GrpcClient = Nitric.Proto.Storage.v1.Storage.StorageClient; namespace Nitric.Sdk.Resource { @@ -45,8 +47,11 @@ public enum BucketPermission public class BucketResource : SecureResource { - internal BucketResource(string name) : base(name, ResourceType.Bucket) + internal readonly GrpcClient Client; + + internal BucketResource(string name, GrpcClient client = null) : base(name, ResourceType.Bucket) { + this.Client = client ?? new GrpcClient(GrpcChannelProvider.GetChannel()); } internal override BaseResource Register() @@ -131,7 +136,8 @@ public Bucket Allow(BucketPermission permission, params BucketPermission[] permi allPerms.AddRange(permissions); this.RegisterPolicy(allPerms); - return new StorageClient().Bucket(this.Name); + + return new Bucket(this.Client, this.Name); } } } diff --git a/src/Nitric.Sdk/Resource/KeyValueStoreResource.cs b/src/Nitric.Sdk/Resource/KeyValueStoreResource.cs index fdfe2c1..a01141c 100644 --- a/src/Nitric.Sdk/Resource/KeyValueStoreResource.cs +++ b/src/Nitric.Sdk/Resource/KeyValueStoreResource.cs @@ -17,6 +17,9 @@ using Nitric.Sdk.KeyValueStore; using Action = Nitric.Proto.Resources.v1.Action; using ResourceType = Nitric.Proto.Resources.v1.ResourceType; +using GrpcClient = Nitric.Proto.KvStore.v1.KvStore.KvStoreClient; +using Nitric.Sdk.Common; +using System; namespace Nitric.Sdk.Resource { @@ -39,10 +42,13 @@ public enum KeyValueStorePermission Delete, } - public class KeyValueStoreResource : SecureResource + public class KeyValueStoreResource : SecureResource { - internal KeyValueStoreResource(string name) : base(name, ResourceType.KeyValueStore) + internal readonly GrpcClient Client; + + internal KeyValueStoreResource(string name, GrpcClient client = null) : base(name, ResourceType.KeyValueStore) { + this.Client = client ?? new GrpcClient(GrpcChannelProvider.GetChannel()); } internal override BaseResource Register() @@ -73,13 +79,14 @@ protected override IEnumerable PermissionsToActions(IEnumerable Allow(KeyValueStorePermission permission, params KeyValueStorePermission[] permissions) + public KeyValueStore Allow(KeyValueStorePermission permission, params KeyValueStorePermission[] permissions) { var allPerms = new List { permission }; allPerms.AddRange(permissions); this.RegisterPolicy(allPerms); - return new KeyValueStoreClient().KV(this.Name); + + return new KeyValueStore(this.Client, this.Name); } } } diff --git a/src/Nitric.Sdk/Resource/QueueResource.cs b/src/Nitric.Sdk/Resource/QueueResource.cs index 79b969f..a81673d 100644 --- a/src/Nitric.Sdk/Resource/QueueResource.cs +++ b/src/Nitric.Sdk/Resource/QueueResource.cs @@ -11,12 +11,13 @@ // 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. +using System; using System.Collections.Generic; using System.Linq; using Nitric.Proto.Resources.v1; -using Nitric.Sdk.Queue; +using Nitric.Sdk.Common; using Action = Nitric.Proto.Resources.v1.Action; -using NitricResource = Nitric.Proto.Resources.v1.ResourceIdentifier; +using GrpcClient = Nitric.Proto.Queues.v1.Queues.QueuesClient; namespace Nitric.Sdk.Resource { @@ -37,8 +38,10 @@ public enum QueuePermission public class QueueResource : SecureResource { - internal QueueResource(string name) : base(name, ResourceType.Queue) + internal readonly GrpcClient Client; + internal QueueResource(string name, GrpcClient client = null) : base(name, ResourceType.Queue) { + this.Client = client ?? new GrpcClient(GrpcChannelProvider.GetChannel()); } internal override BaseResource Register() @@ -75,7 +78,8 @@ public Queue.Queue Allow(QueuePermission permission, params QueuePermission[] allPerms.AddRange(permissions); this.RegisterPolicy(allPerms); - return new QueuesClient().Queue(this.Name); + + return new Queue.Queue(this.Client, this.Name); } } } diff --git a/src/Nitric.Sdk/Resource/SecretResource.cs b/src/Nitric.Sdk/Resource/SecretResource.cs index 3fb7da6..5ebeada 100644 --- a/src/Nitric.Sdk/Resource/SecretResource.cs +++ b/src/Nitric.Sdk/Resource/SecretResource.cs @@ -11,11 +11,14 @@ // 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. +using System; using System.Collections.Generic; using System.Linq; using Nitric.Proto.Resources.v1; -using Nitric.Sdk.Secret; +using NitricSecret = Nitric.Sdk.Secret.Secret; using Action = Nitric.Proto.Resources.v1.Action; +using GrpcClient = Nitric.Proto.Secrets.v1.SecretManager.SecretManagerClient; +using Nitric.Sdk.Common; namespace Nitric.Sdk.Resource { @@ -36,8 +39,11 @@ public enum SecretPermission public class SecretResource : SecureResource { - internal SecretResource(string name) : base(name, ResourceType.Secret) + internal readonly GrpcClient Client; + + internal SecretResource(string name, GrpcClient client = null) : base(name, ResourceType.Secret) { + this.Client = client ?? new GrpcClient(GrpcChannelProvider.GetChannel()); } internal override BaseResource Register() @@ -63,13 +69,14 @@ protected override IEnumerable PermissionsToActions(IEnumerable)new List(), (acc, x) => acc.Concat(actionMap[x])).Distinct(); } - public Secret.Secret Allow(SecretPermission permission, params SecretPermission[] permissions) + public NitricSecret Allow(SecretPermission permission, params SecretPermission[] permissions) { var allPerms = new List { permission }; allPerms.AddRange(permissions); this.RegisterPolicy(allPerms); - return new SecretsClient().Secret(this.Name); + + return new NitricSecret(this.Client, this.Name); } } } diff --git a/src/Nitric.Sdk/Resource/SqlResource.cs b/src/Nitric.Sdk/Resource/SqlResource.cs index 6c81478..1e12d41 100644 --- a/src/Nitric.Sdk/Resource/SqlResource.cs +++ b/src/Nitric.Sdk/Resource/SqlResource.cs @@ -29,8 +29,8 @@ public class SqlResource : BaseResource internal SqlResource(string name, string migrations, GrpcClient client = null) : base(name, ResourceType.SqlDatabase) { - this.Client = client ?? new GrpcClient(GrpcChannelProvider.GetChannel()); - this.Migrations = migrations; + this.Client = client ?? new GrpcClient(GrpcChannelProvider.GetChannel()); + this.Migrations = migrations; } internal override BaseResource Register() @@ -56,11 +56,11 @@ internal override BaseResource Register() /// The connection string of this SQL Database public string ConnectionString() { - var request = new SqlConnectionStringRequest { DatabaseName = this.Name }; + var request = new SqlConnectionStringRequest { DatabaseName = this.Name }; - var resp = this.Client.ConnectionString(request); + var resp = this.Client.ConnectionString(request); - return resp.ConnectionString; + return resp.ConnectionString; } /// @@ -69,11 +69,11 @@ public string ConnectionString() /// The connection string of this SQL Database public async Task ConnectionStringAsync() { - var request = new SqlConnectionStringRequest { DatabaseName = this.Name }; + var request = new SqlConnectionStringRequest { DatabaseName = this.Name }; - var resp = await this.Client.ConnectionStringAsync(request); + var resp = await this.Client.ConnectionStringAsync(request); - return resp.ConnectionString; + return resp.ConnectionString; } } } diff --git a/src/Nitric.Sdk/Resource/TopicResource.cs b/src/Nitric.Sdk/Resource/TopicResource.cs index 1e1524b..eb831f2 100644 --- a/src/Nitric.Sdk/Resource/TopicResource.cs +++ b/src/Nitric.Sdk/Resource/TopicResource.cs @@ -16,11 +16,13 @@ using System.Linq; using Nitric.Proto.Resources.v1; using Nitric.Proto.Topics.v1; +using Nitric.Sdk.Common; using Nitric.Sdk.Service; using Nitric.Sdk.Topics; using Nitric.Sdk.Worker; using Action = Nitric.Proto.Resources.v1.Action; using ResourceType = Nitric.Proto.Resources.v1.ResourceType; +using GrpcClient = Nitric.Proto.Topics.v1.Topics.TopicsClient; namespace Nitric.Sdk.Resource { @@ -37,8 +39,11 @@ public enum TopicPermission public class TopicResource : SecureResource { - internal TopicResource(string name) : base(name, ResourceType.Topic) + internal readonly GrpcClient Client; + + internal TopicResource(string name, GrpcClient client = null) : base(name, ResourceType.Topic) { + this.Client = client ?? new GrpcClient(GrpcChannelProvider.GetChannel()); } internal override BaseResource Register() @@ -99,7 +104,7 @@ public Topic Allow(TopicPermission permission, params TopicPermission[] permi this.RegisterPolicy(allPerms); - return new TopicsClient().Topic(this.Name); + return new Topic(this.Client, this.Name); } } } diff --git a/src/Nitric.Sdk/Resource/WebsocketResource.cs b/src/Nitric.Sdk/Resource/WebsocketResource.cs index ecb194d..ca17b2e 100644 --- a/src/Nitric.Sdk/Resource/WebsocketResource.cs +++ b/src/Nitric.Sdk/Resource/WebsocketResource.cs @@ -23,7 +23,6 @@ using GrpcClient = Nitric.Proto.Websockets.v1.Websocket.WebsocketClient; using Nitric.Sdk.Worker; using Nitric.Proto.Websockets.v1; -using System.Threading.Tasks; namespace Nitric.Sdk.Resource { @@ -40,11 +39,11 @@ public enum WebsocketPermission public class WebsocketResource : SecureResource { - private readonly WebsocketClient wsClient; + private readonly GrpcClient Client; - internal WebsocketResource(string name) : base(name, ResourceType.Websocket) + internal WebsocketResource(string name, GrpcClient client = null) : base(name, ResourceType.Websocket) { - this.wsClient = new WebsocketClient(new GrpcClient(GrpcChannelProvider.GetChannel())); + this.Client = client ?? new GrpcClient(GrpcChannelProvider.GetChannel()); } internal override BaseResource Register() @@ -103,9 +102,19 @@ public void On(Service.WebsocketEventType eventType, Func /// The name of the secret. /// public readonly string Name; - internal Secret(SecretsClient client, string name) + internal Secret(GrpcClient client, string name) { - this.Secrets = client; + this.Client = client; this.Name = name; } @@ -86,10 +87,10 @@ public SecretVersion Put(string value) }; try { - var secretResponse = Secrets.Client.Put(request); + var secretResponse = this.Client.Put(request); return new SecretVersion( new Secret( - this.Secrets, + this.Client, secretResponse.SecretVersion.Secret.Name ), secretResponse.SecretVersion.Version @@ -120,12 +121,13 @@ public async Task PutAsync(string value) Secret = new Proto.Secrets.v1.Secret { Name = this.Name }, Value = Google.Protobuf.ByteString.CopyFrom(Encoding.UTF8.GetBytes(value)), }; + try { - var secretResponse = await Secrets.Client.PutAsync(request); + var secretResponse = await Client.PutAsync(request); return new SecretVersion( new Secret( - this.Secrets, + this.Client, secretResponse.SecretVersion.Secret.Name ), secretResponse.SecretVersion.Version diff --git a/src/Nitric.Sdk/Secret/SecretVersion.cs b/src/Nitric.Sdk/Secret/SecretVersion.cs index 6f51304..021e593 100644 --- a/src/Nitric.Sdk/Secret/SecretVersion.cs +++ b/src/Nitric.Sdk/Secret/SecretVersion.cs @@ -58,7 +58,7 @@ public SecretValue Access() try { - var response = this.Secret.Secrets.Client.Access(secret); + var response = this.Secret.Client.Access(secret); var value = response.Value.ToByteArray(); //Return a new secret value with a reference to this secret version return new SecretValue( @@ -90,7 +90,7 @@ public async Task AccessAsync() try { - var response = await this.Secret.Secrets.Client.AccessAsync(secret); + var response = await this.Secret.Client.AccessAsync(secret); var value = response.Value.ToByteArray(); //Return a new secret value with a reference to this secret version diff --git a/src/Nitric.Sdk/Secret/SecretsClient.cs b/src/Nitric.Sdk/Secret/SecretsClient.cs deleted file mode 100644 index 80e3c9c..0000000 --- a/src/Nitric.Sdk/Secret/SecretsClient.cs +++ /dev/null @@ -1,53 +0,0 @@ -// Copyright 2021, Nitric Technologies Pty Ltd. -// -// 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. - -using System; -using Nitric.Sdk.Common; -using GrpcClient = Nitric.Proto.Secrets.v1.SecretManager.SecretManagerClient; - -namespace Nitric.Sdk.Secret -{ - /// - /// The secrets service client. - /// - public class SecretsClient - { - internal readonly GrpcClient Client; - - /// - /// Create a new secrets service client. - /// - /// - public SecretsClient(GrpcClient client = null) - { - this.Client = client ?? new GrpcClient(GrpcChannelProvider.GetChannel()); - } - - /// - /// Create a reference to a specific secret in the secret store. - /// - /// The name of the secret - /// The secret reference. - /// - public Secret Secret(string name) - { - if (string.IsNullOrEmpty(name)) - { - throw new ArgumentNullException(nameof(name)); - } - - return new Secret(this, name); - } - } -} diff --git a/src/Nitric.Sdk/Storage/Bucket.cs b/src/Nitric.Sdk/Storage/Bucket.cs index 79acbf2..a73dfa2 100644 --- a/src/Nitric.Sdk/Storage/Bucket.cs +++ b/src/Nitric.Sdk/Storage/Bucket.cs @@ -19,7 +19,7 @@ using Nitric.Sdk.Service; using Nitric.Sdk.Worker; using ProtoBlob = Nitric.Proto.Storage.v1.Blob; - +using GrpcClient = Nitric.Proto.Storage.v1.Storage.StorageClient; namespace Nitric.Sdk.Storage { @@ -28,16 +28,16 @@ namespace Nitric.Sdk.Storage /// public class Bucket { - internal readonly StorageClient Storage; + internal readonly GrpcClient Client; /// /// The name of the bucket. /// public string Name { get; private set; } - internal Bucket(StorageClient storage, string name) + internal Bucket(GrpcClient client, string name) { - this.Storage = storage; + this.Client = client; this.Name = name; } @@ -72,7 +72,7 @@ public List Files(string prefix = "") try { - var resp = this.Storage.Client.ListBlobs(request); + var resp = this.Client.ListBlobs(request); var files = new List(); @@ -104,7 +104,7 @@ public async Task> FilesAsync(string prefix = "") try { - var resp = await this.Storage.Client.ListBlobsAsync(request); + var resp = await this.Client.ListBlobsAsync(request); var files = new List(); diff --git a/src/Nitric.Sdk/Storage/File.cs b/src/Nitric.Sdk/Storage/File.cs index 11e76c0..fe087b7 100644 --- a/src/Nitric.Sdk/Storage/File.cs +++ b/src/Nitric.Sdk/Storage/File.cs @@ -12,7 +12,7 @@ // See the License for the specific language governing permissions and // limitations under the License. -using System; +using System; using System.Threading.Tasks; using Google.Protobuf; using Google.Protobuf.WellKnownTypes; @@ -66,7 +66,7 @@ public void Write(byte[] body) }; try { - this.Bucket.Storage.Client.Write(request); + this.Bucket.Client.Write(request); } catch (Grpc.Core.RpcException re) { @@ -89,7 +89,7 @@ public void Write(string body) }; try { - this.Bucket.Storage.Client.Write(request); + this.Bucket.Client.Write(request); } catch (Grpc.Core.RpcException re) { @@ -112,7 +112,7 @@ public async Task WriteAsync(byte[] body) }; try { - await this.Bucket.Storage.Client.WriteAsync(request); + await this.Bucket.Client.WriteAsync(request); } catch (Grpc.Core.RpcException re) { @@ -135,7 +135,7 @@ public async Task WriteAsync(string body) }; try { - await this.Bucket.Storage.Client.WriteAsync(request); + await this.Bucket.Client.WriteAsync(request); } catch (Grpc.Core.RpcException re) { @@ -157,7 +157,7 @@ public byte[] Read() }; try { - var response = this.Bucket.Storage.Client.Read(request); + var response = this.Bucket.Client.Read(request); return response.Body.ToByteArray(); } catch (Grpc.Core.RpcException re) @@ -180,7 +180,7 @@ public async Task ReadAsync() }; try { - var response = await this.Bucket.Storage.Client.ReadAsync(request); + var response = await this.Bucket.Client.ReadAsync(request); return response.Body.ToByteArray(); } catch (Grpc.Core.RpcException re) @@ -202,7 +202,7 @@ public void Delete() }; try { - this.Bucket.Storage.Client.Delete(request); + this.Bucket.Client.Delete(request); } catch (Grpc.Core.RpcException re) { @@ -223,7 +223,7 @@ public async Task DeleteAsync() }; try { - await this.Bucket.Storage.Client.DeleteAsync(request); + await this.Bucket.Client.DeleteAsync(request); } catch (Grpc.Core.RpcException re) { @@ -272,7 +272,7 @@ internal string PreSignUrl(SignedMode mode, int expiry) try { - var resp = this.Bucket.Storage.Client.PreSignUrl(request); + var resp = this.Bucket.Client.PreSignUrl(request); return resp.Url; } catch (Grpc.Core.RpcException re) @@ -323,7 +323,7 @@ internal async Task PreSignUrlAsync(SignedMode mode, int expiry) try { - var resp = await this.Bucket.Storage.Client.PreSignUrlAsync(request); + var resp = await this.Bucket.Client.PreSignUrlAsync(request); return resp.Url; } catch (Grpc.Core.RpcException re) diff --git a/src/Nitric.Sdk/Storage/StorageClient.cs b/src/Nitric.Sdk/Storage/StorageClient.cs deleted file mode 100644 index 541ce7b..0000000 --- a/src/Nitric.Sdk/Storage/StorageClient.cs +++ /dev/null @@ -1,53 +0,0 @@ -// Copyright 2021, Nitric Technologies Pty Ltd. -// -// 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. - -using System; -using Nitric.Sdk.Common; -using GrpcClient = Nitric.Proto.Storage.v1.Storage.StorageClient; - -namespace Nitric.Sdk.Storage -{ - /// - /// A storage client. - /// - public class StorageClient - { - internal readonly GrpcClient Client; - - /// - /// Create a new storage client. - /// - /// Optional internal gRPC client to reuse. - public StorageClient(GrpcClient client = null) - { - this.Client = client ?? new GrpcClient(GrpcChannelProvider.GetChannel()); - } - - /// - /// Create a reference to a bucket in the storage service. - /// - /// The name of the bucket. - /// The new bucket reference. - /// - public Bucket Bucket(string bucketName) - { - if (string.IsNullOrEmpty(bucketName)) - { - throw new ArgumentNullException(nameof(bucketName)); - } - - return new Bucket(this, bucketName); - } - } -} diff --git a/src/Nitric.Sdk/Topics/Topic.cs b/src/Nitric.Sdk/Topics/Topic.cs index d211e88..a58288f 100644 --- a/src/Nitric.Sdk/Topics/Topic.cs +++ b/src/Nitric.Sdk/Topics/Topic.cs @@ -12,9 +12,10 @@ // See the License for the specific language governing permissions and // limitations under the License. -using System.Threading.Tasks; +using System.Threading.Tasks; using Nitric.Proto.Topics.v1; using Nitric.Sdk.Common; +using GrpcClient = Nitric.Proto.Topics.v1.Topics.TopicsClient; namespace Nitric.Sdk.Topics { @@ -23,15 +24,15 @@ namespace Nitric.Sdk.Topics /// public class Topic { - private readonly TopicsClient TopicsClient; + private readonly GrpcClient Client; /// /// The name of topic. /// public string Name { get; private set; } - internal Topic(TopicsClient TopicsClient, string name) + internal Topic(GrpcClient client, string name) { - this.TopicsClient = TopicsClient; + this.Client = client; this.Name = name; } @@ -52,7 +53,7 @@ public void Publish(T message) try { - this.TopicsClient.Client.Publish(request); + this.Client.Publish(request); } catch (Grpc.Core.RpcException re) { @@ -77,7 +78,7 @@ public async Task PublishAsync(T message) try { - await this.TopicsClient.Client.PublishAsync(request); + await this.Client.PublishAsync(request); } catch (Grpc.Core.RpcException re) { diff --git a/src/Nitric.Sdk/Topics/TopicsClient.cs b/src/Nitric.Sdk/Topics/TopicsClient.cs deleted file mode 100644 index 8965137..0000000 --- a/src/Nitric.Sdk/Topics/TopicsClient.cs +++ /dev/null @@ -1,53 +0,0 @@ -// Copyright 2021, Nitric Technologies Pty Ltd. -// -// 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. - -using System; -using Nitric.Sdk.Common; -using TopicsGrpcClient = Nitric.Proto.Topics.v1.Topics.TopicsClient; - -namespace Nitric.Sdk.Topics -{ - /// - /// Events service client. - /// - public class TopicsClient - { - internal readonly TopicsGrpcClient Client; - - /// - /// Create a new events service client. - /// - /// The topics gRPC client. - public TopicsClient(TopicsGrpcClient topic = null) - { - this.Client = topic ?? new TopicsGrpcClient(GrpcChannelProvider.GetChannel()); - } - - /// - /// Create a reference to a topic. - /// - /// The name of the topic. - /// The topic reference. - /// - public Topic Topic(string topicName) - { - if (string.IsNullOrEmpty(topicName)) - { - throw new ArgumentNullException(nameof(topicName)); - } - - return new Topic(this, topicName); - } - } -} diff --git a/src/Nitric.Sdk/Websocket/Connection.cs b/src/Nitric.Sdk/Websocket/Connection.cs index b8b1e8c..127effe 100644 --- a/src/Nitric.Sdk/Websocket/Connection.cs +++ b/src/Nitric.Sdk/Websocket/Connection.cs @@ -11,11 +11,12 @@ // 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. -using System.Threading.Tasks; +using System.Threading.Tasks; using Google.Protobuf; using Grpc.Core; using Nitric.Proto.Websockets.v1; using Nitric.Sdk.Common; +using GrpcClient = Nitric.Proto.Websockets.v1.Websocket.WebsocketClient; namespace Nitric.Sdk.Websocket { @@ -28,11 +29,11 @@ public class Connection public string SocketName { get; set; } - private readonly WebsocketClient Websocket; + private readonly GrpcClient Client; - internal Connection(WebsocketClient websocket, string connectionId, string socketName) + internal Connection(GrpcClient client, string connectionId, string socketName) { - this.Websocket = websocket; + this.Client = client; this.Id = connectionId; this.SocketName = socketName; } @@ -51,7 +52,7 @@ public void SendMessage(string message) }; try { - this.Websocket.Client.SendMessage(request); + this.Client.SendMessage(request); } catch (RpcException e) { @@ -73,7 +74,7 @@ public async Task SendMessageAsync(string message) }; try { - await this.Websocket.Client.SendMessageAsync(request); + await this.Client.SendMessageAsync(request); } catch (RpcException e) { @@ -94,7 +95,7 @@ public void CloseConnection() try { - this.Websocket.Client.CloseConnection(request); + this.Client.CloseConnection(request); } catch (RpcException e) { @@ -115,7 +116,7 @@ public async Task CloseConnectionAsync() try { - await this.Websocket.Client.CloseConnectionAsync(request); + await this.Client.CloseConnectionAsync(request); } catch (RpcException e) { diff --git a/src/Nitric.Sdk/Websocket/WebsocketClient.cs b/src/Nitric.Sdk/Websocket/WebsocketClient.cs deleted file mode 100644 index 8be6825..0000000 --- a/src/Nitric.Sdk/Websocket/WebsocketClient.cs +++ /dev/null @@ -1,44 +0,0 @@ -// Copyright 2021, Nitric Technologies Pty Ltd. -// -// 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. -using System; -using Nitric.Sdk.Common; -using GrpcClient = Nitric.Proto.Websockets.v1.Websocket.WebsocketClient; - -namespace Nitric.Sdk.Websocket -{ - public class WebsocketClient - { - internal readonly GrpcClient Client; - - public WebsocketClient(GrpcClient client = null) - { - this.Client = client ?? new GrpcClient(GrpcChannelProvider.GetChannel()); - } - - public Connection Connection(string socket, string connectionId) - { - if (string.IsNullOrEmpty(socket)) - { - throw new ArgumentNullException(nameof(socket)); - } - - if (string.IsNullOrEmpty(connectionId)) - { - throw new ArgumentNullException(nameof(connectionId)); - } - - return new Connection(this, connectionId, socket); - } - } -} diff --git a/test/Nitric.Sdk.Test/Test.cs b/test/Nitric.Sdk.Test/Test.cs new file mode 100644 index 0000000..1c5f02a --- /dev/null +++ b/test/Nitric.Sdk.Test/Test.cs @@ -0,0 +1,20 @@ +using Nitric.Sdk.Service; +using Application = Nitric.Sdk.Nitric; + +private WebsocketContext ValidateRequest(WebsocketContext ctx, Func next) +{ + // Validate Request + return next(ctx); +} + +private WebsocketContext HandleRequest(WebsocketContext ctx, Func next) +{ + // Handle Request + return next(ctx); +} + +var websocket = Application.Websocket("public"); + +websocket.On(WebsocketEventType.Message, ValidateRequest, HandleRequest); + +Application.Run(); \ No newline at end of file From a0a81ad185ebb84b73dec37b2da7e7d0eb18fb50 Mon Sep 17 00:00:00 2001 From: Ryan Cartwright Date: Wed, 2 Apr 2025 12:48:04 +1100 Subject: [PATCH 26/34] format fix and update workflow files --- .github/workflows/dotnet-test.yml | 2 +- .github/workflows/draft-release.yml | 54 ++++++++++++------------ .github/workflows/publish-on-release.yml | 2 +- src/Nitric.Sdk/Job/Job.cs | 4 +- src/Nitric.Sdk/Resource/OidcResource.cs | 2 +- src/Nitric.Sdk/Service/HttpContext.cs | 8 ++-- 6 files changed, 37 insertions(+), 35 deletions(-) diff --git a/.github/workflows/dotnet-test.yml b/.github/workflows/dotnet-test.yml index ce92762..cff5283 100644 --- a/.github/workflows/dotnet-test.yml +++ b/.github/workflows/dotnet-test.yml @@ -24,7 +24,7 @@ jobs: - name: Setup .NET uses: actions/setup-dotnet@v1 with: - dotnet-version: 6.0.x + dotnet-version: 7.0.x - name: Find and Replace Version templates run: | sed -i.bak 's/${VERSION}/0.0.1/g' src/Nitric.Sdk/Nitric.Sdk.csproj diff --git a/.github/workflows/draft-release.yml b/.github/workflows/draft-release.yml index 523468f..377ae77 100644 --- a/.github/workflows/draft-release.yml +++ b/.github/workflows/draft-release.yml @@ -4,37 +4,37 @@ on: pull_request: types: [closed] branches: - - 'main' + - "main" jobs: version: if: github.event.pull_request.merged == true runs-on: ubuntu-latest steps: - - name: Checkout - uses: actions/checkout@v2 - - name: Setup Dotnet - uses: actions/setup-dotnet@v1 - with: - dotnet-version: 5.0.x - - name: Git Identity - run: | - git config --global user.name 'github-actions[bot]' - git config --global user.email 'github-actions[bot]@users.noreply.github.com' - - name: Bump version and push tag - id: tag_version - uses: mathieudutour/github-tag-action@v5.5 - with: - github_token: ${{ secrets.GITHUB_TOKEN }} + - name: Checkout + uses: actions/checkout@v2 + - name: Setup Dotnet + uses: actions/setup-dotnet@v1 + with: + dotnet-version: 7.0.x + - name: Git Identity + run: | + git config --global user.name 'github-actions[bot]' + git config --global user.email 'github-actions[bot]@users.noreply.github.com' + - name: Bump version and push tag + id: tag_version + uses: mathieudutour/github-tag-action@v5.5 + with: + github_token: ${{ secrets.GITHUB_TOKEN }} - - name: Create Draft Release - id: create_release - uses: actions/create-release@v1 - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - with: - tag_name: ${{ steps.tag_version.outputs.new_tag }} - release_name: Release ${{ steps.tag_version.outputs.new_tag }} - body: See CHANGELOG.md for changes - draft: true - prerelease: false \ No newline at end of file + - name: Create Draft Release + id: create_release + uses: actions/create-release@v1 + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + with: + tag_name: ${{ steps.tag_version.outputs.new_tag }} + release_name: Release ${{ steps.tag_version.outputs.new_tag }} + body: See CHANGELOG.md for changes + draft: true + prerelease: false diff --git a/.github/workflows/publish-on-release.yml b/.github/workflows/publish-on-release.yml index 9d18bc3..b5804f8 100644 --- a/.github/workflows/publish-on-release.yml +++ b/.github/workflows/publish-on-release.yml @@ -18,7 +18,7 @@ jobs: uses: actions/setup-dotnet@v1 with: source-url: https://api.nuget.org/v3/index.json - dotnet-version: 5.0.x + dotnet-version: 7.0.x env: NUGET_AUTH_TOKEN: ${{ secrets.NUGET_TOKEN }} - name: Normalize version string diff --git a/src/Nitric.Sdk/Job/Job.cs b/src/Nitric.Sdk/Job/Job.cs index 41a1ca6..24dc153 100644 --- a/src/Nitric.Sdk/Job/Job.cs +++ b/src/Nitric.Sdk/Job/Job.cs @@ -30,9 +30,9 @@ public class Job /// public string Name { get; private set; } - internal Job(GrpcClient batchClient, string name) + internal Job(GrpcClient client, string name) { - this.Client = batchClient; + this.Client = client; this.Name = name; } diff --git a/src/Nitric.Sdk/Resource/OidcResource.cs b/src/Nitric.Sdk/Resource/OidcResource.cs index 183bbdb..cb29dd0 100644 --- a/src/Nitric.Sdk/Resource/OidcResource.cs +++ b/src/Nitric.Sdk/Resource/OidcResource.cs @@ -11,7 +11,7 @@ public class OidcOptions public string[] Audiences { get; set; } public string[] Scopes { get; set; } - public OidcOptions(string name, string issuer, string[] audiences, string[] scopes) + public OidcOptions(string name, string issuer, string[] audiences, string[] scopes) { this.Name = name; this.Issuer = issuer; diff --git a/src/Nitric.Sdk/Service/HttpContext.cs b/src/Nitric.Sdk/Service/HttpContext.cs index 04b3aed..c32894e 100644 --- a/src/Nitric.Sdk/Service/HttpContext.cs +++ b/src/Nitric.Sdk/Service/HttpContext.cs @@ -70,7 +70,8 @@ public class HttpRequest : TriggerRequest /// /// The object is converted from a JSON string to a type T. /// - public T Json() { + public T Json() + { return JsonConvert.DeserializeObject(Encoding.Default.GetString(this.data)); } @@ -108,7 +109,7 @@ public class HttpResponse : TriggerResponse /// /// The HTTP body data to be returned.ß /// - public byte[] Body { get; set; } = {}; + public byte[] Body { get; set; } = { }; /// /// The HTTP header to be included in the response. @@ -206,7 +207,8 @@ internal ClientMessage ToResponse() }) }; - var triggerResponse = new ClientMessage { + var triggerResponse = new ClientMessage + { Id = Id, HttpResponse = new Proto.Apis.v1.HttpResponse { From 8208b5c1747c7eef8cd433d74a8c8fd52696fa16 Mon Sep 17 00:00:00 2001 From: Ryan Cartwright Date: Wed, 2 Apr 2025 14:19:12 +1100 Subject: [PATCH 27/34] update tests --- src/Nitric.Sdk/Job/Job.cs | 8 +- src/Nitric.Sdk/KeyValueStore/KeyValueStore.cs | 8 +- src/Nitric.Sdk/Queue/Queue.cs | 6 +- src/Nitric.Sdk/Resource/BatchResource.cs | 2 +- src/Nitric.Sdk/Resource/BucketResource.cs | 2 +- .../Resource/KeyValueStoreResource.cs | 2 +- src/Nitric.Sdk/Resource/QueueResource.cs | 2 +- src/Nitric.Sdk/Resource/SecretResource.cs | 2 +- src/Nitric.Sdk/Resource/TopicResource.cs | 2 +- src/Nitric.Sdk/Resource/WebsocketResource.cs | 2 +- src/Nitric.Sdk/Secret/Secret.cs | 15 ++- src/Nitric.Sdk/Storage/Bucket.cs | 7 +- src/Nitric.Sdk/Storage/File.cs | 1 - src/Nitric.Sdk/Topics/Topic.cs | 8 +- src/Nitric.Sdk/Websocket/Connection.cs | 11 +- .../KeyValueStore/KeyValueStoreClientTest.cs | 47 ++++---- test/Nitric.Sdk.Test/Queue/QueueClientTest.cs | 53 ++++----- test/Nitric.Sdk.Test/Secret/SecretTest.cs | 78 +++++--------- .../Storage/StorageClientTest.cs | 101 ++++++++---------- test/Nitric.Sdk.Test/Test.cs | 20 ---- .../Topics/TopicsClientTest.cs | 20 ++-- .../Websocket/WebsocketTest.cs | 48 +++------ .../Nitric.Sdk.Test/Worker/FileEventWorker.cs | 12 +-- 23 files changed, 199 insertions(+), 258 deletions(-) delete mode 100644 test/Nitric.Sdk.Test/Test.cs diff --git a/src/Nitric.Sdk/Job/Job.cs b/src/Nitric.Sdk/Job/Job.cs index 24dc153..fbf9bb2 100644 --- a/src/Nitric.Sdk/Job/Job.cs +++ b/src/Nitric.Sdk/Job/Job.cs @@ -12,6 +12,7 @@ // See the License for the specific language governing permissions and // limitations under the License. +using System; using Nitric.Proto.Batch.v1; using Nitric.Sdk.Common; using GrpcClient = Nitric.Proto.Batch.v1.Batch.BatchClient; @@ -30,8 +31,13 @@ public class Job /// public string Name { get; private set; } - internal Job(GrpcClient client, string name) + internal Job(string name, GrpcClient client = null) { + if (string.IsNullOrEmpty(name)) + { + throw new ArgumentNullException(nameof(name)); + } + this.Client = client; this.Name = name; } diff --git a/src/Nitric.Sdk/KeyValueStore/KeyValueStore.cs b/src/Nitric.Sdk/KeyValueStore/KeyValueStore.cs index 62cd332..a93281d 100644 --- a/src/Nitric.Sdk/KeyValueStore/KeyValueStore.cs +++ b/src/Nitric.Sdk/KeyValueStore/KeyValueStore.cs @@ -12,6 +12,7 @@ // See the License for the specific language governing permissions and // limitations under the License. +using System; using System.Threading; using System.Threading.Tasks; using Nitric.Proto.KvStore.v1; @@ -25,8 +26,13 @@ public class KeyValueStore public string Name; private readonly GrpcClient Client; - public KeyValueStore(GrpcClient client, string name) + public KeyValueStore(string name, GrpcClient client = null) { + if (string.IsNullOrEmpty(name)) + { + throw new ArgumentNullException(nameof(name)); + } + this.Client = client; this.Name = name; } diff --git a/src/Nitric.Sdk/Queue/Queue.cs b/src/Nitric.Sdk/Queue/Queue.cs index b71e519..ff0b24d 100644 --- a/src/Nitric.Sdk/Queue/Queue.cs +++ b/src/Nitric.Sdk/Queue/Queue.cs @@ -33,8 +33,12 @@ public class Queue internal readonly GrpcClient Client; - internal Queue(GrpcClient client, string name) + public Queue(string name, GrpcClient client = null) { + if (string.IsNullOrEmpty(name)) + { + throw new ArgumentNullException(nameof(name)); + } this.Name = name; this.Client = client; } diff --git a/src/Nitric.Sdk/Resource/BatchResource.cs b/src/Nitric.Sdk/Resource/BatchResource.cs index 069940e..d7d7458 100644 --- a/src/Nitric.Sdk/Resource/BatchResource.cs +++ b/src/Nitric.Sdk/Resource/BatchResource.cs @@ -125,7 +125,7 @@ public Job Allow(JobPermission permission, params JobPermission[] permissions this.RegisterPolicy(allPerms); - return new Job(this.Client, this.Name); + return new Job(this.Name, this.Client); } } } diff --git a/src/Nitric.Sdk/Resource/BucketResource.cs b/src/Nitric.Sdk/Resource/BucketResource.cs index 3685b59..8c7ffe1 100644 --- a/src/Nitric.Sdk/Resource/BucketResource.cs +++ b/src/Nitric.Sdk/Resource/BucketResource.cs @@ -137,7 +137,7 @@ public Bucket Allow(BucketPermission permission, params BucketPermission[] permi this.RegisterPolicy(allPerms); - return new Bucket(this.Client, this.Name); + return new Bucket(this.Name, this.Client); } } } diff --git a/src/Nitric.Sdk/Resource/KeyValueStoreResource.cs b/src/Nitric.Sdk/Resource/KeyValueStoreResource.cs index a01141c..d2c001f 100644 --- a/src/Nitric.Sdk/Resource/KeyValueStoreResource.cs +++ b/src/Nitric.Sdk/Resource/KeyValueStoreResource.cs @@ -86,7 +86,7 @@ public KeyValueStore Allow(KeyValueStorePermission permission, params KeyValu this.RegisterPolicy(allPerms); - return new KeyValueStore(this.Client, this.Name); + return new KeyValueStore(this.Name, this.Client); } } } diff --git a/src/Nitric.Sdk/Resource/QueueResource.cs b/src/Nitric.Sdk/Resource/QueueResource.cs index a81673d..e606a75 100644 --- a/src/Nitric.Sdk/Resource/QueueResource.cs +++ b/src/Nitric.Sdk/Resource/QueueResource.cs @@ -79,7 +79,7 @@ public Queue.Queue Allow(QueuePermission permission, params QueuePermission[] this.RegisterPolicy(allPerms); - return new Queue.Queue(this.Client, this.Name); + return new Queue.Queue(this.Name, this.Client); } } } diff --git a/src/Nitric.Sdk/Resource/SecretResource.cs b/src/Nitric.Sdk/Resource/SecretResource.cs index 5ebeada..5747301 100644 --- a/src/Nitric.Sdk/Resource/SecretResource.cs +++ b/src/Nitric.Sdk/Resource/SecretResource.cs @@ -76,7 +76,7 @@ public NitricSecret Allow(SecretPermission permission, params SecretPermission[] this.RegisterPolicy(allPerms); - return new NitricSecret(this.Client, this.Name); + return new NitricSecret(this.Name, this.Client); } } } diff --git a/src/Nitric.Sdk/Resource/TopicResource.cs b/src/Nitric.Sdk/Resource/TopicResource.cs index eb831f2..8037e70 100644 --- a/src/Nitric.Sdk/Resource/TopicResource.cs +++ b/src/Nitric.Sdk/Resource/TopicResource.cs @@ -104,7 +104,7 @@ public Topic Allow(TopicPermission permission, params TopicPermission[] permi this.RegisterPolicy(allPerms); - return new Topic(this.Client, this.Name); + return new Topic(this.Name, this.Client); } } } diff --git a/src/Nitric.Sdk/Resource/WebsocketResource.cs b/src/Nitric.Sdk/Resource/WebsocketResource.cs index ca17b2e..c00a630 100644 --- a/src/Nitric.Sdk/Resource/WebsocketResource.cs +++ b/src/Nitric.Sdk/Resource/WebsocketResource.cs @@ -114,7 +114,7 @@ public Connection Connection(string socket, string connectionId) throw new ArgumentNullException(nameof(connectionId)); } - return new Connection(this.Client, connectionId, socket); + return new Connection(connectionId, socket, this.Client); } } } diff --git a/src/Nitric.Sdk/Secret/Secret.cs b/src/Nitric.Sdk/Secret/Secret.cs index 41947b4..26d82b6 100644 --- a/src/Nitric.Sdk/Secret/Secret.cs +++ b/src/Nitric.Sdk/Secret/Secret.cs @@ -35,8 +35,13 @@ public class Secret /// public readonly string Name; - internal Secret(GrpcClient client, string name) + public Secret(string name, GrpcClient client = null) { + if (string.IsNullOrEmpty(name)) + { + throw new ArgumentNullException(nameof(name)); + } + this.Client = client; this.Name = name; } @@ -90,8 +95,8 @@ public SecretVersion Put(string value) var secretResponse = this.Client.Put(request); return new SecretVersion( new Secret( - this.Client, - secretResponse.SecretVersion.Secret.Name + secretResponse.SecretVersion.Secret.Name, + this.Client ), secretResponse.SecretVersion.Version ); @@ -127,8 +132,8 @@ public async Task PutAsync(string value) var secretResponse = await Client.PutAsync(request); return new SecretVersion( new Secret( - this.Client, - secretResponse.SecretVersion.Secret.Name + secretResponse.SecretVersion.Secret.Name, + this.Client ), secretResponse.SecretVersion.Version ); diff --git a/src/Nitric.Sdk/Storage/Bucket.cs b/src/Nitric.Sdk/Storage/Bucket.cs index a73dfa2..3e8ddf4 100644 --- a/src/Nitric.Sdk/Storage/Bucket.cs +++ b/src/Nitric.Sdk/Storage/Bucket.cs @@ -35,8 +35,13 @@ public class Bucket /// public string Name { get; private set; } - internal Bucket(GrpcClient client, string name) + public Bucket(string name, GrpcClient client = null) { + if (string.IsNullOrEmpty(name)) + { + throw new ArgumentNullException(nameof(name)); + } + this.Client = client; this.Name = name; } diff --git a/src/Nitric.Sdk/Storage/File.cs b/src/Nitric.Sdk/Storage/File.cs index fe087b7..52570d4 100644 --- a/src/Nitric.Sdk/Storage/File.cs +++ b/src/Nitric.Sdk/Storage/File.cs @@ -44,7 +44,6 @@ public class File private readonly Bucket Bucket; public string Name { get; private set; } - internal File(Bucket bucket, string key) { this.Bucket = bucket; diff --git a/src/Nitric.Sdk/Topics/Topic.cs b/src/Nitric.Sdk/Topics/Topic.cs index a58288f..b1c7836 100644 --- a/src/Nitric.Sdk/Topics/Topic.cs +++ b/src/Nitric.Sdk/Topics/Topic.cs @@ -12,6 +12,7 @@ // See the License for the specific language governing permissions and // limitations under the License. +using System; using System.Threading.Tasks; using Nitric.Proto.Topics.v1; using Nitric.Sdk.Common; @@ -30,8 +31,13 @@ public class Topic /// public string Name { get; private set; } - internal Topic(GrpcClient client, string name) + public Topic(string name, GrpcClient client = null) { + if (string.IsNullOrEmpty(name)) + { + throw new ArgumentNullException(nameof(name)); + } + this.Client = client; this.Name = name; } diff --git a/src/Nitric.Sdk/Websocket/Connection.cs b/src/Nitric.Sdk/Websocket/Connection.cs index 127effe..744bfba 100644 --- a/src/Nitric.Sdk/Websocket/Connection.cs +++ b/src/Nitric.Sdk/Websocket/Connection.cs @@ -11,6 +11,7 @@ // 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. +using System; using System.Threading.Tasks; using Google.Protobuf; using Grpc.Core; @@ -31,8 +32,16 @@ public class Connection private readonly GrpcClient Client; - internal Connection(GrpcClient client, string connectionId, string socketName) + public Connection(string connectionId, string socketName, GrpcClient client = null) { + if (string.IsNullOrEmpty(connectionId)) + { + throw new ArgumentNullException(nameof(connectionId)); + } + if (string.IsNullOrEmpty(socketName)) + { + throw new ArgumentNullException(nameof(socketName)); + } this.Client = client; this.Id = connectionId; this.SocketName = socketName; diff --git a/test/Nitric.Sdk.Test/KeyValueStore/KeyValueStoreClientTest.cs b/test/Nitric.Sdk.Test/KeyValueStore/KeyValueStoreClientTest.cs index 2bc73a5..abf71a4 100644 --- a/test/Nitric.Sdk.Test/KeyValueStore/KeyValueStoreClientTest.cs +++ b/test/Nitric.Sdk.Test/KeyValueStore/KeyValueStoreClientTest.cs @@ -21,17 +21,10 @@ public class TestProfile public class KeyValueStoreClientTest { - [Fact] - public void TestBuildKeyValueClient() - { - var storage = new KeyValueStoreClient(); - Assert.NotNull(storage); - } - [Fact] public void TestBuildKeyValueStoreWithName() { - var store = new KeyValueStoreClient().KV("test-store"); + var store = new KeyValueStore("test-store"); Assert.NotNull(store); Assert.Equal("test-store", store.Name); } @@ -40,10 +33,10 @@ public void TestBuildKeyValueStoreWithName() public void TestBuildKeyValueStoreWithoutName() { Assert.Throws( - () => new KeyValueStoreClient().KV("") + () => new KeyValueStore("") ); Assert.Throws( - () => new KeyValueStoreClient().KV(null) + () => new KeyValueStore(null) ); } @@ -75,7 +68,7 @@ public void TestSetToKeyValueStore() .Returns(new KvStoreSetValueResponse()) .Verifiable(); - var kv = new KeyValueStoreClient(gc.Object).KV("test-store"); + var kv = new KeyValueStore("test-store", gc.Object); kv.Set("test-key", testProfile); @@ -102,7 +95,7 @@ public void TestSetNullToKeyValueStore() .Returns(new KvStoreSetValueResponse()) .Verifiable(); - var kv = new KeyValueStoreClient(gc.Object).KV("test-store"); + var kv = new KeyValueStore("test-store", gc.Object); kv.Set("test-key", null); @@ -138,7 +131,7 @@ public void TestSetToKeyValueStoreWithError() .Throws(new RpcException(new Status(StatusCode.NotFound, "The specified key value store does not exist"))) .Verifiable(); - var kv = new KeyValueStoreClient(gc.Object).KV("test-store"); + var kv = new KeyValueStore("test-store", gc.Object); try { @@ -185,7 +178,7 @@ public async void TestSetToKeyValueStoreAsync() .Returns(new AsyncUnaryCall(Task.FromResult(resp), null, null, null, null, null)) .Verifiable(); - var kv = new KeyValueStoreClient(gc.Object).KV("test-store"); + var kv = new KeyValueStore("test-store", gc.Object); await kv.SetAsync("test-key", testProfile); @@ -214,7 +207,7 @@ public async void TestSetNullToKeyValueStoreAsync() .Returns(new AsyncUnaryCall(Task.FromResult(resp), null, null, null, null, null)) .Verifiable(); - var kv = new KeyValueStoreClient(gc.Object).KV("test-store"); + var kv = new KeyValueStore("test-store", gc.Object); await kv.SetAsync("test-key", null); @@ -241,7 +234,7 @@ public async void TestSetNullToKeyValueStoreAsyncWithError() .Throws(new RpcException(new Status(StatusCode.NotFound, "The specified key value store does not exist"))) .Verifiable(); - var kv = new KeyValueStoreClient(gc.Object).KV("test-store"); + var kv = new KeyValueStore("test-store", gc.Object); try { @@ -298,7 +291,7 @@ public void TestGetToKeyValueStore() .Returns(resp) .Verifiable(); - var kv = new KeyValueStoreClient(gc.Object).KV("test-store"); + var kv = new KeyValueStore("test-store", gc.Object); var profile = kv.Get("test-key"); @@ -337,7 +330,7 @@ public void TestGetToKeyValueStoreWithError() .Throws(new RpcException(new Status(StatusCode.NotFound, "The specified key value store does not exist"))) .Verifiable(); - var kv = new KeyValueStoreClient(gc.Object).KV("test-store"); + var kv = new KeyValueStore("test-store", gc.Object); try { @@ -394,7 +387,7 @@ public async void TestGetToKeyValueStoreAsync() .Returns(new AsyncUnaryCall(Task.FromResult(resp), null, null, null, null, null)) .Verifiable(); - var kv = new KeyValueStoreClient(gc.Object).KV("test-store"); + var kv = new KeyValueStore("test-store", gc.Object); var profile = await kv.GetAsync("test-key"); @@ -433,7 +426,7 @@ public async void TestGetToKeyValueStoreAsyncWithError() .Throws(new RpcException(new Status(StatusCode.NotFound, "The specified key value store does not exist"))) .Verifiable(); - var kv = new KeyValueStoreClient(gc.Object).KV("test-store"); + var kv = new KeyValueStore("test-store", gc.Object); try { @@ -468,7 +461,7 @@ public void TestDeleteKeyValuePair() .Returns(new KvStoreDeleteKeyResponse()) .Verifiable(); - var kv = new KeyValueStoreClient(gc.Object).KV("test-store"); + var kv = new KeyValueStore("test-store", gc.Object); kv.Delete("test-key"); @@ -494,7 +487,7 @@ public void TestDeleteKeyValuePairWithError() .Throws(new RpcException(new Status(StatusCode.NotFound, "The specified key value store does not exist"))) .Verifiable(); - var kv = new KeyValueStoreClient(gc.Object).KV("test-store"); + var kv = new KeyValueStore("test-store", gc.Object); try { @@ -531,7 +524,7 @@ public async void TestDeleteKeyValuePairAsync() .Returns(new AsyncUnaryCall(Task.FromResult(resp), null, null, null, null, null)) .Verifiable(); - var kv = new KeyValueStoreClient(gc.Object).KV("test-store"); + var kv = new KeyValueStore("test-store", gc.Object); await kv.DeleteAsync("test-key"); @@ -557,7 +550,7 @@ public async void TestDeleteKeyValuePairAsyncWithError() .Throws(new RpcException(new Status(StatusCode.NotFound, "The specified key value store does not exist"))) .Verifiable(); - var kv = new KeyValueStoreClient(gc.Object).KV("test-store"); + var kv = new KeyValueStore("test-store", gc.Object); try { @@ -604,7 +597,7 @@ public async void TestGetListOfKeysWithNoPrefix() .Returns(resp) .Verifiable(); - var kv = new KeyValueStoreClient(gc.Object).KV("test-store"); + var kv = new KeyValueStore("test-store", gc.Object); var keys = kv.Keys(); @@ -649,7 +642,7 @@ public async void TestGetListOfKeysWithPrefix() .Returns(resp) .Verifiable(); - var kv = new KeyValueStoreClient(gc.Object).KV("test-store"); + var kv = new KeyValueStore("test-store", gc.Object); var keys = kv.Keys("key-"); @@ -683,7 +676,7 @@ public void TestGetListOfKeysWithError() .Throws(new RpcException(new Status(StatusCode.NotFound, "The specified key value store does not exist"))) .Verifiable(); - var kv = new KeyValueStoreClient(gc.Object).KV("test-store"); + var kv = new KeyValueStore("test-store", gc.Object); try { diff --git a/test/Nitric.Sdk.Test/Queue/QueueClientTest.cs b/test/Nitric.Sdk.Test/Queue/QueueClientTest.cs index cd4cfdb..063fbaa 100644 --- a/test/Nitric.Sdk.Test/Queue/QueueClientTest.cs +++ b/test/Nitric.Sdk.Test/Queue/QueueClientTest.cs @@ -29,17 +29,10 @@ namespace Nitric.Sdk.Test.Queue { public class QueueClientTest { - [Fact] - public void TestBuildQueues() - { - var queues = new QueuesClient(); - Assert.NotNull(queues); - } - [Fact] public void TestBuildQueueWithName() { - var queue = new QueuesClient().Queue("test-queue"); + var queue = new Sdk.Queue.Queue("test-queue"); Assert.NotNull(queue); Assert.Equal("test-queue", queue.Name); } @@ -48,10 +41,10 @@ public void TestBuildQueueWithName() public void TestBuildQueueWithoutName() { Assert.Throws( - () => new QueuesClient().Queue("") + () => new Sdk.Queue.Queue("") ); Assert.Throws( - () => new QueuesClient().Queue(null) + () => new Sdk.Queue.Queue(null) ); } @@ -64,7 +57,7 @@ public async void TestEnqueueAsync() .Returns(new AsyncUnaryCall(Task.FromResult(new QueueEnqueueResponse()), null, null, null, null)) .Verifiable(); - var queue = new QueuesClient(qc.Object).Queue("test-queue"); + var queue = new Sdk.Queue.Queue("test-queue", qc.Object); await queue.EnqueueAsync(new TestProfile { Name = "John Smith", Age = 30, Addresses = new List { "123 street st" } }); @@ -76,7 +69,7 @@ public async void TestEnqueueAsync() [Fact] public void TestEnqueueNullMessageAsync() { - var queue = new QueuesClient().Queue("test-queue"); + var queue = new Sdk.Queue.Queue("test-queue"); Assert.ThrowsAsync(() => queue.EnqueueAsync(null)); } @@ -102,7 +95,7 @@ public async void TestEnqueueMultipleMessagesWithFailedMessagesAsync() .Returns(new AsyncUnaryCall(Task.FromResult(queueBatchResponse), null, null, null, null)) .Verifiable(); - var queue = new QueuesClient(qc.Object).Queue("test-queue"); + var queue = new Sdk.Queue.Queue("test-queue", qc.Object); var failedMessagesResp = await queue.EnqueueAsync(new TestProfile { }, new TestProfile { }); @@ -122,7 +115,7 @@ public async void TestEnqueueMultipleMessagesWithNoFailedMessagesAsync() .Returns(new AsyncUnaryCall(Task.FromResult(new QueueEnqueueResponse()), null, null, null, null)) .Verifiable(); - var queue = new QueuesClient(qc.Object).Queue("test-queue"); + var queue = new Sdk.Queue.Queue("test-queue", qc.Object); var failedMessages = await queue.EnqueueAsync(new TestProfile { }, new TestProfile { }); @@ -142,7 +135,7 @@ public async void TestEnqueueToNonExistentQueueAsync() .Throws(new RpcException(new Status(StatusCode.NotFound, "The specified queue does not exist"))) .Verifiable(); - var queue = new QueuesClient(qc.Object).Queue("test-queue"); + var queue = new Sdk.Queue.Queue("test-queue", qc.Object); try { @@ -168,7 +161,7 @@ public void TestEnqueue() .Returns(new QueueEnqueueResponse()) .Verifiable(); - var queue = new QueuesClient(qc.Object).Queue("test-queue"); + var queue = new Sdk.Queue.Queue("test-queue", qc.Object); queue.Enqueue(new TestProfile { Name = "John Smith", Age = 30, Addresses = new List { "123 street st" } }); @@ -186,7 +179,7 @@ public void TestEnqueueToNonExistentQueue() .Throws(new RpcException(new Status(StatusCode.NotFound, "The specified queue does not exist"))) .Verifiable(); - var queue = new QueuesClient(qc.Object).Queue("test-queue"); + var queue = new Sdk.Queue.Queue("test-queue", qc.Object); try { @@ -206,7 +199,7 @@ public void TestEnqueueToNonExistentQueue() [Fact] public void TestEnqueueNullMessage() { - var queue = new QueuesClient().Queue("test-queue"); + var queue = new Sdk.Queue.Queue("test-queue"); Assert.Throws(() => queue.Enqueue(null)); } @@ -232,7 +225,7 @@ public void TestEnqueueMultipleMessagesWithFailedMessages() .Returns(queueBatchResponse) .Verifiable(); - var queue = new QueuesClient(qc.Object).Queue("test-queue"); + var queue = new Sdk.Queue.Queue("test-queue", qc.Object); var failedMessagesResp = queue.Enqueue(new TestProfile { }, new TestProfile { }); @@ -252,7 +245,7 @@ public void TestEnqueueMultipleMessagesWithNoFailedMessages() .Returns(new QueueEnqueueResponse()) .Verifiable(); - var queue = new QueuesClient(qc.Object).Queue("test-queue"); + var queue = new Sdk.Queue.Queue("test-queue", qc.Object); var failedMessages = queue.Enqueue(new TestProfile { }, new TestProfile { }); @@ -284,7 +277,7 @@ public void TestDequeueMessages() .Returns(queueReceieveResponse) .Verifiable(); - var queue = new QueuesClient(qc.Object).Queue("test-queue"); + var queue = new Sdk.Queue.Queue("test-queue", qc.Object); var response = queue.Dequeue(3); @@ -305,7 +298,7 @@ public void TestDequeueNoMessages() .Returns(new QueueDequeueResponse()) .Verifiable(); - var queue = new QueuesClient(qc.Object).Queue("test-queue"); + var queue = new Sdk.Queue.Queue("test-queue", qc.Object); var response = queue.Dequeue(3); @@ -325,7 +318,7 @@ public void TestDequeueToNonExistentQueue() .Throws(new RpcException(new Status(StatusCode.NotFound, "The specified queue does not exist"))) .Verifiable(); - var queue = new QueuesClient(qc.Object).Queue("test-queue"); + var queue = new Sdk.Queue.Queue("test-queue", qc.Object); try { @@ -364,7 +357,7 @@ public async void TestDequeueMessagesAsync() .Returns(new AsyncUnaryCall(Task.FromResult(queueReceieveResponse), null, null, null, null)) .Verifiable(); - var queue = new QueuesClient(qc.Object).Queue("test-queue"); + var queue = new Sdk.Queue.Queue("test-queue", qc.Object); var response = await queue.DequeueAsync(3); @@ -385,7 +378,7 @@ public async void TestDequeueNoMessagesAsync() .Returns(new AsyncUnaryCall(Task.FromResult(new QueueDequeueResponse()), null, null, null, null)) .Verifiable(); - var queue = new QueuesClient(qc.Object).Queue("test-queue"); + var queue = new Sdk.Queue.Queue("test-queue", qc.Object); var response = await queue.DequeueAsync(3); @@ -405,7 +398,7 @@ public async void TestDequeueToNonExistentQueueAsync() .Throws(new RpcException(new Status(StatusCode.NotFound, "The specified queue does not exist"))) .Verifiable(); - var queue = new QueuesClient(qc.Object).Queue("test-queue"); + var queue = new Sdk.Queue.Queue("test-queue", qc.Object); try { @@ -457,7 +450,7 @@ public void TestComplete() It.IsAny())) .Verifiable(); - var queue = new QueuesClient(qc.Object).Queue("test-queue"); + var queue = new Sdk.Queue.Queue("test-queue", qc.Object); var response = queue.Dequeue(3); @@ -503,7 +496,7 @@ public async void TestCompleteAsync() .Returns(new AsyncUnaryCall(Task.FromResult(new QueueCompleteResponse()), null, null, null, null)) .Verifiable(); - var queue = new QueuesClient(qc.Object).Queue("test-queue"); + var queue = new Sdk.Queue.Queue("test-queue", qc.Object); var response = await queue.DequeueAsync(3); @@ -549,7 +542,7 @@ public void TestCompleteToNonExistentQueue() .Throws(new RpcException(new Status(StatusCode.NotFound, "The specified queue does not exist"))) .Verifiable(); - var queue = new QueuesClient(qc.Object).Queue("test-queue"); + var queue = new Sdk.Queue.Queue("test-queue", qc.Object); var response = queue.Dequeue(3); @@ -604,7 +597,7 @@ public async void TestCompleteToNonExistentQueueAsync() .Throws(new RpcException(new Status(StatusCode.NotFound, "The specified queue does not exist"))) .Verifiable(); - var queue = new QueuesClient(qc.Object).Queue("test-queue"); + var queue = new Sdk.Queue.Queue("test-queue", qc.Object); var response = await queue.DequeueAsync(3); diff --git a/test/Nitric.Sdk.Test/Secret/SecretTest.cs b/test/Nitric.Sdk.Test/Secret/SecretTest.cs index 432a6ae..acb10a0 100644 --- a/test/Nitric.Sdk.Test/Secret/SecretTest.cs +++ b/test/Nitric.Sdk.Test/Secret/SecretTest.cs @@ -27,24 +27,10 @@ namespace Nitric.Sdk.Test.Secret { public class SecretTest { - [Fact] - public void TestBuildSecrets() - { - var secrets = new SecretsClient(); - Assert.NotNull(secrets); - } - - [Fact] - public void TestBuildSecretsWithNullClient() - { - var secrets = new SecretsClient(null); - Assert.NotNull(secrets); - } - [Fact] public void TestBuildSecretWithName() { - var secret = new SecretsClient().Secret("test-secret"); + var secret = new Sdk.Secret.Secret("test-secret"); Assert.NotNull(secret); Assert.Equal("test-secret", secret.Name); } @@ -53,9 +39,9 @@ public void TestBuildSecretWithName() public void TestBuildSecretWithoutName() { Assert.Throws( - () => new SecretsClient().Secret("")); + () => new Sdk.Secret.Secret("")); Assert.Throws( - () => new SecretsClient().Secret(null)); + () => new Sdk.Secret.Secret(null)); } //Testing Secret Methods @@ -79,8 +65,7 @@ public async void TestPutSecretBytesAsync() .Returns(new AsyncUnaryCall(Task.FromResult(secretPutResponse), null, null, null, null)) .Verifiable(); - var secret = new SecretsClient(sc.Object) - .Secret("test-secret"); + var secret = new Sdk.Secret.Secret("test-secret", sc.Object); var response = await secret.PutAsync("Super secret message"); @@ -113,8 +98,7 @@ public async void TestPutSecretStringAsync() .Verifiable(); var testString = "Super secret message"; - var secret = new SecretsClient(sc.Object) - .Secret("test-secret"); + var secret = new Sdk.Secret.Secret("test-secret", sc.Object); var response = await secret.PutAsync(testString); Assert.Equal("test-version", response.Id); @@ -128,7 +112,7 @@ public async void TestPutSecretStringAsync() [Fact] public void TestPutEmptySecretStringAsync() { - var secret = new SecretsClient().Secret("test-secret"); + var secret = new Sdk.Secret.Secret("test-secret"); Assert.ThrowsAsync( () => secret.PutAsync("")); } @@ -136,7 +120,7 @@ public void TestPutEmptySecretStringAsync() [Fact] public void TestPutNullSecretBytesAsync() { - var secret = new SecretsClient().Secret("test-secret"); + var secret = new Sdk.Secret.Secret("test-secret"); Assert.ThrowsAsync( () => secret.PutAsync(null)); } @@ -151,8 +135,7 @@ public async void TestPutNonExistentSecretAsync() .Verifiable(); var testString = "Super secret message"; - var secret = new SecretsClient(sc.Object) - .Secret("test-secret"); + var secret = new Sdk.Secret.Secret("test-secret", sc.Object); try { var response = await secret.PutAsync(testString); @@ -190,8 +173,7 @@ public void TestPutSecretBytes() .Returns(secretPutResponse) .Verifiable(); - var secret = new SecretsClient(sc.Object) - .Secret("test-secret"); + var secret = new Sdk.Secret.Secret("test-secret", sc.Object); var response = secret.Put("Super secret message"); @@ -224,8 +206,7 @@ public void TestPutSecretString() .Verifiable(); var testString = "Super secret message"; - var secret = new SecretsClient(sc.Object) - .Secret("test-secret"); + var secret = new Sdk.Secret.Secret("test-secret", sc.Object); var response = secret.Put(testString); Assert.Equal("test-version", response.Id); @@ -239,7 +220,7 @@ public void TestPutSecretString() [Fact] public void TestPutEmptySecretString() { - var secret = new SecretsClient().Secret("test-secret"); + var secret = new Sdk.Secret.Secret("test-secret"); Assert.Throws( () => secret.Put("")); } @@ -247,7 +228,7 @@ public void TestPutEmptySecretString() [Fact] public void TestPutNullSecretBytes() { - var secret = new SecretsClient().Secret("test-secret"); + var secret = new Sdk.Secret.Secret("test-secret"); Assert.Throws( () => secret.Put(null)); } @@ -262,8 +243,7 @@ public void TestPutNonExistentSecret() .Verifiable(); var testString = "Super secret message"; - var secret = new SecretsClient(sc.Object) - .Secret("test-secret"); + var secret = new Sdk.Secret.Secret("test-secret", sc.Object); try { var response = secret.Put(testString); @@ -284,7 +264,7 @@ public void TestPutNonExistentSecret() [Fact] public void TestGetSecretVersion() { - var secret = new SecretsClient().Secret("test-secret"); + var secret = new Sdk.Secret.Secret("test-secret"); var secretVersion = secret.Version("test-version"); Assert.NotNull(secretVersion); Assert.Equal("test-version", secretVersion.Id); @@ -295,26 +275,22 @@ public void TestGetSecretVersion() public void TestGetSecretVersionWithoutName() { Assert.Throws( - () => new SecretsClient().Secret("test-secret").Version("")); + () => new Sdk.Secret.Secret("test-secret").Version("")); Assert.Throws( - () => new SecretsClient().Secret("test-secret").Version(null)); + () => new Sdk.Secret.Secret("test-secret").Version(null)); } [Fact] public void TestGetLatestSecretVersion() { - var secretVersion = new SecretsClient() - .Secret("test-secret") - .Latest(); + var secretVersion = new Sdk.Secret.Secret("test-secret").Latest(); Assert.Equal("latest", secretVersion.Id); } [Fact] public void TestSecretToString() { - var secretString = new SecretsClient() - .Secret("test-secret") - .ToString(); + var secretString = new Sdk.Secret.Secret("test-secret").ToString(); Assert.Equal("[name=test-secret]", secretString); } @@ -340,8 +316,7 @@ public void TestAccess() .Returns(secretPutResponse) .Verifiable(); - var version = new SecretsClient(sc.Object) - .Secret("test-secret") + var version = new Sdk.Secret.Secret("test-secret", sc.Object) .Version("test-version"); var response = version.Access(); @@ -365,8 +340,7 @@ public void TestAccessSecretWithoutPermission() "You do not have permission to access this secret"))) .Verifiable(); - var secret = new SecretsClient(sc.Object) - .Secret("test-secret"); + var secret = new Sdk.Secret.Secret("test-secret", sc.Object); try { var response = secret.Version("test-secret").Access(); @@ -405,8 +379,7 @@ public async void TestAccessAsync() .Returns(new AsyncUnaryCall(Task.FromResult(secretPutResponse), null, null, null, null)) .Verifiable(); - var version = new SecretsClient(sc.Object) - .Secret("test-secret") + var version = new Sdk.Secret.Secret("test-secret", sc.Object) .Version("test-version"); var response = await version.AccessAsync(); @@ -430,8 +403,7 @@ public async void TestAccessSecretWithoutPermissionAsync() "You do not have permission to access this secret"))) .Verifiable(); - var secret = new SecretsClient(sc.Object) - .Secret("test-secret"); + var secret = new Sdk.Secret.Secret("test-secret", sc.Object); try { var response = await secret.Version("test-secret").AccessAsync(); @@ -453,8 +425,7 @@ public async void TestAccessSecretWithoutPermissionAsync() [Fact] public void TestSecretVersionToString() { - var secretVersionString = new SecretsClient() - .Secret("test-secret") + var secretVersionString = new Sdk.Secret.Secret("test-secret") .Version("test-version") .ToString(); Assert.Equal("SecretVersion[secret=[name=test-secret], version=test-version]", secretVersionString); @@ -481,8 +452,7 @@ public void TestSecretValueToString() .Returns(secretPutResponse) .Verifiable(); - var version = new SecretsClient(sc.Object) - .Secret("test-secret") + var version = new Sdk.Secret.Secret("test-secret", sc.Object) .Version("test-version"); var response = version.Access(); diff --git a/test/Nitric.Sdk.Test/Storage/StorageClientTest.cs b/test/Nitric.Sdk.Test/Storage/StorageClientTest.cs index db407c5..f955e4e 100644 --- a/test/Nitric.Sdk.Test/Storage/StorageClientTest.cs +++ b/test/Nitric.Sdk.Test/Storage/StorageClientTest.cs @@ -28,17 +28,10 @@ namespace Nitric.Sdk.Test.Storage public class StorageClientTest { - [Fact] - public void TestBuildStorage() - { - var storage = new Sdk.Storage.StorageClient(); - Assert.NotNull(storage); - } - [Fact] public void TestBuildBucketWithName() { - var bucket = new Sdk.Storage.StorageClient().Bucket("test-bucket"); + var bucket = new Sdk.Storage.Bucket("test-bucket"); Assert.NotNull(bucket); Assert.Equal("test-bucket", bucket.Name); } @@ -47,17 +40,17 @@ public void TestBuildBucketWithName() public void TestBuildBucketWithoutName() { Assert.Throws( - () => new Sdk.Storage.StorageClient().Bucket("") + () => new Sdk.Storage.Bucket("") ); Assert.Throws( - () => new Sdk.Storage.StorageClient().Bucket(null) + () => new Sdk.Storage.Bucket(null) ); } [Fact] public void TestBuildFileWithName() { - var file = new Sdk.Storage.StorageClient().Bucket("test-bucket").File("test-file"); + var file = new Sdk.Storage.Bucket("test-bucket").File("test-file"); Assert.NotNull(file); Assert.Equal("test-file", file.Name); } @@ -66,24 +59,24 @@ public void TestBuildFileWithName() public void TestBuildFileWithoutName() { Assert.Throws( - () => new Sdk.Storage.StorageClient().Bucket("test-bucket").File("") + () => new Sdk.Storage.Bucket("test-bucket").File("") ); Assert.Throws( - () => new Sdk.Storage.StorageClient().Bucket("test-bucket").File(null) + () => new Sdk.Storage.Bucket("test-bucket").File(null) ); } [Fact] public void TestBucketToString() { - var bucket = new Sdk.Storage.StorageClient().Bucket("test-bucket"); + var bucket = new Sdk.Storage.Bucket("test-bucket"); Assert.Equal("Bucket[name=test-bucket]", bucket.ToString()); } [Fact] public void TestFileToString() { - var file = new Sdk.Storage.StorageClient().Bucket("test-bucket").File("test-file"); + var file = new Sdk.Storage.Bucket("test-bucket").File("test-file"); Assert.Equal("File[name=test-file\nbucket=test-bucket]", file.ToString()); } @@ -111,7 +104,7 @@ public void TestListBlobsWithNoPrefix() .Returns(response) .Verifiable(); - var files = new Sdk.Storage.StorageClient(bc.Object).Bucket("test-bucket").Files(); + var files = new Sdk.Storage.Bucket("test-bucket", bc.Object).Files(); bc.Verify( t => t.ListBlobs(request, null, null, @@ -146,7 +139,7 @@ public void TestListBlobsWithPrefix() .Returns(response) .Verifiable(); - var files = new Sdk.Storage.StorageClient(bc.Object).Bucket("test-bucket").Files("key-"); + var files = new Sdk.Storage.Bucket("test-bucket", bc.Object).Files("key-"); bc.Verify( t => t.ListBlobs(request, null, null, @@ -168,7 +161,7 @@ public void TestListBlobsToNonExistentBucket() try { - new Sdk.Storage.StorageClient(bc.Object).Bucket("test-bucket").Files("key-1"); + new Sdk.Storage.Bucket("test-bucket", bc.Object).Files("key-1"); Assert.Fail(); } catch (NitricException e) @@ -206,7 +199,7 @@ public async void TestListBlobsWithNoPrefixAsync() .Returns(new AsyncUnaryCall(Task.FromResult(response), null, null, null, null)) .Verifiable(); - var files = await new Sdk.Storage.StorageClient(bc.Object).Bucket("test-bucket").FilesAsync(); + var files = await new Sdk.Storage.Bucket("test-bucket", bc.Object).FilesAsync(); bc.Verify( t => t.ListBlobsAsync(request, null, null, @@ -241,7 +234,7 @@ public async void TestListBlobsWithPrefixAsync() .Returns(new AsyncUnaryCall(Task.FromResult(response), null, null, null, null)) .Verifiable(); - var files = await new Sdk.Storage.StorageClient(bc.Object).Bucket("test-bucket").FilesAsync("key-"); + var files = await new Sdk.Storage.Bucket("test-bucket", bc.Object).FilesAsync("key-"); bc.Verify( t => t.ListBlobsAsync(request, null, null, @@ -263,7 +256,7 @@ public async void TestListBlobsToNonExistentBucketAsync() try { - await new Sdk.Storage.StorageClient(bc.Object).Bucket("test-bucket").FilesAsync(); + await new Sdk.Storage.Bucket("test-bucket", bc.Object).FilesAsync(); Assert.Fail(); } catch (NitricException e) @@ -294,7 +287,7 @@ public void TestWrite() .Returns(new StorageWriteResponse()) .Verifiable(); - var file = new Sdk.Storage.StorageClient(bc.Object).Bucket("test-bucket").File("test-file"); + var file = new Sdk.Storage.Bucket("test-bucket", bc.Object).File("test-file"); file.Write(System.Text.Encoding.UTF8.GetBytes("Hello World")); @@ -320,7 +313,7 @@ public void TestWriteString() .Returns(new StorageWriteResponse()) .Verifiable(); - var file = new Sdk.Storage.StorageClient(bc.Object).Bucket("test-bucket").File("test-file"); + var file = new Sdk.Storage.Bucket("test-bucket", bc.Object).File("test-file"); file.Write("Hello World"); @@ -346,7 +339,7 @@ public void TestWriteToNonExistentBucket() .Throws(new RpcException(new Status(StatusCode.NotFound, "The specified bucket does not exist"))) .Verifiable(); - var file = new Sdk.Storage.StorageClient(bc.Object).Bucket("test-bucket").File("test-file"); + var file = new Sdk.Storage.Bucket("test-bucket", bc.Object).File("test-file"); try { @@ -381,7 +374,7 @@ public void TestWriteBytesToNonExistentBucket() .Throws(new RpcException(new Status(StatusCode.NotFound, "The specified bucket does not exist"))) .Verifiable(); - var file = new Sdk.Storage.StorageClient(bc.Object).Bucket("test-bucket").File("test-file"); + var file = new Sdk.Storage.Bucket("test-bucket", bc.Object).File("test-file"); try { @@ -416,7 +409,7 @@ public async void TestWriteAsync() .Returns(new AsyncUnaryCall(Task.FromResult(new StorageWriteResponse()), null, null, null, null)) .Verifiable(); - var file = new Sdk.Storage.StorageClient(bc.Object).Bucket("test-bucket").File("test-file"); + var file = new Sdk.Storage.Bucket("test-bucket", bc.Object).File("test-file"); await file.WriteAsync(System.Text.Encoding.UTF8.GetBytes("Hello World")); @@ -434,7 +427,7 @@ public async void TestWriteBytesToNonExistentBucketAsync() .Throws(new RpcException(new Status(StatusCode.NotFound, "The specified bucket does not exist"))) .Verifiable(); - var file = new Sdk.Storage.StorageClient(bc.Object).Bucket("test-bucket").File("test-file"); + var file = new Sdk.Storage.Bucket("test-bucket", bc.Object).File("test-file"); try { @@ -461,7 +454,7 @@ public async void TestWriteToNonExistentBucketAsync() .Throws(new RpcException(new Status(StatusCode.NotFound, "The specified bucket does not exist"))) .Verifiable(); - var file = new Sdk.Storage.StorageClient(bc.Object).Bucket("test-bucket").File("test-file"); + var file = new Sdk.Storage.Bucket("test-bucket", bc.Object).File("test-file"); try { @@ -496,7 +489,7 @@ public async void TestWriteStringAsync() .Returns(new AsyncUnaryCall(Task.FromResult(new StorageWriteResponse()), null, null, null, null)) .Verifiable(); - var file = new Sdk.Storage.StorageClient(bc.Object).Bucket("test-bucket").File("test-file"); + var file = new Sdk.Storage.Bucket("test-bucket", bc.Object).File("test-file"); await file.WriteAsync("Hello World"); @@ -514,7 +507,7 @@ public async void TestWriteStringToNonExistentBucketAsync() .Throws(new RpcException(new Status(StatusCode.NotFound, "The specified bucket does not exist"))) .Verifiable(); - var file = new Sdk.Storage.StorageClient(bc.Object).Bucket("test-bucket").File("test-file"); + var file = new Sdk.Storage.Bucket("test-bucket", bc.Object).File("test-file"); try { @@ -545,7 +538,7 @@ public void TestReadExistingKey() .Returns(storageResponse) .Verifiable(); - var file = new Sdk.Storage.StorageClient(bc.Object).Bucket("test-bucket").File("test-file"); + var file = new Sdk.Storage.Bucket("test-bucket", bc.Object).File("test-file"); var response = file.Read(); @@ -565,7 +558,7 @@ public void TestReadNonExistingKey() .Throws(new RpcException(new Status(StatusCode.NotFound, "The specified key does not exist"))) .Verifiable(); - var file = new Sdk.Storage.StorageClient(bc.Object).Bucket("test-bucket").File("test-file"); + var file = new Sdk.Storage.Bucket("test-bucket", bc.Object).File("test-file"); try { @@ -596,7 +589,7 @@ public async void TestReadExistingKeyAsync() .Returns(new AsyncUnaryCall(Task.FromResult(storageResponse), null, null, null, null)) .Verifiable(); - var file = new Sdk.Storage.StorageClient(bc.Object).Bucket("test-bucket").File("test-file"); + var file = new Sdk.Storage.Bucket("test-bucket", bc.Object).File("test-file"); var response = await file.ReadAsync(); @@ -616,7 +609,7 @@ public async void TestReadNonExistingKeyAsync() .Throws(new RpcException(new Status(StatusCode.NotFound, "The specified key does not exist"))) .Verifiable(); - var file = new Sdk.Storage.StorageClient(bc.Object).Bucket("test-bucket").File("test-file"); + var file = new Sdk.Storage.Bucket("test-bucket", bc.Object).File("test-file"); try { @@ -643,7 +636,7 @@ public void TestDeleteExistingKey() .Returns(new StorageDeleteResponse()) .Verifiable(); - var file = new Sdk.Storage.StorageClient(bc.Object).Bucket("test-bucket").File("test-file"); + var file = new Sdk.Storage.Bucket("test-bucket", bc.Object).File("test-file"); file.Delete(); @@ -661,7 +654,7 @@ public void TestDeleteNonExistingKey() .Throws(new RpcException(new Status(StatusCode.NotFound, "The specified key does not exist"))) .Verifiable(); - var file = new Sdk.Storage.StorageClient(bc.Object).Bucket("test-bucket").File("test-file"); + var file = new Sdk.Storage.Bucket("test-bucket", bc.Object).File("test-file"); try { @@ -688,7 +681,7 @@ public async void TestDeleteExistingKeyAsync() .Returns(new AsyncUnaryCall(Task.FromResult(new StorageDeleteResponse()), null, null, null, null)) .Verifiable(); - var file = new Sdk.Storage.StorageClient(bc.Object).Bucket("test-bucket").File("test-file"); + var file = new Sdk.Storage.Bucket("test-bucket", bc.Object).File("test-file"); await file.DeleteAsync(); @@ -706,7 +699,7 @@ public async void TestDeleteNonExistingKeyAsync() .Throws(new RpcException(new Status(StatusCode.NotFound, "The specified key does not exist"))) .Verifiable(); - var file = new Sdk.Storage.StorageClient(bc.Object).Bucket("test-bucket").File("test-file"); + var file = new Sdk.Storage.Bucket("test-bucket", bc.Object).File("test-file"); try { @@ -741,7 +734,7 @@ public void TestGetUploadUrlWithDefaultExpiry() .Returns(new StoragePreSignUrlResponse { Url = "https://example.com" }) .Verifiable(); - var file = new Sdk.Storage.StorageClient(bc.Object).Bucket("test-bucket").File("test-file"); + var file = new Sdk.Storage.Bucket("test-bucket", bc.Object).File("test-file"); var url = file.GetUploadUrl(); @@ -769,7 +762,7 @@ public void TestGetUploadUrlWithSpecificExpiry() .Returns(new StoragePreSignUrlResponse { Url = "https://example.com" }) .Verifiable(); - var file = new Sdk.Storage.StorageClient(bc.Object).Bucket("test-bucket").File("test-file"); + var file = new Sdk.Storage.Bucket("test-bucket", bc.Object).File("test-file"); var url = file.GetUploadUrl(300); @@ -789,7 +782,7 @@ public void TestGetUploadUrlNonExistingKey() .Throws(new RpcException(new Status(StatusCode.NotFound, "The specified key does not exist"))) .Verifiable(); - var file = new Sdk.Storage.StorageClient(bc.Object).Bucket("test-bucket").File("test-file"); + var file = new Sdk.Storage.Bucket("test-bucket", bc.Object).File("test-file"); try { @@ -824,7 +817,7 @@ public async void TestGetUploadUrlWithDefaultExpiryAsync() .Returns(new AsyncUnaryCall(Task.FromResult(new StoragePreSignUrlResponse { Url = "https://example.com" }), null, null, null, null)) .Verifiable(); - var file = new Sdk.Storage.StorageClient(bc.Object).Bucket("test-bucket").File("test-file"); + var file = new Sdk.Storage.Bucket("test-bucket", bc.Object).File("test-file"); var url = await file.GetUploadUrlAsync(); @@ -852,7 +845,7 @@ public async void TestGetUploadUrlWithSpecificExpiryAsync() .Returns(new AsyncUnaryCall(Task.FromResult(new StoragePreSignUrlResponse { Url = "https://example.com" }), null, null, null, null)) .Verifiable(); - var file = new Sdk.Storage.StorageClient(bc.Object).Bucket("test-bucket").File("test-file"); + var file = new Sdk.Storage.Bucket("test-bucket", bc.Object).File("test-file"); var url = await file.GetUploadUrlAsync(300); @@ -872,7 +865,7 @@ public async void TestGetUploadUrlNonExistingKeyAsync() .Throws(new RpcException(new Status(StatusCode.NotFound, "The specified key does not exist"))) .Verifiable(); - var file = new Sdk.Storage.StorageClient(bc.Object).Bucket("test-bucket").File("test-file"); + var file = new Sdk.Storage.Bucket("test-bucket", bc.Object).File("test-file"); try { @@ -907,7 +900,7 @@ public void TestGetDownloadUrlWithDefaultExpiry() .Returns(new StoragePreSignUrlResponse { Url = "https://example.com" }) .Verifiable(); - var file = new Sdk.Storage.StorageClient(bc.Object).Bucket("test-bucket").File("test-file"); + var file = new Sdk.Storage.Bucket("test-bucket", bc.Object).File("test-file"); var url = file.GetDownloadUrl(); @@ -935,7 +928,7 @@ public void TestGetDownloadUrlWithSpecificExpiry() .Returns(new StoragePreSignUrlResponse { Url = "https://example.com" }) .Verifiable(); - var file = new Sdk.Storage.StorageClient(bc.Object).Bucket("test-bucket").File("test-file"); + var file = new Sdk.Storage.Bucket("test-bucket", bc.Object).File("test-file"); var url = file.GetDownloadUrl(300); @@ -955,7 +948,7 @@ public void TestGetDownloadUrlNonExistingKey() .Throws(new RpcException(new Status(StatusCode.NotFound, "The specified key does not exist"))) .Verifiable(); - var file = new Sdk.Storage.StorageClient(bc.Object).Bucket("test-bucket").File("test-file"); + var file = new Sdk.Storage.Bucket("test-bucket", bc.Object).File("test-file"); try { @@ -990,7 +983,7 @@ public async void TestGetDownloadUrlWithDefaultExpiryAsync() .Returns(new AsyncUnaryCall(Task.FromResult(new StoragePreSignUrlResponse { Url = "https://example.com" }), null, null, null, null)) .Verifiable(); - var file = new Sdk.Storage.StorageClient(bc.Object).Bucket("test-bucket").File("test-file"); + var file = new Sdk.Storage.Bucket("test-bucket", bc.Object).File("test-file"); var url = await file.GetDownloadUrlAsync(); @@ -1018,7 +1011,7 @@ public async void TestGetDownloadUrlWithSpecificExpiryAsync() .Returns(new AsyncUnaryCall(Task.FromResult(new StoragePreSignUrlResponse { Url = "https://example.com" }), null, null, null, null)) .Verifiable(); - var file = new Sdk.Storage.StorageClient(bc.Object).Bucket("test-bucket").File("test-file"); + var file = new Sdk.Storage.Bucket("test-bucket", bc.Object).File("test-file"); var url = await file.GetDownloadUrlAsync(300); @@ -1038,7 +1031,7 @@ public async void TestGetDownloadUrlNonExistingKeyAsync() .Throws(new RpcException(new Status(StatusCode.NotFound, "The specified key does not exist"))) .Verifiable(); - var file = new Sdk.Storage.StorageClient(bc.Object).Bucket("test-bucket").File("test-file"); + var file = new Sdk.Storage.Bucket("test-bucket", bc.Object).File("test-file"); try { @@ -1064,7 +1057,7 @@ public void TestRegisterBlobEventWorkerOnWrite() return ctx; }; - var bucket = new Sdk.Storage.StorageClient().Bucket("test-bucket"); + var bucket = new Sdk.Storage.Bucket("test-bucket"); bucket.On(Service.BlobEventType.Write, "*", middleware); } @@ -1077,7 +1070,7 @@ public void TestRegisterBlobEventWorkerOnDelete() return ctx; }; - var bucket = new Sdk.Storage.StorageClient().Bucket("test-bucket"); + var bucket = new Sdk.Storage.Bucket("test-bucket"); bucket.On(Service.BlobEventType.Delete, "*", middleware); } @@ -1090,7 +1083,7 @@ public void TestRegisterBlobEventWorkerOnWriteWithMultipleMiddleware() return next(ctx); }; - var bucket = new Sdk.Storage.StorageClient().Bucket("test-bucket"); + var bucket = new Sdk.Storage.Bucket("test-bucket"); bucket.On(Service.BlobEventType.Write, "*", middleware, middleware); } @@ -1103,7 +1096,7 @@ public void TestRegisterBlobEventWorkerOnDeleteWithMultipleMiddleware() return next(ctx); }; - var bucket = new Sdk.Storage.StorageClient().Bucket("test-bucket"); + var bucket = new Sdk.Storage.Bucket("test-bucket"); bucket.On(Service.BlobEventType.Delete, "*", middleware, middleware); } diff --git a/test/Nitric.Sdk.Test/Test.cs b/test/Nitric.Sdk.Test/Test.cs deleted file mode 100644 index 1c5f02a..0000000 --- a/test/Nitric.Sdk.Test/Test.cs +++ /dev/null @@ -1,20 +0,0 @@ -using Nitric.Sdk.Service; -using Application = Nitric.Sdk.Nitric; - -private WebsocketContext ValidateRequest(WebsocketContext ctx, Func next) -{ - // Validate Request - return next(ctx); -} - -private WebsocketContext HandleRequest(WebsocketContext ctx, Func next) -{ - // Handle Request - return next(ctx); -} - -var websocket = Application.Websocket("public"); - -websocket.On(WebsocketEventType.Message, ValidateRequest, HandleRequest); - -Application.Run(); \ No newline at end of file diff --git a/test/Nitric.Sdk.Test/Topics/TopicsClientTest.cs b/test/Nitric.Sdk.Test/Topics/TopicsClientTest.cs index 556d4de..15586d1 100644 --- a/test/Nitric.Sdk.Test/Topics/TopicsClientTest.cs +++ b/test/Nitric.Sdk.Test/Topics/TopicsClientTest.cs @@ -34,16 +34,10 @@ public class TestProfile public class EventClientTest { - [Fact] - public void TestBuildEvents() - { - var evt = new TopicsClient(); - Assert.NotNull(evt); - } [Fact] public void TestBuildTopicWithName() { - var topic = new TopicsClient().Topic("test-topic"); + var topic = new Topic("test-topic"); Assert.NotNull(topic); Assert.Equal("test-topic", topic.Name); } @@ -52,10 +46,10 @@ public void TestBuildTopicWithName() public void TestBuildTopicWithoutName() { Assert.Throws( - () => new TopicsClient().Topic("") + () => new Topic("") ); Assert.Throws( - () => new TopicsClient().Topic(null) + () => new Topic(null) ); } @@ -67,7 +61,7 @@ public void TestPublish() ec.Setup(e => e.Publish(It.IsAny(), null, null, It.IsAny())) .Verifiable(); - var topic = new TopicsClient(ec.Object).Topic("test-topic"); + var topic = new Topic("test-topic", ec.Object); var profile = new TestProfile { Name = "John Smith", Age = 30, Addresses = new List { "123 street st" } }; @@ -86,7 +80,7 @@ public void TestPublishToNonExistentTopic() .Throws(new RpcException(new Status(StatusCode.NotFound, "The specified topic does not exist"))) .Verifiable(); - var topic = new TopicsClient(ec.Object).Topic("test-topic"); + var topic = new Topic("test-topic", ec.Object); var profile = new TestProfile { Name = "John Smith", Age = 30, Addresses = new List { "123 street st" } }; @@ -112,7 +106,7 @@ public async void TestPublishAsync() .Returns(new AsyncUnaryCall(Task.FromResult(new TopicPublishResponse()), null, null, null, null)) .Verifiable(); - var topic = new TopicsClient(ec.Object).Topic("test-topic"); + var topic = new Topic("test-topic", ec.Object); var profile = new TestProfile { Name = "John Smith", Age = 30, Addresses = new List { "123 street st" } }; @@ -131,7 +125,7 @@ public async void TestPublishAsyncToNonExistentTopic() .Throws(new RpcException(new Status(StatusCode.NotFound, "The specified topic does not exist"))) .Verifiable(); - var topic = new TopicsClient(ec.Object).Topic("test-topic"); + var topic = new Topic("test-topic", ec.Object); var profile = new TestProfile { Name = "John Smith", Age = 30, Addresses = new List { "123 street st" } }; diff --git a/test/Nitric.Sdk.Test/Websocket/WebsocketTest.cs b/test/Nitric.Sdk.Test/Websocket/WebsocketTest.cs index 76a44d7..086ed80 100644 --- a/test/Nitric.Sdk.Test/Websocket/WebsocketTest.cs +++ b/test/Nitric.Sdk.Test/Websocket/WebsocketTest.cs @@ -14,24 +14,10 @@ namespace Nitric.Sdk.Test.Websocket public class WebsocketTest { - [Fact] - public void TestWebsocketBuild() - { - var websocket = new WebsocketClient(); - Assert.NotNull(websocket); - } - - [Fact] - public void TestBuildWebsocketsWithNullClient() - { - var websocket = new WebsocketClient(null); - Assert.NotNull(websocket); - } - [Fact] public void TestBuildWebsocketWithIdAndSocket() { - var connection = new WebsocketClient(null).Connection("socket-name", "connection-id"); + var connection = new Connection("connection-id", "socket-name"); Assert.NotNull(connection); Assert.Equal("connection-id", connection.Id); Assert.Equal("socket-name", connection.SocketName); @@ -41,13 +27,13 @@ public void TestBuildWebsocketWithIdAndSocket() public void TestBuildWebsocketWithoutIdOrSocket() { Assert.Throws( - () => new WebsocketClient().Connection("", "connection-id")); + () => new Connection("", "connection-id")); Assert.Throws( - () => new WebsocketClient().Connection(null, "connection-id")); + () => new Connection(null, "connection-id")); Assert.Throws( - () => new WebsocketClient().Connection("socket-name", "")); + () => new Connection("socket-name", "")); Assert.Throws( - () => new WebsocketClient().Connection("socket-name", null)); + () => new Connection("socket-name", null)); } //Testing Websocket Methods @@ -65,8 +51,7 @@ public void TestWebsocketSend() e.SendMessage(websocketSendRequest, null, null, It.IsAny())) .Verifiable(); - var connection = new WebsocketClient(wc.Object) - .Connection("socket-name", "connection-id"); + var connection = new Connection("connection-id", "socket-name", wc.Object); connection.SendMessage("websocket-data"); @@ -89,8 +74,7 @@ public void TestWebsocketSendWithError() e.SendMessage(websocketSendRequest, null, null, It.IsAny())) .Throws(new RpcException(Status.DefaultCancelled, "succeeded in failing")); - var connection = new WebsocketClient(wc.Object) - .Connection("socket-name", "connection-id"); + var connection = new Connection("connection-id", "socket-name", wc.Object); Assert.Throws(() => connection.SendMessage("websocket-data") @@ -112,8 +96,7 @@ public async void TestWebsocketSendAsync() .Returns(new AsyncUnaryCall(Task.FromResult(new WebsocketSendResponse()), null, null, null, null)) .Verifiable(); - var connection = new WebsocketClient(wc.Object) - .Connection("socket-name", "connection-id"); + var connection = new Connection("connection-id", "socket-name", wc.Object); await connection.SendMessageAsync("websocket-data"); @@ -136,8 +119,7 @@ public void TestWebsocketSendWithErrorAsync() e.SendMessageAsync(websocketSendRequest, null, null, It.IsAny())) .Throws(new RpcException(Status.DefaultCancelled, "succeeded in failing")); - var connection = new WebsocketClient(wc.Object) - .Connection("socket-name", "connection-id"); + var connection = new Connection("connection-id", "socket-name", wc.Object); Assert.ThrowsAsync(() => connection.SendMessageAsync("websocket-data") @@ -157,8 +139,7 @@ public void TestWebsocketClose() e.CloseConnection(websocketCloseRequest, null, null, It.IsAny())) .Verifiable(); - var connection = new WebsocketClient(wc.Object) - .Connection("socket-name", "connection-id"); + var connection = new Connection("connection-id", "socket-name", wc.Object); connection.CloseConnection(); @@ -180,8 +161,7 @@ public void TestWebsocketCloseWithError() e.CloseConnection(websocketCloseRequest, null, null, It.IsAny())) .Throws(new RpcException(Status.DefaultCancelled, "succeeded in failing")); - var connection = new WebsocketClient(wc.Object) - .Connection("socket-name", "connection-id"); + var connection = new Connection("connection-id", "socket-name", wc.Object); Assert.Throws(() => connection.CloseConnection() @@ -202,8 +182,7 @@ public async void TestWebsocketCloseAsync() .Returns(new AsyncUnaryCall(Task.FromResult(new WebsocketCloseConnectionResponse()), null, null, null, null)) .Verifiable(); - var connection = new WebsocketClient(wc.Object) - .Connection("socket-name", "connection-id"); + var connection = new Connection("connection-id", "socket-name", wc.Object); await connection.CloseConnectionAsync(); @@ -225,8 +204,7 @@ public void TestWebsocketCloseWithErrorAsync() e.CloseConnectionAsync(websocketCloseRequest, null, null, It.IsAny())) .Throws(new RpcException(Status.DefaultCancelled, "succeeded in failing")); - var connection = new WebsocketClient(wc.Object) - .Connection("socket-name", "connection-id"); + var connection = new Connection("connection-id", "socket-name", wc.Object); Assert.ThrowsAsync(() => connection.CloseConnectionAsync() diff --git a/test/Nitric.Sdk.Test/Worker/FileEventWorker.cs b/test/Nitric.Sdk.Test/Worker/FileEventWorker.cs index dc334bd..5a44f4f 100644 --- a/test/Nitric.Sdk.Test/Worker/FileEventWorker.cs +++ b/test/Nitric.Sdk.Test/Worker/FileEventWorker.cs @@ -29,7 +29,7 @@ public void TestFileEventWorkerBuildWithMiddleware() BlobEventType = Proto.Storage.v1.BlobEventType.Created, }; - var bucket = new StorageClient().Bucket("bucket-name"); + var bucket = new Bucket("bucket-name"); var worker = new FileEventWorker(registration, bucket, middleware); @@ -50,7 +50,7 @@ public void TestFileEventWorkerBuildWithMultipleMiddleware() BlobEventType = Proto.Storage.v1.BlobEventType.Created, }; - var bucket = new StorageClient().Bucket("bucket-name"); + var bucket = new Bucket("bucket-name"); var worker = new FileEventWorker(registration, bucket, middleware, middleware); @@ -71,7 +71,7 @@ public void TestFileEventWorkerBuildWithNoMiddleware() BlobEventType = Proto.Storage.v1.BlobEventType.Created, }; - var bucket = new StorageClient().Bucket("bucket-name"); + var bucket = new Bucket("bucket-name"); Assert.Throws(() => { @@ -111,7 +111,7 @@ public async void TestFileEventWorkerStartCreated() e.Listen(null, null, It.IsAny())) .Returns(resp); - var bucket = new StorageClient().Bucket("bucket-name"); + var bucket = new Bucket("bucket-name"); var worker = new FileEventWorker(registration, bucket, middleware) { @@ -156,7 +156,7 @@ public async void TestFileEventWorkerStartDeleted() e.Listen(null, null, It.IsAny())) .Returns(resp); - var bucket = new StorageClient().Bucket("bucket-name"); + var bucket = new Bucket("bucket-name"); var worker = new FileEventWorker(registration, bucket, middleware) { @@ -199,7 +199,7 @@ public async void TestFileEventWorkerStartsWithErrors() e.Listen(null, null, It.IsAny())) .Returns(resp); - var bucket = new StorageClient().Bucket("bucket-name"); + var bucket = new Bucket("bucket-name"); var worker = new FileEventWorker(registration, bucket, middleware) { From 69fd9f0de9bbe354b1cb67e547ee648a2f45daa4 Mon Sep 17 00:00:00 2001 From: Ryan Cartwright Date: Wed, 2 Apr 2025 17:39:16 +1100 Subject: [PATCH 28/34] add to string and test cases, as well as job worker tests --- src/Nitric.Sdk/Job/Job.cs | 25 +- src/Nitric.Sdk/KeyValueStore/KeyValueStore.cs | 11 +- src/Nitric.Sdk/Queue/Message.cs | 13 +- src/Nitric.Sdk/Queue/Queue.cs | 9 + src/Nitric.Sdk/Secret/Secret.cs | 4 +- src/Nitric.Sdk/Storage/Bucket.cs | 2 +- src/Nitric.Sdk/Topics/Topic.cs | 9 + src/Nitric.Sdk/Websocket/Connection.cs | 9 + src/Nitric.Sdk/Worker/JobWorker.cs | 6 + test/Nitric.Sdk.Test/Batch/JobTest.cs | 253 ++++++++++++++++++ ...toreClientTest.cs => KeyValueStoreTest.cs} | 8 + test/Nitric.Sdk.Test/Queue/FailedTaskTest.cs | 47 ---- .../{QueueClientTest.cs => QueueTest.cs} | 14 + .../{TaskTest.cs => ReceivedMessageTest.cs} | 27 +- test/Nitric.Sdk.Test/Secret/SecretTest.cs | 7 +- .../{StorageClientTest.cs => BucketTest.cs} | 0 .../{TopicsClientTest.cs => TopicTest.cs} | 8 + .../{WebsocketTest.cs => ConnectionTest.cs} | 14 +- test/Nitric.Sdk.Test/Worker/JobWorkerTest.cs | 198 ++++++++++++++ 19 files changed, 595 insertions(+), 69 deletions(-) create mode 100644 test/Nitric.Sdk.Test/Batch/JobTest.cs rename test/Nitric.Sdk.Test/KeyValueStore/{KeyValueStoreClientTest.cs => KeyValueStoreTest.cs} (99%) delete mode 100644 test/Nitric.Sdk.Test/Queue/FailedTaskTest.cs rename test/Nitric.Sdk.Test/Queue/{QueueClientTest.cs => QueueTest.cs} (98%) rename test/Nitric.Sdk.Test/Queue/{TaskTest.cs => ReceivedMessageTest.cs} (70%) rename test/Nitric.Sdk.Test/Storage/{StorageClientTest.cs => BucketTest.cs} (100%) rename test/Nitric.Sdk.Test/Topics/{TopicsClientTest.cs => TopicTest.cs} (96%) rename test/Nitric.Sdk.Test/Websocket/{WebsocketTest.cs => ConnectionTest.cs} (94%) create mode 100644 test/Nitric.Sdk.Test/Worker/JobWorkerTest.cs diff --git a/src/Nitric.Sdk/Job/Job.cs b/src/Nitric.Sdk/Job/Job.cs index fbf9bb2..cd5b47a 100644 --- a/src/Nitric.Sdk/Job/Job.cs +++ b/src/Nitric.Sdk/Job/Job.cs @@ -13,6 +13,7 @@ // limitations under the License. using System; +using System.Threading.Tasks; using Nitric.Proto.Batch.v1; using Nitric.Sdk.Common; using GrpcClient = Nitric.Proto.Batch.v1.Batch.BatchClient; @@ -31,7 +32,7 @@ public class Job /// public string Name { get; private set; } - internal Job(string name, GrpcClient client = null) + public Job(string name, GrpcClient client = null) { if (string.IsNullOrEmpty(name)) { @@ -51,11 +52,15 @@ public void Submit(T data) var request = new JobSubmitRequest { JobName = this.Name, - Data = new JobData + }; + + if (data != null) + { + request.Data = new JobData { Struct = Struct.FromJsonSerializable(data), - }, - }; + }; + } this.Client.SubmitJob(request); } @@ -64,16 +69,20 @@ public void Submit(T data) /// Submit a job to the batch service asynchronously /// /// Data to submit to the job - public async void SubmitAsync(T data) + public async Task SubmitAsync(T data) { var request = new JobSubmitRequest { JobName = this.Name, - Data = new JobData + }; + + if (data != null) + { + request.Data = new JobData { Struct = Struct.FromJsonSerializable(data), - }, - }; + }; + } await this.Client.SubmitJobAsync(request); } diff --git a/src/Nitric.Sdk/KeyValueStore/KeyValueStore.cs b/src/Nitric.Sdk/KeyValueStore/KeyValueStore.cs index a93281d..f7f9e4c 100644 --- a/src/Nitric.Sdk/KeyValueStore/KeyValueStore.cs +++ b/src/Nitric.Sdk/KeyValueStore/KeyValueStore.cs @@ -32,7 +32,7 @@ public KeyValueStore(string name, GrpcClient client = null) { throw new ArgumentNullException(nameof(name)); } - + this.Client = client; this.Name = name; } @@ -220,6 +220,15 @@ public KeyValueKeysResponseStream Keys(string prefix = "") throw NitricException.FromRpcException(re); } } + + /// + /// Return a string representation of the key value store. Will not contain the key value store contents. + /// + /// + public override string ToString() + { + return GetType().Name + "[name=" + Name + "]"; + } } public class KeyValueKeysResponseStream diff --git a/src/Nitric.Sdk/Queue/Message.cs b/src/Nitric.Sdk/Queue/Message.cs index 03b3305..aad3b90 100644 --- a/src/Nitric.Sdk/Queue/Message.cs +++ b/src/Nitric.Sdk/Queue/Message.cs @@ -87,6 +87,15 @@ public async Task CompleteAsync() throw NitricException.FromRpcException(re); } } + + /// + /// Return a string representation of the message. + /// + /// + public override string ToString() + { + return GetType().Name + "[leaseId=" + LeaseId + "]"; + } } /// @@ -105,12 +114,12 @@ public class FailedMessage public T Message { get; set; } /// - /// Return a string representation of the failed task. + /// Return a string representation of the failed message. /// /// public override string ToString() { - return "FailedMessage[details=" + Details + "]"; + return GetType().Name + "[details=" + Details + "]"; } } } diff --git a/src/Nitric.Sdk/Queue/Queue.cs b/src/Nitric.Sdk/Queue/Queue.cs index ff0b24d..eb655b2 100644 --- a/src/Nitric.Sdk/Queue/Queue.cs +++ b/src/Nitric.Sdk/Queue/Queue.cs @@ -198,6 +198,15 @@ public async Task>> DequeueAsync(int depth = 1) throw NitricException.FromRpcException(re); } } + + /// + /// Return a string representation of the queue. + /// + /// + public override string ToString() + { + return GetType().Name + "[name=" + Name + "]"; + } } } diff --git a/src/Nitric.Sdk/Secret/Secret.cs b/src/Nitric.Sdk/Secret/Secret.cs index 26d82b6..9400f6f 100644 --- a/src/Nitric.Sdk/Secret/Secret.cs +++ b/src/Nitric.Sdk/Secret/Secret.cs @@ -145,12 +145,12 @@ public async Task PutAsync(string value) } /// - /// A string representing this secret. Will not contain the value of the secret. + /// Return a string representation of this secret. Will not contain the secret contents. /// /// public override string ToString() { - return "[name=" + this.Name + "]"; + return GetType().Name + "[name=" + Name + "]"; } } } diff --git a/src/Nitric.Sdk/Storage/Bucket.cs b/src/Nitric.Sdk/Storage/Bucket.cs index 3e8ddf4..5eb224f 100644 --- a/src/Nitric.Sdk/Storage/Bucket.cs +++ b/src/Nitric.Sdk/Storage/Bucket.cs @@ -171,7 +171,7 @@ public void On( } /// - /// Return a string representation of the file. Will not contain the file contents. + /// Return a string representation of the bucket. /// /// public override string ToString() diff --git a/src/Nitric.Sdk/Topics/Topic.cs b/src/Nitric.Sdk/Topics/Topic.cs index b1c7836..7887e30 100644 --- a/src/Nitric.Sdk/Topics/Topic.cs +++ b/src/Nitric.Sdk/Topics/Topic.cs @@ -91,5 +91,14 @@ public async Task PublishAsync(T message) throw NitricException.FromRpcException(re); } } + + /// + /// Return a string representation of the topic + /// + /// + public override string ToString() + { + return GetType().Name + "[name=" + Name + "]"; + } } } diff --git a/src/Nitric.Sdk/Websocket/Connection.cs b/src/Nitric.Sdk/Websocket/Connection.cs index 744bfba..9e154ee 100644 --- a/src/Nitric.Sdk/Websocket/Connection.cs +++ b/src/Nitric.Sdk/Websocket/Connection.cs @@ -132,5 +132,14 @@ public async Task CloseConnectionAsync() throw NitricException.FromRpcException(e); } } + + /// + /// Return a string representation of the connection + /// + /// + public override string ToString() + { + return GetType().Name + "[socketName=" + SocketName + ",connectionId=" + Id + "]"; + } } } diff --git a/src/Nitric.Sdk/Worker/JobWorker.cs b/src/Nitric.Sdk/Worker/JobWorker.cs index e48b4a4..10dd48f 100644 --- a/src/Nitric.Sdk/Worker/JobWorker.cs +++ b/src/Nitric.Sdk/Worker/JobWorker.cs @@ -33,6 +33,12 @@ public JobWorker(RegistrationRequest request, Func, JobContext> this.GrpcClient = new GrpcClient(GrpcChannelProvider.GetChannel()); } + public JobWorker(RegistrationRequest request, params Middleware>[] middlewares) : base(middlewares) + { + this.RegistrationRequest = request; + this.GrpcClient = new GrpcClient(GrpcChannelProvider.GetChannel()); + } + public override async Task Start(CancellationToken cancellationToken = default) { var stream = this.GrpcClient.HandleJob(); diff --git a/test/Nitric.Sdk.Test/Batch/JobTest.cs b/test/Nitric.Sdk.Test/Batch/JobTest.cs new file mode 100644 index 0000000..1bf3e17 --- /dev/null +++ b/test/Nitric.Sdk.Test/Batch/JobTest.cs @@ -0,0 +1,253 @@ +using System; +using System.Collections.Generic; +using System.Threading; +using System.Threading.Tasks; +using Grpc.Core; +using Moq; +using Nitric.Proto.Batch.v1; +using Nitric.Sdk.Common; +using Xunit; +using GrpcClient = Nitric.Proto.Batch.v1.Batch.BatchClient; + + +namespace Nitric.Sdk.Test.Job +{ + public class TestSubmission + { + public int Id { get; set; } + public string Message { get; set; } + public List Tags { get; set; } + } + public class JobTest + { + [Fact] + public void TestBuildJobWithName() + { + var job = new Sdk.Job.Job("job-name"); + + Assert.NotNull(job); + Assert.Equal("job-name", job.Name); + } + + [Fact] + public void TestBuildJobWithoutName() + { + Assert.Throws( + () => new Sdk.Job.Job("") + ); + Assert.Throws( + () => new Sdk.Job.Job(null) + ); + } + + [Fact] + public void TestJobToString() + { + var job = new Sdk.Job.Job("job-name"); + + Assert.Equal("Job`1[name=job-name]", job.ToString()); + } + + [Fact] + public void TestSubmitJob() + { + var testProfile = new TestSubmission + { + Id = 1234, + Message = "This seems like a good test string?", + Tags = new List { "message", "test" } + }; + + var payload = Sdk.Common.Struct.FromJsonSerializable(testProfile); + + var request = new JobSubmitRequest + { + JobName = "job-name", + Data = new JobData + { + Struct = payload + } + }; + + Mock gc = new Mock(); + gc.Setup(e => + e.SubmitJob(It.IsAny(), null, null, It.IsAny())) + .Returns(new JobSubmitResponse()) + .Verifiable(); + + var kv = new Sdk.Job.Job("job-name", gc.Object); + + kv.Submit(testProfile); + + gc.Verify( + t => t.SubmitJob(request, null, null, It.IsAny()), Times.Once); + } + + [Fact] + public void TestSubmitJobWithNullPayload() + { + var request = new JobSubmitRequest + { + JobName = "job-name", + }; + + Mock gc = new Mock(); + gc.Setup(e => + e.SubmitJob(It.IsAny(), null, null, It.IsAny())) + .Returns(new JobSubmitResponse()) + .Verifiable(); + + var kv = new Sdk.Job.Job("job-name", gc.Object); + + kv.Submit(null); + + gc.Verify( + t => t.SubmitJob(request, null, null, It.IsAny()), Times.Once); + } + + [Fact] + public void TestSubmitJobWithError() + { + var testSubmission = new TestSubmission + { + Id = 1234, + Message = "This seems like a good test string?", + Tags = new List { "message", "test" } + }; + + var payload = Sdk.Common.Struct.FromJsonSerializable(testSubmission); + + var request = new JobSubmitRequest + { + JobName = "job-name", + Data = new JobData + { + Struct = payload + } + }; + + Mock gc = new Mock(); + gc.Setup(e => + e.SubmitJob(It.IsAny(), null, null, It.IsAny())) + .Throws(new RpcException(new Status(StatusCode.NotFound, "The specified job does not exist"))) + .Verifiable(); + + var job = new Sdk.Job.Job("job-name", gc.Object); + + try + { + job.Submit(testSubmission); + Assert.Fail(); + } + catch (RpcException e) + { + Assert.Equal("Status(StatusCode=\"NotFound\", Detail=\"The specified job does not exist\")", + e.Message); + } + + gc.Verify( + t => t.SubmitJob(request, null, null, It.IsAny()), Times.Once); + } + + [Fact] + public async Task TestSubmitJobAsync() + { + var testSubmission = new TestSubmission + { + Id = 1234, + Message = "This seems like a good test string?", + Tags = new List { "message", "test" } + }; + + var payload = Sdk.Common.Struct.FromJsonSerializable(testSubmission); + + var request = new JobSubmitRequest + { + JobName = "job-name", + Data = new JobData + { + Struct = payload + } + }; + + Mock gc = new Mock(); + gc.Setup(e => + e.SubmitJobAsync(It.IsAny(), null, null, It.IsAny())) + .Returns(new AsyncUnaryCall(Task.FromResult(new JobSubmitResponse()), null, null, null, null, null)) + .Verifiable(); + + var job = new Sdk.Job.Job("job-name", gc.Object); + + await job.SubmitAsync(testSubmission); + + gc.Verify( + t => t.SubmitJobAsync(request, null, null, It.IsAny()), Times.Once); + } + + [Fact] + public async Task TestSubmitJobAsyncWithNullPayload() + { + var request = new JobSubmitRequest + { + JobName = "job-name", + }; + + Mock gc = new Mock(); + gc.Setup(e => + e.SubmitJobAsync(It.IsAny(), null, null, It.IsAny())) + .Returns(new AsyncUnaryCall(Task.FromResult(new JobSubmitResponse()), null, null, null, null, null)) + .Verifiable(); + + var kv = new Sdk.Job.Job("job-name", gc.Object); + + await kv.SubmitAsync(null); + + gc.Verify( + t => t.SubmitJobAsync(request, null, null, It.IsAny()), Times.Once); + } + + [Fact] + public async Task TestSubmitJobAsyncWithError() + { + var testSubmission = new TestSubmission + { + Id = 1234, + Message = "This seems like a good test string?", + Tags = new List { "message", "test" } + }; + + var payload = Sdk.Common.Struct.FromJsonSerializable(testSubmission); + + var request = new JobSubmitRequest + { + JobName = "job-name", + Data = new JobData + { + Struct = payload + } + }; + + Mock gc = new Mock(); + gc.Setup(e => + e.SubmitJobAsync(It.IsAny(), null, null, It.IsAny())) + .Throws(new RpcException(new Status(StatusCode.NotFound, "The specified job does not exist"))) + .Verifiable(); + + var job = new Sdk.Job.Job("job-name", gc.Object); + + try + { + await job.SubmitAsync(testSubmission); + Assert.Fail(); + } + catch (RpcException e) + { + Assert.Equal("Status(StatusCode=\"NotFound\", Detail=\"The specified job does not exist\")", + e.Message); + } + + gc.Verify( + t => t.SubmitJobAsync(request, null, null, It.IsAny()), Times.Once); + } + } +} diff --git a/test/Nitric.Sdk.Test/KeyValueStore/KeyValueStoreClientTest.cs b/test/Nitric.Sdk.Test/KeyValueStore/KeyValueStoreTest.cs similarity index 99% rename from test/Nitric.Sdk.Test/KeyValueStore/KeyValueStoreClientTest.cs rename to test/Nitric.Sdk.Test/KeyValueStore/KeyValueStoreTest.cs index abf71a4..de9dfdf 100644 --- a/test/Nitric.Sdk.Test/KeyValueStore/KeyValueStoreClientTest.cs +++ b/test/Nitric.Sdk.Test/KeyValueStore/KeyValueStoreTest.cs @@ -40,6 +40,14 @@ public void TestBuildKeyValueStoreWithoutName() ); } + [Fact] + public void TestKeyValueStoreToString() + { + var job = new KeyValueStore("test-store"); + + Assert.Equal("KeyValueStore`1[name=test-store]", job.ToString()); + } + [Fact] public void TestSetToKeyValueStore() { diff --git a/test/Nitric.Sdk.Test/Queue/FailedTaskTest.cs b/test/Nitric.Sdk.Test/Queue/FailedTaskTest.cs deleted file mode 100644 index b6f50cf..0000000 --- a/test/Nitric.Sdk.Test/Queue/FailedTaskTest.cs +++ /dev/null @@ -1,47 +0,0 @@ -// Copyright 2021, Nitric Technologies Pty Ltd. -// -// 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. - -using System.Collections.Generic; -using Google.Protobuf.WellKnownTypes; -using Nitric.Sdk.Queue; -using Xunit; - -namespace Nitric.Sdk.Test.Queue -{ - public class TestProfile - { - public string Name; - public double Age; - public List Addresses; - } - - public class FailedTaskTest - { - [Fact] - public void TestBuild() - { - var payload = new TestProfile - { Name = "John Smith", Age = 30, Addresses = new List { "123 street st " } }; - var failedTask = new FailedMessage - { - Details = "message", - Message = payload, - }; - - Assert.NotNull(failedTask); - Assert.Equal(payload, failedTask.Message); - Assert.Equal("message", failedTask.Details); - } - } -} diff --git a/test/Nitric.Sdk.Test/Queue/QueueClientTest.cs b/test/Nitric.Sdk.Test/Queue/QueueTest.cs similarity index 98% rename from test/Nitric.Sdk.Test/Queue/QueueClientTest.cs rename to test/Nitric.Sdk.Test/Queue/QueueTest.cs index 063fbaa..dafbde1 100644 --- a/test/Nitric.Sdk.Test/Queue/QueueClientTest.cs +++ b/test/Nitric.Sdk.Test/Queue/QueueTest.cs @@ -27,6 +27,13 @@ namespace Nitric.Sdk.Test.Queue { + public class TestProfile + { + public string Name; + public double Age; + public List Addresses; + } + public class QueueClientTest { [Fact] @@ -48,6 +55,13 @@ public void TestBuildQueueWithoutName() ); } + [Fact] + public void TestQueueToString() + { + var queue = new Sdk.Queue.Queue("test-queue"); + Assert.Equal("Queue`1[name=test-queue]", queue.ToString()); + } + [Fact] public async void TestEnqueueAsync() { diff --git a/test/Nitric.Sdk.Test/Queue/TaskTest.cs b/test/Nitric.Sdk.Test/Queue/ReceivedMessageTest.cs similarity index 70% rename from test/Nitric.Sdk.Test/Queue/TaskTest.cs rename to test/Nitric.Sdk.Test/Queue/ReceivedMessageTest.cs index 7b2e95b..1aaf99c 100644 --- a/test/Nitric.Sdk.Test/Queue/TaskTest.cs +++ b/test/Nitric.Sdk.Test/Queue/ReceivedMessageTest.cs @@ -18,7 +18,7 @@ namespace Nitric.Sdk.Test.Queue { - public class QueueItemTest + public class ReceivedMessageTest { [Fact] public void TestBuildReceivedMessage() @@ -35,6 +35,18 @@ public void TestBuildReceivedMessage() Assert.Equal(payload, queueItem.Message); } + [Fact] + public void TestReceivedMessageToString() + { + var queueItem = new ReceivedMessage + { + LeaseId = "1", + Message = null, + }; + + Assert.Equal("ReceivedMessage`1[leaseId=1]", queueItem.ToString()); + } + [Fact] public void TestBuildFailedMessage() { @@ -48,7 +60,18 @@ public void TestBuildFailedMessage() Assert.NotNull(failedMessage); Assert.Equal("The failed task failed successfully", failedMessage.Details); Assert.Equal(payload, failedMessage.Message); - Assert.Equal("FailedMessage[details=The failed task failed successfully]", failedMessage.ToString()); + } + + [Fact] + public void TestFailedMessageToString() + { + var failedMessage = new FailedMessage + { + Details = "The failed task failed successfully", + Message = null, + }; + + Assert.Equal("FailedMessage`1[details=The failed task failed successfully]", failedMessage.ToString()); } } } diff --git a/test/Nitric.Sdk.Test/Secret/SecretTest.cs b/test/Nitric.Sdk.Test/Secret/SecretTest.cs index acb10a0..1768098 100644 --- a/test/Nitric.Sdk.Test/Secret/SecretTest.cs +++ b/test/Nitric.Sdk.Test/Secret/SecretTest.cs @@ -27,6 +27,7 @@ namespace Nitric.Sdk.Test.Secret { public class SecretTest { + [Fact] public void TestBuildSecretWithName() { @@ -291,7 +292,7 @@ public void TestGetLatestSecretVersion() public void TestSecretToString() { var secretString = new Sdk.Secret.Secret("test-secret").ToString(); - Assert.Equal("[name=test-secret]", secretString); + Assert.Equal("Secret[name=test-secret]", secretString); } //Testing Secret Version Methods @@ -428,7 +429,7 @@ public void TestSecretVersionToString() var secretVersionString = new Sdk.Secret.Secret("test-secret") .Version("test-version") .ToString(); - Assert.Equal("SecretVersion[secret=[name=test-secret], version=test-version]", secretVersionString); + Assert.Equal("SecretVersion[secret=Secret[name=test-secret], version=test-version]", secretVersionString); } [Fact] @@ -458,7 +459,7 @@ public void TestSecretValueToString() var response = version.Access(); Assert.Equal( - "SecretValue[secretVersion=SecretVersion[secret=[name=test-secret], version=test-version], value.length=20]", + "SecretValue[secretVersion=SecretVersion[secret=Secret[name=test-secret], version=test-version], value.length=20]", response.ToString()); sc.Verify( diff --git a/test/Nitric.Sdk.Test/Storage/StorageClientTest.cs b/test/Nitric.Sdk.Test/Storage/BucketTest.cs similarity index 100% rename from test/Nitric.Sdk.Test/Storage/StorageClientTest.cs rename to test/Nitric.Sdk.Test/Storage/BucketTest.cs diff --git a/test/Nitric.Sdk.Test/Topics/TopicsClientTest.cs b/test/Nitric.Sdk.Test/Topics/TopicTest.cs similarity index 96% rename from test/Nitric.Sdk.Test/Topics/TopicsClientTest.cs rename to test/Nitric.Sdk.Test/Topics/TopicTest.cs index 15586d1..df5c5b7 100644 --- a/test/Nitric.Sdk.Test/Topics/TopicsClientTest.cs +++ b/test/Nitric.Sdk.Test/Topics/TopicTest.cs @@ -53,6 +53,14 @@ public void TestBuildTopicWithoutName() ); } + [Fact] + public void TestTopicToString() + { + var topic = new Topic("test-topic"); + + Assert.Equal("Topic`1[name=test-topic]", topic.ToString()); + } + [Fact] public void TestPublish() { diff --git a/test/Nitric.Sdk.Test/Websocket/WebsocketTest.cs b/test/Nitric.Sdk.Test/Websocket/ConnectionTest.cs similarity index 94% rename from test/Nitric.Sdk.Test/Websocket/WebsocketTest.cs rename to test/Nitric.Sdk.Test/Websocket/ConnectionTest.cs index 086ed80..4d0a240 100644 --- a/test/Nitric.Sdk.Test/Websocket/WebsocketTest.cs +++ b/test/Nitric.Sdk.Test/Websocket/ConnectionTest.cs @@ -15,7 +15,7 @@ namespace Nitric.Sdk.Test.Websocket public class WebsocketTest { [Fact] - public void TestBuildWebsocketWithIdAndSocket() + public void TestBuildConnectionWithIdAndSocket() { var connection = new Connection("connection-id", "socket-name"); Assert.NotNull(connection); @@ -24,7 +24,7 @@ public void TestBuildWebsocketWithIdAndSocket() } [Fact] - public void TestBuildWebsocketWithoutIdOrSocket() + public void TestBuildConnectionWithoutIdOrSocket() { Assert.Throws( () => new Connection("", "connection-id")); @@ -36,6 +36,14 @@ public void TestBuildWebsocketWithoutIdOrSocket() () => new Connection("socket-name", null)); } + [Fact] + public void TestConnectionToString() + { + var connection = new Connection("connection-id", "socket-name"); + + Assert.Equal("Connection[socketName=socket-name,connectionId=connection-id]", connection.ToString()); + } + //Testing Websocket Methods [Fact] public void TestWebsocketSend() @@ -61,7 +69,7 @@ public void TestWebsocketSend() } [Fact] - public void TestWebsocketSendWithError() + public void TestConnectionSendWithError() { var websocketSendRequest = new WebsocketSendRequest { diff --git a/test/Nitric.Sdk.Test/Worker/JobWorkerTest.cs b/test/Nitric.Sdk.Test/Worker/JobWorkerTest.cs new file mode 100644 index 0000000..41385dc --- /dev/null +++ b/test/Nitric.Sdk.Test/Worker/JobWorkerTest.cs @@ -0,0 +1,198 @@ +using System; +using System.Collections.Generic; +using System.Threading; +using Grpc.Core; +using Moq; +using Nitric.Sdk.Service; +using Nitric.Sdk.Worker; +using Nitric.Proto.Batch.v1; +using Xunit; + +using GrpcClient = Nitric.Proto.Batch.v1.Job.JobClient; +using Nitric.Sdk.Common; + +namespace Nitric.Sdk.Test.Worker +{ + public class TestSubmission + { + public int Id { get; set; } + public string Message { get; set; } + public List Tags { get; set; } + } + + public class JobWorkerTest + { + [Fact] + public void TestJobWorkerBuildWithMiddleware() + { + Func, JobContext> middleware = (ctx) => + { + return ctx; + }; + + var registration = new RegistrationRequest + { + JobName = "job-name", + }; + + var worker = new JobWorker(registration, middleware); + + Assert.NotNull(worker); + } + + [Fact] + public void TestJobWorkerBuildWithMultipleMiddleware() + { + Middleware> middleware = (ctx, next) => + { + return next(ctx); + }; + + var registration = new RegistrationRequest + { + JobName = "job-name" + }; + + var worker = new JobWorker(registration, middleware, middleware); + + Assert.NotNull(worker); + } + + [Fact] + public void TestJobWorkerBuildWithNoMiddleware() + { + Middleware> middleware = (ctx, next) => + { + return next(ctx); + }; + + var registration = new RegistrationRequest + { + JobName = "job-name", + }; + + Assert.Throws(() => + { + var worker = new JobWorker(registration); + }); + } + + [Fact] + public async void TestJobWorkerStart() + { + var testSubmission = new TestSubmission + { + Id = 1234, + Message = "this seems like a good test message", + Tags = new List { "message", "test" } + }; + + var jobRequest = new JobRequest + { + JobName = "schedule-name", + Data = new JobData + { + Struct = Struct.FromJsonSerializable(testSubmission), + } + }; + + Middleware> middleware = (ctx, next) => + { + Assert.Equal("job-name", ctx.Req.JobName); + Assert.Equal(1234, ctx.Req.Data.Id); + Assert.Equal("this seems like a good test message", ctx.Req.Data.Message); + Assert.Equal(new List { "message", "test" }, ctx.Req.Data.Tags); + return next(ctx); + }; + + var registration = new RegistrationRequest + { + JobName = "job-name", + }; + + var mockClientMessage = new FakeClientStreamWriter(); + + var responseStream = new FakeAsyncStreamReader( + new List + { + new ServerMessage { Id = "id-1", RegistrationResponse = new RegistrationResponse { }}, + new ServerMessage { Id = "id-2", JobRequest = jobRequest }, + } + ); + + var resp = new AsyncDuplexStreamingCall(mockClientMessage, responseStream, null, null, null, null); + + Mock wc = new Mock(); + wc.Setup(e => + e.HandleJob(null, null, It.IsAny())) + .Returns(resp); + + var worker = new JobWorker(registration, middleware) + { + GrpcClient = wc.Object + }; + + await worker.Start(); + + wc.Verify( + t => t.HandleJob(null, null, It.IsAny()), Times.Once); + } + + [Fact] + public async void TestScheduleWorkerStartsWithErrors() + { + var testSubmission = new TestSubmission + { + Id = 1234, + Message = "this seems like a good test message", + Tags = new List { "message", "test" } + }; + + var jobRequest = new JobRequest + { + JobName = "schedule-name", + Data = new JobData + { + Struct = Struct.FromJsonSerializable(testSubmission), + } + }; + + Middleware> middleware = (ctx, next) => + { + throw new ApplicationException("Expected test exception!"); + }; + + var registration = new RegistrationRequest + { + JobName = "job-name", + }; + + var mockClientMessage = new FakeClientStreamWriter(); + + var responseStream = new FakeAsyncStreamReader( + new List + { + new ServerMessage { Id = "id-1", RegistrationResponse = new RegistrationResponse { }}, + new ServerMessage { Id = "id-2", JobRequest = jobRequest }, + } + ); + + var resp = new AsyncDuplexStreamingCall(mockClientMessage, responseStream, null, null, null, null); + + Mock wc = new Mock(); + wc.Setup(e => + e.HandleJob(null, null, It.IsAny())) + .Returns(resp); + + var worker = new JobWorker(registration, middleware) + { + GrpcClient = wc.Object + }; + + await worker.Start(); + + wc.Verify( + t => t.HandleJob(null, null, It.IsAny()), Times.Once); + } + } +} \ No newline at end of file From c916c7f49d4844fccb0a58b659a3f78e9f9b17fa Mon Sep 17 00:00:00 2001 From: Ryan Cartwright Date: Wed, 2 Apr 2025 18:42:00 +1100 Subject: [PATCH 29/34] add missing license headers --- src/Nitric.Sdk/Resource/OidcResource.cs | 14 ++++++++++++++ src/Nitric.Sdk/Resource/SqlResource.cs | 1 + .../KeyValueStore/KeyValueStoreTest.cs | 14 ++++++++++++++ test/Nitric.Sdk.Test/Websocket/ConnectionTest.cs | 14 ++++++++++++++ tools/license/licenseconfig.json | 1 + 5 files changed, 44 insertions(+) diff --git a/src/Nitric.Sdk/Resource/OidcResource.cs b/src/Nitric.Sdk/Resource/OidcResource.cs index cb29dd0..84794d9 100644 --- a/src/Nitric.Sdk/Resource/OidcResource.cs +++ b/src/Nitric.Sdk/Resource/OidcResource.cs @@ -1,3 +1,17 @@ +// Copyright 2021, Nitric Technologies Pty Ltd. +// +// 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. + using Nitric.Proto.Resources.v1; namespace Nitric.Sdk.Resource diff --git a/src/Nitric.Sdk/Resource/SqlResource.cs b/src/Nitric.Sdk/Resource/SqlResource.cs index 1e12d41..69795eb 100644 --- a/src/Nitric.Sdk/Resource/SqlResource.cs +++ b/src/Nitric.Sdk/Resource/SqlResource.cs @@ -11,6 +11,7 @@ // 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. + using System; using Nitric.Proto.Sql.v1; using GrpcClient = Nitric.Proto.Sql.v1.Sql.SqlClient; diff --git a/test/Nitric.Sdk.Test/KeyValueStore/KeyValueStoreTest.cs b/test/Nitric.Sdk.Test/KeyValueStore/KeyValueStoreTest.cs index de9dfdf..565ead7 100644 --- a/test/Nitric.Sdk.Test/KeyValueStore/KeyValueStoreTest.cs +++ b/test/Nitric.Sdk.Test/KeyValueStore/KeyValueStoreTest.cs @@ -1,3 +1,17 @@ +// Copyright 2021, Nitric Technologies Pty Ltd. +// +// 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. + using System; using System.Collections.Generic; using Grpc.Core; diff --git a/test/Nitric.Sdk.Test/Websocket/ConnectionTest.cs b/test/Nitric.Sdk.Test/Websocket/ConnectionTest.cs index 4d0a240..7897e15 100644 --- a/test/Nitric.Sdk.Test/Websocket/ConnectionTest.cs +++ b/test/Nitric.Sdk.Test/Websocket/ConnectionTest.cs @@ -1,3 +1,17 @@ +// Copyright 2021, Nitric Technologies Pty Ltd. +// +// 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. + using System; using System.Threading.Tasks; using Google.Protobuf; diff --git a/tools/license/licenseconfig.json b/tools/license/licenseconfig.json index 5bc3c34..4580abe 100644 --- a/tools/license/licenseconfig.json +++ b/tools/license/licenseconfig.json @@ -6,6 +6,7 @@ ".github/", "properties/**/*", "Scripts/", + "nitric/proto/**/*", "src/Nitric.Sdk/Proto/**/*", "test/**/*", "tools/", From da5d71cd7a37733bfa58abdcc98a5433d119168f Mon Sep 17 00:00:00 2001 From: Ryan Cartwright Date: Wed, 2 Apr 2025 18:46:13 +1100 Subject: [PATCH 30/34] format --- test/Nitric.Sdk.Test/Mocks.cs | 2 +- test/Nitric.Sdk.Test/Worker/SubscriptionWorkerTest.cs | 2 +- test/Nitric.Sdk.Test/Worker/WebsocketWorkerTest.cs | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/test/Nitric.Sdk.Test/Mocks.cs b/test/Nitric.Sdk.Test/Mocks.cs index 90aa3dd..9924b15 100644 --- a/test/Nitric.Sdk.Test/Mocks.cs +++ b/test/Nitric.Sdk.Test/Mocks.cs @@ -33,7 +33,7 @@ public Task MoveNext(CancellationToken cancellationToken) internal class FakeClientStreamWriter : IClientStreamWriter { - WriteOptions IAsyncStreamWriter.WriteOptions { get => WriteOptions.Default; set {} } + WriteOptions IAsyncStreamWriter.WriteOptions { get => WriteOptions.Default; set { } } public Task CompleteAsync() { diff --git a/test/Nitric.Sdk.Test/Worker/SubscriptionWorkerTest.cs b/test/Nitric.Sdk.Test/Worker/SubscriptionWorkerTest.cs index 2f87d09..c5064c6 100644 --- a/test/Nitric.Sdk.Test/Worker/SubscriptionWorkerTest.cs +++ b/test/Nitric.Sdk.Test/Worker/SubscriptionWorkerTest.cs @@ -159,7 +159,7 @@ public async void TestSubscriptionWorkerStartsWithErrors() TopicName = "schedule-name", Message = new TopicMessage { - StructPayload = Struct.FromJsonSerializable(new TestProfile + StructPayload = Struct.FromJsonSerializable(new TestProfile { Name = "John Smith", Age = 21, diff --git a/test/Nitric.Sdk.Test/Worker/WebsocketWorkerTest.cs b/test/Nitric.Sdk.Test/Worker/WebsocketWorkerTest.cs index 7cb67b9..699f466 100644 --- a/test/Nitric.Sdk.Test/Worker/WebsocketWorkerTest.cs +++ b/test/Nitric.Sdk.Test/Worker/WebsocketWorkerTest.cs @@ -90,7 +90,7 @@ public async void TestWebsocketWorkerStart() new List { new ServerMessage { Id = "id-1", RegistrationResponse = new RegistrationResponse { }}, - new ServerMessage + new ServerMessage { Id = "id-2", WebsocketEventRequest = new WebsocketEventRequest From f56f12c43584eb48a2456ea3a3913c688a6a9d65 Mon Sep 17 00:00:00 2001 From: Ryan Cartwright Date: Mon, 7 Apr 2025 16:32:16 +1000 Subject: [PATCH 31/34] remove synchronous code for API routes and resource calls --- makefile | 1 + src/Nitric.Sdk/Job/Job.cs | 24 +-- src/Nitric.Sdk/KeyValueStore/KeyValueStore.cs | 86 +--------- src/Nitric.Sdk/Queue/Message.cs | 25 +-- src/Nitric.Sdk/Queue/Queue.cs | 82 +-------- src/Nitric.Sdk/Resource/ApiResource.cs | 35 ++-- src/Nitric.Sdk/Resource/BatchResource.cs | 3 +- src/Nitric.Sdk/Resource/BucketResource.cs | 3 +- src/Nitric.Sdk/Resource/ScheduleResource.cs | 5 +- src/Nitric.Sdk/Resource/TopicResource.cs | 3 +- src/Nitric.Sdk/Resource/WebsocketResource.cs | 42 ++++- src/Nitric.Sdk/Secret/Secret.cs | 38 +---- src/Nitric.Sdk/Secret/SecretVersion.cs | 34 +--- src/Nitric.Sdk/Service/Middleware.cs | 3 +- src/Nitric.Sdk/Storage/Bucket.cs | 36 +--- src/Nitric.Sdk/Storage/File.cs | 158 +----------------- src/Nitric.Sdk/Topics/Topic.cs | 27 +-- src/Nitric.Sdk/Websocket/Connection.cs | 47 +----- src/Nitric.Sdk/Worker/ApiWorker.cs | 4 +- src/Nitric.Sdk/Worker/BlobEventWorker.cs | 4 +- src/Nitric.Sdk/Worker/FileEventWorker.cs | 4 +- src/Nitric.Sdk/Worker/JobWorker.cs | 4 +- src/Nitric.Sdk/Worker/ScheduleWorker.cs | 4 +- src/Nitric.Sdk/Worker/SubscriptionWorker.cs | 4 +- src/Nitric.Sdk/Worker/WebsocketWorker.cs | 4 +- src/Nitric.Sdk/Worker/Worker.cs | 11 +- 26 files changed, 112 insertions(+), 579 deletions(-) diff --git a/makefile b/makefile index 95f1653..99284b5 100644 --- a/makefile +++ b/makefile @@ -18,6 +18,7 @@ clean: @rm -rf src/Nitric.Sdk/bin @rm -rf src/Nitric.Sdk/obj @rm -rf src/Nitric.Sdk/Proto + @dotnet clean download: @curl -L https://github.com/nitrictech/nitric/releases/download/v${NITRIC_VERSION}/proto.tgz -o nitric.tgz diff --git a/src/Nitric.Sdk/Job/Job.cs b/src/Nitric.Sdk/Job/Job.cs index cd5b47a..64d0402 100644 --- a/src/Nitric.Sdk/Job/Job.cs +++ b/src/Nitric.Sdk/Job/Job.cs @@ -43,33 +43,11 @@ public Job(string name, GrpcClient client = null) this.Name = name; } - /// - /// Submit a job to the batch service - /// - /// Data to submit to the job - public void Submit(T data) - { - var request = new JobSubmitRequest - { - JobName = this.Name, - }; - - if (data != null) - { - request.Data = new JobData - { - Struct = Struct.FromJsonSerializable(data), - }; - } - - this.Client.SubmitJob(request); - } - /// /// Submit a job to the batch service asynchronously /// /// Data to submit to the job - public async Task SubmitAsync(T data) + public async void Submit(T data) { var request = new JobSubmitRequest { diff --git a/src/Nitric.Sdk/KeyValueStore/KeyValueStore.cs b/src/Nitric.Sdk/KeyValueStore/KeyValueStore.cs index f7f9e4c..92faf36 100644 --- a/src/Nitric.Sdk/KeyValueStore/KeyValueStore.cs +++ b/src/Nitric.Sdk/KeyValueStore/KeyValueStore.cs @@ -42,35 +42,7 @@ public KeyValueStore(string name, GrpcClient client = null) /// /// The unique key that references the value. /// The value that was referenced by the key. - public T Get(string key) - { - var request = new KvStoreGetValueRequest - { - Ref = new ValueRef - { - Store = Name, - Key = key, - } - }; - - try - { - var resp = this.Client.GetValue(request); - - return Struct.ToJsonSerializable(resp.Value.Content); - } - catch (Grpc.Core.RpcException re) - { - throw NitricException.FromRpcException(re); - } - } - - /// - /// Get a value from the key value store by referencing the key. - /// - /// The unique key that references the value. - /// The value that was referenced by the key. - public async Task GetAsync(string key) + public async Task Get(string key) { var request = new KvStoreGetValueRequest { @@ -98,34 +70,7 @@ public async Task GetAsync(string key) /// /// A unique key that will reference the value. /// The value to store. - public void Set(string key, T value) - { - var request = new KvStoreSetValueRequest - { - Content = Struct.FromJsonSerializable(value), - Ref = new ValueRef - { - Store = Name, - Key = key, - } - }; - - try - { - this.Client.SetValue(request); - } - catch (Grpc.Core.RpcException re) - { - throw NitricException.FromRpcException(re); - } - } - - /// - /// Set a key value pair in the key value store. - /// - /// A unique key that will reference the value. - /// The value to store. - public async Task SetAsync(string key, T value) + public async Task Set(string key, T value) { var request = new KvStoreSetValueRequest { @@ -151,32 +96,7 @@ public async Task SetAsync(string key, T value) /// Delete a value from the key value store. /// /// The unique key that references the value. - public void Delete(string key) - { - var request = new KvStoreDeleteKeyRequest - { - Ref = new ValueRef - { - Store = Name, - Key = key, - } - }; - - try - { - this.Client.DeleteKey(request); - } - catch (Grpc.Core.RpcException re) - { - throw NitricException.FromRpcException(re); - } - } - - /// - /// Delete a value from the key value store. - /// - /// The unique key that references the value. - public async Task DeleteAsync(string key) + public async Task Delete(string key) { var request = new KvStoreDeleteKeyRequest { diff --git a/src/Nitric.Sdk/Queue/Message.cs b/src/Nitric.Sdk/Queue/Message.cs index aad3b90..d505234 100644 --- a/src/Nitric.Sdk/Queue/Message.cs +++ b/src/Nitric.Sdk/Queue/Message.cs @@ -47,30 +47,7 @@ public class ReceivedMessage /// /// /// - public void Complete() - { - var request = new QueueCompleteRequest - { - QueueName = this.Queue.Name, - LeaseId = this.LeaseId, - }; - - try - { - Queue.Client.Complete(request); - } - catch (Grpc.Core.RpcException re) - { - throw NitricException.FromRpcException(re); - } - } - - /// - /// Complete this task and remove it from the source queue. - /// - /// - /// - public async Task CompleteAsync() + public async void Complete() { var request = new QueueCompleteRequest { diff --git a/src/Nitric.Sdk/Queue/Queue.cs b/src/Nitric.Sdk/Queue/Queue.cs index eb655b2..12339a9 100644 --- a/src/Nitric.Sdk/Queue/Queue.cs +++ b/src/Nitric.Sdk/Queue/Queue.cs @@ -49,51 +49,7 @@ public Queue(string name, GrpcClient client = null) /// The tasks to push to the queue. /// /// - public List> Enqueue(T task, params T[] tasks) - { - if (task == null) - { - throw new ArgumentNullException(nameof(task)); - } - var taskList = new List() { task }; - - taskList.AddRange(tasks); - - var request = new QueueEnqueueRequest - { - QueueName = Name, - }; - - var messages = taskList.Select(task => new QueueMessage - { - StructPayload = Struct.FromJsonSerializable(task) - }); - - request.Messages.AddRange(messages); - - try - { - var response = this.Client.Enqueue(request); - - return response.FailedMessages.Select(failedMessage => new FailedMessage - { - Details = failedMessage.Details, - Message = Struct.ToJsonSerializable(failedMessage.Message.StructPayload), - }).ToList(); - } - catch (Grpc.Core.RpcException re) - { - throw NitricException.FromRpcException(re); - } - } - - /// - /// Send a task to this queue. - /// - /// The tasks to push to the queue. - /// - /// - public async Task>> EnqueueAsync(T task, params T[] tasks) + public async Task>> Enqueue(T task, params T[] tasks) { if (task == null) { @@ -140,41 +96,7 @@ public async Task>> EnqueueAsync(T task, params T[] tasks) /// The maximum number of tasks to dequeue. /// Tasks dequeued from the queue. /// - public List> Dequeue(int depth = 1) - { - var request = new QueueDequeueRequest - { - QueueName = this.Name, - Depth = Math.Max(depth, 1) - }; - - try - { - var response = this.Client.Dequeue(request); - - return response.Messages.Select(message => new ReceivedMessage - { - Queue = this, - LeaseId = message.LeaseId, - Message = Struct.ToJsonSerializable(message.Message.StructPayload) - }).ToList(); - } - catch (Grpc.Core.RpcException re) - { - throw NitricException.FromRpcException(re); - } - } - - /// - /// Dequeue tasks from the queue to process. - /// - /// The number of tasks returned will be the same or less than the requested depth, based on the number of tasks - /// available on the queue. - /// - /// The maximum number of tasks to dequeue. - /// Tasks dequeued from the queue. - /// - public async Task>> DequeueAsync(int depth = 1) + public async Task>> Dequeue(int depth = 1) { var request = new QueueDequeueRequest { diff --git a/src/Nitric.Sdk/Resource/ApiResource.cs b/src/Nitric.Sdk/Resource/ApiResource.cs index 20f51e6..bafde98 100644 --- a/src/Nitric.Sdk/Resource/ApiResource.cs +++ b/src/Nitric.Sdk/Resource/ApiResource.cs @@ -72,7 +72,7 @@ internal void AttachOidc(OidcOptions opts) /// The path to match on. /// The handler to run. /// Security rules to override API-level security. - public void Get(string route, Func handler, OidcOptions[] security = null) => Route(route, new RouteOptions(security: security)).Get(handler); + public void Get(string route, Func> handler, OidcOptions[] security = null) => Route(route, new RouteOptions(security: security)).Get(handler); /// /// Create a new GET handler on the specified route. @@ -88,7 +88,7 @@ internal void AttachOidc(OidcOptions opts) /// The path to match on. /// The handler to run. /// Security rules to override API-level security. - public void Post(string route, Func handler, OidcOptions[] security = null) => Route(route, new RouteOptions(security: security)).Post(handler); + public void Post(string route, Func> handler, OidcOptions[] security = null) => Route(route, new RouteOptions(security: security)).Post(handler); /// /// Create a new POST handler on the specified route. @@ -104,7 +104,7 @@ internal void AttachOidc(OidcOptions opts) /// The path to match on. /// The handler to run. /// Security rules to override API-level security. - public void Put(string route, Func handler, OidcOptions[] security = null) => Route(route, new RouteOptions(security: security)).Put(handler); + public void Put(string route, Func> handler, OidcOptions[] security = null) => Route(route, new RouteOptions(security: security)).Put(handler); /// /// Create a new PUT handler on the specified route. @@ -120,7 +120,7 @@ internal void AttachOidc(OidcOptions opts) /// The path to match on. /// The handler to run. /// Security rules to override API-level security. - public void Delete(string route, Func handler, OidcOptions[] security = null) => Route(route, new RouteOptions(security: security)).Delete(handler); + public void Delete(string route, Func> handler, OidcOptions[] security = null) => Route(route, new RouteOptions(security: security)).Delete(handler); /// /// Create a new DELETE handler on the specified route. @@ -136,7 +136,7 @@ internal void AttachOidc(OidcOptions opts) /// The path to match on. /// The handler to run. /// Security rules to override API-level security. - public void Options(string route, Func handler, OidcOptions[] security = null) => Route(route, new RouteOptions(security: security)).Options(handler); + public void Options(string route, Func> handler, OidcOptions[] security = null) => Route(route, new RouteOptions(security: security)).Options(handler); /// /// Create a new OPTIONS handler on the specified route. @@ -152,7 +152,7 @@ internal void AttachOidc(OidcOptions opts) /// The path to match on. /// The handler to run. /// Security rules to override API-level security. - public void All(string route, Func handler, OidcOptions[] security = null) => Route(route, new RouteOptions(security: security)).All(handler); + public void All(string route, Func> handler, OidcOptions[] security = null) => Route(route, new RouteOptions(security: security)).All(handler); /// /// Create a new handler on the specified route for every HTTP verb. @@ -249,12 +249,12 @@ internal ApiRoute(ApiResource api, string path, RouteOptions opts) }; } - private Middleware[] ConcatMiddleware(Func handler) + private Middleware[] ConcatMiddleware(Func> handler) { - HttpContext ComposedMiddleware(HttpContext context, Func next) + async Task ComposedMiddleware(HttpContext context, Func> next) { - context = handler(context); - return next(context); + context = await handler(context); + return await next(context); } return this.Opts.Middlewares.Append(ComposedMiddleware).ToArray(); } @@ -268,7 +268,7 @@ private Middleware[] ConcatMiddleware(Middleware[] mid /// Create a new GET handler on the specified route. /// /// The handler to run. - public void Get(Func handler) => Method(this.Path, new HttpMethod[] { HttpMethod.Get }, this.Opts, ConcatMiddleware(handler)); + public void Get(Func> handler) => Method(this.Path, new HttpMethod[] { HttpMethod.Get }, this.Opts, ConcatMiddleware(handler)); /// /// Create a new GET middleware chain on the specified route. @@ -280,7 +280,7 @@ private Middleware[] ConcatMiddleware(Middleware[] mid /// Create a new POST handler on the specified route. /// /// The handler to run. - public void Post(Func handler) => Method(this.Path, new HttpMethod[] { HttpMethod.Post }, this.Opts, ConcatMiddleware(handler)); + public void Post(Func> handler) => Method(this.Path, new HttpMethod[] { HttpMethod.Post }, this.Opts, ConcatMiddleware(handler)); /// /// Create a new POST middleware chain on the specified route. @@ -292,7 +292,7 @@ private Middleware[] ConcatMiddleware(Middleware[] mid /// Create a new PUT handler on the specified route. /// /// The handler to run. - public void Put(Func handler) => Method(this.Path, new HttpMethod[] { HttpMethod.Put }, this.Opts, ConcatMiddleware(handler)); + public void Put(Func> handler) => Method(this.Path, new HttpMethod[] { HttpMethod.Put }, this.Opts, ConcatMiddleware(handler)); /// /// Create a new PUT middleware chain on the specified route. @@ -304,7 +304,7 @@ private Middleware[] ConcatMiddleware(Middleware[] mid /// Create a new DELETE handler on the specified route. /// /// The handler to run. - public void Delete(Func handler) => Method(this.Path, new HttpMethod[] { HttpMethod.Delete }, this.Opts, ConcatMiddleware(handler)); + public void Delete(Func> handler) => Method(this.Path, new HttpMethod[] { HttpMethod.Delete }, this.Opts, ConcatMiddleware(handler)); /// /// Create a new DELETE middleware chain on the specified route. @@ -316,7 +316,7 @@ private Middleware[] ConcatMiddleware(Middleware[] mid /// Create a new OPTIONS handler on the specified route. /// /// The handler to run. - public void Options(Func handler) => Method(this.Path, new HttpMethod[] { HttpMethod.Options }, this.Opts, ConcatMiddleware(handler)); + public void Options(Func> handler) => Method(this.Path, new HttpMethod[] { HttpMethod.Options }, this.Opts, ConcatMiddleware(handler)); /// /// Create a new OPTIONS middleware chain on the specified route. @@ -328,7 +328,7 @@ private Middleware[] ConcatMiddleware(Middleware[] mid /// Create a new OPTIONS handler on the specified route. /// /// - public void Patch(Func handler) => Method(this.Path, new HttpMethod[] { HttpMethod.Patch }, this.Opts, ConcatMiddleware(handler)); + public void Patch(Func> handler) => Method(this.Path, new HttpMethod[] { HttpMethod.Patch }, this.Opts, ConcatMiddleware(handler)); /// /// Create a new OPTIONS middleware chain on the specified route. @@ -346,11 +346,12 @@ private Middleware[] ConcatMiddleware(Middleware[] mid HttpMethod.Options, HttpMethod.Patch }; + /// /// Create a new handler on the specified route for every HTTP verb. /// /// The handler to run. - public void All(Func handler) => Method(this.Path, httpMethods, this.Opts, ConcatMiddleware(handler)); + public void All(Func> handler) => Method(this.Path, httpMethods, this.Opts, ConcatMiddleware(handler)); /// /// Create a new chain of middleware on the specified route for every HTTP verb. diff --git a/src/Nitric.Sdk/Resource/BatchResource.cs b/src/Nitric.Sdk/Resource/BatchResource.cs index d7d7458..97f5d0e 100644 --- a/src/Nitric.Sdk/Resource/BatchResource.cs +++ b/src/Nitric.Sdk/Resource/BatchResource.cs @@ -23,6 +23,7 @@ using System.Linq; using GrpcClient = Nitric.Proto.Batch.v1.Batch.BatchClient; using Nitric.Sdk.Common; +using System.Threading.Tasks; namespace Nitric.Sdk.Resource { @@ -93,7 +94,7 @@ protected override IEnumerable PermissionsToActions(IEnumerable)new List(), (acc, x) => acc.Concat(actionMap[x])).Distinct(); } - public void Handler(Func, JobContext> middlewares, JobResourceRequirements requirements = null) + public void Handler(Func, Task>> middlewares, JobResourceRequirements requirements = null) { requirements ??= new JobResourceRequirements(); diff --git a/src/Nitric.Sdk/Resource/BucketResource.cs b/src/Nitric.Sdk/Resource/BucketResource.cs index 8c7ffe1..264f8ad 100644 --- a/src/Nitric.Sdk/Resource/BucketResource.cs +++ b/src/Nitric.Sdk/Resource/BucketResource.cs @@ -23,6 +23,7 @@ using Action = Nitric.Proto.Resources.v1.Action; using Nitric.Sdk.Common; using GrpcClient = Nitric.Proto.Storage.v1.Storage.StorageClient; +using System.Threading.Tasks; namespace Nitric.Sdk.Resource { @@ -112,7 +113,7 @@ public void On( public void On( Service.BlobEventType blobEventType, string keyPrefixFilter, - Func handler) + Func> handler) { var request = new RegistrationRequest { diff --git a/src/Nitric.Sdk/Resource/ScheduleResource.cs b/src/Nitric.Sdk/Resource/ScheduleResource.cs index 424fe10..329aed2 100644 --- a/src/Nitric.Sdk/Resource/ScheduleResource.cs +++ b/src/Nitric.Sdk/Resource/ScheduleResource.cs @@ -17,6 +17,7 @@ using Nitric.Proto.Schedules.v1; using Nitric.Proto.Resources.v1; using ResourceType = Nitric.Proto.Resources.v1.ResourceType; +using System.Threading.Tasks; namespace Nitric.Sdk.Resource { @@ -39,7 +40,7 @@ internal override BaseResource Register() /// /// The interval for the schedule running. e.g. '7 days', '1 hour', '5 minutes' /// The middleware (code) to run on a schedule. - public void Every(string rate, Func middleware) + public void Every(string rate, Func> middleware) { var registration = new RegistrationRequest { @@ -74,7 +75,7 @@ public void Every(string rate, params Middleware[] middleware) /// /// The cron expression representing when the schedule should run. /// The middleware (code) to run on a schedule. - public void Cron(string expression, Func middleware) + public void Cron(string expression, Func> middleware) { var registration = new RegistrationRequest { diff --git a/src/Nitric.Sdk/Resource/TopicResource.cs b/src/Nitric.Sdk/Resource/TopicResource.cs index 8037e70..8b12ba5 100644 --- a/src/Nitric.Sdk/Resource/TopicResource.cs +++ b/src/Nitric.Sdk/Resource/TopicResource.cs @@ -23,6 +23,7 @@ using Action = Nitric.Proto.Resources.v1.Action; using ResourceType = Nitric.Proto.Resources.v1.ResourceType; using GrpcClient = Nitric.Proto.Topics.v1.Topics.TopicsClient; +using System.Threading.Tasks; namespace Nitric.Sdk.Resource { @@ -83,7 +84,7 @@ public void Subscribe(params Middleware>[] middleware) /// Registers a handler to be called whenever a new event is published to this topic. /// /// The handler to call to process events - public void Subscribe(Func, MessageContext> handler) + public void Subscribe(Func, Task>> handler) { var registrationRequest = new RegistrationRequest { TopicName = this.Name }; diff --git a/src/Nitric.Sdk/Resource/WebsocketResource.cs b/src/Nitric.Sdk/Resource/WebsocketResource.cs index c00a630..b5f8a09 100644 --- a/src/Nitric.Sdk/Resource/WebsocketResource.cs +++ b/src/Nitric.Sdk/Resource/WebsocketResource.cs @@ -23,6 +23,7 @@ using GrpcClient = Nitric.Proto.Websockets.v1.Websocket.WebsocketClient; using Nitric.Sdk.Worker; using Nitric.Proto.Websockets.v1; +using System.Threading.Tasks; namespace Nitric.Sdk.Resource { @@ -85,16 +86,49 @@ public void On(Service.WebsocketEventType eventType, params Middleware - /// Registers a handler to be called whenever a new event is published to this websocket. + /// Registers a handler to be called whenever a connection event is published to this websocket. /// - /// The type of websocket event /// The handler to call to process websocket events - public void On(Service.WebsocketEventType eventType, Func handler) + public void OnConnect(Func> handler) { var registrationRequest = new RegistrationRequest { SocketName = Name, - EventType = eventType.ToGrpc() + EventType = Service.WebsocketEventType.Connected.ToGrpc() + }; + + var websocketWorker = new WebsocketWorker(registrationRequest, handler); + + Nitric.RegisterWorker(websocketWorker); + } + + /// + /// Registers a handler to be called whenever a disconnection event is published to this websocket. + /// + /// The handler to call to process websocket events + public void OnDisconnect(Func> handler) + { + var registrationRequest = new RegistrationRequest + { + SocketName = Name, + EventType = Service.WebsocketEventType.Disconnected.ToGrpc() + }; + + var websocketWorker = new WebsocketWorker(registrationRequest, handler); + + Nitric.RegisterWorker(websocketWorker); + } + + /// + /// Registers a handler to be called whenever a message event is published to this websocket. + /// + /// The handler to call to process websocket events + public void OnMessage(Func> handler) + { + var registrationRequest = new RegistrationRequest + { + SocketName = Name, + EventType = Service.WebsocketEventType.Message.ToGrpc() }; var websocketWorker = new WebsocketWorker(registrationRequest, handler); diff --git a/src/Nitric.Sdk/Secret/Secret.cs b/src/Nitric.Sdk/Secret/Secret.cs index 9400f6f..bc01afc 100644 --- a/src/Nitric.Sdk/Secret/Secret.cs +++ b/src/Nitric.Sdk/Secret/Secret.cs @@ -78,43 +78,7 @@ public SecretVersion Latest() /// A reference to the specific version of the secret containing the provided value. /// /// - public SecretVersion Put(string value) - { - if (string.IsNullOrEmpty(value)) - { - throw new ArgumentNullException(nameof(value)); - } - - var request = new SecretPutRequest - { - Secret = new Proto.Secrets.v1.Secret { Name = this.Name }, - Value = Google.Protobuf.ByteString.CopyFrom(Encoding.UTF8.GetBytes(value)), - }; - try - { - var secretResponse = this.Client.Put(request); - return new SecretVersion( - new Secret( - secretResponse.SecretVersion.Secret.Name, - this.Client - ), - secretResponse.SecretVersion.Version - ); - } - catch (Grpc.Core.RpcException re) - { - throw NitricException.FromRpcException(re); - } - } - - /// - /// Create a new version of this secret containing the provided value and set it as the latest version. - /// - /// The secret value to store from a string. - /// A reference to the specific version of the secret containing the provided value. - /// - /// - public async Task PutAsync(string value) + public async Task Put(string value) { if (string.IsNullOrEmpty(value)) { diff --git a/src/Nitric.Sdk/Secret/SecretVersion.cs b/src/Nitric.Sdk/Secret/SecretVersion.cs index 021e593..fedd828 100644 --- a/src/Nitric.Sdk/Secret/SecretVersion.cs +++ b/src/Nitric.Sdk/Secret/SecretVersion.cs @@ -45,39 +45,7 @@ internal SecretVersion(Secret secret, string id) /// /// The secret value from the secrets store. /// - public SecretValue Access() - { - var secret = new SecretAccessRequest - { - SecretVersion = new Proto.Secrets.v1.SecretVersion - { - Secret = new Proto.Secrets.v1.Secret { Name = this.Secret.Name }, - Version = this.Id, - } - }; - - try - { - var response = this.Secret.Client.Access(secret); - var value = response.Value.ToByteArray(); - //Return a new secret value with a reference to this secret version - return new SecretValue( - this, - value.Length > 0 ? value : Array.Empty() - ); - } - catch (Grpc.Core.RpcException re) - { - throw Common.NitricException.FromRpcException(re); - } - } - - /// - /// Retrieve the value stored in this version. - /// - /// The secret value from the secrets store. - /// - public async Task AccessAsync() + public async Task Access() { var secret = new SecretAccessRequest { diff --git a/src/Nitric.Sdk/Service/Middleware.cs b/src/Nitric.Sdk/Service/Middleware.cs index a3b1fad..e4dc946 100644 --- a/src/Nitric.Sdk/Service/Middleware.cs +++ b/src/Nitric.Sdk/Service/Middleware.cs @@ -13,6 +13,7 @@ // limitations under the License. using System; +using System.Threading.Tasks; namespace Nitric.Sdk.Service { @@ -20,5 +21,5 @@ namespace Nitric.Sdk.Service /// Represents a chainable handler for incoming requests. Useful for decorating existing handlers. /// /// The request context. - public delegate TCtx Middleware(TCtx ctx, Func next); + public delegate Task Middleware(TCtx ctx, Func> next); } diff --git a/src/Nitric.Sdk/Storage/Bucket.cs b/src/Nitric.Sdk/Storage/Bucket.cs index 5eb224f..355f7ba 100644 --- a/src/Nitric.Sdk/Storage/Bucket.cs +++ b/src/Nitric.Sdk/Storage/Bucket.cs @@ -67,39 +67,7 @@ public File File(string key) /// /// The prefix to filter file names by. /// All the files in the bucket as Nitric file references. - public List Files(string prefix = "") - { - var request = new StorageListBlobsRequest - { - BucketName = this.Name, - Prefix = prefix, - }; - - try - { - var resp = this.Client.ListBlobs(request); - - var files = new List(); - - foreach (ProtoBlob file in resp.Blobs) - { - files.Add(new File(this, file.Key)); - } - - return files; - } - catch (Grpc.Core.RpcException e) - { - throw Common.NitricException.FromRpcException(e); - } - } - - /// - /// Get a list of files in a bucket. - /// - /// The prefix to filter file names by. - /// All the files in the bucket as Nitric file references. - public async Task> FilesAsync(string prefix = "") + public async Task> Files(string prefix = "") { var request = new StorageListBlobsRequest { @@ -157,7 +125,7 @@ public void On( public void On( Service.BlobEventType blobEventType, string keyPrefixFilter, - Func handler) + Func> handler) { var request = new RegistrationRequest { diff --git a/src/Nitric.Sdk/Storage/File.cs b/src/Nitric.Sdk/Storage/File.cs index 52570d4..bd136d3 100644 --- a/src/Nitric.Sdk/Storage/File.cs +++ b/src/Nitric.Sdk/Storage/File.cs @@ -55,53 +55,7 @@ internal File(Bucket bucket, string key) /// /// The contents to write. /// - public void Write(byte[] body) - { - var request = new StorageWriteRequest - { - BucketName = Bucket.Name, - Key = this.Name, - Body = ByteString.CopyFrom(body) - }; - try - { - this.Bucket.Client.Write(request); - } - catch (Grpc.Core.RpcException re) - { - throw NitricException.FromRpcException(re); - } - } - - /// - /// Create or update the contents of the file. - /// - /// The contents to write. - /// - public void Write(string body) - { - var request = new StorageWriteRequest - { - BucketName = Bucket.Name, - Key = this.Name, - Body = ByteString.CopyFromUtf8(body) - }; - try - { - this.Bucket.Client.Write(request); - } - catch (Grpc.Core.RpcException re) - { - throw NitricException.FromRpcException(re); - } - } - - /// - /// Create or update the contents of the file. - /// - /// The contents to write. - /// - public async Task WriteAsync(byte[] body) + public async void Write(byte[] body) { var request = new StorageWriteRequest { @@ -124,7 +78,7 @@ public async Task WriteAsync(byte[] body) /// /// The contents to write. /// - public async Task WriteAsync(string body) + public async void Write(string body) { var request = new StorageWriteRequest { @@ -147,30 +101,7 @@ public async Task WriteAsync(string body) /// /// The file contents. /// - public byte[] Read() - { - var request = new StorageReadRequest - { - BucketName = Bucket.Name, - Key = this.Name - }; - try - { - var response = this.Bucket.Client.Read(request); - return response.Body.ToByteArray(); - } - catch (Grpc.Core.RpcException re) - { - throw NitricException.FromRpcException(re); - } - } - - /// - /// Retrieve the contents of a file. - /// - /// The file contents. - /// - public async Task ReadAsync() + public async Task Read() { var request = new StorageReadRequest { @@ -192,28 +123,7 @@ public async Task ReadAsync() /// Delete the file. /// /// - public void Delete() - { - var request = new StorageDeleteRequest - { - BucketName = Bucket.Name, - Key = this.Name - }; - try - { - this.Bucket.Client.Delete(request); - } - catch (Grpc.Core.RpcException re) - { - throw NitricException.FromRpcException(re); - } - } - - /// - /// Delete the file. - /// - /// - public async Task DeleteAsync() + public async Task Delete() { var request = new StorageDeleteRequest { @@ -230,64 +140,14 @@ public async Task DeleteAsync() } } - /// - /// Create a presigned URL for writing to a given file reference. - /// - /// How long the URL should be valid for in seconds. Defaults to 600 seconds (10 minutes). - /// The signed URL for writing. - public string GetUploadUrl(int expiry = 600) - { - return this.PreSignUrl(SignedMode.Write, expiry); - } - - /// - /// Create a presigned URL for reading a given file reference. - /// - /// How long the URL should be valid for in seconds. Defaults to 600 seconds (10 minutes). - /// The signed URL for reading. - public string GetDownloadUrl(int expiry = 600) - { - return this.PreSignUrl(SignedMode.Read, expiry); - } - - /// - /// Create a presigned URL for reading or writing for the given file reference. - /// - /// The mode the URL will access the file with. E.g. reading or writing. - /// How long the URL should be valid for in seconds (max of 604800). - /// The signed URL for reading or writing - internal string PreSignUrl(SignedMode mode, int expiry) - { - var request = new StoragePreSignUrlRequest - { - BucketName = this.Bucket.Name, - Key = this.Name, - Operation = mode == SignedMode.Read ? StoragePreSignUrlRequest.Types.Operation.Read : StoragePreSignUrlRequest.Types.Operation.Write, - Expiry = new Duration - { - Seconds = Math.Clamp(expiry, 0, 604800), - } - }; - - try - { - var resp = this.Bucket.Client.PreSignUrl(request); - return resp.Url; - } - catch (Grpc.Core.RpcException re) - { - throw NitricException.FromRpcException(re); - } - } - /// /// Create a presigned URL for reading a given file reference. /// /// How long the URL should be valid for in seconds. Defaults to 600 seconds (10 minutes). /// The signed URL for reading. - public async Task GetDownloadUrlAsync(int expiry = 600) + public async Task GetDownloadUrl(int expiry = 600) { - return await this.PreSignUrlAsync(SignedMode.Read, expiry); + return await this.PreSignUrl(SignedMode.Read, expiry); } @@ -296,9 +156,9 @@ public async Task GetDownloadUrlAsync(int expiry = 600) /// /// How long the URL should be valid for in seconds. Defaults to 600 seconds (10 minutes). /// The signed URL for writing. - public async Task GetUploadUrlAsync(int expiry = 600) + public async Task GetUploadUrl(int expiry = 600) { - return await this.PreSignUrlAsync(SignedMode.Write, expiry); + return await this.PreSignUrl(SignedMode.Write, expiry); } /// @@ -307,7 +167,7 @@ public async Task GetUploadUrlAsync(int expiry = 600) /// The mode the URL will access the file with. E.g. reading or writing. /// How long the URL should be valid for in seconds (max of 604800). /// The signed URL for reading or writing - internal async Task PreSignUrlAsync(SignedMode mode, int expiry) + internal async Task PreSignUrl(SignedMode mode, int expiry) { var request = new StoragePreSignUrlRequest { diff --git a/src/Nitric.Sdk/Topics/Topic.cs b/src/Nitric.Sdk/Topics/Topic.cs index 7887e30..1e9cbc7 100644 --- a/src/Nitric.Sdk/Topics/Topic.cs +++ b/src/Nitric.Sdk/Topics/Topic.cs @@ -47,32 +47,7 @@ public Topic(string name, GrpcClient client = null) /// /// The message to publish /// - public void Publish(T message) - { - var structPayload = Struct.FromJsonSerializable(message); - - var request = new TopicPublishRequest - { - TopicName = this.Name, - Message = new TopicMessage { StructPayload = structPayload } - }; - - try - { - this.Client.Publish(request); - } - catch (Grpc.Core.RpcException re) - { - throw NitricException.FromRpcException(re); - } - } - - /// - /// Publish a new message to this topic. - /// - /// The message to publish - /// - public async Task PublishAsync(T message) + public async void Publish(T message) { var structPayload = Struct.FromJsonSerializable(message); diff --git a/src/Nitric.Sdk/Websocket/Connection.cs b/src/Nitric.Sdk/Websocket/Connection.cs index 9e154ee..8208e56 100644 --- a/src/Nitric.Sdk/Websocket/Connection.cs +++ b/src/Nitric.Sdk/Websocket/Connection.cs @@ -51,29 +51,7 @@ public Connection(string connectionId, string socketName, GrpcClient client = nu /// Send a message to the websocket. /// /// The message to be sent - public void SendMessage(string message) - { - var request = new WebsocketSendRequest - { - ConnectionId = this.Id, - SocketName = this.SocketName, - Data = ByteString.CopyFromUtf8(message) - }; - try - { - this.Client.SendMessage(request); - } - catch (RpcException e) - { - throw NitricException.FromRpcException(e); - } - } - - /// - /// Send a message to the websocket. - /// - /// The message to be sent - public async Task SendMessageAsync(string message) + public async void SendMessage(string message) { var request = new WebsocketSendRequest { @@ -94,28 +72,7 @@ public async Task SendMessageAsync(string message) /// /// Close the connection to the websocket. /// - public void CloseConnection() - { - var request = new WebsocketCloseConnectionRequest - { - ConnectionId = this.Id, - SocketName = this.SocketName, - }; - - try - { - this.Client.CloseConnection(request); - } - catch (RpcException e) - { - throw NitricException.FromRpcException(e); - } - } - - /// - /// Close the connection to the websocket. - /// - public async Task CloseConnectionAsync() + public async void CloseConnection() { var request = new WebsocketCloseConnectionRequest { diff --git a/src/Nitric.Sdk/Worker/ApiWorker.cs b/src/Nitric.Sdk/Worker/ApiWorker.cs index c83279b..5f234bb 100644 --- a/src/Nitric.Sdk/Worker/ApiWorker.cs +++ b/src/Nitric.Sdk/Worker/ApiWorker.cs @@ -27,7 +27,7 @@ public class ApiWorker : AbstractWorker readonly private RegistrationRequest RegistrationRequest; public GrpcClient GrpcClient { private get; set; } - public ApiWorker(RegistrationRequest request, Func middleware) : base(middleware) + public ApiWorker(RegistrationRequest request, Func> middleware) : base(middleware) { this.RegistrationRequest = request; this.GrpcClient = new GrpcClient(GrpcChannelProvider.GetChannel()); @@ -55,7 +55,7 @@ public override async Task Start(CancellationToken cancellationToken = default) try { - ctx = this.Middleware(ctx); + ctx = await this.Middleware(ctx); } catch (Exception err) { diff --git a/src/Nitric.Sdk/Worker/BlobEventWorker.cs b/src/Nitric.Sdk/Worker/BlobEventWorker.cs index ae26a04..c29808a 100644 --- a/src/Nitric.Sdk/Worker/BlobEventWorker.cs +++ b/src/Nitric.Sdk/Worker/BlobEventWorker.cs @@ -27,7 +27,7 @@ public class BlobEventWorker : AbstractWorker readonly private RegistrationRequest RegistrationRequest; public GrpcClient GrpcClient { private get; set; } - public BlobEventWorker(RegistrationRequest request, Func middleware) : base(middleware) + public BlobEventWorker(RegistrationRequest request, Func> middleware) : base(middleware) { this.RegistrationRequest = request; this.GrpcClient = new GrpcClient(GrpcChannelProvider.GetChannel()); @@ -55,7 +55,7 @@ public override async Task Start(CancellationToken cancellationToken = default) try { - ctx = this.Middleware(ctx); + ctx = await this.Middleware(ctx); } catch (Exception err) { diff --git a/src/Nitric.Sdk/Worker/FileEventWorker.cs b/src/Nitric.Sdk/Worker/FileEventWorker.cs index 46225e8..723016f 100644 --- a/src/Nitric.Sdk/Worker/FileEventWorker.cs +++ b/src/Nitric.Sdk/Worker/FileEventWorker.cs @@ -29,7 +29,7 @@ public class FileEventWorker : AbstractWorker readonly private Bucket bucket; public GrpcClient GrpcClient { private get; set; } - public FileEventWorker(RegistrationRequest request, Bucket bucket, Func middleware) : base(middleware) + public FileEventWorker(RegistrationRequest request, Bucket bucket, Func> middleware) : base(middleware) { this.RegistrationRequest = request; this.bucket = bucket; @@ -59,7 +59,7 @@ public override async Task Start(CancellationToken cancellationToken = default) try { - ctx = this.Middleware(ctx); + ctx = await this.Middleware(ctx); } catch (Exception err) { diff --git a/src/Nitric.Sdk/Worker/JobWorker.cs b/src/Nitric.Sdk/Worker/JobWorker.cs index 10dd48f..5ce31c4 100644 --- a/src/Nitric.Sdk/Worker/JobWorker.cs +++ b/src/Nitric.Sdk/Worker/JobWorker.cs @@ -27,7 +27,7 @@ public class JobWorker : AbstractWorker> readonly private RegistrationRequest RegistrationRequest; public GrpcClient GrpcClient { private get; set; } - public JobWorker(RegistrationRequest request, Func, JobContext> middleware) : base(middleware) + public JobWorker(RegistrationRequest request, Func, Task>> middleware) : base(middleware) { this.RegistrationRequest = request; this.GrpcClient = new GrpcClient(GrpcChannelProvider.GetChannel()); @@ -55,7 +55,7 @@ public override async Task Start(CancellationToken cancellationToken = default) try { - ctx = this.Middleware(ctx); + ctx = await this.Middleware(ctx); } catch (Exception) { diff --git a/src/Nitric.Sdk/Worker/ScheduleWorker.cs b/src/Nitric.Sdk/Worker/ScheduleWorker.cs index fbcf686..ff1df24 100644 --- a/src/Nitric.Sdk/Worker/ScheduleWorker.cs +++ b/src/Nitric.Sdk/Worker/ScheduleWorker.cs @@ -27,7 +27,7 @@ public class ScheduleWorker : AbstractWorker readonly private RegistrationRequest RegistrationRequest; public GrpcClient GrpcClient { private get; set; } - public ScheduleWorker(RegistrationRequest request, Func middleware) : base(middleware) + public ScheduleWorker(RegistrationRequest request, Func> middleware) : base(middleware) { this.RegistrationRequest = request; this.GrpcClient = new GrpcClient(GrpcChannelProvider.GetChannel()); @@ -55,7 +55,7 @@ public override async Task Start(CancellationToken cancellationToken = default) try { - ctx = this.Middleware(ctx); + ctx = await this.Middleware(ctx); } catch (Exception err) { diff --git a/src/Nitric.Sdk/Worker/SubscriptionWorker.cs b/src/Nitric.Sdk/Worker/SubscriptionWorker.cs index e989f71..3850896 100644 --- a/src/Nitric.Sdk/Worker/SubscriptionWorker.cs +++ b/src/Nitric.Sdk/Worker/SubscriptionWorker.cs @@ -27,7 +27,7 @@ public class SubscriptionWorker : AbstractWorker> readonly private RegistrationRequest RegistrationRequest; public GrpcClient GrpcClient { private get; set; } - public SubscriptionWorker(RegistrationRequest request, Func, MessageContext> middleware) : base(middleware) + public SubscriptionWorker(RegistrationRequest request, Func, Task>> middleware) : base(middleware) { this.RegistrationRequest = request; this.GrpcClient = new GrpcClient(GrpcChannelProvider.GetChannel()); @@ -55,7 +55,7 @@ public override async Task Start(CancellationToken cancellationToken = default) try { - ctx = this.Middleware(ctx); + ctx = await this.Middleware(ctx); } catch (Exception err) { diff --git a/src/Nitric.Sdk/Worker/WebsocketWorker.cs b/src/Nitric.Sdk/Worker/WebsocketWorker.cs index a2778ed..5d3662b 100644 --- a/src/Nitric.Sdk/Worker/WebsocketWorker.cs +++ b/src/Nitric.Sdk/Worker/WebsocketWorker.cs @@ -27,7 +27,7 @@ public class WebsocketWorker : AbstractWorker readonly private RegistrationRequest RegistrationRequest; public GrpcClient GrpcClient { private get; set; } - public WebsocketWorker(RegistrationRequest request, Func middleware) : base(middleware) + public WebsocketWorker(RegistrationRequest request, Func> middleware) : base(middleware) { this.RegistrationRequest = request; this.GrpcClient = new GrpcClient(GrpcChannelProvider.GetChannel()); @@ -55,7 +55,7 @@ public override async Task Start(CancellationToken cancellationToken = default) try { - ctx = this.Middleware(ctx); + ctx = await this.Middleware(ctx); } catch (Exception err) { diff --git a/src/Nitric.Sdk/Worker/Worker.cs b/src/Nitric.Sdk/Worker/Worker.cs index 11bcb58..b1d6778 100644 --- a/src/Nitric.Sdk/Worker/Worker.cs +++ b/src/Nitric.Sdk/Worker/Worker.cs @@ -28,7 +28,7 @@ interface IWorker public abstract class AbstractWorker : IWorker { - protected Func Middleware; + protected Func> Middleware; public AbstractWorker(params Middleware[] middlewares) { @@ -42,19 +42,22 @@ public AbstractWorker(params Middleware[] middlewares) middlewareList.AddRange(middlewares); - Func lastCall = (context) => context; + Func> lastCall = (context) => + { + return Task.FromResult(context); + }; middlewares.Reverse(); this.Middleware = middlewares.Aggregate(lastCall, (next, handler) => { - Func nextFunc = (context) => handler(context, next) ?? context; + Func> nextFunc = async (context) => await handler(context, next) ?? context; return nextFunc; }); } - public AbstractWorker(Func middleware) + public AbstractWorker(Func> middleware) { this.Middleware = middleware; } From c3d75c3198c348f2621d602cd27c9a3e9d0a4a57 Mon Sep 17 00:00:00 2001 From: Ryan Cartwright Date: Tue, 8 Apr 2025 12:51:40 +1000 Subject: [PATCH 32/34] remove onmessage, onconnect, and ondisconnect from websocket --- src/Nitric.Sdk/Resource/WebsocketResource.cs | 40 ++------------------ 1 file changed, 3 insertions(+), 37 deletions(-) diff --git a/src/Nitric.Sdk/Resource/WebsocketResource.cs b/src/Nitric.Sdk/Resource/WebsocketResource.cs index b5f8a09..b64de1b 100644 --- a/src/Nitric.Sdk/Resource/WebsocketResource.cs +++ b/src/Nitric.Sdk/Resource/WebsocketResource.cs @@ -86,49 +86,15 @@ public void On(Service.WebsocketEventType eventType, params Middleware - /// Registers a handler to be called whenever a connection event is published to this websocket. + /// Registers a handler to be called whenever an event is published to this websocket. /// /// The handler to call to process websocket events - public void OnConnect(Func> handler) + public void On(Service.WebsocketEventType eventType, Func> handler) { var registrationRequest = new RegistrationRequest { SocketName = Name, - EventType = Service.WebsocketEventType.Connected.ToGrpc() - }; - - var websocketWorker = new WebsocketWorker(registrationRequest, handler); - - Nitric.RegisterWorker(websocketWorker); - } - - /// - /// Registers a handler to be called whenever a disconnection event is published to this websocket. - /// - /// The handler to call to process websocket events - public void OnDisconnect(Func> handler) - { - var registrationRequest = new RegistrationRequest - { - SocketName = Name, - EventType = Service.WebsocketEventType.Disconnected.ToGrpc() - }; - - var websocketWorker = new WebsocketWorker(registrationRequest, handler); - - Nitric.RegisterWorker(websocketWorker); - } - - /// - /// Registers a handler to be called whenever a message event is published to this websocket. - /// - /// The handler to call to process websocket events - public void OnMessage(Func> handler) - { - var registrationRequest = new RegistrationRequest - { - SocketName = Name, - EventType = Service.WebsocketEventType.Message.ToGrpc() + EventType = eventType.ToGrpc() }; var websocketWorker = new WebsocketWorker(registrationRequest, handler); From bcfc507e405e7649dc5e245134d202fe76311b64 Mon Sep 17 00:00:00 2001 From: Ryan Cartwright Date: Wed, 9 Apr 2025 11:31:33 +1000 Subject: [PATCH 33/34] remove all synchronous tests --- src/Nitric.Sdk/Job/Job.cs | 2 +- src/Nitric.Sdk/Nitric.Sdk.csproj | 4 +- src/Nitric.Sdk/Queue/Message.cs | 2 +- src/Nitric.Sdk/Storage/File.cs | 4 +- src/Nitric.Sdk/Topics/Topic.cs | 2 +- src/Nitric.Sdk/Websocket/Connection.cs | 4 +- test/Nitric.Sdk.Test/Batch/JobTest.cs | 113 +--- .../KeyValueStore/KeyValueStoreTest.cs | 293 +-------- test/Nitric.Sdk.Test/Queue/QueueTest.cs | 351 ++--------- test/Nitric.Sdk.Test/Secret/SecretTest.cs | 210 +------ test/Nitric.Sdk.Test/Storage/BucketTest.cs | 573 ++---------------- test/Nitric.Sdk.Test/Topics/TopicTest.cs | 52 +- .../Websocket/ConnectionTest.cs | 107 +--- test/Nitric.Sdk.Test/Worker/ApiWorkerTest.cs | 17 +- .../Nitric.Sdk.Test/Worker/BlobEventWorker.cs | 21 +- .../Nitric.Sdk.Test/Worker/FileEventWorker.cs | 21 +- test/Nitric.Sdk.Test/Worker/JobWorkerTest.cs | 15 +- .../Worker/ScheduleWorkerTest.cs | 17 +- .../Worker/SubscriptionWorkerTest.cs | 13 +- .../Worker/WebsocketWorkerTest.cs | 17 +- 20 files changed, 225 insertions(+), 1613 deletions(-) diff --git a/src/Nitric.Sdk/Job/Job.cs b/src/Nitric.Sdk/Job/Job.cs index 64d0402..2ffd1bd 100644 --- a/src/Nitric.Sdk/Job/Job.cs +++ b/src/Nitric.Sdk/Job/Job.cs @@ -47,7 +47,7 @@ public Job(string name, GrpcClient client = null) /// Submit a job to the batch service asynchronously /// /// Data to submit to the job - public async void Submit(T data) + public async Task Submit(T data) { var request = new JobSubmitRequest { diff --git a/src/Nitric.Sdk/Nitric.Sdk.csproj b/src/Nitric.Sdk/Nitric.Sdk.csproj index 01c777b..c7f40ee 100644 --- a/src/Nitric.Sdk/Nitric.Sdk.csproj +++ b/src/Nitric.Sdk/Nitric.Sdk.csproj @@ -1,7 +1,7 @@ netstandard2.1 - 1.0.0 + 1.0.0-b Nitric.Sdk Nitric Pty Ltd LICENSE.txt @@ -22,7 +22,7 @@ - + diff --git a/src/Nitric.Sdk/Queue/Message.cs b/src/Nitric.Sdk/Queue/Message.cs index d505234..73fa22d 100644 --- a/src/Nitric.Sdk/Queue/Message.cs +++ b/src/Nitric.Sdk/Queue/Message.cs @@ -47,7 +47,7 @@ public class ReceivedMessage /// /// /// - public async void Complete() + public async Task Complete() { var request = new QueueCompleteRequest { diff --git a/src/Nitric.Sdk/Storage/File.cs b/src/Nitric.Sdk/Storage/File.cs index bd136d3..97ba0ad 100644 --- a/src/Nitric.Sdk/Storage/File.cs +++ b/src/Nitric.Sdk/Storage/File.cs @@ -55,7 +55,7 @@ internal File(Bucket bucket, string key) /// /// The contents to write. /// - public async void Write(byte[] body) + public async Task Write(byte[] body) { var request = new StorageWriteRequest { @@ -78,7 +78,7 @@ public async void Write(byte[] body) /// /// The contents to write. /// - public async void Write(string body) + public async Task Write(string body) { var request = new StorageWriteRequest { diff --git a/src/Nitric.Sdk/Topics/Topic.cs b/src/Nitric.Sdk/Topics/Topic.cs index 1e9cbc7..151d80f 100644 --- a/src/Nitric.Sdk/Topics/Topic.cs +++ b/src/Nitric.Sdk/Topics/Topic.cs @@ -47,7 +47,7 @@ public Topic(string name, GrpcClient client = null) /// /// The message to publish /// - public async void Publish(T message) + public async Task Publish(T message) { var structPayload = Struct.FromJsonSerializable(message); diff --git a/src/Nitric.Sdk/Websocket/Connection.cs b/src/Nitric.Sdk/Websocket/Connection.cs index 8208e56..6750fa7 100644 --- a/src/Nitric.Sdk/Websocket/Connection.cs +++ b/src/Nitric.Sdk/Websocket/Connection.cs @@ -51,7 +51,7 @@ public Connection(string connectionId, string socketName, GrpcClient client = nu /// Send a message to the websocket. /// /// The message to be sent - public async void SendMessage(string message) + public async Task SendMessage(string message) { var request = new WebsocketSendRequest { @@ -72,7 +72,7 @@ public async void SendMessage(string message) /// /// Close the connection to the websocket. /// - public async void CloseConnection() + public async Task CloseConnection() { var request = new WebsocketCloseConnectionRequest { diff --git a/test/Nitric.Sdk.Test/Batch/JobTest.cs b/test/Nitric.Sdk.Test/Batch/JobTest.cs index 1bf3e17..b10c6d5 100644 --- a/test/Nitric.Sdk.Test/Batch/JobTest.cs +++ b/test/Nitric.Sdk.Test/Batch/JobTest.cs @@ -49,108 +49,7 @@ public void TestJobToString() } [Fact] - public void TestSubmitJob() - { - var testProfile = new TestSubmission - { - Id = 1234, - Message = "This seems like a good test string?", - Tags = new List { "message", "test" } - }; - - var payload = Sdk.Common.Struct.FromJsonSerializable(testProfile); - - var request = new JobSubmitRequest - { - JobName = "job-name", - Data = new JobData - { - Struct = payload - } - }; - - Mock gc = new Mock(); - gc.Setup(e => - e.SubmitJob(It.IsAny(), null, null, It.IsAny())) - .Returns(new JobSubmitResponse()) - .Verifiable(); - - var kv = new Sdk.Job.Job("job-name", gc.Object); - - kv.Submit(testProfile); - - gc.Verify( - t => t.SubmitJob(request, null, null, It.IsAny()), Times.Once); - } - - [Fact] - public void TestSubmitJobWithNullPayload() - { - var request = new JobSubmitRequest - { - JobName = "job-name", - }; - - Mock gc = new Mock(); - gc.Setup(e => - e.SubmitJob(It.IsAny(), null, null, It.IsAny())) - .Returns(new JobSubmitResponse()) - .Verifiable(); - - var kv = new Sdk.Job.Job("job-name", gc.Object); - - kv.Submit(null); - - gc.Verify( - t => t.SubmitJob(request, null, null, It.IsAny()), Times.Once); - } - - [Fact] - public void TestSubmitJobWithError() - { - var testSubmission = new TestSubmission - { - Id = 1234, - Message = "This seems like a good test string?", - Tags = new List { "message", "test" } - }; - - var payload = Sdk.Common.Struct.FromJsonSerializable(testSubmission); - - var request = new JobSubmitRequest - { - JobName = "job-name", - Data = new JobData - { - Struct = payload - } - }; - - Mock gc = new Mock(); - gc.Setup(e => - e.SubmitJob(It.IsAny(), null, null, It.IsAny())) - .Throws(new RpcException(new Status(StatusCode.NotFound, "The specified job does not exist"))) - .Verifiable(); - - var job = new Sdk.Job.Job("job-name", gc.Object); - - try - { - job.Submit(testSubmission); - Assert.Fail(); - } - catch (RpcException e) - { - Assert.Equal("Status(StatusCode=\"NotFound\", Detail=\"The specified job does not exist\")", - e.Message); - } - - gc.Verify( - t => t.SubmitJob(request, null, null, It.IsAny()), Times.Once); - } - - [Fact] - public async Task TestSubmitJobAsync() + public async Task TestSubmitJob() { var testSubmission = new TestSubmission { @@ -178,14 +77,14 @@ public async Task TestSubmitJobAsync() var job = new Sdk.Job.Job("job-name", gc.Object); - await job.SubmitAsync(testSubmission); + await job.Submit(testSubmission); gc.Verify( t => t.SubmitJobAsync(request, null, null, It.IsAny()), Times.Once); } [Fact] - public async Task TestSubmitJobAsyncWithNullPayload() + public async Task TestSubmitJobWithNullPayload() { var request = new JobSubmitRequest { @@ -200,14 +99,14 @@ public async Task TestSubmitJobAsyncWithNullPayload() var kv = new Sdk.Job.Job("job-name", gc.Object); - await kv.SubmitAsync(null); + await kv.Submit(null); gc.Verify( t => t.SubmitJobAsync(request, null, null, It.IsAny()), Times.Once); } [Fact] - public async Task TestSubmitJobAsyncWithError() + public async Task TestSubmitJobWithError() { var testSubmission = new TestSubmission { @@ -237,7 +136,7 @@ public async Task TestSubmitJobAsyncWithError() try { - await job.SubmitAsync(testSubmission); + await job.Submit(testSubmission); Assert.Fail(); } catch (RpcException e) diff --git a/test/Nitric.Sdk.Test/KeyValueStore/KeyValueStoreTest.cs b/test/Nitric.Sdk.Test/KeyValueStore/KeyValueStoreTest.cs index 565ead7..1de614a 100644 --- a/test/Nitric.Sdk.Test/KeyValueStore/KeyValueStoreTest.cs +++ b/test/Nitric.Sdk.Test/KeyValueStore/KeyValueStoreTest.cs @@ -63,115 +63,7 @@ public void TestKeyValueStoreToString() } [Fact] - public void TestSetToKeyValueStore() - { - var testProfile = new TestProfile - { - Name = "John Smith", - Age = 21, - Addresses = new List { "123 address street" } - }; - - var payload = Sdk.Common.Struct.FromJsonSerializable(testProfile); - - var request = new KvStoreSetValueRequest - { - Content = payload, - Ref = new ValueRef - { - Key = "test-key", - Store = "test-store" - } - }; - - Mock gc = new Mock(); - gc.Setup(e => - e.SetValue(It.IsAny(), null, null, It.IsAny())) - .Returns(new KvStoreSetValueResponse()) - .Verifiable(); - - var kv = new KeyValueStore("test-store", gc.Object); - - kv.Set("test-key", testProfile); - - gc.Verify( - t => t.SetValue(request, null, null, It.IsAny()), Times.Once); - } - - [Fact] - public void TestSetNullToKeyValueStore() - { - var request = new KvStoreSetValueRequest - { - Content = null, - Ref = new ValueRef - { - Key = "test-key", - Store = "test-store" - } - }; - - Mock gc = new Mock(); - gc.Setup(e => - e.SetValue(It.IsAny(), null, null, It.IsAny())) - .Returns(new KvStoreSetValueResponse()) - .Verifiable(); - - var kv = new KeyValueStore("test-store", gc.Object); - - kv.Set("test-key", null); - - gc.Verify( - t => t.SetValue(request, null, null, It.IsAny()), Times.Once); - } - - [Fact] - public void TestSetToKeyValueStoreWithError() - { - var testProfile = new TestProfile - { - Name = "John Smith", - Age = 21, - Addresses = new List { "123 address street" } - }; - - var payload = Sdk.Common.Struct.FromJsonSerializable(testProfile); - - var request = new KvStoreSetValueRequest - { - Content = payload, - Ref = new ValueRef - { - Key = "test-key", - Store = "test-store" - } - }; - - Mock gc = new Mock(); - gc.Setup(e => - e.SetValue(It.IsAny(), null, null, It.IsAny())) - .Throws(new RpcException(new Status(StatusCode.NotFound, "The specified key value store does not exist"))) - .Verifiable(); - - var kv = new KeyValueStore("test-store", gc.Object); - - try - { - kv.Set("test-key", testProfile); - Assert.Fail(); - } - catch (NitricException e) - { - Assert.Equal("Status(StatusCode=\"NotFound\", Detail=\"The specified key value store does not exist\")", - e.Message); - } - - gc.Verify( - t => t.SetValue(request, null, null, It.IsAny()), Times.Once); - } - - [Fact] - public async void TestSetToKeyValueStoreAsync() + public async void TestSetToKeyValueStore() { var testProfile = new TestProfile { @@ -202,14 +94,14 @@ public async void TestSetToKeyValueStoreAsync() var kv = new KeyValueStore("test-store", gc.Object); - await kv.SetAsync("test-key", testProfile); + await kv.Set("test-key", testProfile); gc.Verify( t => t.SetValueAsync(request, null, null, It.IsAny()), Times.Once); } [Fact] - public async void TestSetNullToKeyValueStoreAsync() + public async void TestSetNullToKeyValueStore() { var request = new KvStoreSetValueRequest { @@ -231,14 +123,14 @@ public async void TestSetNullToKeyValueStoreAsync() var kv = new KeyValueStore("test-store", gc.Object); - await kv.SetAsync("test-key", null); + await kv.Set("test-key", null); gc.Verify( t => t.SetValueAsync(request, null, null, It.IsAny()), Times.Once); } [Fact] - public async void TestSetNullToKeyValueStoreAsyncWithError() + public async void TestSetNullToKeyValueStoreWithError() { var request = new KvStoreSetValueRequest { @@ -260,7 +152,7 @@ public async void TestSetNullToKeyValueStoreAsyncWithError() try { - await kv.SetAsync("test-key", null); + await kv.Set("test-key", null); Assert.Fail(); } catch (NitricException e) @@ -274,103 +166,7 @@ public async void TestSetNullToKeyValueStoreAsyncWithError() } [Fact] - public void TestGetToKeyValueStore() - { - var testProfile = new TestProfile - { - Name = "John Smith", - Age = 21, - Addresses = new List { "123 address street" } - }; - - var payload = Sdk.Common.Struct.FromJsonSerializable(testProfile); - - var request = new KvStoreGetValueRequest - { - Ref = new ValueRef - { - Key = "test-key", - Store = "test-store" - } - }; - - var resp = new KvStoreGetValueResponse - { - Value = new Value - { - Content = payload, - Ref = new ValueRef - { - Key = "test-key", - Store = "test-store" - } - } - }; - - Mock gc = new Mock(); - gc.Setup(e => - e.GetValue(It.IsAny(), null, null, It.IsAny())) - .Returns(resp) - .Verifiable(); - - var kv = new KeyValueStore("test-store", gc.Object); - - var profile = kv.Get("test-key"); - - Assert.Equal("John Smith", profile.Name); - Assert.Equal(21, profile.Age); - Assert.Equal("123 address street", profile.Addresses[0]); - - gc.Verify( - t => t.GetValue(request, null, null, It.IsAny()), Times.Once); - } - - [Fact] - public void TestGetToKeyValueStoreWithError() - { - var testProfile = new TestProfile - { - Name = "John Smith", - Age = 21, - Addresses = new List { "123 address street" } - }; - - var payload = Sdk.Common.Struct.FromJsonSerializable(testProfile); - - var request = new KvStoreGetValueRequest - { - Ref = new ValueRef - { - Key = "test-key", - Store = "test-store" - } - }; - - Mock gc = new Mock(); - gc.Setup(e => - e.GetValue(It.IsAny(), null, null, It.IsAny())) - .Throws(new RpcException(new Status(StatusCode.NotFound, "The specified key value store does not exist"))) - .Verifiable(); - - var kv = new KeyValueStore("test-store", gc.Object); - - try - { - kv.Get("test-key"); - Assert.Fail(); - } - catch (NitricException e) - { - Assert.Equal("Status(StatusCode=\"NotFound\", Detail=\"The specified key value store does not exist\")", - e.Message); - } - - gc.Verify( - t => t.GetValue(request, null, null, It.IsAny()), Times.Once); - } - - [Fact] - public async void TestGetToKeyValueStoreAsync() + public async void TestGetToKeyValueStore() { var testProfile = new TestProfile { @@ -411,7 +207,7 @@ public async void TestGetToKeyValueStoreAsync() var kv = new KeyValueStore("test-store", gc.Object); - var profile = await kv.GetAsync("test-key"); + var profile = await kv.Get("test-key"); Assert.Equal("John Smith", profile.Name); Assert.Equal(21, profile.Age); @@ -422,7 +218,7 @@ public async void TestGetToKeyValueStoreAsync() } [Fact] - public async void TestGetToKeyValueStoreAsyncWithError() + public async void TestGetToKeyValueStoreWithError() { var testProfile = new TestProfile { @@ -452,7 +248,7 @@ public async void TestGetToKeyValueStoreAsyncWithError() try { - await kv.GetAsync("test-key"); + await kv.Get("test-key"); Assert.Fail(); } catch (NitricException e) @@ -466,68 +262,7 @@ public async void TestGetToKeyValueStoreAsyncWithError() } [Fact] - public void TestDeleteKeyValuePair() - { - var request = new KvStoreDeleteKeyRequest - { - Ref = new ValueRef - { - Key = "test-key", - Store = "test-store" - } - }; - - Mock gc = new Mock(); - gc.Setup(e => - e.DeleteKey(It.IsAny(), null, null, It.IsAny())) - .Returns(new KvStoreDeleteKeyResponse()) - .Verifiable(); - - var kv = new KeyValueStore("test-store", gc.Object); - - kv.Delete("test-key"); - - gc.Verify( - t => t.DeleteKey(request, null, null, It.IsAny()), Times.Once); - } - - [Fact] - public void TestDeleteKeyValuePairWithError() - { - var request = new KvStoreDeleteKeyRequest - { - Ref = new ValueRef - { - Key = "test-key", - Store = "test-store" - } - }; - - Mock gc = new Mock(); - gc.Setup(e => - e.DeleteKey(It.IsAny(), null, null, It.IsAny())) - .Throws(new RpcException(new Status(StatusCode.NotFound, "The specified key value store does not exist"))) - .Verifiable(); - - var kv = new KeyValueStore("test-store", gc.Object); - - try - { - kv.Delete("test-key"); - Assert.Fail(); - } - catch (NitricException e) - { - Assert.Equal("Status(StatusCode=\"NotFound\", Detail=\"The specified key value store does not exist\")", - e.Message); - } - - gc.Verify( - t => t.DeleteKey(request, null, null, It.IsAny()), Times.Once); - } - - [Fact] - public async void TestDeleteKeyValuePairAsync() + public async void TestDeleteKeyValuePair() { var request = new KvStoreDeleteKeyRequest { @@ -548,14 +283,14 @@ public async void TestDeleteKeyValuePairAsync() var kv = new KeyValueStore("test-store", gc.Object); - await kv.DeleteAsync("test-key"); + await kv.Delete("test-key"); gc.Verify( t => t.DeleteKeyAsync(request, null, null, It.IsAny()), Times.Once); } [Fact] - public async void TestDeleteKeyValuePairAsyncWithError() + public async void TestDeleteKeyValuePairWithError() { var request = new KvStoreDeleteKeyRequest { @@ -576,7 +311,7 @@ public async void TestDeleteKeyValuePairAsyncWithError() try { - await kv.DeleteAsync("test-key"); + await kv.Delete("test-key"); Assert.Fail(); } catch (NitricException e) diff --git a/test/Nitric.Sdk.Test/Queue/QueueTest.cs b/test/Nitric.Sdk.Test/Queue/QueueTest.cs index dafbde1..cbb6457 100644 --- a/test/Nitric.Sdk.Test/Queue/QueueTest.cs +++ b/test/Nitric.Sdk.Test/Queue/QueueTest.cs @@ -20,7 +20,6 @@ using Moq; using Nitric.Proto.Queues.v1; using GrpcClient = Nitric.Proto.Queues.v1.Queues.QueuesClient; -using Nitric.Sdk.Queue; using Xunit; using System.Threading.Tasks; using Nitric.Sdk.Common; @@ -63,7 +62,7 @@ public void TestQueueToString() } [Fact] - public async void TestEnqueueAsync() + public async void TestEnqueue() { Mock qc = new Mock(); qc.Setup(e => @@ -73,7 +72,7 @@ public async void TestEnqueueAsync() var queue = new Sdk.Queue.Queue("test-queue", qc.Object); - await queue.EnqueueAsync(new TestProfile { Name = "John Smith", Age = 30, Addresses = new List { "123 street st" } }); + await queue.Enqueue(new TestProfile { Name = "John Smith", Age = 30, Addresses = new List { "123 street st" } }); qc.Verify( t => t.EnqueueAsync(It.IsAny(), null, null, It.IsAny()), @@ -81,15 +80,15 @@ public async void TestEnqueueAsync() } [Fact] - public void TestEnqueueNullMessageAsync() + public void TestEnqueueNullMessage() { var queue = new Sdk.Queue.Queue("test-queue"); - Assert.ThrowsAsync(() => queue.EnqueueAsync(null)); + Assert.ThrowsAsync(async () => await queue.Enqueue(null)); } [Fact] - public async void TestEnqueueMultipleMessagesWithFailedMessagesAsync() + public async void TestEnqueueMultipleMessagesWithFailedMessages() { FailedEnqueueMessage failedMessage = new FailedEnqueueMessage(); failedMessage.Details = "I am a failed message... I failed my message"; @@ -111,7 +110,7 @@ public async void TestEnqueueMultipleMessagesWithFailedMessagesAsync() var queue = new Sdk.Queue.Queue("test-queue", qc.Object); - var failedMessagesResp = await queue.EnqueueAsync(new TestProfile { }, new TestProfile { }); + var failedMessagesResp = await queue.Enqueue(new TestProfile { }, new TestProfile { }); Assert.Equal("I am a failed message... I failed my message", failedMessagesResp[0].Details); @@ -121,7 +120,7 @@ public async void TestEnqueueMultipleMessagesWithFailedMessagesAsync() } [Fact] - public async void TestEnqueueMultipleMessagesWithNoFailedMessagesAsync() + public async void TestEnqueueMultipleMessagesWithNoFailedMessages() { Mock qc = new Mock(); qc.Setup(e => e.EnqueueAsync(It.IsAny(), null, null, @@ -131,7 +130,7 @@ public async void TestEnqueueMultipleMessagesWithNoFailedMessagesAsync() var queue = new Sdk.Queue.Queue("test-queue", qc.Object); - var failedMessages = await queue.EnqueueAsync(new TestProfile { }, new TestProfile { }); + var failedMessages = await queue.Enqueue(new TestProfile { }, new TestProfile { }); Assert.Empty(failedMessages); @@ -141,7 +140,7 @@ public async void TestEnqueueMultipleMessagesWithNoFailedMessagesAsync() } [Fact] - public async void TestEnqueueToNonExistentQueueAsync() + public async void TestEnqueueToNonExistentQueue() { Mock qc = new Mock(); qc.Setup(e => @@ -153,7 +152,7 @@ public async void TestEnqueueToNonExistentQueueAsync() try { - await queue.EnqueueAsync(new TestProfile()); + await queue.Enqueue(new TestProfile()); } catch (NitricException ne) { @@ -167,201 +166,25 @@ public async void TestEnqueueToNonExistentQueueAsync() } [Fact] - public void TestEnqueue() - { - Mock qc = new Mock(); - qc.Setup(e => - e.Enqueue(It.IsAny(), null, null, It.IsAny())) - .Returns(new QueueEnqueueResponse()) - .Verifiable(); - - var queue = new Sdk.Queue.Queue("test-queue", qc.Object); - - queue.Enqueue(new TestProfile { Name = "John Smith", Age = 30, Addresses = new List { "123 street st" } }); - - qc.Verify( - t => t.Enqueue(It.IsAny(), null, null, It.IsAny()), - Times.Once); - } - - [Fact] - public void TestEnqueueToNonExistentQueue() - { - Mock qc = new Mock(); - qc.Setup(e => - e.Enqueue(It.IsAny(), null, null, It.IsAny())) - .Throws(new RpcException(new Status(StatusCode.NotFound, "The specified queue does not exist"))) - .Verifiable(); - - var queue = new Sdk.Queue.Queue("test-queue", qc.Object); - - try - { - queue.Enqueue(new TestProfile()); - } - catch (NitricException ne) - { - Assert.Equal("Status(StatusCode=\"NotFound\", Detail=\"The specified queue does not exist\")", - ne.Message); - } - - qc.Verify( - t => t.Enqueue(It.IsAny(), null, null, It.IsAny()), - Times.Once); - } - - [Fact] - public void TestEnqueueNullMessage() - { - var queue = new Sdk.Queue.Queue("test-queue"); - - Assert.Throws(() => queue.Enqueue(null)); - } - - [Fact] - public void TestEnqueueMultipleMessagesWithFailedMessages() + public async void TestDequeueMessages() { - FailedEnqueueMessage failedMessage = new FailedEnqueueMessage(); - failedMessage.Details = "I am a failed message... I failed my message"; - failedMessage.Message = new QueueMessage(); - - List failedMessages = new List - { - failedMessage, - }; - - var queueBatchResponse = new QueueEnqueueResponse(); - queueBatchResponse.FailedMessages.AddRange(failedMessages); - - Mock qc = new Mock(); - qc.Setup(e => e.Enqueue(It.IsAny(), null, null, - It.IsAny())) - .Returns(queueBatchResponse) - .Verifiable(); - - var queue = new Sdk.Queue.Queue("test-queue", qc.Object); - - var failedMessagesResp = queue.Enqueue(new TestProfile { }, new TestProfile { }); - - Assert.Equal("I am a failed message... I failed my message", failedMessagesResp[0].Details); - - qc.Verify( - t => t.Enqueue(It.IsAny(), null, null, - It.IsAny()), Times.Once); - } - - [Fact] - public void TestEnqueueMultipleMessagesWithNoFailedMessages() - { - Mock qc = new Mock(); - qc.Setup(e => e.Enqueue(It.IsAny(), null, null, - It.IsAny())) - .Returns(new QueueEnqueueResponse()) - .Verifiable(); - - var queue = new Sdk.Queue.Queue("test-queue", qc.Object); - - var failedMessages = queue.Enqueue(new TestProfile { }, new TestProfile { }); - - Assert.Empty(failedMessages); - - qc.Verify( - t => t.Enqueue(It.IsAny(), null, null, - It.IsAny()), Times.Once); - } - - [Fact] - public void TestDequeueMessages() - { - var messagePayload = Sdk.Common.Struct.FromJsonSerializable(new TestProfile { Name = "John Smith" }); - var message = new DequeuedMessage - { - LeaseId = "1234", - Message = new QueueMessage { StructPayload = messagePayload }, - }; - - var messages = new List() { message }; - - var queueReceieveResponse = new QueueDequeueResponse(); - queueReceieveResponse.Messages.AddRange(messages); - - Mock qc = new Mock(); - qc.Setup(e => e.Dequeue(It.IsAny(), null, null, - It.IsAny())) - .Returns(queueReceieveResponse) - .Verifiable(); - - var queue = new Sdk.Queue.Queue("test-queue", qc.Object); - - var response = queue.Dequeue(3); - - Assert.Equal("1234", response[0].LeaseId); - Assert.Equal("John Smith", response[0].Message.Name); - - qc.Verify( - t => t.Dequeue(It.IsAny(), null, null, - It.IsAny()), Times.Once); - } - - [Fact] - public void TestDequeueNoMessages() - { - Mock qc = new Mock(); - qc.Setup(e => e.Dequeue(It.IsAny(), null, null, - It.IsAny())) - .Returns(new QueueDequeueResponse()) - .Verifiable(); - - var queue = new Sdk.Queue.Queue("test-queue", qc.Object); - - var response = queue.Dequeue(3); - - Assert.Empty(response); - - qc.Verify( - t => t.Dequeue(It.IsAny(), null, null, - It.IsAny()), Times.Once); - } - - [Fact] - public void TestDequeueToNonExistentQueue() - { - Mock qc = new Mock(); - qc.Setup(e => e.Dequeue(It.IsAny(), null, null, - It.IsAny())) - .Throws(new RpcException(new Status(StatusCode.NotFound, "The specified queue does not exist"))) - .Verifiable(); - - var queue = new Sdk.Queue.Queue("test-queue", qc.Object); - - try - { - queue.Dequeue(3); - Assert.Fail(); - } - catch (NitricException e) - { - Assert.Equal("Status(StatusCode=\"NotFound\", Detail=\"The specified queue does not exist\")", - e.Message); - } - - qc.Verify( - t => t.Dequeue(It.IsAny(), null, null, - It.IsAny()), Times.Once); - } + var payload = new Google.Protobuf.WellKnownTypes.Struct(); + payload.Fields.Add("Name", Value.ForString("John Smith")); + payload.Fields.Add("Age", Value.ForNumber(30.0)); + payload.Fields.Add("Addresses", Value.ForList(new[] { Value.ForString("123 street st") })); - [Fact] - public async void TestDequeueMessagesAsync() - { - var messagePayload = Sdk.Common.Struct.FromJsonSerializable(new TestProfile { Name = "John Smith" }); - var message = new DequeuedMessage + var messages = new List() { - LeaseId = "1234", - Message = new QueueMessage { StructPayload = messagePayload }, + new DequeuedMessage + { + Message = new QueueMessage + { + StructPayload = payload + }, + LeaseId = "1" + } }; - var messages = new List() { message }; - var queueReceieveResponse = new QueueDequeueResponse(); queueReceieveResponse.Messages.AddRange(messages); @@ -373,10 +196,11 @@ public async void TestDequeueMessagesAsync() var queue = new Sdk.Queue.Queue("test-queue", qc.Object); - var response = await queue.DequeueAsync(3); + var response = await queue.Dequeue(3); - Assert.Equal("1234", response[0].LeaseId); Assert.Equal("John Smith", response[0].Message.Name); + Assert.Equal(30.0, response[0].Message.Age); + Assert.Equal("123 street st", response[0].Message.Addresses[0]); qc.Verify( t => t.DequeueAsync(It.IsAny(), null, null, @@ -384,7 +208,7 @@ public async void TestDequeueMessagesAsync() } [Fact] - public async void TestDequeueNoMessagesAsync() + public async void TestDequeueNoMessages() { Mock qc = new Mock(); qc.Setup(e => e.DequeueAsync(It.IsAny(), null, null, @@ -394,7 +218,7 @@ public async void TestDequeueNoMessagesAsync() var queue = new Sdk.Queue.Queue("test-queue", qc.Object); - var response = await queue.DequeueAsync(3); + var response = await queue.Dequeue(3); Assert.Empty(response); @@ -404,7 +228,7 @@ public async void TestDequeueNoMessagesAsync() } [Fact] - public async void TestDequeueToNonExistentQueueAsync() + public async void TestDequeueToNonExistentQueue() { Mock qc = new Mock(); qc.Setup(e => e.DequeueAsync(It.IsAny(), null, null, @@ -416,7 +240,7 @@ public async void TestDequeueToNonExistentQueueAsync() try { - await queue.DequeueAsync(3); + await queue.Dequeue(3); Assert.Fail(); } catch (NitricException e) @@ -431,52 +255,7 @@ public async void TestDequeueToNonExistentQueueAsync() } [Fact] - public void TestComplete() - { - var payload = new Google.Protobuf.WellKnownTypes.Struct(); - payload.Fields.Add("Name", Value.ForString("John Smith")); - payload.Fields.Add("Age", Value.ForNumber(30.0)); - payload.Fields.Add("Addresses", Value.ForList(new[] { Value.ForString("123 street st") })); - - var messages = new List() - { - new DequeuedMessage - { - Message = new QueueMessage - { - StructPayload = payload - }, - LeaseId = "1" - } - }; - - var queueReceieveResponse = new QueueDequeueResponse(); - queueReceieveResponse.Messages.AddRange(messages); - - Mock qc = new Mock(); - qc.Setup(e => e.Dequeue(It.IsAny(), null, null, - It.IsAny())) - .Returns(queueReceieveResponse) - .Verifiable(); - - Mock qcr = new Mock(); - qc.Setup(e => e.Complete(It.IsAny(), null, null, - It.IsAny())) - .Verifiable(); - - var queue = new Sdk.Queue.Queue("test-queue", qc.Object); - - var response = queue.Dequeue(3); - - response.ToList()[0].Complete(); - - qc.Verify( - t => t.Complete(It.IsAny(), null, null, - It.IsAny()), Times.Once); - } - - [Fact] - public async void TestCompleteAsync() + public async void TestComplete() { var payload = new Google.Protobuf.WellKnownTypes.Struct(); payload.Fields.Add("Name", Value.ForString("John Smith")); @@ -504,7 +283,6 @@ public async void TestCompleteAsync() .Returns(new AsyncUnaryCall(Task.FromResult(queueReceieveResponse), null, null, null, null)) .Verifiable(); - Mock qcr = new Mock(); qc.Setup(e => e.CompleteAsync(It.IsAny(), null, null, It.IsAny())) .Returns(new AsyncUnaryCall(Task.FromResult(new QueueCompleteResponse()), null, null, null, null)) @@ -512,9 +290,9 @@ public async void TestCompleteAsync() var queue = new Sdk.Queue.Queue("test-queue", qc.Object); - var response = await queue.DequeueAsync(3); + var response = await queue.Dequeue(3); - await response.ToList()[0].CompleteAsync(); + await response.ToList()[0].Complete(); qc.Verify( t => t.CompleteAsync(It.IsAny(), null, null, @@ -522,62 +300,7 @@ public async void TestCompleteAsync() } [Fact] - public void TestCompleteToNonExistentQueue() - { - var payload = new Google.Protobuf.WellKnownTypes.Struct(); - payload.Fields.Add("Name", Value.ForString("John Smith")); - payload.Fields.Add("Age", Value.ForNumber(30.0)); - payload.Fields.Add("Addresses", Value.ForList(new[] { Value.ForString("123 street st") })); - - var messages = new List() - { - new DequeuedMessage - { - Message = new QueueMessage - { - StructPayload = payload - }, - LeaseId = "1" - } - }; - - var queueReceieveResponse = new QueueDequeueResponse(); - queueReceieveResponse.Messages.AddRange(messages); - - Mock qc = new Mock(); - qc.Setup(e => e.Dequeue(It.IsAny(), null, null, - It.IsAny())) - .Returns(queueReceieveResponse) - .Verifiable(); - - Mock qcr = new Mock(); - qc.Setup(e => e.Complete(It.IsAny(), null, null, - It.IsAny())) - .Throws(new RpcException(new Status(StatusCode.NotFound, "The specified queue does not exist"))) - .Verifiable(); - - var queue = new Sdk.Queue.Queue("test-queue", qc.Object); - - var response = queue.Dequeue(3); - - try - { - response.ToList()[0].Complete(); - Assert.Fail(); - } - catch (NitricException e) - { - Assert.Equal("Status(StatusCode=\"NotFound\", Detail=\"The specified queue does not exist\")", - e.Message); - } - - qc.Verify( - t => t.Complete(It.IsAny(), null, null, - It.IsAny()), Times.Once); - } - - [Fact] - public async void TestCompleteToNonExistentQueueAsync() + public async void TestCompleteToNonExistentQueue() { var payload = new Google.Protobuf.WellKnownTypes.Struct(); payload.Fields.Add("Name", Value.ForString("John Smith")); @@ -613,11 +336,11 @@ public async void TestCompleteToNonExistentQueueAsync() var queue = new Sdk.Queue.Queue("test-queue", qc.Object); - var response = await queue.DequeueAsync(3); + var response = await queue.Dequeue(3); try { - await response.ToList()[0].CompleteAsync(); + await response.ToList()[0].Complete(); Assert.Fail(); } catch (NitricException e) diff --git a/test/Nitric.Sdk.Test/Secret/SecretTest.cs b/test/Nitric.Sdk.Test/Secret/SecretTest.cs index 1768098..1f1e92c 100644 --- a/test/Nitric.Sdk.Test/Secret/SecretTest.cs +++ b/test/Nitric.Sdk.Test/Secret/SecretTest.cs @@ -47,7 +47,7 @@ public void TestBuildSecretWithoutName() //Testing Secret Methods [Fact] - public async void TestPutSecretBytesAsync() + public async void TestPutSecretBytes() { var secretPutResponse = new SecretPutResponse { @@ -68,7 +68,7 @@ public async void TestPutSecretBytesAsync() var secret = new Sdk.Secret.Secret("test-secret", sc.Object); - var response = await secret.PutAsync("Super secret message"); + var response = await secret.Put("Super secret message"); Assert.Equal("test-version", response.Id); Assert.Equal(secret.Name, response.Secret.Name); @@ -79,7 +79,7 @@ public async void TestPutSecretBytesAsync() } [Fact] - public async void TestPutSecretStringAsync() + public async void TestPutSecretString() { var secretPutResponse = new SecretPutResponse { @@ -100,7 +100,7 @@ public async void TestPutSecretStringAsync() var testString = "Super secret message"; var secret = new Sdk.Secret.Secret("test-secret", sc.Object); - var response = await secret.PutAsync(testString); + var response = await secret.Put(testString); Assert.Equal("test-version", response.Id); Assert.Equal(secret.Name, response.Secret.Name); @@ -111,23 +111,23 @@ public async void TestPutSecretStringAsync() } [Fact] - public void TestPutEmptySecretStringAsync() + public void TestPutEmptySecretString() { var secret = new Sdk.Secret.Secret("test-secret"); Assert.ThrowsAsync( - () => secret.PutAsync("")); + async () => await secret.Put("")); } [Fact] - public void TestPutNullSecretBytesAsync() + public void TestPutNullSecretBytes() { var secret = new Sdk.Secret.Secret("test-secret"); Assert.ThrowsAsync( - () => secret.PutAsync(null)); + async () => await secret.Put(null)); } [Fact] - public async void TestPutNonExistentSecretAsync() + public async void TestPutNonExistentSecret() { Mock sc = new Mock(); sc.Setup(e => @@ -139,7 +139,7 @@ public async void TestPutNonExistentSecretAsync() var secret = new Sdk.Secret.Secret("test-secret", sc.Object); try { - var response = await secret.PutAsync(testString); + var response = await secret.Put(testString); Assert.Fail(); } catch (NitricException ne) @@ -154,114 +154,6 @@ public async void TestPutNonExistentSecretAsync() Times.Once); } - [Fact] - public void TestPutSecretBytes() - { - var secretPutResponse = new SecretPutResponse - { - SecretVersion = new Proto.Secrets.v1.SecretVersion - { - Secret = new Proto.Secrets.v1.Secret - { - Name = "test-secret", - }, - Version = "test-version", - } - }; - Mock sc = new Mock(); - sc.Setup(e => - e.Put(It.IsAny(), null, null, It.IsAny())) - .Returns(secretPutResponse) - .Verifiable(); - - var secret = new Sdk.Secret.Secret("test-secret", sc.Object); - - var response = secret.Put("Super secret message"); - - Assert.Equal("test-version", response.Id); - Assert.Equal(secret.Name, response.Secret.Name); - - sc.Verify( - t => t.Put(It.IsAny(), null, null, It.IsAny()), - Times.Once); - } - - [Fact] - public void TestPutSecretString() - { - var secretPutResponse = new SecretPutResponse - { - SecretVersion = new Proto.Secrets.v1.SecretVersion - { - Secret = new Proto.Secrets.v1.Secret - { - Name = "test-secret", - }, - Version = "test-version", - } - }; - Mock sc = new Mock(); - sc.Setup(e => - e.Put(It.IsAny(), null, null, It.IsAny())) - .Returns(secretPutResponse) - .Verifiable(); - - var testString = "Super secret message"; - var secret = new Sdk.Secret.Secret("test-secret", sc.Object); - var response = secret.Put(testString); - - Assert.Equal("test-version", response.Id); - Assert.Equal(secret.Name, response.Secret.Name); - - sc.Verify( - t => t.Put(It.IsAny(), null, null, It.IsAny()), - Times.Once); - } - - [Fact] - public void TestPutEmptySecretString() - { - var secret = new Sdk.Secret.Secret("test-secret"); - Assert.Throws( - () => secret.Put("")); - } - - [Fact] - public void TestPutNullSecretBytes() - { - var secret = new Sdk.Secret.Secret("test-secret"); - Assert.Throws( - () => secret.Put(null)); - } - - [Fact] - public void TestPutNonExistentSecret() - { - Mock sc = new Mock(); - sc.Setup(e => - e.Put(It.IsAny(), null, null, It.IsAny())) - .Throws(new RpcException(new Status(StatusCode.NotFound, "The specified secret does not exist"))) - .Verifiable(); - - var testString = "Super secret message"; - var secret = new Sdk.Secret.Secret("test-secret", sc.Object); - try - { - var response = secret.Put(testString); - Assert.Fail(); - } - catch (NitricException ne) - { - Assert.Equal("Status(StatusCode=\"NotFound\", Detail=\"The specified secret does not exist\")", - ne.Message); - } - - - sc.Verify( - t => t.Put(It.IsAny(), null, null, It.IsAny()), - Times.Once); - } - [Fact] public void TestGetSecretVersion() { @@ -295,72 +187,8 @@ public void TestSecretToString() Assert.Equal("Secret[name=test-secret]", secretString); } - //Testing Secret Version Methods [Fact] - public void TestAccess() - { - var secretPutResponse = new SecretAccessResponse - { - SecretVersion = new Proto.Secrets.v1.SecretVersion - { - Secret = new Proto.Secrets.v1.Secret - { - Name = "test-secret", - }, - Version = "test-version", - }, - Value = Google.Protobuf.ByteString.CopyFromUtf8("Super secret message"), - }; - Mock sc = new Mock(); - sc.Setup(e => e.Access(It.IsAny(), null, null, - It.IsAny())) - .Returns(secretPutResponse) - .Verifiable(); - - var version = new Sdk.Secret.Secret("test-secret", sc.Object) - .Version("test-version"); - var response = version.Access(); - - Assert.Equal("test-version", response.SecretVersion.Id); - Assert.Equal("test-secret", response.SecretVersion.Secret.Name); - Assert.Equal("Super secret message", Encoding.UTF8.GetString(response.ValueBytes)); - Assert.Equal("Super secret message", response.Value); - - sc.Verify( - t => t.Access(It.IsAny(), null, null, - It.IsAny()), Times.Once); - } - - [Fact] - public void TestAccessSecretWithoutPermission() - { - Mock sc = new Mock(); - sc.Setup(e => e.Access(It.IsAny(), null, null, - It.IsAny())) - .Throws(new RpcException(new Status(StatusCode.PermissionDenied, - "You do not have permission to access this secret"))) - .Verifiable(); - - var secret = new Sdk.Secret.Secret("test-secret", sc.Object); - try - { - var response = secret.Version("test-secret").Access(); - } - catch (NitricException ne) - { - Assert.Equal( - "Status(StatusCode=\"PermissionDenied\", Detail=\"You do not have permission to access this secret\")", - ne.Message); - } - - - sc.Verify( - t => t.Access(It.IsAny(), null, null, - It.IsAny()), Times.Once); - } - - [Fact] - public async void TestAccessAsync() + public async void TestAccess() { var secretPutResponse = new SecretAccessResponse { @@ -382,7 +210,7 @@ public async void TestAccessAsync() var version = new Sdk.Secret.Secret("test-secret", sc.Object) .Version("test-version"); - var response = await version.AccessAsync(); + var response = await version.Access(); Assert.Equal("test-version", response.SecretVersion.Id); Assert.Equal("test-secret", response.SecretVersion.Secret.Name); @@ -395,7 +223,7 @@ public async void TestAccessAsync() } [Fact] - public async void TestAccessSecretWithoutPermissionAsync() + public async void TestAccessSecretWithoutPermission() { Mock sc = new Mock(); sc.Setup(e => e.AccessAsync(It.IsAny(), null, null, @@ -407,7 +235,7 @@ public async void TestAccessSecretWithoutPermissionAsync() var secret = new Sdk.Secret.Secret("test-secret", sc.Object); try { - var response = await secret.Version("test-secret").AccessAsync(); + var response = await secret.Version("test-secret").Access(); } catch (NitricException ne) { @@ -433,7 +261,7 @@ public void TestSecretVersionToString() } [Fact] - public void TestSecretValueToString() + public async Task TestSecretValueToString() { var secretPutResponse = new SecretAccessResponse { @@ -448,22 +276,22 @@ public void TestSecretValueToString() Value = Google.Protobuf.ByteString.CopyFromUtf8("Super secret message"), }; Mock sc = new Mock(); - sc.Setup(e => e.Access(It.IsAny(), null, null, + sc.Setup(e => e.AccessAsync(It.IsAny(), null, null, It.IsAny())) - .Returns(secretPutResponse) + .Returns(new AsyncUnaryCall(Task.FromResult(secretPutResponse), null, null, null, null)) .Verifiable(); var version = new Sdk.Secret.Secret("test-secret", sc.Object) .Version("test-version"); - var response = version.Access(); + var response = await version.Access(); Assert.Equal( "SecretValue[secretVersion=SecretVersion[secret=Secret[name=test-secret], version=test-version], value.length=20]", response.ToString()); sc.Verify( - t => t.Access(It.IsAny(), null, null, + t => t.AccessAsync(It.IsAny(), null, null, It.IsAny()), Times.Once); } } diff --git a/test/Nitric.Sdk.Test/Storage/BucketTest.cs b/test/Nitric.Sdk.Test/Storage/BucketTest.cs index f955e4e..dd38801 100644 --- a/test/Nitric.Sdk.Test/Storage/BucketTest.cs +++ b/test/Nitric.Sdk.Test/Storage/BucketTest.cs @@ -81,102 +81,7 @@ public void TestFileToString() } [Fact] - public void TestListBlobsWithNoPrefix() - { - var request = new StorageListBlobsRequest - { - BucketName = "test-bucket", - Prefix = "", - }; - - var blobs = new List - { - new Blob { Key = "key-1" }, - new Blob { Key = "key-2" }, - new Blob { Key = "key-3" }, - }; - var response = new StorageListBlobsResponse(); - response.Blobs.AddRange(blobs); - - Mock bc = new Mock(); - bc.Setup(e => e.ListBlobs(It.IsAny(), null, null, - It.IsAny())) - .Returns(response) - .Verifiable(); - - var files = new Sdk.Storage.Bucket("test-bucket", bc.Object).Files(); - - bc.Verify( - t => t.ListBlobs(request, null, null, - It.IsAny()), Times.Once); - - Assert.Equal("key-1", files[0].Name); - Assert.Equal("key-2", files[1].Name); - Assert.Equal("key-3", files[2].Name); - } - - [Fact] - public void TestListBlobsWithPrefix() - { - var request = new StorageListBlobsRequest - { - BucketName = "test-bucket", - Prefix = "key-", - }; - - var blobs = new List - { - new Blob { Key = "key-1" }, - new Blob { Key = "key-2" }, - new Blob { Key = "key-3" }, - }; - var response = new StorageListBlobsResponse(); - response.Blobs.AddRange(blobs); - - Mock bc = new Mock(); - bc.Setup(e => e.ListBlobs(It.IsAny(), null, null, - It.IsAny())) - .Returns(response) - .Verifiable(); - - var files = new Sdk.Storage.Bucket("test-bucket", bc.Object).Files("key-"); - - bc.Verify( - t => t.ListBlobs(request, null, null, - It.IsAny()), Times.Once); - - Assert.Equal("key-1", files[0].Name); - Assert.Equal("key-2", files[1].Name); - Assert.Equal("key-3", files[2].Name); - } - - [Fact] - public void TestListBlobsToNonExistentBucket() - { - Mock bc = new Mock(); - bc.Setup(e => e.ListBlobs(It.IsAny(), null, null, - It.IsAny())) - .Throws(new RpcException(new Status(StatusCode.NotFound, "The specified bucket does not exist"))) - .Verifiable(); - - try - { - new Sdk.Storage.Bucket("test-bucket", bc.Object).Files("key-1"); - Assert.Fail(); - } - catch (NitricException e) - { - Assert.Equal("Status(StatusCode=\"NotFound\", Detail=\"The specified bucket does not exist\")", - e.Message); - } - - bc.Verify( - t => t.ListBlobs(It.IsAny(), null, null, - It.IsAny()), Times.Once); - } - - [Fact] - public async void TestListBlobsWithNoPrefixAsync() + public async void TestListBlobsWithNoPrefix() { var request = new StorageListBlobsRequest { @@ -199,7 +104,7 @@ public async void TestListBlobsWithNoPrefixAsync() .Returns(new AsyncUnaryCall(Task.FromResult(response), null, null, null, null)) .Verifiable(); - var files = await new Sdk.Storage.Bucket("test-bucket", bc.Object).FilesAsync(); + var files = await new Sdk.Storage.Bucket("test-bucket", bc.Object).Files(); bc.Verify( t => t.ListBlobsAsync(request, null, null, @@ -211,7 +116,7 @@ public async void TestListBlobsWithNoPrefixAsync() } [Fact] - public async void TestListBlobsWithPrefixAsync() + public async void TestListBlobsWithPrefix() { var request = new StorageListBlobsRequest { @@ -234,7 +139,7 @@ public async void TestListBlobsWithPrefixAsync() .Returns(new AsyncUnaryCall(Task.FromResult(response), null, null, null, null)) .Verifiable(); - var files = await new Sdk.Storage.Bucket("test-bucket", bc.Object).FilesAsync("key-"); + var files = await new Sdk.Storage.Bucket("test-bucket", bc.Object).Files("key-"); bc.Verify( t => t.ListBlobsAsync(request, null, null, @@ -246,7 +151,7 @@ public async void TestListBlobsWithPrefixAsync() } [Fact] - public async void TestListBlobsToNonExistentBucketAsync() + public async void TestListBlobsToNonExistentBucket() { Mock bc = new Mock(); bc.Setup(e => e.ListBlobsAsync(It.IsAny(), null, null, @@ -256,7 +161,7 @@ public async void TestListBlobsToNonExistentBucketAsync() try { - await new Sdk.Storage.Bucket("test-bucket", bc.Object).FilesAsync(); + await new Sdk.Storage.Bucket("test-bucket", bc.Object).Files(); Assert.Fail(); } catch (NitricException e) @@ -271,7 +176,7 @@ public async void TestListBlobsToNonExistentBucketAsync() } [Fact] - public void TestWrite() + public async void TestWrite() { var request = new StorageWriteRequest { @@ -282,48 +187,22 @@ public void TestWrite() }; Mock bc = new Mock(); - bc.Setup(e => e.Write(It.IsAny(), null, null, - It.IsAny())) - .Returns(new StorageWriteResponse()) - .Verifiable(); - - var file = new Sdk.Storage.Bucket("test-bucket", bc.Object).File("test-file"); - - file.Write(System.Text.Encoding.UTF8.GetBytes("Hello World")); - - bc.Verify( - t => t.Write(It.IsAny(), null, null, - It.IsAny()), Times.Once); - } - - [Fact] - public void TestWriteString() - { - var request = new StorageWriteRequest - { - BucketName = "test-bucket", - Key = "test-file", - Body = Google.Protobuf.ByteString.CopyFrom( - System.Text.Encoding.UTF8.GetBytes("Body")) - }; - - Mock bc = new Mock(); - bc.Setup(e => e.Write(It.IsAny(), null, null, + bc.Setup(e => e.WriteAsync(It.IsAny(), null, null, It.IsAny())) - .Returns(new StorageWriteResponse()) + .Returns(new AsyncUnaryCall(Task.FromResult(new StorageWriteResponse()), null, null, null, null)) .Verifiable(); var file = new Sdk.Storage.Bucket("test-bucket", bc.Object).File("test-file"); - file.Write("Hello World"); + await file.Write(System.Text.Encoding.UTF8.GetBytes("Hello World")); bc.Verify( - t => t.Write(It.IsAny(), null, null, + t => t.WriteAsync(It.IsAny(), null, null, It.IsAny()), Times.Once); } [Fact] - public void TestWriteToNonExistentBucket() + public async void TestWriteBytesToNonExistentBucket() { var request = new StorageWriteRequest { @@ -334,7 +213,7 @@ public void TestWriteToNonExistentBucket() }; Mock bc = new Mock(); - bc.Setup(e => e.Write(It.IsAny(), null, null, + bc.Setup(e => e.WriteAsync(It.IsAny(), null, null, It.IsAny())) .Throws(new RpcException(new Status(StatusCode.NotFound, "The specified bucket does not exist"))) .Verifiable(); @@ -343,7 +222,7 @@ public void TestWriteToNonExistentBucket() try { - file.Write("Hello World"); + await file.Write(System.Text.Encoding.UTF8.GetBytes("Hello World")); Assert.Fail(); } catch (NitricException e) @@ -353,23 +232,15 @@ public void TestWriteToNonExistentBucket() } bc.Verify( - t => t.Write(It.IsAny(), null, null, + t => t.WriteAsync(It.IsAny(), null, null, It.IsAny()), Times.Once); } [Fact] - public void TestWriteBytesToNonExistentBucket() + public async void TestWriteToNonExistentBucket() { - var request = new StorageWriteRequest - { - BucketName = "test-bucket", - Key = "test-file", - Body = Google.Protobuf.ByteString.CopyFrom( - System.Text.Encoding.UTF8.GetBytes("Hello World")) - }; - Mock bc = new Mock(); - bc.Setup(e => e.Write(It.IsAny(), null, null, + bc.Setup(e => e.WriteAsync(It.IsAny(), null, null, It.IsAny())) .Throws(new RpcException(new Status(StatusCode.NotFound, "The specified bucket does not exist"))) .Verifiable(); @@ -378,7 +249,7 @@ public void TestWriteBytesToNonExistentBucket() try { - file.Write(System.Text.Encoding.UTF8.GetBytes("Hello World")); + await file.Write("Hello World"); Assert.Fail(); } catch (NitricException e) @@ -388,12 +259,12 @@ public void TestWriteBytesToNonExistentBucket() } bc.Verify( - t => t.Write(It.IsAny(), null, null, + t => t.WriteAsync(It.IsAny(), null, null, It.IsAny()), Times.Once); } [Fact] - public async void TestWriteAsync() + public async void TestWriteString() { var request = new StorageWriteRequest { @@ -411,61 +282,7 @@ public async void TestWriteAsync() var file = new Sdk.Storage.Bucket("test-bucket", bc.Object).File("test-file"); - await file.WriteAsync(System.Text.Encoding.UTF8.GetBytes("Hello World")); - - bc.Verify( - t => t.WriteAsync(It.IsAny(), null, null, - It.IsAny()), Times.Once); - } - - [Fact] - public async void TestWriteBytesToNonExistentBucketAsync() - { - Mock bc = new Mock(); - bc.Setup(e => e.WriteAsync(It.IsAny(), null, null, - It.IsAny())) - .Throws(new RpcException(new Status(StatusCode.NotFound, "The specified bucket does not exist"))) - .Verifiable(); - - var file = new Sdk.Storage.Bucket("test-bucket", bc.Object).File("test-file"); - - try - { - await file.WriteAsync(System.Text.Encoding.UTF8.GetBytes("Hello World")); - Assert.Fail(); - } - catch (NitricException e) - { - Assert.Equal("Status(StatusCode=\"NotFound\", Detail=\"The specified bucket does not exist\")", - e.Message); - } - - bc.Verify( - t => t.WriteAsync(It.IsAny(), null, null, - It.IsAny()), Times.Once); - } - - [Fact] - public async void TestWriteToNonExistentBucketAsync() - { - Mock bc = new Mock(); - bc.Setup(e => e.WriteAsync(It.IsAny(), null, null, - It.IsAny())) - .Throws(new RpcException(new Status(StatusCode.NotFound, "The specified bucket does not exist"))) - .Verifiable(); - - var file = new Sdk.Storage.Bucket("test-bucket", bc.Object).File("test-file"); - - try - { - await file.WriteAsync("Hello World"); - Assert.Fail(); - } - catch (NitricException e) - { - Assert.Equal("Status(StatusCode=\"NotFound\", Detail=\"The specified bucket does not exist\")", - e.Message); - } + await file.Write("Hello World"); bc.Verify( t => t.WriteAsync(It.IsAny(), null, null, @@ -473,7 +290,7 @@ public async void TestWriteToNonExistentBucketAsync() } [Fact] - public async void TestWriteStringAsync() + public async void TestWriteStringToNonExistentBucket() { var request = new StorageWriteRequest { @@ -483,24 +300,6 @@ public async void TestWriteStringAsync() System.Text.Encoding.UTF8.GetBytes("Body")) }; - Mock bc = new Mock(); - bc.Setup(e => e.WriteAsync(It.IsAny(), null, null, - It.IsAny())) - .Returns(new AsyncUnaryCall(Task.FromResult(new StorageWriteResponse()), null, null, null, null)) - .Verifiable(); - - var file = new Sdk.Storage.Bucket("test-bucket", bc.Object).File("test-file"); - - await file.WriteAsync("Hello World"); - - bc.Verify( - t => t.WriteAsync(It.IsAny(), null, null, - It.IsAny()), Times.Once); - } - - [Fact] - public async void TestWriteStringToNonExistentBucketAsync() - { Mock bc = new Mock(); bc.Setup(e => e.WriteAsync(It.IsAny(), null, null, It.IsAny())) @@ -511,7 +310,7 @@ public async void TestWriteStringToNonExistentBucketAsync() try { - await file.WriteAsync("Hello World"); + await file.Write("Hello World"); Assert.Fail(); } catch (NitricException e) @@ -526,58 +325,7 @@ public async void TestWriteStringToNonExistentBucketAsync() } [Fact] - public void TestReadExistingKey() - { - var storageResponse = new StorageReadResponse(); - storageResponse.Body = - Google.Protobuf.ByteString.CopyFrom(System.Text.Encoding.UTF8.GetBytes("Hello World")); - - Mock bc = new Mock(); - bc.Setup(e => e.Read(It.IsAny(), null, null, - It.IsAny())) - .Returns(storageResponse) - .Verifiable(); - - var file = new Sdk.Storage.Bucket("test-bucket", bc.Object).File("test-file"); - - var response = file.Read(); - - Assert.Equal("Hello World", System.Text.Encoding.UTF8.GetString(response)); - - bc.Verify( - t => t.Read(It.IsAny(), null, null, It.IsAny()), - Times.Once); - } - - [Fact] - public void TestReadNonExistingKey() - { - Mock bc = new Mock(); - bc.Setup(e => e.Read(It.IsAny(), null, null, - It.IsAny())) - .Throws(new RpcException(new Status(StatusCode.NotFound, "The specified key does not exist"))) - .Verifiable(); - - var file = new Sdk.Storage.Bucket("test-bucket", bc.Object).File("test-file"); - - try - { - file.Read(); - Assert.True(false); - } - catch (NitricException ne) - { - Assert.Equal("Status(StatusCode=\"NotFound\", Detail=\"The specified key does not exist\")", - ne.Message); - } - - bc.Verify( - t => t.Read(It.IsAny(), null, null, It.IsAny()), - Times.Once); - } - - [Fact] - public async void TestReadExistingKeyAsync() + public async void TestReadExistingKey() { var storageResponse = new StorageReadResponse(); storageResponse.Body = @@ -591,7 +339,7 @@ public async void TestReadExistingKeyAsync() var file = new Sdk.Storage.Bucket("test-bucket", bc.Object).File("test-file"); - var response = await file.ReadAsync(); + var response = await file.Read(); Assert.Equal("Hello World", System.Text.Encoding.UTF8.GetString(response)); @@ -601,7 +349,7 @@ public async void TestReadExistingKeyAsync() } [Fact] - public async void TestReadNonExistingKeyAsync() + public async void TestReadNonExistingKey() { Mock bc = new Mock(); bc.Setup(e => e.ReadAsync(It.IsAny(), null, null, @@ -613,7 +361,7 @@ public async void TestReadNonExistingKeyAsync() try { - await file.ReadAsync(); + await file.Read(); Assert.Fail(); } catch (NitricException ne) @@ -628,52 +376,7 @@ public async void TestReadNonExistingKeyAsync() } [Fact] - public void TestDeleteExistingKey() - { - Mock bc = new Mock(); - bc.Setup(e => e.Delete(It.IsAny(), null, null, - It.IsAny())) - .Returns(new StorageDeleteResponse()) - .Verifiable(); - - var file = new Sdk.Storage.Bucket("test-bucket", bc.Object).File("test-file"); - - file.Delete(); - - bc.Verify( - t => t.Delete(It.IsAny(), null, null, - It.IsAny()), Times.Once); - } - - [Fact] - public void TestDeleteNonExistingKey() - { - Mock bc = new Mock(); - bc.Setup(e => e.Delete(It.IsAny(), null, null, - It.IsAny())) - .Throws(new RpcException(new Status(StatusCode.NotFound, "The specified key does not exist"))) - .Verifiable(); - - var file = new Sdk.Storage.Bucket("test-bucket", bc.Object).File("test-file"); - - try - { - file.Delete(); - Assert.Fail(); - } - catch (NitricException ne) - { - Assert.Equal("Status(StatusCode=\"NotFound\", Detail=\"The specified key does not exist\")", - ne.Message); - } - - bc.Verify( - t => t.Delete(It.IsAny(), null, null, It.IsAny()), - Times.Once); - } - - [Fact] - public async void TestDeleteExistingKeyAsync() + public async void TestDeleteExistingKey() { Mock bc = new Mock(); bc.Setup(e => e.DeleteAsync(It.IsAny(), null, null, @@ -683,7 +386,7 @@ public async void TestDeleteExistingKeyAsync() var file = new Sdk.Storage.Bucket("test-bucket", bc.Object).File("test-file"); - await file.DeleteAsync(); + await file.Delete(); bc.Verify( t => t.DeleteAsync(It.IsAny(), null, null, @@ -691,7 +394,7 @@ public async void TestDeleteExistingKeyAsync() } [Fact] - public async void TestDeleteNonExistingKeyAsync() + public async void TestDeleteNonExistingKey() { Mock bc = new Mock(); bc.Setup(e => e.DeleteAsync(It.IsAny(), null, null, @@ -703,7 +406,7 @@ public async void TestDeleteNonExistingKeyAsync() try { - await file.DeleteAsync(); + await file.Delete(); Assert.Fail(); } catch (NitricException ne) @@ -718,7 +421,7 @@ public async void TestDeleteNonExistingKeyAsync() } [Fact] - public void TestGetUploadUrlWithDefaultExpiry() + public async void TestGetUploadUrlWithDefaultExpiry() { var request = new StoragePreSignUrlRequest { @@ -729,24 +432,24 @@ public void TestGetUploadUrlWithDefaultExpiry() }; Mock bc = new Mock(); - bc.Setup(e => e.PreSignUrl(It.IsAny(), null, null, + bc.Setup(e => e.PreSignUrlAsync(It.IsAny(), null, null, It.IsAny())) - .Returns(new StoragePreSignUrlResponse { Url = "https://example.com" }) + .Returns(new AsyncUnaryCall(Task.FromResult(new StoragePreSignUrlResponse { Url = "https://example.com" }), null, null, null, null)) .Verifiable(); var file = new Sdk.Storage.Bucket("test-bucket", bc.Object).File("test-file"); - var url = file.GetUploadUrl(); + var url = await file.GetUploadUrl(); bc.Verify( - t => t.PreSignUrl(request, null, null, + t => t.PreSignUrlAsync(request, null, null, It.IsAny()), Times.Once); Assert.Equal("https://example.com", url); } [Fact] - public void TestGetUploadUrlWithSpecificExpiry() + public async void TestGetUploadUrlWithSpecificExpiry() { var request = new StoragePreSignUrlRequest { @@ -756,61 +459,6 @@ public void TestGetUploadUrlWithSpecificExpiry() Expiry = new Google.Protobuf.WellKnownTypes.Duration { Seconds = 300 }, }; - Mock bc = new Mock(); - bc.Setup(e => e.PreSignUrl(It.IsAny(), null, null, - It.IsAny())) - .Returns(new StoragePreSignUrlResponse { Url = "https://example.com" }) - .Verifiable(); - - var file = new Sdk.Storage.Bucket("test-bucket", bc.Object).File("test-file"); - - var url = file.GetUploadUrl(300); - - bc.Verify( - t => t.PreSignUrl(request, null, null, - It.IsAny()), Times.Once); - - Assert.Equal("https://example.com", url); - } - - [Fact] - public void TestGetUploadUrlNonExistingKey() - { - Mock bc = new Mock(); - bc.Setup(e => e.PreSignUrl(It.IsAny(), null, null, - It.IsAny())) - .Throws(new RpcException(new Status(StatusCode.NotFound, "The specified key does not exist"))) - .Verifiable(); - - var file = new Sdk.Storage.Bucket("test-bucket", bc.Object).File("test-file"); - - try - { - file.GetUploadUrl(); - Assert.Fail(); - } - catch (NitricException ne) - { - Assert.Equal("Status(StatusCode=\"NotFound\", Detail=\"The specified key does not exist\")", - ne.Message); - } - - bc.Verify( - t => t.PreSignUrl(It.IsAny(), null, null, It.IsAny()), - Times.Once); - } - - [Fact] - public async void TestGetUploadUrlWithDefaultExpiryAsync() - { - var request = new StoragePreSignUrlRequest - { - BucketName = "test-bucket", - Key = "test-file", - Operation = StoragePreSignUrlRequest.Types.Operation.Write, - Expiry = new Google.Protobuf.WellKnownTypes.Duration { Seconds = 600 }, - }; - Mock bc = new Mock(); bc.Setup(e => e.PreSignUrlAsync(It.IsAny(), null, null, It.IsAny())) @@ -819,7 +467,7 @@ public async void TestGetUploadUrlWithDefaultExpiryAsync() var file = new Sdk.Storage.Bucket("test-bucket", bc.Object).File("test-file"); - var url = await file.GetUploadUrlAsync(); + var url = await file.GetUploadUrl(300); bc.Verify( t => t.PreSignUrlAsync(request, null, null, @@ -829,36 +477,16 @@ public async void TestGetUploadUrlWithDefaultExpiryAsync() } [Fact] - public async void TestGetUploadUrlWithSpecificExpiryAsync() + public async void TestGetUploadUrlNonExistingKey() { var request = new StoragePreSignUrlRequest { BucketName = "test-bucket", Key = "test-file", Operation = StoragePreSignUrlRequest.Types.Operation.Write, - Expiry = new Google.Protobuf.WellKnownTypes.Duration { Seconds = 300 }, + Expiry = new Google.Protobuf.WellKnownTypes.Duration { Seconds = 600 }, }; - Mock bc = new Mock(); - bc.Setup(e => e.PreSignUrlAsync(It.IsAny(), null, null, - It.IsAny())) - .Returns(new AsyncUnaryCall(Task.FromResult(new StoragePreSignUrlResponse { Url = "https://example.com" }), null, null, null, null)) - .Verifiable(); - - var file = new Sdk.Storage.Bucket("test-bucket", bc.Object).File("test-file"); - - var url = await file.GetUploadUrlAsync(300); - - bc.Verify( - t => t.PreSignUrlAsync(request, null, null, - It.IsAny()), Times.Once); - - Assert.Equal("https://example.com", url); - } - - [Fact] - public async void TestGetUploadUrlNonExistingKeyAsync() - { Mock bc = new Mock(); bc.Setup(e => e.PreSignUrlAsync(It.IsAny(), null, null, It.IsAny())) @@ -869,7 +497,7 @@ public async void TestGetUploadUrlNonExistingKeyAsync() try { - await file.GetUploadUrlAsync(); + await file.GetUploadUrl(); Assert.Fail(); } catch (NitricException ne) @@ -879,12 +507,12 @@ public async void TestGetUploadUrlNonExistingKeyAsync() } bc.Verify( - t => t.PreSignUrlAsync(It.IsAny(), null, null, It.IsAny()), - Times.Once); + t => t.PreSignUrlAsync(It.IsAny(), null, null, + It.IsAny()), Times.Once); } [Fact] - public void TestGetDownloadUrlWithDefaultExpiry() + public async void TestGetDownloadUrlWithDefaultExpiry() { var request = new StoragePreSignUrlRequest { @@ -895,24 +523,24 @@ public void TestGetDownloadUrlWithDefaultExpiry() }; Mock bc = new Mock(); - bc.Setup(e => e.PreSignUrl(It.IsAny(), null, null, + bc.Setup(e => e.PreSignUrlAsync(It.IsAny(), null, null, It.IsAny())) - .Returns(new StoragePreSignUrlResponse { Url = "https://example.com" }) + .Returns(new AsyncUnaryCall(Task.FromResult(new StoragePreSignUrlResponse { Url = "https://example.com" }), null, null, null, null)) .Verifiable(); var file = new Sdk.Storage.Bucket("test-bucket", bc.Object).File("test-file"); - var url = file.GetDownloadUrl(); + var url = await file.GetDownloadUrl(); bc.Verify( - t => t.PreSignUrl(request, null, null, + t => t.PreSignUrlAsync(request, null, null, It.IsAny()), Times.Once); Assert.Equal("https://example.com", url); } [Fact] - public void TestGetDownloadUrlWithSpecificExpiry() + public async void TestGetDownloadUrlWithSpecificExpiry() { var request = new StoragePreSignUrlRequest { @@ -922,61 +550,6 @@ public void TestGetDownloadUrlWithSpecificExpiry() Expiry = new Google.Protobuf.WellKnownTypes.Duration { Seconds = 300 }, }; - Mock bc = new Mock(); - bc.Setup(e => e.PreSignUrl(It.IsAny(), null, null, - It.IsAny())) - .Returns(new StoragePreSignUrlResponse { Url = "https://example.com" }) - .Verifiable(); - - var file = new Sdk.Storage.Bucket("test-bucket", bc.Object).File("test-file"); - - var url = file.GetDownloadUrl(300); - - bc.Verify( - t => t.PreSignUrl(request, null, null, - It.IsAny()), Times.Once); - - Assert.Equal("https://example.com", url); - } - - [Fact] - public void TestGetDownloadUrlNonExistingKey() - { - Mock bc = new Mock(); - bc.Setup(e => e.PreSignUrl(It.IsAny(), null, null, - It.IsAny())) - .Throws(new RpcException(new Status(StatusCode.NotFound, "The specified key does not exist"))) - .Verifiable(); - - var file = new Sdk.Storage.Bucket("test-bucket", bc.Object).File("test-file"); - - try - { - file.GetDownloadUrl(); - Assert.Fail(); - } - catch (NitricException ne) - { - Assert.Equal("Status(StatusCode=\"NotFound\", Detail=\"The specified key does not exist\")", - ne.Message); - } - - bc.Verify( - t => t.PreSignUrl(It.IsAny(), null, null, It.IsAny()), - Times.Once); - } - - [Fact] - public async void TestGetDownloadUrlWithDefaultExpiryAsync() - { - var request = new StoragePreSignUrlRequest - { - BucketName = "test-bucket", - Key = "test-file", - Operation = StoragePreSignUrlRequest.Types.Operation.Read, - Expiry = new Google.Protobuf.WellKnownTypes.Duration { Seconds = 600 }, - }; - Mock bc = new Mock(); bc.Setup(e => e.PreSignUrlAsync(It.IsAny(), null, null, It.IsAny())) @@ -985,7 +558,7 @@ public async void TestGetDownloadUrlWithDefaultExpiryAsync() var file = new Sdk.Storage.Bucket("test-bucket", bc.Object).File("test-file"); - var url = await file.GetDownloadUrlAsync(); + var url = await file.GetDownloadUrl(300); bc.Verify( t => t.PreSignUrlAsync(request, null, null, @@ -995,36 +568,16 @@ public async void TestGetDownloadUrlWithDefaultExpiryAsync() } [Fact] - public async void TestGetDownloadUrlWithSpecificExpiryAsync() + public async void TestGetDownloadUrlNonExistingKey() { var request = new StoragePreSignUrlRequest { BucketName = "test-bucket", Key = "test-file", Operation = StoragePreSignUrlRequest.Types.Operation.Read, - Expiry = new Google.Protobuf.WellKnownTypes.Duration { Seconds = 300 }, + Expiry = new Google.Protobuf.WellKnownTypes.Duration { Seconds = 600 }, }; - Mock bc = new Mock(); - bc.Setup(e => e.PreSignUrlAsync(It.IsAny(), null, null, - It.IsAny())) - .Returns(new AsyncUnaryCall(Task.FromResult(new StoragePreSignUrlResponse { Url = "https://example.com" }), null, null, null, null)) - .Verifiable(); - - var file = new Sdk.Storage.Bucket("test-bucket", bc.Object).File("test-file"); - - var url = await file.GetDownloadUrlAsync(300); - - bc.Verify( - t => t.PreSignUrlAsync(request, null, null, - It.IsAny()), Times.Once); - - Assert.Equal("https://example.com", url); - } - - [Fact] - public async void TestGetDownloadUrlNonExistingKeyAsync() - { Mock bc = new Mock(); bc.Setup(e => e.PreSignUrlAsync(It.IsAny(), null, null, It.IsAny())) @@ -1035,7 +588,7 @@ public async void TestGetDownloadUrlNonExistingKeyAsync() try { - await file.GetDownloadUrlAsync(); + await file.GetDownloadUrl(); Assert.Fail(); } catch (NitricException ne) @@ -1045,16 +598,16 @@ public async void TestGetDownloadUrlNonExistingKeyAsync() } bc.Verify( - t => t.PreSignUrlAsync(It.IsAny(), null, null, It.IsAny()), - Times.Once); + t => t.PreSignUrlAsync(It.IsAny(), null, null, + It.IsAny()), Times.Once); } [Fact] public void TestRegisterBlobEventWorkerOnWrite() { - Func middleware = (ctx) => + Func> middleware = async (ctx) => { - return ctx; + return await Task.FromResult(ctx); }; var bucket = new Sdk.Storage.Bucket("test-bucket"); @@ -1065,9 +618,9 @@ public void TestRegisterBlobEventWorkerOnWrite() [Fact] public void TestRegisterBlobEventWorkerOnDelete() { - Func middleware = (ctx) => + Func> middleware = async (ctx) => { - return ctx; + return await Task.FromResult(ctx); }; var bucket = new Sdk.Storage.Bucket("test-bucket"); @@ -1078,9 +631,9 @@ public void TestRegisterBlobEventWorkerOnDelete() [Fact] public void TestRegisterBlobEventWorkerOnWriteWithMultipleMiddleware() { - Middleware middleware = (ctx, next) => + Middleware middleware = async (ctx, next) => { - return next(ctx); + return await next(ctx); }; var bucket = new Sdk.Storage.Bucket("test-bucket"); @@ -1091,9 +644,9 @@ public void TestRegisterBlobEventWorkerOnWriteWithMultipleMiddleware() [Fact] public void TestRegisterBlobEventWorkerOnDeleteWithMultipleMiddleware() { - Middleware middleware = (ctx, next) => + Middleware middleware = async (ctx, next) => { - return next(ctx); + return await next(ctx); }; var bucket = new Sdk.Storage.Bucket("test-bucket"); diff --git a/test/Nitric.Sdk.Test/Topics/TopicTest.cs b/test/Nitric.Sdk.Test/Topics/TopicTest.cs index df5c5b7..1434680 100644 --- a/test/Nitric.Sdk.Test/Topics/TopicTest.cs +++ b/test/Nitric.Sdk.Test/Topics/TopicTest.cs @@ -62,51 +62,7 @@ public void TestTopicToString() } [Fact] - public void TestPublish() - { - Mock ec = new Mock(); - - ec.Setup(e => e.Publish(It.IsAny(), null, null, It.IsAny())) - .Verifiable(); - - var topic = new Topic("test-topic", ec.Object); - - var profile = new TestProfile - { Name = "John Smith", Age = 30, Addresses = new List { "123 street st" } }; - - topic.Publish(profile); - - ec.Verify(t => t.Publish(It.IsAny(), null, null, It.IsAny()), Times.Once); - } - - [Fact] - public void TestPublishToNonExistentTopic() - { - Mock ec = new Mock(); - - ec.Setup(e => e.Publish(It.IsAny(), null, null, It.IsAny())) - .Throws(new RpcException(new Status(StatusCode.NotFound, "The specified topic does not exist"))) - .Verifiable(); - - var topic = new Topic("test-topic", ec.Object); - - var profile = new TestProfile - { Name = "John Smith", Age = 30, Addresses = new List { "123 street st" } }; - - try - { - topic.Publish(profile); - } - catch (NitricException ne) - { - Assert.Equal("Status(StatusCode=\"NotFound\", Detail=\"The specified topic does not exist\")", ne.Message); - } - - ec.Verify(t => t.Publish(It.IsAny(), null, null, It.IsAny()), Times.Once); - } - - [Fact] - public async void TestPublishAsync() + public async void TestPublish() { Mock ec = new Mock(); @@ -119,13 +75,13 @@ public async void TestPublishAsync() var profile = new TestProfile { Name = "John Smith", Age = 30, Addresses = new List { "123 street st" } }; - await topic.PublishAsync(profile); + await topic.Publish(profile); ec.Verify(t => t.PublishAsync(It.IsAny(), null, null, It.IsAny()), Times.Once); } [Fact] - public async void TestPublishAsyncToNonExistentTopic() + public async void TestPublishToNonExistentTopic() { Mock ec = new Mock(); @@ -140,7 +96,7 @@ public async void TestPublishAsyncToNonExistentTopic() try { - await topic.PublishAsync(profile); + await topic.Publish(profile); } catch (NitricException ne) { diff --git a/test/Nitric.Sdk.Test/Websocket/ConnectionTest.cs b/test/Nitric.Sdk.Test/Websocket/ConnectionTest.cs index 7897e15..a9e101c 100644 --- a/test/Nitric.Sdk.Test/Websocket/ConnectionTest.cs +++ b/test/Nitric.Sdk.Test/Websocket/ConnectionTest.cs @@ -58,53 +58,8 @@ public void TestConnectionToString() Assert.Equal("Connection[socketName=socket-name,connectionId=connection-id]", connection.ToString()); } - //Testing Websocket Methods [Fact] - public void TestWebsocketSend() - { - var websocketSendRequest = new WebsocketSendRequest - { - SocketName = "socket-name", - ConnectionId = "connection-id", - Data = ByteString.CopyFromUtf8("websocket-data") - }; - Mock wc = new Mock(); - wc.Setup(e => - e.SendMessage(websocketSendRequest, null, null, It.IsAny())) - .Verifiable(); - - var connection = new Connection("connection-id", "socket-name", wc.Object); - - connection.SendMessage("websocket-data"); - - wc.Verify( - t => t.SendMessage(websocketSendRequest, null, null, It.IsAny()), - Times.Once); - } - - [Fact] - public void TestConnectionSendWithError() - { - var websocketSendRequest = new WebsocketSendRequest - { - SocketName = "socket-name", - ConnectionId = "connection-id", - Data = ByteString.CopyFromUtf8("websocket-data") - }; - Mock wc = new Mock(); - wc.Setup(e => - e.SendMessage(websocketSendRequest, null, null, It.IsAny())) - .Throws(new RpcException(Status.DefaultCancelled, "succeeded in failing")); - - var connection = new Connection("connection-id", "socket-name", wc.Object); - - Assert.Throws(() => - connection.SendMessage("websocket-data") - ); - } - - [Fact] - public async void TestWebsocketSendAsync() + public async void TestWebsocketSend() { var websocketSendRequest = new WebsocketSendRequest { @@ -120,7 +75,7 @@ public async void TestWebsocketSendAsync() var connection = new Connection("connection-id", "socket-name", wc.Object); - await connection.SendMessageAsync("websocket-data"); + await connection.SendMessage("websocket-data"); wc.Verify( t => t.SendMessageAsync(websocketSendRequest, null, null, It.IsAny()), @@ -128,7 +83,7 @@ public async void TestWebsocketSendAsync() } [Fact] - public void TestWebsocketSendWithErrorAsync() + public void TestWebsocketSendWithError() { var websocketSendRequest = new WebsocketSendRequest { @@ -143,55 +98,13 @@ public void TestWebsocketSendWithErrorAsync() var connection = new Connection("connection-id", "socket-name", wc.Object); - Assert.ThrowsAsync(() => - connection.SendMessageAsync("websocket-data") + Assert.ThrowsAsync(async () => + await connection.SendMessage("websocket-data") ); } [Fact] - public void TestWebsocketClose() - { - var websocketCloseRequest = new WebsocketCloseConnectionRequest - { - SocketName = "socket-name", - ConnectionId = "connection-id", - }; - Mock wc = new Mock(); - wc.Setup(e => - e.CloseConnection(websocketCloseRequest, null, null, It.IsAny())) - .Verifiable(); - - var connection = new Connection("connection-id", "socket-name", wc.Object); - - connection.CloseConnection(); - - wc.Verify( - t => t.CloseConnection(websocketCloseRequest, null, null, It.IsAny()), - Times.Once); - } - - [Fact] - public void TestWebsocketCloseWithError() - { - var websocketCloseRequest = new WebsocketCloseConnectionRequest - { - SocketName = "socket-name", - ConnectionId = "connection-id", - }; - Mock wc = new Mock(); - wc.Setup(e => - e.CloseConnection(websocketCloseRequest, null, null, It.IsAny())) - .Throws(new RpcException(Status.DefaultCancelled, "succeeded in failing")); - - var connection = new Connection("connection-id", "socket-name", wc.Object); - - Assert.Throws(() => - connection.CloseConnection() - ); - } - - [Fact] - public async void TestWebsocketCloseAsync() + public async void TestWebsocketClose() { var websocketCloseRequest = new WebsocketCloseConnectionRequest { @@ -206,7 +119,7 @@ public async void TestWebsocketCloseAsync() var connection = new Connection("connection-id", "socket-name", wc.Object); - await connection.CloseConnectionAsync(); + await connection.CloseConnection(); wc.Verify( t => t.CloseConnectionAsync(websocketCloseRequest, null, null, It.IsAny()), @@ -214,7 +127,7 @@ public async void TestWebsocketCloseAsync() } [Fact] - public void TestWebsocketCloseWithErrorAsync() + public void TestWebsocketCloseWithError() { var websocketCloseRequest = new WebsocketCloseConnectionRequest { @@ -228,9 +141,7 @@ public void TestWebsocketCloseWithErrorAsync() var connection = new Connection("connection-id", "socket-name", wc.Object); - Assert.ThrowsAsync(() => - connection.CloseConnectionAsync() - ); + Assert.ThrowsAsync(connection.CloseConnection); } } } \ No newline at end of file diff --git a/test/Nitric.Sdk.Test/Worker/ApiWorkerTest.cs b/test/Nitric.Sdk.Test/Worker/ApiWorkerTest.cs index 1146348..9ca1369 100644 --- a/test/Nitric.Sdk.Test/Worker/ApiWorkerTest.cs +++ b/test/Nitric.Sdk.Test/Worker/ApiWorkerTest.cs @@ -1,6 +1,7 @@ using System; using System.Collections.Generic; using System.Threading; +using System.Threading.Tasks; using Google.Protobuf; using Grpc.Core; using Moq; @@ -18,9 +19,9 @@ public class ApiWorkerTest [Fact] public void TestApiWorkerBuildWithMiddleware() { - Func middleware = (ctx) => + Func> middleware = async (ctx) => { - return ctx; + return await Task.FromResult(ctx); }; var registration = new RegistrationRequest @@ -37,9 +38,9 @@ public void TestApiWorkerBuildWithMiddleware() [Fact] public void TestApiWorkerBuildWithMultipleMiddleware() { - Middleware middleware = (ctx, next) => + Middleware middleware = async (ctx, next) => { - return next(ctx); + return await next(ctx); }; var registration = new RegistrationRequest @@ -56,9 +57,9 @@ public void TestApiWorkerBuildWithMultipleMiddleware() [Fact] public void TestApiWorkerBuildWithNoMiddleware() { - Middleware middleware = (ctx, next) => + Middleware middleware = async (ctx, next) => { - return next(ctx); + return await next(ctx); }; var registration = new RegistrationRequest @@ -76,13 +77,13 @@ public void TestApiWorkerBuildWithNoMiddleware() [Fact] public async void TestApiWorkerStart() { - Middleware middleware = (ctx, next) => + Middleware middleware = async (ctx, next) => { var profile = ctx.Req.Json(); Assert.Equal("John Smith", profile.Name); Assert.Equal(21, profile.Age); Assert.Equal("john.smith@email.com", profile.Contacts[0]); - return next(ctx); + return await next(ctx); }; var registration = new RegistrationRequest diff --git a/test/Nitric.Sdk.Test/Worker/BlobEventWorker.cs b/test/Nitric.Sdk.Test/Worker/BlobEventWorker.cs index 0da6c1e..f48f3c0 100644 --- a/test/Nitric.Sdk.Test/Worker/BlobEventWorker.cs +++ b/test/Nitric.Sdk.Test/Worker/BlobEventWorker.cs @@ -1,6 +1,7 @@ using System; using System.Collections.Generic; using System.Threading; +using System.Threading.Tasks; using Grpc.Core; using Moq; using Nitric.Proto.Storage.v1; @@ -17,9 +18,9 @@ public class BlobEventWorkerTest [Fact] public void TestBlobEventWorkerBuildWithMiddleware() { - Func middleware = (ctx) => + Func> middleware = async (ctx) => { - return ctx; + return await Task.FromResult(ctx); }; var registration = new RegistrationRequest @@ -36,9 +37,9 @@ public void TestBlobEventWorkerBuildWithMiddleware() [Fact] public void TestBlobEventWorkerBuildWithMultipleMiddleware() { - Middleware middleware = (ctx, next) => + Middleware middleware = async (ctx, next) => { - return next(ctx); + return await next(ctx); }; var registration = new RegistrationRequest @@ -55,9 +56,9 @@ public void TestBlobEventWorkerBuildWithMultipleMiddleware() [Fact] public void TestBlobEventWorkerBuildWithNoMiddleware() { - Middleware middleware = (ctx, next) => + Middleware middleware = async (ctx, next) => { - return next(ctx); + return await next(ctx); }; var registration = new RegistrationRequest @@ -75,11 +76,11 @@ public void TestBlobEventWorkerBuildWithNoMiddleware() [Fact] public async void TestBlobEventWorkerStartCreated() { - Middleware middleware = (ctx, next) => + Middleware middleware = async (ctx, next) => { Assert.Equal("test-file", ctx.Req.Key); Assert.Equal(Service.BlobEventType.Write, ctx.Req.NotificationType); - return next(ctx); + return await next(ctx); }; var registration = new RegistrationRequest @@ -118,11 +119,11 @@ public async void TestBlobEventWorkerStartCreated() [Fact] public async void TestBlobEventWorkerStartDeleted() { - Middleware middleware = (ctx, next) => + Middleware middleware = async (ctx, next) => { Assert.Equal("test-file", ctx.Req.Key); Assert.Equal(Service.BlobEventType.Delete, ctx.Req.NotificationType); - return next(ctx); + return await next(ctx); }; var registration = new RegistrationRequest diff --git a/test/Nitric.Sdk.Test/Worker/FileEventWorker.cs b/test/Nitric.Sdk.Test/Worker/FileEventWorker.cs index 5a44f4f..cefd925 100644 --- a/test/Nitric.Sdk.Test/Worker/FileEventWorker.cs +++ b/test/Nitric.Sdk.Test/Worker/FileEventWorker.cs @@ -1,6 +1,7 @@ using System; using System.Collections.Generic; using System.Threading; +using System.Threading.Tasks; using Grpc.Core; using Moq; using Nitric.Proto.Storage.v1; @@ -18,9 +19,9 @@ public class FileEventWorkerTest [Fact] public void TestFileEventWorkerBuildWithMiddleware() { - Func middleware = (ctx) => + Func> middleware = async (ctx) => { - return ctx; + return await Task.FromResult(ctx); }; var registration = new RegistrationRequest @@ -39,9 +40,9 @@ public void TestFileEventWorkerBuildWithMiddleware() [Fact] public void TestFileEventWorkerBuildWithMultipleMiddleware() { - Middleware middleware = (ctx, next) => + Middleware middleware = async (ctx, next) => { - return next(ctx); + return await next(ctx); }; var registration = new RegistrationRequest @@ -60,9 +61,9 @@ public void TestFileEventWorkerBuildWithMultipleMiddleware() [Fact] public void TestFileEventWorkerBuildWithNoMiddleware() { - Middleware middleware = (ctx, next) => + Middleware middleware = async (ctx, next) => { - return next(ctx); + return await next(ctx); }; var registration = new RegistrationRequest @@ -82,11 +83,11 @@ public void TestFileEventWorkerBuildWithNoMiddleware() [Fact] public async void TestFileEventWorkerStartCreated() { - Middleware middleware = (ctx, next) => + Middleware middleware = async (ctx, next) => { Assert.Equal("test-file", ctx.Req.File.Name); Assert.Equal(Service.BlobEventType.Write, ctx.Req.NotificationType); - return next(ctx); + return await next(ctx); }; var registration = new RegistrationRequest @@ -127,11 +128,11 @@ public async void TestFileEventWorkerStartCreated() [Fact] public async void TestFileEventWorkerStartDeleted() { - Middleware middleware = (ctx, next) => + Middleware middleware = async (ctx, next) => { Assert.Equal("test-file", ctx.Req.File.Name); Assert.Equal(Service.BlobEventType.Delete, ctx.Req.NotificationType); - return next(ctx); + return await next(ctx); }; var registration = new RegistrationRequest diff --git a/test/Nitric.Sdk.Test/Worker/JobWorkerTest.cs b/test/Nitric.Sdk.Test/Worker/JobWorkerTest.cs index 41385dc..25add62 100644 --- a/test/Nitric.Sdk.Test/Worker/JobWorkerTest.cs +++ b/test/Nitric.Sdk.Test/Worker/JobWorkerTest.cs @@ -10,6 +10,7 @@ using GrpcClient = Nitric.Proto.Batch.v1.Job.JobClient; using Nitric.Sdk.Common; +using System.Threading.Tasks; namespace Nitric.Sdk.Test.Worker { @@ -25,9 +26,9 @@ public class JobWorkerTest [Fact] public void TestJobWorkerBuildWithMiddleware() { - Func, JobContext> middleware = (ctx) => + Func, Task>> middleware = async (ctx) => { - return ctx; + return await Task.FromResult(ctx); }; var registration = new RegistrationRequest @@ -43,9 +44,9 @@ public void TestJobWorkerBuildWithMiddleware() [Fact] public void TestJobWorkerBuildWithMultipleMiddleware() { - Middleware> middleware = (ctx, next) => + Middleware> middleware = async (ctx, next) => { - return next(ctx); + return await next(ctx); }; var registration = new RegistrationRequest @@ -61,9 +62,9 @@ public void TestJobWorkerBuildWithMultipleMiddleware() [Fact] public void TestJobWorkerBuildWithNoMiddleware() { - Middleware> middleware = (ctx, next) => + Middleware> middleware = async (ctx, next) => { - return next(ctx); + return await next(ctx); }; var registration = new RegistrationRequest @@ -139,7 +140,7 @@ public async void TestJobWorkerStart() } [Fact] - public async void TestScheduleWorkerStartsWithErrors() + public async void TestJobWorkerStartsWithErrors() { var testSubmission = new TestSubmission { diff --git a/test/Nitric.Sdk.Test/Worker/ScheduleWorkerTest.cs b/test/Nitric.Sdk.Test/Worker/ScheduleWorkerTest.cs index 327bf88..ec6195c 100644 --- a/test/Nitric.Sdk.Test/Worker/ScheduleWorkerTest.cs +++ b/test/Nitric.Sdk.Test/Worker/ScheduleWorkerTest.cs @@ -1,6 +1,7 @@ using System; using System.Collections.Generic; using System.Threading; +using System.Threading.Tasks; using Grpc.Core; using Moq; using Nitric.Proto.Schedules.v1; @@ -17,9 +18,9 @@ public class ScheduleWorkerTest [Fact] public void TestScheduleWorkerBuildWithMiddleware() { - Func middleware = (ctx) => + Func> middleware = async (ctx) => { - return ctx; + return await Task.FromResult(ctx); }; var registration = new RegistrationRequest @@ -36,9 +37,9 @@ public void TestScheduleWorkerBuildWithMiddleware() [Fact] public void TestScheduleWorkerBuildWithMultipleMiddleware() { - Middleware middleware = (ctx, next) => + Middleware middleware = async (ctx, next) => { - return next(ctx); + return await next(ctx); }; var registration = new RegistrationRequest @@ -55,9 +56,9 @@ public void TestScheduleWorkerBuildWithMultipleMiddleware() [Fact] public void TestScheduleWorkerBuildWithNoMiddleware() { - Middleware middleware = (ctx, next) => + Middleware middleware = async (ctx, next) => { - return next(ctx); + return await next(ctx); }; var registration = new RegistrationRequest @@ -75,10 +76,10 @@ public void TestScheduleWorkerBuildWithNoMiddleware() [Fact] public async void TestScheduleWorkerStart() { - Middleware middleware = (ctx, next) => + Middleware middleware = async (ctx, next) => { Assert.Equal("schedule-name", ctx.Req.ScheduleName); - return next(ctx); + return await next(ctx); }; var registration = new RegistrationRequest diff --git a/test/Nitric.Sdk.Test/Worker/SubscriptionWorkerTest.cs b/test/Nitric.Sdk.Test/Worker/SubscriptionWorkerTest.cs index c5064c6..69c625f 100644 --- a/test/Nitric.Sdk.Test/Worker/SubscriptionWorkerTest.cs +++ b/test/Nitric.Sdk.Test/Worker/SubscriptionWorkerTest.cs @@ -2,6 +2,7 @@ using System.Collections.Generic; using System.ComponentModel; using System.Threading; +using System.Threading.Tasks; using Grpc.Core; using Moq; using Nitric.Proto.Topics.v1; @@ -26,9 +27,9 @@ public class SubscriptionWorkerTest [Fact] public void TestSubscriptionWorkerBuildWithMiddleware() { - Func, MessageContext> middleware = (ctx) => + Func, Task>> middleware = async (ctx) => { - return ctx; + return await Task.FromResult(ctx); }; var registration = new RegistrationRequest @@ -44,9 +45,9 @@ public void TestSubscriptionWorkerBuildWithMiddleware() [Fact] public void TestSubscriptionWorkerBuildWithMultipleMiddleware() { - Middleware> middleware = (ctx, next) => + Middleware> middleware = async (ctx, next) => { - return next(ctx); + return await next(ctx); }; var registration = new RegistrationRequest @@ -76,13 +77,13 @@ public void TestSubscriptionWorkerBuildWithNoMiddleware() [Fact] public async void TestSubscriptionWorkerStart() { - Middleware> middleware = (ctx, next) => + Middleware> middleware = async (ctx, next) => { Assert.Equal("topic-name", ctx.Req.TopicName); Assert.Equal("John Smith", ctx.Req.Message.Name); Assert.Equal(21, ctx.Req.Message.Age); Assert.Equal("john.smith@email.com", ctx.Req.Message.Contacts[0]); - return next(ctx); + return await next(ctx); }; var registration = new RegistrationRequest diff --git a/test/Nitric.Sdk.Test/Worker/WebsocketWorkerTest.cs b/test/Nitric.Sdk.Test/Worker/WebsocketWorkerTest.cs index 699f466..7b16014 100644 --- a/test/Nitric.Sdk.Test/Worker/WebsocketWorkerTest.cs +++ b/test/Nitric.Sdk.Test/Worker/WebsocketWorkerTest.cs @@ -1,6 +1,7 @@ using System; using System.Collections.Generic; using System.Threading; +using System.Threading.Tasks; using Grpc.Core; using Moq; using Nitric.Proto.Websockets.v1; @@ -17,9 +18,9 @@ public class WebsocketWorkerTest [Fact] public void TestWebsocketWorkerBuildWithMiddleware() { - Func middleware = (ctx) => + Func> middleware = async (ctx) => { - return ctx; + return await Task.FromResult(ctx); }; var registration = new RegistrationRequest @@ -35,9 +36,9 @@ public void TestWebsocketWorkerBuildWithMiddleware() [Fact] public void TestWebsocketWorkerBuildWithMultipleMiddleware() { - Middleware middleware = (ctx, next) => + Middleware middleware = async (ctx, next) => { - return next(ctx); + return await next(ctx); }; var registration = new RegistrationRequest @@ -53,9 +54,9 @@ public void TestWebsocketWorkerBuildWithMultipleMiddleware() [Fact] public void TestWebsocketWorkerBuildWithNoMiddleware() { - Middleware middleware = (ctx, next) => + Middleware middleware = async (ctx, next) => { - return next(ctx); + return await next(ctx); }; var registration = new RegistrationRequest @@ -72,11 +73,11 @@ public void TestWebsocketWorkerBuildWithNoMiddleware() [Fact] public async void TestWebsocketWorkerStart() { - Middleware middleware = (ctx, next) => + Middleware middleware = async (ctx, next) => { Assert.Equal("websocket-name", ctx.Req.SocketName); Assert.Equal("connection-1234", ctx.Req.ConnectionId); - return next(ctx); + return await next(ctx); }; var registration = new RegistrationRequest From 885b9f763e2192299f7fcc02b295d14b6abb6fcc Mon Sep 17 00:00:00 2001 From: Ryan Cartwright Date: Thu, 10 Apr 2025 14:32:01 +1000 Subject: [PATCH 34/34] stop versioning proto files --- .gitignore | 4 +- nitric/proto/apis/v1/apis.proto | 120 ------- nitric/proto/batch/v1/batch.proto | 96 ----- nitric/proto/deployments/v1/deployments.proto | 337 ------------------ nitric/proto/http/v1/http.proto | 30 -- nitric/proto/keyvalue/v1/keyvalue.proto | 75 ---- nitric/proto/kvstore/v1/kvstore.proto | 93 ----- nitric/proto/queues/v1/queues.proto | 82 ----- nitric/proto/resources/v1/resources.proto | 152 -------- nitric/proto/schedules/v1/schedules.proto | 69 ---- nitric/proto/secrets/v1/secrets.proto | 60 ---- nitric/proto/sql/v1/sql.proto | 26 -- nitric/proto/storage/v1/storage.proto | 191 ---------- nitric/proto/topics/v1/topics.proto | 94 ----- nitric/proto/websockets/v1/websockets.proto | 153 -------- 15 files changed, 3 insertions(+), 1579 deletions(-) delete mode 100644 nitric/proto/apis/v1/apis.proto delete mode 100644 nitric/proto/batch/v1/batch.proto delete mode 100644 nitric/proto/deployments/v1/deployments.proto delete mode 100644 nitric/proto/http/v1/http.proto delete mode 100644 nitric/proto/keyvalue/v1/keyvalue.proto delete mode 100644 nitric/proto/kvstore/v1/kvstore.proto delete mode 100644 nitric/proto/queues/v1/queues.proto delete mode 100644 nitric/proto/resources/v1/resources.proto delete mode 100644 nitric/proto/schedules/v1/schedules.proto delete mode 100644 nitric/proto/secrets/v1/secrets.proto delete mode 100644 nitric/proto/sql/v1/sql.proto delete mode 100644 nitric/proto/storage/v1/storage.proto delete mode 100644 nitric/proto/topics/v1/topics.proto delete mode 100644 nitric/proto/websockets/v1/websockets.proto diff --git a/.gitignore b/.gitignore index 2d99d8a..6de619c 100644 --- a/.gitignore +++ b/.gitignore @@ -331,4 +331,6 @@ ASALocalRun/ **/bin/ .idea .vs -dotCover.* \ No newline at end of file +dotCover.* +__out/** +nitric/**/*.proto \ No newline at end of file diff --git a/nitric/proto/apis/v1/apis.proto b/nitric/proto/apis/v1/apis.proto deleted file mode 100644 index 1428d69..0000000 --- a/nitric/proto/apis/v1/apis.proto +++ /dev/null @@ -1,120 +0,0 @@ -syntax = "proto3"; -package nitric.proto.apis.v1; - -// protoc plugin options for code generation -option go_package = "github.com/nitrictech/nitric/core/pkg/proto/apis/v1;apispb"; -option java_package = "io.nitric.proto.apis.v1"; -option java_multiple_files = true; -option java_outer_classname = "ApisService"; -option php_namespace = "Nitric\\Proto\\Apis\\V1"; -option csharp_namespace = "Nitric.Proto.Apis.v1"; - -// Service for API routing and handlers -service Api { - // Serve a route on an API - rpc Serve(stream ClientMessage) returns (stream ServerMessage); - - // Retrieve details about an API - rpc ApiDetails(ApiDetailsRequest) returns (ApiDetailsResponse); -} - -message ApiDetailsRequest { - string api_name = 1; -} - -message ApiDetailsResponse { - string url = 1; -} - -// ClientMessage sent by the service to the nitric server -message ClientMessage { - // globally unique ID of the request/response pair - string id = 1; - - oneof content { - // Register an API route handler - RegistrationRequest registration_request = 2; - - // Response to an HTTP request - HttpResponse http_response = 3; - } -} - -message HeaderValue { - repeated string value = 1; -} - -message QueryValue { - repeated string value = 1; -} - -message HttpRequest { - // The request method - string method = 1; - - // The path of the request - string path = 2; - - // HTTP request headers - map headers = 3; - - // HTTP Query params - map query_params = 4; - - // HTTP Path parameters - map path_params = 5; - - // HTTP Request body - bytes body = 6; -} - -// HttpResponseMessage -message HttpResponse { - // The HTTP response status code - int32 status = 1; - - // HTTP response headers - map headers = 2; - - // HTTP response body - bytes body = 3; -} - -// ServerMessage sent by the nitric server to the service -message ServerMessage { - // globally unique ID of the request/response pair - string id = 1; - - oneof content { - // Response to an API serve request - RegistrationResponse registration_response = 2; - - // HTTP request to be routed to the service (handler) - HttpRequest http_request = 3; - } -} - -message RegistrationResponse { -} - -message ApiWorkerScopes { - repeated string scopes = 1; -} - -message ApiWorkerOptions { - // Apply security definitions to this operation - // This will be mapped to named ApiSecurityDefinitionResource(s) - map security = 1; - // explicitly disable security for this endpoint - // We need to do this as the default value of a repeated field - // is always empty so there is no way of knowing if security is explicitly - // disabled - bool security_disabled = 2; -} - -message RegistrationRequest { - string api = 1; - string path = 2; - repeated string methods = 3; - ApiWorkerOptions options = 4; -} diff --git a/nitric/proto/batch/v1/batch.proto b/nitric/proto/batch/v1/batch.proto deleted file mode 100644 index 48c4152..0000000 --- a/nitric/proto/batch/v1/batch.proto +++ /dev/null @@ -1,96 +0,0 @@ -syntax = "proto3"; -package nitric.proto.batch.v1; - -import "google/protobuf/struct.proto"; - -// protoc plugin options for code generation -option go_package = "github.com/nitrictech/nitric/core/pkg/proto/batch/v1;batchpb"; -option java_package = "io.nitric.proto.batch.v1"; -option java_multiple_files = true; -option java_outer_classname = "BatchService"; -option php_namespace = "Nitric\\Proto\\Batch\\V1"; -option csharp_namespace = "Nitric.Proto.Batch.v1"; - -// Service for processing jobs -service Job { - rpc HandleJob(stream ClientMessage) returns (stream ServerMessage); -} - -// Service for submitting jobs to be processed -service Batch { - rpc SubmitJob(JobSubmitRequest) returns (JobSubmitResponse); -} - -message ClientMessage { - // globally unique ID of the request/response pair - string id = 1; - - oneof content { - // Register a handler for a job - RegistrationRequest registration_request = 2; - - // Handle a job submission - JobResponse job_response = 3; - } -} - -message JobRequest { - string job_name = 1; - - JobData data = 2; -} - -message JobData { - oneof data { - google.protobuf.Struct struct = 1; - } -} - -message JobResponse { - // Mark if the job was successfully processed - bool success = 1; -} - -message RegistrationRequest { - string job_name = 1; - - // Register with default requirements - JobResourceRequirements requirements = 2; -} - -message RegistrationResponse { -} - -message JobResourceRequirements { - // The number of CPUs to allocate for the job - float cpus = 1; - // The amount of memory to allocate for the job - int64 memory = 2; - // The number of GPUs to allocate for the job - int64 gpus = 3; -} - -// ServerMessage is the message sent from the nitric server to the service -message ServerMessage { - // globally unique ID of the request/response pair - string id = 1; - - oneof content { - // - RegistrationResponse registration_response = 2; - - // Request to a job handler - JobRequest job_request = 3; - } -} - -message JobSubmitRequest { - // The name of the job that should handle the data - string job_name = 1; - - // The data to be processed by the job - JobData data = 2; -} - -message JobSubmitResponse { -} diff --git a/nitric/proto/deployments/v1/deployments.proto b/nitric/proto/deployments/v1/deployments.proto deleted file mode 100644 index 3735708..0000000 --- a/nitric/proto/deployments/v1/deployments.proto +++ /dev/null @@ -1,337 +0,0 @@ -syntax = "proto3"; - -package nitric.proto.deployments.v1; - -import "google/protobuf/struct.proto"; -import "nitric/proto/batch/v1/batch.proto"; -import "nitric/proto/resources/v1/resources.proto"; -import "nitric/proto/storage/v1/storage.proto"; - -//protoc plugin options for code generation -option go_package = "github.com/nitrictech/nitric/core/pkg/proto/deployments/v1;deploymentspb"; -option java_package = "io.nitric.proto.deployments.v1"; -option java_multiple_files = true; -option java_outer_classname = "DeploymentsService"; -option php_namespace = "Nitric\\Proto\\Deployments\\V1"; -option csharp_namespace = "Nitric.Proto.Deployments.v1"; - -// The Nitric Deloyment Service contract -service Deployment { - // Begins a new deployment - // Server will stream updates back to the connected client - // on the status of the deployment - rpc Up (DeploymentUpRequest) returns (stream DeploymentUpEvent); - // Tears down an existing deployment - // Server will stream updates back to the connected client - // on the status of the teardown - rpc Down (DeploymentDownRequest) returns (stream DeploymentDownEvent); -} - -message DeploymentUpRequest { - // The spec to deploy - Spec spec = 1; - - // A map of attributes related to the deploy request - // this allows for adding project identifiers etc. - google.protobuf.Struct attributes = 2; - - // A hint to the provider of the kind of output that the client can accept - // This will allow provider developers to provider richer output back to clients. - bool interactive = 3; -} - -message DeploymentUpEvent { - oneof content { - string message = 1; - ResourceUpdate update = 2; - UpResult result = 3; - } -} - -enum ResourceDeploymentAction { - // A new resource is being created - CREATE = 0; - // An existing resource is being updated - UPDATE = 1; - // An existing resource is being replaced - REPLACE = 2; - // No-op on the resource (it already exists and requires no changes) - SAME = 3; - // An existing resource is being deleted - DELETE = 4; -} - -enum ResourceDeploymentStatus { - // The action hasn't started, usually due to a dependency - PENDING = 0; - // The action in currently in-flight, e.g. waiting for cloud provider to provision a resource - IN_PROGRESS = 1; - // The action has been applied successfully - SUCCESS = 2; - // The action has failed to be (completely) applied - FAILED = 3; -} - -message ResourceUpdate { - // The resource being updated, if this is nil the update applies to the stack - nitric.proto.resources.v1.ResourceIdentifier id = 1; - - // The type of update being applied - ResourceDeploymentAction action = 3; - - // The current status of the action being applied - ResourceDeploymentStatus status = 4; - - // (optional) A globally unique identifier (scoped to the id above), used when Nitric Resources map 1:many in a cloud provider. - // e.g. the container image repository for a service deployment. - // This can also be set when id is nil above and it will imply a non-nitric resource that is necessary to deploy for a stack to operate - // e.g. an Azure StorageAccount - string sub_resource = 5; - - // Additional information about the update - string message = 6; -} - -// Terminal message indicating deployment success -message UpResult { - // Indicate the success status - bool success = 1; - - - oneof content { - // Simple text output as result - string text = 2; - } -} - -message DeploymentDownRequest { - // A map of attributes related to the deploy request - // this allows for adding project identifiers etc. - google.protobuf.Struct attributes = 1; - - // A hint to the provider of the kind of output that the client can accept - // This will allow provider developers to provider richer output back to clients. - bool interactive = 2; -} - -message DeploymentDownEvent { - oneof content { - string message = 1; - DownResult result = 2; - ResourceUpdate update = 3; - } -} - -// Terminal message indicating deployment success -message DownResult { -} - -// An image source to be used for service deployment -message ImageSource { - // URI of the docker image - // To support remote images this may also need to provide auth information - string uri = 1; -} - -// A unit of compute (i.e. function/container) -message Service { - // Source of the service - oneof source { - // Container image as a service - ImageSource image = 1; - // Alternative sources could include - // - zipped code sources - // - git/scm repository URIs - - } - - // Expected worker count for this service - int32 workers = 10; - // Configurable timeout for request handling - int32 timeout = 11 [deprecated = true]; - // Configurable memory size for this instance - int32 memory = 12 [deprecated = true]; - - // A simple type property - // describes the requested type of service that this should be - // for this project, a provider can implement how this request is satisfied - // in any way - string type = 13; - - // Environment variables for this service - map env = 14; -} - -message Job { - // The name of the job to create - string name = 1; - - // The default resource requirements of the job - nitric.proto.batch.v1.JobResourceRequirements requirements = 2; -} - -message Batch { - // Source of the service - oneof source { - // Image URI for this batch service - ImageSource image = 1; - } - - // A simple type property - // describes the requested type of batch that this should be - // for this project, a provider can implement how this request is satisfied - // in any way - string type = 10; - - // Environment variables for this Batch - map env = 11; - - // Jobs that are defined in this Batch - repeated Job jobs = 12; -} - -message Bucket { - repeated BucketListener listeners = 1; -} - -message BucketListener { - nitric.proto.storage.v1.RegistrationRequest config = 1; - oneof target { - // The name of an service to target - string service = 2; - } -} - -message Topic { - repeated SubscriptionTarget subscriptions = 1; -} - -message Queue { -} - -message KeyValueStore { -} - -message Secret { -} - -message SubscriptionTarget { - oneof target { - // The name of an service to target - string service = 1; - // Additional targets could potentially include - // - HTTP/API Endpoints - // - Queues - } -} - -message TopicSubscription { - SubscriptionTarget target = 1; -} - -message HttpTarget { - oneof target { - // The name of an service to target - string service = 1; - } -} - -// An http proxy resource -message Http { - HttpTarget target = 1; -} - -message Api { - oneof document { - // An OpenAPI document for deployment - // This document will contain extensions that hint of services that should be targeted as part of the deployment - string openapi = 1; - } -} - -// Declare a new websocket -message Websocket { - // Target for handling new client connections - WebsocketTarget connect_target = 1; - // Target for handling client disconnections - WebsocketTarget disconnect_target = 2; - // Target for handling all other message types - WebsocketTarget message_target = 3; -} - -message WebsocketTarget { - oneof target { - // The name of an service to target - string service = 1; - // Additional targets could potentially include - // - HTTP/API Endpoints - } -} - -message ScheduleTarget { - oneof target { - // The name of an service to target - string service = 1; - // Additional targets could potentially include - // - HTTP/API Endpoints - } -} - -message Schedule { - ScheduleTarget target = 1; - - oneof cadence { - ScheduleEvery every = 10; - ScheduleCron cron = 11; - } -} - -message SqlDatabase { - oneof migrations { - // The URI of a docker image to use to execute the migrations for this database - string image_uri = 1; - } -} - -message ScheduleEvery { - // rate string e.g. '5 minutes'. Value frequencies are 'minutes', 'hours', 'days'. - string rate = 1; -} - -message ScheduleCron { - // standard unix cron expression - string expression = 1; -} - -message Resource { - nitric.proto.resources.v1.ResourceIdentifier id = 1; - - oneof config { - Service service = 10; - Bucket bucket = 11; - Topic topic = 12; - Api api = 13; - Policy policy = 14; - Schedule schedule = 15; - KeyValueStore key_value_store = 16; - Secret secret = 17; - Websocket websocket = 18; - Http http = 19; - Queue queue = 20; - SqlDatabase sql_database = 21; - Batch batch = 22; - } -} - -// This is already defined in the resource contracts, -// unfortunately there are parts we don't want to duplicate, such as API config -message Policy { - repeated Resource principals = 1; - repeated nitric.proto.resources.v1.Action actions = 2; - repeated Resource resources = 3; -} - -message Spec { - // list of resources to deploy - repeated Resource resources = 1; -} diff --git a/nitric/proto/http/v1/http.proto b/nitric/proto/http/v1/http.proto deleted file mode 100644 index 24feec3..0000000 --- a/nitric/proto/http/v1/http.proto +++ /dev/null @@ -1,30 +0,0 @@ -syntax = "proto3"; -package nitric.proto.http.v1; - -// protoc plugin options for code generation -option go_package = "github.com/nitrictech/nitric/core/pkg/proto/http/v1;httppb"; -option java_package = "io.nitric.proto.http.v1"; -option java_multiple_files = true; -option java_outer_classname = "HttpService"; -option php_namespace = "Nitric\\Proto\\Http\\V1"; -option csharp_namespace = "Nitric.Proto.Http.v1"; - -// Service for proxying HTTP requests -service Http { - // Proxy an HTTP server - rpc Proxy(stream ClientMessage) returns (stream ServerMessage); -} - -message ClientMessage { - // Details of the HTTP server to proxy - HttpProxyRequest request = 1; -} - -message ServerMessage { -} - -message HttpProxyRequest { - // The address the server can be accessed on - string host = 1; -} - diff --git a/nitric/proto/keyvalue/v1/keyvalue.proto b/nitric/proto/keyvalue/v1/keyvalue.proto deleted file mode 100644 index 816b4b3..0000000 --- a/nitric/proto/keyvalue/v1/keyvalue.proto +++ /dev/null @@ -1,75 +0,0 @@ -syntax = "proto3"; -package nitric.proto.KeyValue.v1; - -import "google/protobuf/struct.proto"; - -// protoc plugin options for code generation -// option go_package = "nitric/v1;v1"; -option go_package = "github.com/nitrictech/nitric/core/pkg/proto/keyvalue/v1;KeyValuepb"; -option java_package = "io.nitric.proto.keyvalue.v1"; -option java_multiple_files = true; -option java_outer_classname = "KeyValueService"; -option php_namespace = "Nitric\\Proto\\KeyValue\\V1"; -option csharp_namespace = "Nitric.Proto.KeyValue.v1"; - -// Service for storage and retrieval of simple JSON keyValue -service KeyValue { - // Get an existing value - rpc Get (KeyValueGetRequest) returns (KeyValueGetResponse); - - // Create a new or overwrite an existing value - rpc Set (KeyValueSetRequest) returns (KeyValueSetResponse); - - // Delete a key and its value - rpc Delete (KeyValueDeleteRequest) returns (KeyValueDeleteResponse); -} - -// Provides a Key/Value Store -message Store { - // The store name - string name = 1; -} - -// ValueRef provides a unique identifier for a value -message ValueRef { - // The key/value store name - string store = 1; - - // The item's unique key within the store - string key = 2; -} - -// Value provides a return value type -message Value { - // ValueRef of the key/value pair, which includes the store and key - ValueRef ref = 1; - - // The content (JSON object) - google.protobuf.Struct content = 2; -} - -message KeyValueGetRequest { - // ValueRef of the key/value pair to get, which includes the store and key - ValueRef ref = 1; -} - -message KeyValueGetResponse { - // The retrieved value - Value value = 1; -} - -message KeyValueSetRequest { - // ValueRef of the key/value pair to set, which includes the store and key - ValueRef ref = 1 ; - // The value content to store (JSON object) - google.protobuf.Struct content = 3; -} - -message KeyValueSetResponse {} - -message KeyValueDeleteRequest { - // ValueRef of the key/value pair to delete, which includes the store and key - ValueRef ref = 1; -} - -message KeyValueDeleteResponse {} diff --git a/nitric/proto/kvstore/v1/kvstore.proto b/nitric/proto/kvstore/v1/kvstore.proto deleted file mode 100644 index 6c7c279..0000000 --- a/nitric/proto/kvstore/v1/kvstore.proto +++ /dev/null @@ -1,93 +0,0 @@ -syntax = "proto3"; -package nitric.proto.kvstore.v1; - -import "google/protobuf/struct.proto"; - -// protoc plugin options for code generation -// option go_package = "nitric/v1;v1"; -option go_package = "github.com/nitrictech/nitric/core/pkg/proto/kvstore/v1;kvstorepb"; -option java_package = "io.nitric.proto.kvstore.v1"; -option java_multiple_files = true; -option java_outer_classname = "KvStoreService"; -option php_namespace = "Nitric\\Proto\\KvStore\\V1"; -option csharp_namespace = "Nitric.Proto.KvStore.v1"; - -// Service for storage and retrieval of simple JSON keyValue -service KvStore { - // Get an existing value - rpc GetValue (KvStoreGetValueRequest) returns (KvStoreGetValueResponse); - - // Create a new or overwrite an existing value - rpc SetValue (KvStoreSetValueRequest) returns (KvStoreSetValueResponse); - - // Delete a key and its value - rpc DeleteKey (KvStoreDeleteKeyRequest) returns (KvStoreDeleteKeyResponse); - - // Iterate over all keys in a store - rpc ScanKeys (KvStoreScanKeysRequest) returns (stream KvStoreScanKeysResponse); -} - -// Provides a Key/Value Store -message Store { - // The store name - string name = 1; -} - -// ValueRef provides a unique identifier for a value -message ValueRef { - // The key/value store name - string store = 1; - - // The item's unique key within the store - string key = 2; -} - -// Value provides a return value type -message Value { - // ValueRef of the key/value pair, which includes the store and key - ValueRef ref = 1; - - // The content (JSON object) - google.protobuf.Struct content = 2; -} - -message KvStoreGetValueRequest { - // ValueRef of the key/value pair to get, which includes the store and key - ValueRef ref = 1; -} - -message KvStoreGetValueResponse { - // The retrieved value - Value value = 1; -} - -message KvStoreSetValueRequest { - // ValueRef of the key/value pair to set, which includes the store and key - ValueRef ref = 1 ; - // The value content to store (JSON object) - google.protobuf.Struct content = 3; -} - -message KvStoreSetValueResponse { -} - -message KvStoreDeleteKeyRequest { - // ValueRef of the key/value pair to delete, which includes the store and key - ValueRef ref = 1; -} - -message KvStoreDeleteKeyResponse { -} - -message KvStoreScanKeysRequest { - // The store to iterate over - Store store = 1; - - // The prefix to filter keys by - string prefix = 2; -} - -message KvStoreScanKeysResponse { - // The key of the key/value pair - string key = 1; -} diff --git a/nitric/proto/queues/v1/queues.proto b/nitric/proto/queues/v1/queues.proto deleted file mode 100644 index 122af91..0000000 --- a/nitric/proto/queues/v1/queues.proto +++ /dev/null @@ -1,82 +0,0 @@ -syntax = "proto3"; -package nitric.proto.queues.v1; - -import "google/protobuf/struct.proto"; - -// protoc plugin options for code generation -option go_package = "github.com/nitrictech/nitric/core/pkg/proto/queues/v1;queuespb"; -option java_package = "io.nitric.proto.queues.v1"; -option java_multiple_files = true; -option java_outer_classname = "QueuesService"; -option php_namespace = "Nitric\\Proto\\Queues\\V1"; -option csharp_namespace = "Nitric.Proto.Queues.v1"; - -// The Nitric Queue Service contract -service Queues { - // Send message(s) to a queue - rpc Enqueue (QueueEnqueueRequest) returns (QueueEnqueueResponse); - // Receive message(s) from a queue - rpc Dequeue (QueueDequeueRequest) returns (QueueDequeueResponse); - // Complete an message previously popped from a queue - rpc Complete (QueueCompleteRequest) returns (QueueCompleteResponse); -} - -message QueueEnqueueRequest { - // The Nitric name for the queue - // this will automatically be resolved to the provider specific queue identifier. - string queue_name = 1; - // Array of messages to push to the queue - repeated QueueMessage messages = 2; -} - -// Response for sending messages to a queue -message QueueEnqueueResponse { - // A list of messages that failed to be queued - repeated FailedEnqueueMessage failed_messages = 1; -} - -message QueueDequeueRequest { - // The nitric name for the queue - // this will automatically be resolved to the provider specific queue identifier. - string queue_name = 1; - // The max number of messages to pop off the queue, may be capped by provider specific limitations - int32 depth = 2; -} - -message QueueDequeueResponse { - // Array of messages popped off the queue - repeated DequeuedMessage messages = 1; -} - -message QueueCompleteRequest { - // The nitric name for the queue - // this will automatically be resolved to the provider specific queue identifier. - string queue_name = 1; - - // Lease id of the message to be completed - string lease_id = 2; -} - -message QueueCompleteResponse { -} - -// An message to be sent to a queue. -message QueueMessage { - // The queue message contents - oneof content { - google.protobuf.Struct struct_payload = 1; - } -} - -message DequeuedMessage { - string lease_id = 1; - - QueueMessage message = 2; -} - -message FailedEnqueueMessage { - // The message that failed to be pushed - QueueMessage message = 1; - // A description of the failure - string details = 2; -} diff --git a/nitric/proto/resources/v1/resources.proto b/nitric/proto/resources/v1/resources.proto deleted file mode 100644 index 980ce2b..0000000 --- a/nitric/proto/resources/v1/resources.proto +++ /dev/null @@ -1,152 +0,0 @@ -syntax = "proto3"; -package nitric.proto.resources.v1; - -//protoc plugin options for code generation -option go_package = "github.com/nitrictech/nitric/core/pkg/proto/resources/v1;resourcespb"; -option java_package = "io.nitric.proto.resources.v1"; -option java_multiple_files = true; -option java_outer_classname = "ResourcesService"; -option php_namespace = "Nitric\\Proto\\Resources\\V1"; -option csharp_namespace = "Nitric.Proto.Resources.v1"; - -// Nitric Resource Service -// The service definition exists to allow a nitric application to declare peripheral dependencies -service Resources { - // Declare a resource for the nitric application - // At Deploy time this will create resources as part of the nitric stacks dependency graph - // At runtime - rpc Declare (ResourceDeclareRequest) returns (ResourceDeclareResponse); -} - -message PolicyResource { - repeated ResourceIdentifier principals = 1; - repeated Action actions = 2; - repeated ResourceIdentifier resources = 3; -} - -enum ResourceType { - Api = 0; - Service = 1; - Bucket = 2; - Topic = 3; - Schedule = 4; - Subscription = 5; - KeyValueStore = 6; - Policy = 7; - Secret = 8; - BucketListener = 9; - Websocket = 10; - Http = 11; - ApiSecurityDefinition = 12; - Queue = 13; - SqlDatabase = 14; - // Batches represent a collection of jobs - Batch = 15; - Job = 16; -} - -// Unique identifier for a resource within a nitric application. -message ResourceIdentifier { - ResourceType type = 1; - string name = 2; -} - -message ResourceDeclareRequest { - ResourceIdentifier id = 1; - - oneof config { - PolicyResource policy = 10; - BucketResource bucket = 11; - TopicResource topic = 12; - KeyValueStoreResource key_value_store = 13; - SecretResource secret = 14; - ApiResource api = 15; - ApiSecurityDefinitionResource api_security_definition = 16; - QueueResource queue = 17; - SqlDatabaseResource sql_database = 18; - JobResource job = 19; - } -} - -message BucketResource { -} -message TopicResource { -} -message QueueResource { -} -message KeyValueStoreResource { -} -message SecretResource { -} - -message JobResource { -} - -message SqlDatabaseMigrations { - oneof migrations { - // The path to this databases SQL migrations - // Valid values are file://relative/path/to/migrations as a directory or dockerfile://path/to/migrations.dockerfile to hint at a docker image build - // Paths should be relative to the root of the application (nitric.yaml file location) - string migrations_path = 1; - } -} - -message SqlDatabaseResource { - SqlDatabaseMigrations migrations = 1; -} - -message ApiOpenIdConnectionDefinition { - string issuer = 1; - repeated string audiences = 2; -} - -message ApiSecurityDefinitionResource { - string api_name = 1; - - oneof definition { - ApiOpenIdConnectionDefinition oidc = 2; - } -} - -message ApiScopes { - repeated string scopes = 1; -} - -message ApiResource { - // root level security map for this api - // references ApiSecurityDefinitionResource(s) - map security = 1; -} - -enum Action { - // Bucket Permissions: 0XX - BucketFileList = 0; - BucketFileGet = 1; - BucketFilePut = 2; - BucketFileDelete = 3; - - // Topic Permissions: 2XX - TopicPublish = 200; - - // KeyValue Store Permissions: 3XX - KeyValueStoreRead = 300; - KeyValueStoreWrite = 301; - KeyValueStoreDelete = 302; - - // Secret Permissions: 4XX - SecretPut = 400; - SecretAccess = 401; - - // Websocket Permissions: 5XX - WebsocketManage = 500; - - // Queue Permissions: 6XX - QueueEnqueue = 600; - QueueDequeue = 601; - - // Job Permissions: 7XX - JobSubmit = 700; -} - -message ResourceDeclareResponse { -} diff --git a/nitric/proto/schedules/v1/schedules.proto b/nitric/proto/schedules/v1/schedules.proto deleted file mode 100644 index 364d548..0000000 --- a/nitric/proto/schedules/v1/schedules.proto +++ /dev/null @@ -1,69 +0,0 @@ -syntax = "proto3"; -package nitric.proto.schedules.v1; - -// protoc plugin options for code generation -option go_package = "github.com/nitrictech/nitric/core/pkg/proto/schedules/v1;schedulespb"; -option java_package = "io.nitric.proto.schedules.v1"; -option java_multiple_files = true; -option java_outer_classname = "SchedulesService"; -option php_namespace = "Nitric\\Proto\\Schedules\\V1"; -option csharp_namespace = "Nitric.Proto.Schedules.v1"; - -// Service for scheduling callbacks on a cadence -service Schedules { - rpc Schedule(stream ClientMessage) returns (stream ServerMessage); -} - -// ClientMessages are sent from the service to the nitric server -message ClientMessage { - // globally unique ID of the request/response pair - string id = 1; - - oneof content { - // Register new a schedule - RegistrationRequest registration_request = 2; - - // Response to a schedule interval (i.e. response from callback function) - IntervalResponse interval_response = 3; - } -} - -message IntervalRequest { - string schedule_name = 1; -} - -// ServerMessages are sent from the nitric server to the service -message ServerMessage { - // globally unique ID of the request/response pair - string id = 1; - - oneof content { - // Response to a schedule subscription request - RegistrationResponse registration_response = 2; - - // A schedule interval trigger request (i.e. call the callback) - IntervalRequest interval_request = 3; - } -} - -message RegistrationRequest { - string schedule_name = 1; - oneof cadence { - ScheduleEvery every = 10; - ScheduleCron cron = 11; - } -} - -message ScheduleEvery { - string rate = 1; -} - -message ScheduleCron { - string expression = 1; -} - -message RegistrationResponse { -} - -message IntervalResponse { -} diff --git a/nitric/proto/secrets/v1/secrets.proto b/nitric/proto/secrets/v1/secrets.proto deleted file mode 100644 index 7d64e8c..0000000 --- a/nitric/proto/secrets/v1/secrets.proto +++ /dev/null @@ -1,60 +0,0 @@ -syntax = "proto3"; -package nitric.proto.secrets.v1; - -//protoc plugin options for code generation -option go_package = "github.com/nitrictech/nitric/core/pkg/proto/secrets/v1;secretspb"; -option java_package = "io.nitric.proto.secrets.v1"; -option java_multiple_files = true; -option java_outer_classname = "SecretsService"; -option php_namespace = "Nitric\\Proto\\Secrets\\V1"; -option csharp_namespace = "Nitric.Proto.Secrets.v1"; - -// The Nitric Secret Service -service SecretManager { - // Updates a secret, creating a new one if it doesn't already exist - rpc Put (SecretPutRequest) returns (SecretPutResponse); - // Gets a secret from a Secret Store - rpc Access (SecretAccessRequest) returns (SecretAccessResponse); -} - -// Request to put a secret to a Secret Store -message SecretPutRequest { - // The Secret to put to the Secret store - Secret secret = 1; - // The value to assign to that secret - bytes value = 2; -} - -// Result from putting the secret to a Secret Store -message SecretPutResponse { - // The id of the secret - SecretVersion secret_version = 1; -} - -// Request to get a secret from a Secret Store -message SecretAccessRequest { - // The id of the secret - SecretVersion secret_version = 1; -} - -// The secret response -message SecretAccessResponse { - // The version of the secret that was requested - SecretVersion secret_version = 1; - // The value of the secret - bytes value = 2; -} - -// The secret container -message Secret { - // The secret name - string name = 1; -} - -// A version of a secret -message SecretVersion { - // Reference to the secret container - Secret secret = 1; - // The secret version - string version = 2; -} \ No newline at end of file diff --git a/nitric/proto/sql/v1/sql.proto b/nitric/proto/sql/v1/sql.proto deleted file mode 100644 index fb8a1ba..0000000 --- a/nitric/proto/sql/v1/sql.proto +++ /dev/null @@ -1,26 +0,0 @@ -syntax = "proto3"; -package nitric.proto.sql.v1; - -//protoc plugin options for code generation -option go_package = "github.com/nitrictech/nitric/core/pkg/proto/sql/v1;sqlpb"; -option java_package = "io.nitric.proto.sql.v1"; -option java_multiple_files = true; -option java_outer_classname = "SqlService"; -option php_namespace = "Nitric\\Proto\\Sql\\V1"; -option csharp_namespace = "Nitric.Proto.Sql.v1"; - -// The Nitric Secret Service -service Sql { - // Retrieve the connection string for a given database - rpc ConnectionString (SqlConnectionStringRequest) returns (SqlConnectionStringResponse); -} - -message SqlConnectionStringRequest { - // The name of the database to retrieve the connection string for - string database_name = 1; -} - -message SqlConnectionStringResponse { - // The connection string for the database - string connection_string = 1; -} diff --git a/nitric/proto/storage/v1/storage.proto b/nitric/proto/storage/v1/storage.proto deleted file mode 100644 index afcc6ec..0000000 --- a/nitric/proto/storage/v1/storage.proto +++ /dev/null @@ -1,191 +0,0 @@ -syntax = "proto3"; - -package nitric.proto.storage.v1; - -import "google/protobuf/duration.proto"; - -// protoc plugin options for code generation -option go_package = "github.com/nitrictech/nitric/core/pkg/proto/storage/v1;storagepb"; -option java_package = "io.nitric.proto.storage.v1"; -option java_multiple_files = true; -option java_outer_classname = "StorageService"; -option php_namespace = "Nitric\\Proto\\Storage\\V1"; -option csharp_namespace = "Nitric.Proto.Storage.v1"; - -// Services for storage and retrieval of blobs in the form of byte arrays, such as text and binary blobs. -service Storage { - // Retrieve an item from a bucket - rpc Read (StorageReadRequest) returns (StorageReadResponse); - // Store an item to a bucket - rpc Write (StorageWriteRequest) returns (StorageWriteResponse); - // Delete an item from a bucket - rpc Delete (StorageDeleteRequest) returns (StorageDeleteResponse); - // Generate a pre-signed URL for direct operations on an item - rpc PreSignUrl (StoragePreSignUrlRequest) returns (StoragePreSignUrlResponse); - // List blobs currently in the bucket - rpc ListBlobs (StorageListBlobsRequest) returns (StorageListBlobsResponse); - // Determine is an object exists in a bucket - rpc Exists (StorageExistsRequest) returns (StorageExistsResponse); -} - -service StorageListener { - // Listen for changes on a bucket - rpc Listen (stream ClientMessage) returns (stream ServerMessage); -} - -// ClientMessages are sent from the service to the nitric server -message ClientMessage { - // globally unique ID of the request/response pair - string id = 1; - - oneof content { - // Watch for changes on a bucket - RegistrationRequest registration_request = 2; - // Response to a blob event (change to a blob) - BlobEventResponse blob_event_response = 3; - } -} - -// ServerMessages are sent from the nitric server to the service -message ServerMessage { - // globally unique ID of the request/response pair - string id = 1; - - oneof content { - // Watch for changes on a bucket - RegistrationResponse registration_response = 2; - // Event for a blob in a bucket - BlobEventRequest blob_event_request = 3; - } -} - -message BlobEventRequest { - string bucket_name = 1; - - oneof event { - BlobEvent blob_event = 10; - } -} - -message BlobEvent { - // The key of the blob the event is for - string key = 1; - - // The type of event that occurred - BlobEventType type = 2; -} - -message BlobEventResponse { - bool success = 1; -} - -enum BlobEventType { - Created = 0; - Deleted = 1; -} - -message RegistrationRequest { - // Name of the bucket to watch - string bucket_name = 1; - - // Event type to listen for - BlobEventType blob_event_type = 2; - - // A blob key prefix to filter events by - string key_prefix_filter = 3; -} - -message RegistrationResponse { - // The ID of the registration - string id = 1; -} - -// Request to put (create/update) a storage item -message StorageWriteRequest { - // Nitric name of the bucket to store in - // this will be automatically resolved to the provider specific bucket identifier. - string bucket_name = 1; - // Key to store the item under - string key = 2; - // bytes array to store - bytes body = 3; -} - -// Result of putting a storage item -message StorageWriteResponse { -} - -// Request to retrieve a storage item -message StorageReadRequest { - // Nitric name of the bucket to retrieve from - // this will be automatically resolved to the provider specific bucket identifier. - string bucket_name = 1; - // Key of item to retrieve - string key = 2; -} - -// Returned storage item -message StorageReadResponse { - // The body bytes of the retrieved storage item - bytes body = 1; -} - -// Request to delete a storage item -message StorageDeleteRequest { - // Name of the bucket to delete from - string bucket_name = 1; - // Key of item to delete - string key = 2; -} - -// Result of deleting a storage item -message StorageDeleteResponse { -} - -// Request to generate a pre-signed URL for a blob to perform a specific operation, such as read or write. -message StoragePreSignUrlRequest { - // Nitric name of the bucket to retrieve from - // this will be automatically resolved to the provider specific bucket identifier. - string bucket_name = 1; - // Key of item to generate the signed URL for. - // The URL and the token it contains will only be valid for operations on this resource specifically. - string key = 2; - // Operation - enum Operation { - READ = 0; - WRITE = 1; - } - Operation operation = 3; - // Expiry defined as as protobuf duration - google.protobuf.Duration expiry = 4; -} - -message StoragePreSignUrlResponse { - // The pre-signed url, restricted to the operation, resource and expiry time specified in the request. - string url = 1; -} - -message StorageListBlobsRequest { - string bucket_name = 1; - - string prefix = 2; -} - -message Blob { - string key = 1; -} - -message StorageListBlobsResponse { - // keys of the blobs in the bucket - repeated Blob blobs = 1; -} - -message StorageExistsRequest { - string bucket_name = 1; - // Key of item to retrieve - string key = 2; -} - -message StorageExistsResponse { - bool exists = 1; -} diff --git a/nitric/proto/topics/v1/topics.proto b/nitric/proto/topics/v1/topics.proto deleted file mode 100644 index 643504a..0000000 --- a/nitric/proto/topics/v1/topics.proto +++ /dev/null @@ -1,94 +0,0 @@ -syntax = "proto3"; -package nitric.proto.topics.v1; - -import "google/protobuf/duration.proto"; -import "google/protobuf/struct.proto"; - -// protoc plugin options for code generation -option go_package = "github.com/nitrictech/nitric/core/pkg/proto/topics/v1;topicspb"; -option java_package = "io.nitric.proto.topics.v1"; -option java_multiple_files = true; -option java_outer_classname = "TopicsService"; -option php_namespace = "Nitric\\Proto\\Topics\\V1"; -option csharp_namespace = "Nitric.Proto.Topics.v1"; - -// Service for publishing asynchronous messages -service Topics { - // Publishes a message to a given topic - rpc Publish (TopicPublishRequest) returns (TopicPublishResponse); -} - -// Service for subscribing to asynchronous messages -service Subscriber { - // Subscribe to a topic and handle incoming messages - rpc Subscribe (stream ClientMessage) returns (stream ServerMessage); -} - -// ClientMessage is the message sent from the service to the nitric server -message ClientMessage { - // globally unique ID of the request/response pair - string id = 1; - - oneof content { - // Register a subscription to a topic - RegistrationRequest registration_request = 2; - - // Handle a message received from a topic - MessageResponse message_response = 3; - } -} - -message MessageRequest { - string topic_name = 1; - - // Message Type - TopicMessage message = 2; -} - -message MessageResponse { - bool success = 1; -} - -// ServerMessage is the message sent from the nitric server to the service -message ServerMessage { - // globally unique ID of the request/response pair - string id = 1; - - oneof content { - // Response to a topic subscription request - RegistrationResponse registration_response = 2; - - // Response to a topic message request - MessageRequest message_request = 3; - } -} - -message RegistrationRequest { - string topic_name = 1; -} - -message RegistrationResponse { -} - -message TopicMessage { - // The topic message contents - oneof content { - google.protobuf.Struct struct_payload = 1; - } -} - -// Request to publish a message to a topic -message TopicPublishRequest { - // The name of the topic to publish the topic to - string topic_name = 1; - - // The message to be published - TopicMessage message = 2; - - // An optional delay specified in seconds (minimum 10 seconds) - google.protobuf.Duration delay = 3; -} - -// Result of publishing an topic -message TopicPublishResponse { -} diff --git a/nitric/proto/websockets/v1/websockets.proto b/nitric/proto/websockets/v1/websockets.proto deleted file mode 100644 index d69ff56..0000000 --- a/nitric/proto/websockets/v1/websockets.proto +++ /dev/null @@ -1,153 +0,0 @@ -syntax = "proto3"; -package nitric.proto.websockets.v1; - -// protoc plugin options for code generation -option go_package = "github.com/nitrictech/nitric/core/pkg/proto/websockets/v1;websocketspb"; -option java_package = "io.nitric.proto.websockets.v1"; -option java_multiple_files = true; -option java_outer_classname = "WebsocketsService"; -option php_namespace = "Nitric\\Proto\\Websockets\\V1"; -option csharp_namespace = "Nitric.Proto.Websockets.v1"; - -service Websocket { - // Send a messages to a websocket - rpc SendMessage(WebsocketSendRequest) returns (WebsocketSendResponse); - - // Close a websocket connection - // This can be used to force a client to disconnect - rpc CloseConnection(WebsocketCloseConnectionRequest) returns (WebsocketCloseConnectionResponse); - - // Retrieve details about an API - rpc SocketDetails(WebsocketDetailsRequest) returns (WebsocketDetailsResponse); -} - -message WebsocketDetailsRequest { - string socket_name = 1; -} - -message WebsocketDetailsResponse { - string url = 1; -} - -service WebsocketHandler { - // Handle incoming websocket events - rpc HandleEvents (stream ClientMessage) returns (stream ServerMessage); -} - -message WebsocketSendRequest { - // The nitric name of the socket to send on - string socket_name = 1; - // The connection ID of the client to send to - string connection_id = 2; - // The data to send to the socket - bytes data = 3; -} - -message WebsocketSendResponse { -} - -message WebsocketCloseConnectionRequest { - // The nitric name of the socket to send on - string socket_name = 1; - // The connection ID of the client to send to - string connection_id = 2; -} - -message WebsocketCloseConnectionResponse { -} - - -// ClientMessages are sent from the service to the nitric server -message ClientMessage { - // Globally unique id to pair requests/responses - string id = 1; - - oneof content { - // Client initialisation request - // A worker will not be eligible for triggers - // until it has identified itself - RegistrationRequest registration_request = 2; - - // Client responding with result of a trigger - WebsocketEventResponse websocket_event_response = 3; - } -} - -enum WebsocketEventType { - // Specialised Event for handling new client connections - Connect = 0; - // Specialised Event for handling existing client connections - Disconnect = 1; - // All other types of events are messages - Message = 2; -} - -// Placeholder message -message RegistrationResponse { -} - -message RegistrationRequest { - // The nitric name of the socket that this worker listens on - string socket_name = 1; - // The type of event that this worker handles - WebsocketEventType event_type = 2; -} - -message WebsocketEventRequest { - // The nitric name of the socket that this worker listens on - string socket_name = 1; - - // The connection this trigger came from - string connection_id = 2; - - oneof websocket_event { - WebsocketConnectionEvent connection = 10; - WebsocketDisconnectionEvent disconnection = 11; - WebsocketMessageEvent message = 12; - } -} - -message QueryValue { - repeated string value = 1; -} - -// ServerMessages are sent from the nitric server to the service -message ServerMessage { - // Server message ID, used to pair requests/responses - string id = 1; - - oneof content { - // Server responding - // with client configuration details to an - // InitRequest - RegistrationResponse registration_response = 2; - - // Server requesting client to process an event - WebsocketEventRequest websocket_event_request = 3; - } -} - -message WebsocketEventResponse { - oneof websocket_response { - WebsocketConnectionResponse connection_response = 10; - // WebsocketDisconnectionResponse disconnection_response = 11; - // WebsocketMessageEventResponse message_response = 12; - } -} - -message WebsocketConnectionEvent { - // The query params available in the connection request - map query_params = 1; -} - -message WebsocketConnectionResponse { - bool reject = 1; -} - -message WebsocketDisconnectionEvent { -} - -message WebsocketMessageEvent { - // Data available on - bytes body = 1; -}