From 4d92eb3482c467c59b4ed6ee0ba4ec847f9b2e99 Mon Sep 17 00:00:00 2001 From: Nick Cao Date: Mon, 17 Mar 2025 15:35:55 -0400 Subject: [PATCH 1/4] Add method for creating/updating/deleting exporter --- proto/jumpstarter/client/v1/client.proto | 42 +++++++++++++++++++++++- 1 file changed, 41 insertions(+), 1 deletion(-) diff --git a/proto/jumpstarter/client/v1/client.proto b/proto/jumpstarter/client/v1/client.proto index 9c19531..828ea74 100644 --- a/proto/jumpstarter/client/v1/client.proto +++ b/proto/jumpstarter/client/v1/client.proto @@ -28,6 +28,24 @@ service ClientService { option (google.api.http) = {get: "/v1/{parent=namespaces/*}/exporters"}; option (google.api.method_signature) = "parent"; } + rpc CreateExporter(CreateExporterRequest) returns (Exporter) { + option (google.api.http) = { + post: "/v1/{parent=namespaces/*}/exporters" + body: "exporter" + }; + option (google.api.method_signature) = "parent,exporter,exporter_id"; + } + rpc UpdateExporter(UpdateExporterRequest) returns (Exporter) { + option (google.api.http) = { + patch: "/v1/{exporter.name=namespaces/*/exporter/*}" + body: "exporter" + }; + option (google.api.method_signature) = "exporter,update_mask"; + } + rpc DeleteExporter(DeleteExporterRequest) returns (google.protobuf.Empty) { + option (google.api.http) = {delete: "/v1/{name=namespaces/*/exporters/*}"}; + option (google.api.method_signature) = "name"; + } rpc GetLease(GetLeaseRequest) returns (Lease) { option (google.api.http) = {get: "/v1/{name=namespaces/*/leases/*}"}; @@ -66,7 +84,7 @@ message Exporter { }; string name = 1 [(google.api.field_behavior) = IDENTIFIER]; - map labels = 2; + map labels = 2 [(google.api.field_behavior) = REQUIRED]; } message Lease { @@ -122,6 +140,28 @@ message ListExportersResponse { string next_page_token = 2; } +message CreateExporterRequest { + string parent = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = {child_type: "jumpstarter.dev/Exporter"} + ]; + + string exporter_id = 2 [(google.api.field_behavior) = OPTIONAL]; + Exporter exporter = 3 [(google.api.field_behavior) = REQUIRED]; +} + +message UpdateExporterRequest { + Exporter exporter = 1 [(google.api.field_behavior) = REQUIRED]; + google.protobuf.FieldMask update_mask = 2 [(google.api.field_behavior) = OPTIONAL]; +} + +message DeleteExporterRequest { + string name = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = {type: "jumpstarter.dev/Exporter"} + ]; +} + message GetLeaseRequest { string name = 1 [ (google.api.field_behavior) = REQUIRED, From ca092fda958880c77a40e14c1c6d51385ca4121f Mon Sep 17 00:00:00 2001 From: Nick Cao Date: Mon, 17 Mar 2025 15:37:08 -0400 Subject: [PATCH 2/4] Add client message --- proto/jumpstarter/client/v1/client.proto | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/proto/jumpstarter/client/v1/client.proto b/proto/jumpstarter/client/v1/client.proto index 828ea74..d4c0fdc 100644 --- a/proto/jumpstarter/client/v1/client.proto +++ b/proto/jumpstarter/client/v1/client.proto @@ -87,6 +87,18 @@ message Exporter { map labels = 2 [(google.api.field_behavior) = REQUIRED]; } +message Client { + option (google.api.resource) = { + type: "jumpstarter.dev/Client" + pattern: "namespaces/{namespace}/clients/{exporter}" + singular: "client" + plural: "clients" + }; + + string name = 1 [(google.api.field_behavior) = IDENTIFIER]; + map labels = 2 [(google.api.field_behavior) = REQUIRED]; +} + message Lease { option (google.api.resource) = { type: "jumpstarter.dev/Lease" From cb822e2e7c0c2d84650e1db556f633acc8c991a7 Mon Sep 17 00:00:00 2001 From: Nick Cao Date: Mon, 17 Mar 2025 15:40:11 -0400 Subject: [PATCH 3/4] Add method for getting/listing/creating/updating/deleting client --- proto/jumpstarter/client/v1/client.proto | 75 +++++++++++++++++++++++- 1 file changed, 73 insertions(+), 2 deletions(-) diff --git a/proto/jumpstarter/client/v1/client.proto b/proto/jumpstarter/client/v1/client.proto index d4c0fdc..975b711 100644 --- a/proto/jumpstarter/client/v1/client.proto +++ b/proto/jumpstarter/client/v1/client.proto @@ -37,7 +37,7 @@ service ClientService { } rpc UpdateExporter(UpdateExporterRequest) returns (Exporter) { option (google.api.http) = { - patch: "/v1/{exporter.name=namespaces/*/exporter/*}" + patch: "/v1/{exporter.name=namespaces/*/exporters/*}" body: "exporter" }; option (google.api.method_signature) = "exporter,update_mask"; @@ -47,6 +47,33 @@ service ClientService { option (google.api.method_signature) = "name"; } + rpc GetClient(GetClientRequest) returns (Client) { + option (google.api.http) = {get: "/v1/{name=namespaces/*/clients/*}"}; + option (google.api.method_signature) = "name"; + } + rpc ListClients(ListClientsRequest) returns (ListClientsResponse) { + option (google.api.http) = {get: "/v1/{parent=namespaces/*}/clients"}; + option (google.api.method_signature) = "parent"; + } + rpc CreateClient(CreateClientRequest) returns (Client) { + option (google.api.http) = { + post: "/v1/{parent=namespaces/*}/clients" + body: "client" + }; + option (google.api.method_signature) = "parent,client,client_id"; + } + rpc UpdateClient(UpdateClientRequest) returns (Client) { + option (google.api.http) = { + patch: "/v1/{client.name=namespaces/*/clients/*}" + body: "client" + }; + option (google.api.method_signature) = "client,update_mask"; + } + rpc DeleteClient(DeleteClientRequest) returns (google.protobuf.Empty) { + option (google.api.http) = {delete: "/v1/{name=namespaces/*/clients/*}"}; + option (google.api.method_signature) = "name"; + } + rpc GetLease(GetLeaseRequest) returns (Lease) { option (google.api.http) = {get: "/v1/{name=namespaces/*/leases/*}"}; option (google.api.method_signature) = "name"; @@ -90,7 +117,7 @@ message Exporter { message Client { option (google.api.resource) = { type: "jumpstarter.dev/Client" - pattern: "namespaces/{namespace}/clients/{exporter}" + pattern: "namespaces/{namespace}/clients/{client}" singular: "client" plural: "clients" }; @@ -174,6 +201,50 @@ message DeleteExporterRequest { ]; } +message GetClientRequest { + string name = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = {type: "jumpstarter.dev/Client"} + ]; +} + +message ListClientsRequest { + string parent = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = {child_type: "jumpstarter.dev/Client"} + ]; + int32 page_size = 2 [(google.api.field_behavior) = OPTIONAL]; + string page_token = 3 [(google.api.field_behavior) = OPTIONAL]; + string filter = 4 [(google.api.field_behavior) = OPTIONAL]; +} + +message ListClientsResponse { + repeated Client clients = 1; + string next_page_token = 2; +} + +message CreateClientRequest { + string parent = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = {child_type: "jumpstarter.dev/Client"} + ]; + + string client_id = 2 [(google.api.field_behavior) = OPTIONAL]; + Client client = 3 [(google.api.field_behavior) = REQUIRED]; +} + +message UpdateClientRequest { + Client client = 1 [(google.api.field_behavior) = REQUIRED]; + google.protobuf.FieldMask update_mask = 2 [(google.api.field_behavior) = OPTIONAL]; +} + +message DeleteClientRequest { + string name = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = {type: "jumpstarter.dev/Client"} + ]; +} + message GetLeaseRequest { string name = 1 [ (google.api.field_behavior) = REQUIRED, From aeee44271b9d86af1beb983abf2766e89e6de63d Mon Sep 17 00:00:00 2001 From: Nick Cao Date: Mon, 17 Mar 2025 15:47:59 -0400 Subject: [PATCH 4/4] Add username and admin field to client/exporter message --- proto/jumpstarter/client/v1/client.proto | 3 +++ 1 file changed, 3 insertions(+) diff --git a/proto/jumpstarter/client/v1/client.proto b/proto/jumpstarter/client/v1/client.proto index 975b711..34eb66e 100644 --- a/proto/jumpstarter/client/v1/client.proto +++ b/proto/jumpstarter/client/v1/client.proto @@ -112,6 +112,7 @@ message Exporter { string name = 1 [(google.api.field_behavior) = IDENTIFIER]; map labels = 2 [(google.api.field_behavior) = REQUIRED]; + optional string username = 3; } message Client { @@ -124,6 +125,8 @@ message Client { string name = 1 [(google.api.field_behavior) = IDENTIFIER]; map labels = 2 [(google.api.field_behavior) = REQUIRED]; + bool admin = 3 [(google.api.field_behavior) = OPTIONAL]; + optional string username = 4; } message Lease {