From a6facdcdc6a9904fefb4d3763ec84d48033601d4 Mon Sep 17 00:00:00 2001 From: Lionello Lunesu Date: Sun, 3 Dec 2023 13:44:40 -0800 Subject: [PATCH] update proto --- index.ts | 2 +- io/defang/v1/fabric.proto | 8 +- protos/io/defang/v1/fabric_grpc_pb.d.ts | 10 +- protos/io/defang/v1/fabric_grpc_pb.js | 17 ++- protos/io/defang/v1/fabric_pb.d.ts | 20 ++++ protos/io/defang/v1/fabric_pb.js | 152 ++++++++++++++++++++++++ 6 files changed, 197 insertions(+), 12 deletions(-) diff --git a/index.ts b/index.ts index daebd69..812b8ec 100644 --- a/index.ts +++ b/index.ts @@ -167,7 +167,7 @@ async function uploadBuildContext( ): Promise { const uploadUrlResponse = await new Promise( (resolve, reject) => - client.createUploadURL(new Empty(), (err, res) => + client.createUploadURL(new pb.UploadURLRequest(), (err, res) => err ? reject(err) : resolve(res!) ) ); diff --git a/io/defang/v1/fabric.proto b/io/defang/v1/fabric.proto index 3903cc9..0e9261f 100644 --- a/io/defang/v1/fabric.proto +++ b/io/defang/v1/fabric.proto @@ -1,7 +1,7 @@ // protos/v1/fabric.proto syntax = "proto3"; -option go_package = "github.com/defang-io/defang-mvp/fabric/protos/io/defang/v1"; +option go_package = "github.com/defang-io/defang/src/protos/io/defang/v1"; // option java_multiple_files = true; // option java_package = "io.defang.fabric"; // option java_outer_classname = "FabricProto"; @@ -31,7 +31,7 @@ service FabricController { rpc PutSecret(SecretValue) returns (google.protobuf.Empty); rpc ListSecrets(google.protobuf.Empty) returns (Secrets); // no values - rpc CreateUploadURL(google.protobuf.Empty) returns (UploadURLResponse); + rpc CreateUploadURL(UploadURLRequest) returns (UploadURLResponse); // rpc DeleteSecret(SecretValue) returns (google.protobuf.Empty); } @@ -51,6 +51,8 @@ message File { message GenerateFilesResponse { repeated File files = 1; } +message UploadURLRequest { string digest = 1; } + message UploadURLResponse { string url = 1; } message ServiceInfo { @@ -237,7 +239,7 @@ message Service { string name = 1; string image = 2; Platform platform = 3; - bool internal = 4; + bool internal = 4; // true if service is internal TODO: not part of spec Deploy deploy = 5; repeated Port ports = 6; map environment = 7; diff --git a/protos/io/defang/v1/fabric_grpc_pb.d.ts b/protos/io/defang/v1/fabric_grpc_pb.d.ts index 20cbe6e..d69a6de 100644 --- a/protos/io/defang/v1/fabric_grpc_pb.d.ts +++ b/protos/io/defang/v1/fabric_grpc_pb.d.ts @@ -22,7 +22,7 @@ interface IFabricControllerService extends grpc.ServiceDefinition; putSecret: grpc.MethodDefinition; listSecrets: grpc.MethodDefinition; - createUploadURL: grpc.MethodDefinition; + createUploadURL: grpc.MethodDefinition; } export const FabricControllerService: IFabricControllerService; @@ -42,7 +42,7 @@ export interface IFabricControllerServer extends grpc.UntypedServiceImplementati generateFiles: grpc.handleUnaryCall; putSecret: grpc.handleUnaryCall; listSecrets: grpc.handleUnaryCall; - createUploadURL: grpc.handleUnaryCall; + createUploadURL: grpc.handleUnaryCall; } export class FabricControllerClient extends grpc.Client { @@ -87,7 +87,7 @@ export class FabricControllerClient extends grpc.Client { listSecrets(argument: google_protobuf_empty_pb.Empty, callback: grpc.requestCallback): grpc.ClientUnaryCall; listSecrets(argument: google_protobuf_empty_pb.Empty, metadataOrOptions: grpc.Metadata | grpc.CallOptions | null, callback: grpc.requestCallback): grpc.ClientUnaryCall; listSecrets(argument: google_protobuf_empty_pb.Empty, metadata: grpc.Metadata | null, options: grpc.CallOptions | null, callback: grpc.requestCallback): grpc.ClientUnaryCall; - createUploadURL(argument: google_protobuf_empty_pb.Empty, callback: grpc.requestCallback): grpc.ClientUnaryCall; - createUploadURL(argument: google_protobuf_empty_pb.Empty, metadataOrOptions: grpc.Metadata | grpc.CallOptions | null, callback: grpc.requestCallback): grpc.ClientUnaryCall; - createUploadURL(argument: google_protobuf_empty_pb.Empty, metadata: grpc.Metadata | null, options: grpc.CallOptions | null, callback: grpc.requestCallback): grpc.ClientUnaryCall; + createUploadURL(argument: io_defang_v1_fabric_pb.UploadURLRequest, callback: grpc.requestCallback): grpc.ClientUnaryCall; + createUploadURL(argument: io_defang_v1_fabric_pb.UploadURLRequest, metadataOrOptions: grpc.Metadata | grpc.CallOptions | null, callback: grpc.requestCallback): grpc.ClientUnaryCall; + createUploadURL(argument: io_defang_v1_fabric_pb.UploadURLRequest, metadata: grpc.Metadata | null, options: grpc.CallOptions | null, callback: grpc.requestCallback): grpc.ClientUnaryCall; } diff --git a/protos/io/defang/v1/fabric_grpc_pb.js b/protos/io/defang/v1/fabric_grpc_pb.js index f274668..bf22509 100644 --- a/protos/io/defang/v1/fabric_grpc_pb.js +++ b/protos/io/defang/v1/fabric_grpc_pb.js @@ -217,6 +217,17 @@ function deserialize_io_defang_v1_TokenResponse(buffer_arg) { return io_defang_v1_fabric_pb.TokenResponse.deserializeBinary(new Uint8Array(buffer_arg)); } +function serialize_io_defang_v1_UploadURLRequest(arg) { + if (!(arg instanceof io_defang_v1_fabric_pb.UploadURLRequest)) { + throw new Error('Expected argument of type io.defang.v1.UploadURLRequest'); + } + return Buffer.from(arg.serializeBinary()); +} + +function deserialize_io_defang_v1_UploadURLRequest(buffer_arg) { + return io_defang_v1_fabric_pb.UploadURLRequest.deserializeBinary(new Uint8Array(buffer_arg)); +} + function serialize_io_defang_v1_UploadURLResponse(arg) { if (!(arg instanceof io_defang_v1_fabric_pb.UploadURLResponse)) { throw new Error('Expected argument of type io.defang.v1.UploadURLResponse'); @@ -406,10 +417,10 @@ createUploadURL: { path: '/io.defang.v1.FabricController/CreateUploadURL', requestStream: false, responseStream: false, - requestType: google_protobuf_empty_pb.Empty, + requestType: io_defang_v1_fabric_pb.UploadURLRequest, responseType: io_defang_v1_fabric_pb.UploadURLResponse, - requestSerialize: serialize_google_protobuf_Empty, - requestDeserialize: deserialize_google_protobuf_Empty, + requestSerialize: serialize_io_defang_v1_UploadURLRequest, + requestDeserialize: deserialize_io_defang_v1_UploadURLRequest, responseSerialize: serialize_io_defang_v1_UploadURLResponse, responseDeserialize: deserialize_io_defang_v1_UploadURLResponse, }, diff --git a/protos/io/defang/v1/fabric_pb.d.ts b/protos/io/defang/v1/fabric_pb.d.ts index 0b54e0c..8532ef4 100644 --- a/protos/io/defang/v1/fabric_pb.d.ts +++ b/protos/io/defang/v1/fabric_pb.d.ts @@ -117,6 +117,26 @@ export namespace GenerateFilesResponse { } } +export class UploadURLRequest extends jspb.Message { + getDigest(): string; + setDigest(value: string): void; + + serializeBinary(): Uint8Array; + toObject(includeInstance?: boolean): UploadURLRequest.AsObject; + static toObject(includeInstance: boolean, msg: UploadURLRequest): UploadURLRequest.AsObject; + static extensions: {[key: number]: jspb.ExtensionFieldInfo}; + static extensionsBinary: {[key: number]: jspb.ExtensionFieldBinaryInfo}; + static serializeBinaryToWriter(message: UploadURLRequest, writer: jspb.BinaryWriter): void; + static deserializeBinary(bytes: Uint8Array): UploadURLRequest; + static deserializeBinaryFromReader(message: UploadURLRequest, reader: jspb.BinaryReader): UploadURLRequest; +} + +export namespace UploadURLRequest { + export type AsObject = { + digest: string, + } +} + export class UploadURLResponse extends jspb.Message { getUrl(): string; setUrl(value: string): void; diff --git a/protos/io/defang/v1/fabric_pb.js b/protos/io/defang/v1/fabric_pb.js index 1b239a3..8197690 100644 --- a/protos/io/defang/v1/fabric_pb.js +++ b/protos/io/defang/v1/fabric_pb.js @@ -57,6 +57,7 @@ goog.exportSymbol('proto.io.defang.v1.TailRequest', null, global); goog.exportSymbol('proto.io.defang.v1.TailResponse', null, global); goog.exportSymbol('proto.io.defang.v1.TokenRequest', null, global); goog.exportSymbol('proto.io.defang.v1.TokenResponse', null, global); +goog.exportSymbol('proto.io.defang.v1.UploadURLRequest', null, global); goog.exportSymbol('proto.io.defang.v1.UploadURLResponse', null, global); goog.exportSymbol('proto.io.defang.v1.Version', null, global); /** @@ -164,6 +165,27 @@ if (goog.DEBUG && !COMPILED) { */ proto.io.defang.v1.GenerateFilesResponse.displayName = 'proto.io.defang.v1.GenerateFilesResponse'; } +/** + * Generated by JsPbCodeGenerator. + * @param {Array=} opt_data Optional initial data array, typically from a + * server response, or constructed directly in Javascript. The array is used + * in place and becomes part of the constructed object. It is not cloned. + * If no data is provided, the constructed object will be empty, but still + * valid. + * @extends {jspb.Message} + * @constructor + */ +proto.io.defang.v1.UploadURLRequest = function(opt_data) { + jspb.Message.initialize(this, opt_data, 0, -1, null, null); +}; +goog.inherits(proto.io.defang.v1.UploadURLRequest, jspb.Message); +if (goog.DEBUG && !COMPILED) { + /** + * @public + * @override + */ + proto.io.defang.v1.UploadURLRequest.displayName = 'proto.io.defang.v1.UploadURLRequest'; +} /** * Generated by JsPbCodeGenerator. * @param {Array=} opt_data Optional initial data array, typically from a @@ -1479,6 +1501,136 @@ proto.io.defang.v1.GenerateFilesResponse.prototype.clearFilesList = function() { +if (jspb.Message.GENERATE_TO_OBJECT) { +/** + * Creates an object representation of this proto. + * Field names that are reserved in JavaScript and will be renamed to pb_name. + * Optional fields that are not set will be set to undefined. + * To access a reserved field use, foo.pb_, eg, foo.pb_default. + * For the list of reserved names please see: + * net/proto2/compiler/js/internal/generator.cc#kKeyword. + * @param {boolean=} opt_includeInstance Deprecated. whether to include the + * JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @return {!Object} + */ +proto.io.defang.v1.UploadURLRequest.prototype.toObject = function(opt_includeInstance) { + return proto.io.defang.v1.UploadURLRequest.toObject(opt_includeInstance, this); +}; + + +/** + * Static version of the {@see toObject} method. + * @param {boolean|undefined} includeInstance Deprecated. Whether to include + * the JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @param {!proto.io.defang.v1.UploadURLRequest} msg The msg instance to transform. + * @return {!Object} + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.io.defang.v1.UploadURLRequest.toObject = function(includeInstance, msg) { + var f, obj = { + digest: jspb.Message.getFieldWithDefault(msg, 1, "") + }; + + if (includeInstance) { + obj.$jspbMessageInstance = msg; + } + return obj; +}; +} + + +/** + * Deserializes binary data (in protobuf wire format). + * @param {jspb.ByteSource} bytes The bytes to deserialize. + * @return {!proto.io.defang.v1.UploadURLRequest} + */ +proto.io.defang.v1.UploadURLRequest.deserializeBinary = function(bytes) { + var reader = new jspb.BinaryReader(bytes); + var msg = new proto.io.defang.v1.UploadURLRequest; + return proto.io.defang.v1.UploadURLRequest.deserializeBinaryFromReader(msg, reader); +}; + + +/** + * Deserializes binary data (in protobuf wire format) from the + * given reader into the given message object. + * @param {!proto.io.defang.v1.UploadURLRequest} msg The message object to deserialize into. + * @param {!jspb.BinaryReader} reader The BinaryReader to use. + * @return {!proto.io.defang.v1.UploadURLRequest} + */ +proto.io.defang.v1.UploadURLRequest.deserializeBinaryFromReader = function(msg, reader) { + while (reader.nextField()) { + if (reader.isEndGroup()) { + break; + } + var field = reader.getFieldNumber(); + switch (field) { + case 1: + var value = /** @type {string} */ (reader.readString()); + msg.setDigest(value); + break; + default: + reader.skipField(); + break; + } + } + return msg; +}; + + +/** + * Serializes the message to binary data (in protobuf wire format). + * @return {!Uint8Array} + */ +proto.io.defang.v1.UploadURLRequest.prototype.serializeBinary = function() { + var writer = new jspb.BinaryWriter(); + proto.io.defang.v1.UploadURLRequest.serializeBinaryToWriter(this, writer); + return writer.getResultBuffer(); +}; + + +/** + * Serializes the given message to binary data (in protobuf wire + * format), writing to the given BinaryWriter. + * @param {!proto.io.defang.v1.UploadURLRequest} message + * @param {!jspb.BinaryWriter} writer + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.io.defang.v1.UploadURLRequest.serializeBinaryToWriter = function(message, writer) { + var f = undefined; + f = message.getDigest(); + if (f.length > 0) { + writer.writeString( + 1, + f + ); + } +}; + + +/** + * optional string digest = 1; + * @return {string} + */ +proto.io.defang.v1.UploadURLRequest.prototype.getDigest = function() { + return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 1, "")); +}; + + +/** + * @param {string} value + * @return {!proto.io.defang.v1.UploadURLRequest} returns this + */ +proto.io.defang.v1.UploadURLRequest.prototype.setDigest = function(value) { + return jspb.Message.setProto3StringField(this, 1, value); +}; + + + + + if (jspb.Message.GENERATE_TO_OBJECT) { /** * Creates an object representation of this proto.