Skip to content

Commit

Permalink
update proto
Browse files Browse the repository at this point in the history
  • Loading branch information
lionello committed Dec 3, 2023
1 parent e27223a commit a6facdc
Show file tree
Hide file tree
Showing 6 changed files with 197 additions and 12 deletions.
2 changes: 1 addition & 1 deletion index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -167,7 +167,7 @@ async function uploadBuildContext(
): Promise<string> {
const uploadUrlResponse = await new Promise<pb.UploadURLResponse>(
(resolve, reject) =>
client.createUploadURL(new Empty(), (err, res) =>
client.createUploadURL(new pb.UploadURLRequest(), (err, res) =>
err ? reject(err) : resolve(res!)
)
);
Expand Down
8 changes: 5 additions & 3 deletions io/defang/v1/fabric.proto
Original file line number Diff line number Diff line change
@@ -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";
Expand Down Expand Up @@ -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);
}

Expand All @@ -51,6 +51,8 @@ message File {

message GenerateFilesResponse { repeated File files = 1; }

message UploadURLRequest { string digest = 1; }

message UploadURLResponse { string url = 1; }

message ServiceInfo {
Expand Down Expand Up @@ -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<string, string> environment = 7;
Expand Down
10 changes: 5 additions & 5 deletions protos/io/defang/v1/fabric_grpc_pb.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ interface IFabricControllerService extends grpc.ServiceDefinition<grpc.UntypedSe
generateFiles: grpc.MethodDefinition<io_defang_v1_fabric_pb.GenerateFilesRequest, io_defang_v1_fabric_pb.GenerateFilesResponse>;
putSecret: grpc.MethodDefinition<io_defang_v1_fabric_pb.SecretValue, google_protobuf_empty_pb.Empty>;
listSecrets: grpc.MethodDefinition<google_protobuf_empty_pb.Empty, io_defang_v1_fabric_pb.Secrets>;
createUploadURL: grpc.MethodDefinition<google_protobuf_empty_pb.Empty, io_defang_v1_fabric_pb.UploadURLResponse>;
createUploadURL: grpc.MethodDefinition<io_defang_v1_fabric_pb.UploadURLRequest, io_defang_v1_fabric_pb.UploadURLResponse>;
}

export const FabricControllerService: IFabricControllerService;
Expand All @@ -42,7 +42,7 @@ export interface IFabricControllerServer extends grpc.UntypedServiceImplementati
generateFiles: grpc.handleUnaryCall<io_defang_v1_fabric_pb.GenerateFilesRequest, io_defang_v1_fabric_pb.GenerateFilesResponse>;
putSecret: grpc.handleUnaryCall<io_defang_v1_fabric_pb.SecretValue, google_protobuf_empty_pb.Empty>;
listSecrets: grpc.handleUnaryCall<google_protobuf_empty_pb.Empty, io_defang_v1_fabric_pb.Secrets>;
createUploadURL: grpc.handleUnaryCall<google_protobuf_empty_pb.Empty, io_defang_v1_fabric_pb.UploadURLResponse>;
createUploadURL: grpc.handleUnaryCall<io_defang_v1_fabric_pb.UploadURLRequest, io_defang_v1_fabric_pb.UploadURLResponse>;
}

export class FabricControllerClient extends grpc.Client {
Expand Down Expand Up @@ -87,7 +87,7 @@ export class FabricControllerClient extends grpc.Client {
listSecrets(argument: google_protobuf_empty_pb.Empty, callback: grpc.requestCallback<io_defang_v1_fabric_pb.Secrets>): grpc.ClientUnaryCall;
listSecrets(argument: google_protobuf_empty_pb.Empty, metadataOrOptions: grpc.Metadata | grpc.CallOptions | null, callback: grpc.requestCallback<io_defang_v1_fabric_pb.Secrets>): grpc.ClientUnaryCall;
listSecrets(argument: google_protobuf_empty_pb.Empty, metadata: grpc.Metadata | null, options: grpc.CallOptions | null, callback: grpc.requestCallback<io_defang_v1_fabric_pb.Secrets>): grpc.ClientUnaryCall;
createUploadURL(argument: google_protobuf_empty_pb.Empty, callback: grpc.requestCallback<io_defang_v1_fabric_pb.UploadURLResponse>): grpc.ClientUnaryCall;
createUploadURL(argument: google_protobuf_empty_pb.Empty, metadataOrOptions: grpc.Metadata | grpc.CallOptions | null, callback: grpc.requestCallback<io_defang_v1_fabric_pb.UploadURLResponse>): grpc.ClientUnaryCall;
createUploadURL(argument: google_protobuf_empty_pb.Empty, metadata: grpc.Metadata | null, options: grpc.CallOptions | null, callback: grpc.requestCallback<io_defang_v1_fabric_pb.UploadURLResponse>): grpc.ClientUnaryCall;
createUploadURL(argument: io_defang_v1_fabric_pb.UploadURLRequest, callback: grpc.requestCallback<io_defang_v1_fabric_pb.UploadURLResponse>): grpc.ClientUnaryCall;
createUploadURL(argument: io_defang_v1_fabric_pb.UploadURLRequest, metadataOrOptions: grpc.Metadata | grpc.CallOptions | null, callback: grpc.requestCallback<io_defang_v1_fabric_pb.UploadURLResponse>): grpc.ClientUnaryCall;
createUploadURL(argument: io_defang_v1_fabric_pb.UploadURLRequest, metadata: grpc.Metadata | null, options: grpc.CallOptions | null, callback: grpc.requestCallback<io_defang_v1_fabric_pb.UploadURLResponse>): grpc.ClientUnaryCall;
}
17 changes: 14 additions & 3 deletions protos/io/defang/v1/fabric_grpc_pb.js
Original file line number Diff line number Diff line change
Expand Up @@ -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');
Expand Down Expand Up @@ -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,
},
Expand Down
20 changes: 20 additions & 0 deletions protos/io/defang/v1/fabric_pb.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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<jspb.Message>};
static extensionsBinary: {[key: number]: jspb.ExtensionFieldBinaryInfo<jspb.Message>};
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;
Expand Down
152 changes: 152 additions & 0 deletions protos/io/defang/v1/fabric_pb.js
Original file line number Diff line number Diff line change
Expand Up @@ -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);
/**
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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_<name>, 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.
Expand Down

0 comments on commit a6facdc

Please sign in to comment.