From 33e7b4538e56df2cb4bf608fa015d3ff0116f332 Mon Sep 17 00:00:00 2001 From: Todd Knight Date: Sat, 12 Sep 2020 21:54:18 -0700 Subject: [PATCH] WorkerCoordination and GetSession API refactoring (#354) * Possible api changes. * Worker API update. * Updating import alias name. * Moving session down a level as a member of the GetSessionResponse. * Marshal the auth flag into the GetSessionResponse proto instead of the session. --- internal/cmd/commands/proxy/proxy.go | 7 +- internal/gen/controller.swagger.json | 120 --- .../api/resources/sessions/session.pb.go | 413 ++++++++ .../api/services/worker_service.pb.go | 689 ------------- .../server_coordination_service.pb.go | 928 ++++++++++++++++++ .../servers/services/session_service.pb.go | 334 +++++++ .../api/resources/sessions/v1/session.proto | 70 ++ .../api/services/v1/worker_service.proto | 77 -- .../v1/server_coordination_service.proto | 84 ++ .../servers/services/v1/session_service.proto | 25 + internal/servers/controller/handler.go | 32 +- .../handlers/workers/worker_service.go | 34 +- internal/servers/controller/listeners.go | 6 +- .../servers/worker/controller_connection.go | 4 +- internal/servers/worker/handler.go | 4 +- internal/servers/worker/job.go | 12 +- internal/servers/worker/status.go | 16 +- internal/servers/worker/tcp_proxy.go | 4 +- 18 files changed, 1923 insertions(+), 936 deletions(-) create mode 100644 internal/gen/controller/api/resources/sessions/session.pb.go delete mode 100644 internal/gen/controller/api/services/worker_service.pb.go create mode 100644 internal/gen/controller/servers/services/server_coordination_service.pb.go create mode 100644 internal/gen/controller/servers/services/session_service.pb.go create mode 100644 internal/proto/local/controller/api/resources/sessions/v1/session.proto delete mode 100644 internal/proto/local/controller/api/services/v1/worker_service.proto create mode 100644 internal/proto/local/controller/servers/services/v1/server_coordination_service.proto create mode 100644 internal/proto/local/controller/servers/services/v1/session_service.proto diff --git a/internal/cmd/commands/proxy/proxy.go b/internal/cmd/commands/proxy/proxy.go index f7f6771cea..705a2e5fd2 100644 --- a/internal/cmd/commands/proxy/proxy.go +++ b/internal/cmd/commands/proxy/proxy.go @@ -17,7 +17,7 @@ import ( "github.com/golang/protobuf/proto" "github.com/hashicorp/boundary/globals" "github.com/hashicorp/boundary/internal/cmd/base" - "github.com/hashicorp/boundary/internal/gen/controller/api/services" + wpbs "github.com/hashicorp/boundary/internal/gen/controller/servers/services" "github.com/hashicorp/boundary/internal/proxy" "github.com/hashicorp/go-cleanhttp" "github.com/hashicorp/vault/sdk/helper/base62" @@ -147,11 +147,12 @@ func (c *Command) Run(args []string) int { return 1 } - sessionInfo := new(services.ValidateSessionResponse) - if err := proto.Unmarshal(marshaled, sessionInfo); err != nil { + sessionResponseInfo := new(wpbs.GetSessionResponse) + if err := proto.Unmarshal(marshaled, sessionResponseInfo); err != nil { c.UI.Error(fmt.Errorf("Unable to proto-decode authorization string: %w", err).Error()) return 1 } + sessionInfo := sessionResponseInfo.GetSession() if len(sessionInfo.GetWorkerInfo()) == 0 { c.UI.Error("No workers found in authorization string") diff --git a/internal/gen/controller.swagger.json b/internal/gen/controller.swagger.json index c3943d14f4..229c247f64 100644 --- a/internal/gen/controller.swagger.json +++ b/internal/gen/controller.swagger.json @@ -3821,25 +3821,6 @@ } } }, - "controller.api.services.v1.StatusResponse": { - "type": "object", - "properties": { - "controllers": { - "type": "array", - "items": { - "$ref": "#/definitions/controller.servers.v1.Server" - }, - "description": "Active controllers. This can be used (eventually) for conneciton\nmanagement." - }, - "cancel_job_ids": { - "type": "array", - "items": { - "type": "string" - }, - "description": "Jobs that should be canceled: ones assigned to this worker that have been\nreported as active but are in canceling state in the database. Once the\nworker cancels the job, it will no longer show up in active_jobs in the\nnext heartbeat, and we can move the job to canceled state." - } - } - }, "controller.api.services.v1.UpdateAccountResponse": { "type": "object", "properties": { @@ -3920,107 +3901,6 @@ } } }, - "controller.api.services.v1.ValidateSessionResponse": { - "type": "object", - "properties": { - "id": { - "type": "string", - "title": "ID of the session job" - }, - "scope_id": { - "type": "string", - "title": "The scope the job was created in" - }, - "user_id": { - "type": "string", - "title": "The ID of the user that requested the session" - }, - "type": { - "type": "string", - "title": "Type of the session (e.g. tcp, ssh, etc.)" - }, - "endpoint": { - "type": "string", - "title": "The endpoint to connect to, in a manner that makes sense for the type" - }, - "certificate": { - "type": "string", - "format": "byte", - "description": "The certificate to use when connecting (or if using custom certs, to\nserve as the \"login\"). Raw DER bytes." - }, - "private_key": { - "type": "string", - "format": "byte", - "description": "The private key to use when connecting (or if using custom certs, to pass\nas the \"password\")." - }, - "expiration_time": { - "type": "string", - "format": "date-time", - "title": "After this time the connection will be expired, e.g. forcefully terminated" - }, - "worker_info": { - "type": "array", - "items": { - "$ref": "#/definitions/controller.api.services.v1.WorkerInfo" - }, - "description": "Worker information. The first worker in the slice should be prioritized." - } - }, - "title": "SessionResponse contains information necessary for a client to establish a session" - }, - "controller.api.services.v1.WorkerInfo": { - "type": "object", - "properties": { - "address": { - "type": "string", - "title": "The address of the worker" - } - } - }, - "controller.servers.v1.Server": { - "type": "object", - "properties": { - "private_id": { - "type": "string", - "title": "Private ID of the resource" - }, - "type": { - "type": "string", - "title": "Type of the resource (controller, worker)" - }, - "name": { - "type": "string", - "title": "Name of the resource" - }, - "description": { - "type": "string", - "title": "Description of the resource" - }, - "address": { - "type": "string", - "title": "Address for the server" - }, - "create_time": { - "$ref": "#/definitions/controller.storage.timestamp.v1.Timestamp", - "title": "First seen time from the RDBMS" - }, - "update_time": { - "$ref": "#/definitions/controller.storage.timestamp.v1.Timestamp", - "title": "Last time there was an update" - } - }, - "title": "Server contains all fields related to a Controller or Worker resource" - }, - "controller.storage.timestamp.v1.Timestamp": { - "type": "object", - "properties": { - "timestamp": { - "type": "string", - "format": "date-time" - } - }, - "title": "Timestamp for storage messages. We've defined a new local type wrapper\nof google.protobuf.Timestamp so we can implement sql.Scanner and sql.Valuer\ninterfaces. See:\nhttps://golang.org/pkg/database/sql/#Scanner\nhttps://golang.org/pkg/database/sql/driver/#Valuer" - }, "google.protobuf.NullValue": { "type": "string", "enum": [ diff --git a/internal/gen/controller/api/resources/sessions/session.pb.go b/internal/gen/controller/api/resources/sessions/session.pb.go new file mode 100644 index 0000000000..65dc67f8ac --- /dev/null +++ b/internal/gen/controller/api/resources/sessions/session.pb.go @@ -0,0 +1,413 @@ +// Code generated by protoc-gen-go. DO NOT EDIT. +// versions: +// protoc-gen-go v1.25.0 +// protoc v3.12.4 +// source: controller/api/resources/sessions/v1/session.proto + +package sessions + +import ( + proto "github.com/golang/protobuf/proto" + _ "github.com/golang/protobuf/ptypes/struct" + timestamp "github.com/golang/protobuf/ptypes/timestamp" + _ "github.com/golang/protobuf/ptypes/wrappers" + scopes "github.com/hashicorp/boundary/internal/gen/controller/api/resources/scopes" + _ "github.com/hashicorp/boundary/internal/gen/controller/protooptions" + protoreflect "google.golang.org/protobuf/reflect/protoreflect" + protoimpl "google.golang.org/protobuf/runtime/protoimpl" + reflect "reflect" + sync "sync" +) + +const ( + // Verify that this generated code is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion) + // Verify that runtime/protoimpl is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20) +) + +// This is a compile-time assertion that a sufficiently up-to-date version +// of the legacy proto package is being used. +const _ = proto.ProtoPackageIsVersion4 + +type WorkerInfo struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + // The address of the worker + Address string `protobuf:"bytes,10,opt,name=address,proto3" json:"address,omitempty"` +} + +func (x *WorkerInfo) Reset() { + *x = WorkerInfo{} + if protoimpl.UnsafeEnabled { + mi := &file_controller_api_resources_sessions_v1_session_proto_msgTypes[0] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *WorkerInfo) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*WorkerInfo) ProtoMessage() {} + +func (x *WorkerInfo) ProtoReflect() protoreflect.Message { + mi := &file_controller_api_resources_sessions_v1_session_proto_msgTypes[0] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use WorkerInfo.ProtoReflect.Descriptor instead. +func (*WorkerInfo) Descriptor() ([]byte, []int) { + return file_controller_api_resources_sessions_v1_session_proto_rawDescGZIP(), []int{0} +} + +func (x *WorkerInfo) GetAddress() string { + if x != nil { + return x.Address + } + return "" +} + +// Session contains all fields related to a Session resource +type Session struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + // The ID of the resource + // Output only. + Id string `protobuf:"bytes,10,opt,name=id,proto3" json:"id,omitempty"` + // The id of the parent of this resource. This must be defined for creation of this resource, but is otherwise + // read only. + TargetId string `protobuf:"bytes,20,opt,name=target_id,proto3" json:"target_id,omitempty"` + // Scope information for this resource + // Output only. + Scope *scopes.ScopeInfo `protobuf:"bytes,30,opt,name=scope,proto3" json:"scope,omitempty"` + // The time this resource was created + // Output only. + CreatedTime *timestamp.Timestamp `protobuf:"bytes,40,opt,name=created_time,proto3" json:"created_time,omitempty"` + // The time this resource was last updated. + // Output only. + UpdatedTime *timestamp.Timestamp `protobuf:"bytes,50,opt,name=updated_time,proto3" json:"updated_time,omitempty"` + // After this time the connection will be expired, e.g. forcefully terminated + ExpirationTime *timestamp.Timestamp `protobuf:"bytes,60,opt,name=expiration_time,proto3" json:"expiration_time,omitempty"` + // The version can be used in subsequent write requests to ensure this + // resource has not changed and to fail the write if it has. + Version uint32 `protobuf:"varint,70,opt,name=version,proto3" json:"version,omitempty"` + // Type of the session (e.g. tcp, ssh, etc.) + Type string `protobuf:"bytes,80,opt,name=type,proto3" json:"type,omitempty"` + // The ID of the user that requested the session + UserId string `protobuf:"bytes,90,opt,name=user_id,proto3" json:"user_id,omitempty"` + HostId string `protobuf:"bytes,100,opt,name=host_id,proto3" json:"host_id,omitempty"` + ScopeId string `protobuf:"bytes,110,opt,name=scope_id,proto3" json:"scope_id,omitempty"` + // The certificate to use when connecting (or if using custom certs, to + // serve as the "login"). Raw DER bytes. + Certificate []byte `protobuf:"bytes,120,opt,name=certificate,proto3" json:"certificate,omitempty"` + // The private key to use when connecting (or if using custom certs, to pass + // as the "password"). + PrivateKey []byte `protobuf:"bytes,130,opt,name=private_key,proto3" json:"private_key,omitempty"` + Endpoint string `protobuf:"bytes,140,opt,name=endpoint,proto3" json:"endpoint,omitempty"` + // Worker information. The first worker in the slice should be prioritized. + WorkerInfo []*WorkerInfo `protobuf:"bytes,150,rep,name=worker_info,proto3" json:"worker_info,omitempty"` +} + +func (x *Session) Reset() { + *x = Session{} + if protoimpl.UnsafeEnabled { + mi := &file_controller_api_resources_sessions_v1_session_proto_msgTypes[1] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *Session) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*Session) ProtoMessage() {} + +func (x *Session) ProtoReflect() protoreflect.Message { + mi := &file_controller_api_resources_sessions_v1_session_proto_msgTypes[1] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use Session.ProtoReflect.Descriptor instead. +func (*Session) Descriptor() ([]byte, []int) { + return file_controller_api_resources_sessions_v1_session_proto_rawDescGZIP(), []int{1} +} + +func (x *Session) GetId() string { + if x != nil { + return x.Id + } + return "" +} + +func (x *Session) GetTargetId() string { + if x != nil { + return x.TargetId + } + return "" +} + +func (x *Session) GetScope() *scopes.ScopeInfo { + if x != nil { + return x.Scope + } + return nil +} + +func (x *Session) GetCreatedTime() *timestamp.Timestamp { + if x != nil { + return x.CreatedTime + } + return nil +} + +func (x *Session) GetUpdatedTime() *timestamp.Timestamp { + if x != nil { + return x.UpdatedTime + } + return nil +} + +func (x *Session) GetExpirationTime() *timestamp.Timestamp { + if x != nil { + return x.ExpirationTime + } + return nil +} + +func (x *Session) GetVersion() uint32 { + if x != nil { + return x.Version + } + return 0 +} + +func (x *Session) GetType() string { + if x != nil { + return x.Type + } + return "" +} + +func (x *Session) GetUserId() string { + if x != nil { + return x.UserId + } + return "" +} + +func (x *Session) GetHostId() string { + if x != nil { + return x.HostId + } + return "" +} + +func (x *Session) GetScopeId() string { + if x != nil { + return x.ScopeId + } + return "" +} + +func (x *Session) GetCertificate() []byte { + if x != nil { + return x.Certificate + } + return nil +} + +func (x *Session) GetPrivateKey() []byte { + if x != nil { + return x.PrivateKey + } + return nil +} + +func (x *Session) GetEndpoint() string { + if x != nil { + return x.Endpoint + } + return "" +} + +func (x *Session) GetWorkerInfo() []*WorkerInfo { + if x != nil { + return x.WorkerInfo + } + return nil +} + +var File_controller_api_resources_sessions_v1_session_proto protoreflect.FileDescriptor + +var file_controller_api_resources_sessions_v1_session_proto_rawDesc = []byte{ + 0x0a, 0x32, 0x63, 0x6f, 0x6e, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x65, 0x72, 0x2f, 0x61, 0x70, 0x69, + 0x2f, 0x72, 0x65, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x73, 0x2f, 0x73, 0x65, 0x73, 0x73, 0x69, + 0x6f, 0x6e, 0x73, 0x2f, 0x76, 0x31, 0x2f, 0x73, 0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x2e, 0x70, + 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x24, 0x63, 0x6f, 0x6e, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x65, 0x72, + 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x72, 0x65, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x73, 0x2e, 0x73, + 0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x73, 0x2e, 0x76, 0x31, 0x1a, 0x1f, 0x67, 0x6f, 0x6f, 0x67, + 0x6c, 0x65, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2f, 0x74, 0x69, 0x6d, 0x65, + 0x73, 0x74, 0x61, 0x6d, 0x70, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x1e, 0x67, 0x6f, 0x6f, + 0x67, 0x6c, 0x65, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2f, 0x77, 0x72, 0x61, + 0x70, 0x70, 0x65, 0x72, 0x73, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x1c, 0x67, 0x6f, 0x6f, + 0x67, 0x6c, 0x65, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2f, 0x73, 0x74, 0x72, + 0x75, 0x63, 0x74, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x2e, 0x63, 0x6f, 0x6e, 0x74, 0x72, + 0x6f, 0x6c, 0x6c, 0x65, 0x72, 0x2f, 0x61, 0x70, 0x69, 0x2f, 0x72, 0x65, 0x73, 0x6f, 0x75, 0x72, + 0x63, 0x65, 0x73, 0x2f, 0x73, 0x63, 0x6f, 0x70, 0x65, 0x73, 0x2f, 0x76, 0x31, 0x2f, 0x73, 0x63, + 0x6f, 0x70, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x2a, 0x63, 0x6f, 0x6e, 0x74, 0x72, + 0x6f, 0x6c, 0x6c, 0x65, 0x72, 0x2f, 0x63, 0x75, 0x73, 0x74, 0x6f, 0x6d, 0x5f, 0x6f, 0x70, 0x74, + 0x69, 0x6f, 0x6e, 0x73, 0x2f, 0x76, 0x31, 0x2f, 0x6f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x2e, + 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, 0x26, 0x0a, 0x0a, 0x57, 0x6f, 0x72, 0x6b, 0x65, 0x72, 0x49, + 0x6e, 0x66, 0x6f, 0x12, 0x18, 0x0a, 0x07, 0x61, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x18, 0x0a, + 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x61, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x22, 0xf7, 0x04, + 0x0a, 0x07, 0x53, 0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x12, 0x0e, 0x0a, 0x02, 0x69, 0x64, 0x18, + 0x0a, 0x20, 0x01, 0x28, 0x09, 0x52, 0x02, 0x69, 0x64, 0x12, 0x1c, 0x0a, 0x09, 0x74, 0x61, 0x72, + 0x67, 0x65, 0x74, 0x5f, 0x69, 0x64, 0x18, 0x14, 0x20, 0x01, 0x28, 0x09, 0x52, 0x09, 0x74, 0x61, + 0x72, 0x67, 0x65, 0x74, 0x5f, 0x69, 0x64, 0x12, 0x43, 0x0a, 0x05, 0x73, 0x63, 0x6f, 0x70, 0x65, + 0x18, 0x1e, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x2d, 0x2e, 0x63, 0x6f, 0x6e, 0x74, 0x72, 0x6f, 0x6c, + 0x6c, 0x65, 0x72, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x72, 0x65, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, + 0x73, 0x2e, 0x73, 0x63, 0x6f, 0x70, 0x65, 0x73, 0x2e, 0x76, 0x31, 0x2e, 0x53, 0x63, 0x6f, 0x70, + 0x65, 0x49, 0x6e, 0x66, 0x6f, 0x52, 0x05, 0x73, 0x63, 0x6f, 0x70, 0x65, 0x12, 0x3e, 0x0a, 0x0c, + 0x63, 0x72, 0x65, 0x61, 0x74, 0x65, 0x64, 0x5f, 0x74, 0x69, 0x6d, 0x65, 0x18, 0x28, 0x20, 0x01, + 0x28, 0x0b, 0x32, 0x1a, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, + 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x54, 0x69, 0x6d, 0x65, 0x73, 0x74, 0x61, 0x6d, 0x70, 0x52, 0x0c, + 0x63, 0x72, 0x65, 0x61, 0x74, 0x65, 0x64, 0x5f, 0x74, 0x69, 0x6d, 0x65, 0x12, 0x3e, 0x0a, 0x0c, + 0x75, 0x70, 0x64, 0x61, 0x74, 0x65, 0x64, 0x5f, 0x74, 0x69, 0x6d, 0x65, 0x18, 0x32, 0x20, 0x01, + 0x28, 0x0b, 0x32, 0x1a, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, + 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x54, 0x69, 0x6d, 0x65, 0x73, 0x74, 0x61, 0x6d, 0x70, 0x52, 0x0c, + 0x75, 0x70, 0x64, 0x61, 0x74, 0x65, 0x64, 0x5f, 0x74, 0x69, 0x6d, 0x65, 0x12, 0x44, 0x0a, 0x0f, + 0x65, 0x78, 0x70, 0x69, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x5f, 0x74, 0x69, 0x6d, 0x65, 0x18, + 0x3c, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1a, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, + 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x54, 0x69, 0x6d, 0x65, 0x73, 0x74, 0x61, 0x6d, + 0x70, 0x52, 0x0f, 0x65, 0x78, 0x70, 0x69, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x5f, 0x74, 0x69, + 0x6d, 0x65, 0x12, 0x18, 0x0a, 0x07, 0x76, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x18, 0x46, 0x20, + 0x01, 0x28, 0x0d, 0x52, 0x07, 0x76, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x12, 0x12, 0x0a, 0x04, + 0x74, 0x79, 0x70, 0x65, 0x18, 0x50, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x74, 0x79, 0x70, 0x65, + 0x12, 0x18, 0x0a, 0x07, 0x75, 0x73, 0x65, 0x72, 0x5f, 0x69, 0x64, 0x18, 0x5a, 0x20, 0x01, 0x28, + 0x09, 0x52, 0x07, 0x75, 0x73, 0x65, 0x72, 0x5f, 0x69, 0x64, 0x12, 0x18, 0x0a, 0x07, 0x68, 0x6f, + 0x73, 0x74, 0x5f, 0x69, 0x64, 0x18, 0x64, 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x68, 0x6f, 0x73, + 0x74, 0x5f, 0x69, 0x64, 0x12, 0x1a, 0x0a, 0x08, 0x73, 0x63, 0x6f, 0x70, 0x65, 0x5f, 0x69, 0x64, + 0x18, 0x6e, 0x20, 0x01, 0x28, 0x09, 0x52, 0x08, 0x73, 0x63, 0x6f, 0x70, 0x65, 0x5f, 0x69, 0x64, + 0x12, 0x20, 0x0a, 0x0b, 0x63, 0x65, 0x72, 0x74, 0x69, 0x66, 0x69, 0x63, 0x61, 0x74, 0x65, 0x18, + 0x78, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x0b, 0x63, 0x65, 0x72, 0x74, 0x69, 0x66, 0x69, 0x63, 0x61, + 0x74, 0x65, 0x12, 0x21, 0x0a, 0x0b, 0x70, 0x72, 0x69, 0x76, 0x61, 0x74, 0x65, 0x5f, 0x6b, 0x65, + 0x79, 0x18, 0x82, 0x01, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x0b, 0x70, 0x72, 0x69, 0x76, 0x61, 0x74, + 0x65, 0x5f, 0x6b, 0x65, 0x79, 0x12, 0x1b, 0x0a, 0x08, 0x65, 0x6e, 0x64, 0x70, 0x6f, 0x69, 0x6e, + 0x74, 0x18, 0x8c, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x08, 0x65, 0x6e, 0x64, 0x70, 0x6f, 0x69, + 0x6e, 0x74, 0x12, 0x53, 0x0a, 0x0b, 0x77, 0x6f, 0x72, 0x6b, 0x65, 0x72, 0x5f, 0x69, 0x6e, 0x66, + 0x6f, 0x18, 0x96, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x30, 0x2e, 0x63, 0x6f, 0x6e, 0x74, 0x72, + 0x6f, 0x6c, 0x6c, 0x65, 0x72, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x72, 0x65, 0x73, 0x6f, 0x75, 0x72, + 0x63, 0x65, 0x73, 0x2e, 0x73, 0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x73, 0x2e, 0x76, 0x31, 0x2e, + 0x57, 0x6f, 0x72, 0x6b, 0x65, 0x72, 0x49, 0x6e, 0x66, 0x6f, 0x52, 0x0b, 0x77, 0x6f, 0x72, 0x6b, + 0x65, 0x72, 0x5f, 0x69, 0x6e, 0x66, 0x6f, 0x42, 0x57, 0x5a, 0x55, 0x67, 0x69, 0x74, 0x68, 0x75, + 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x68, 0x61, 0x73, 0x68, 0x69, 0x63, 0x6f, 0x72, 0x70, 0x2f, + 0x62, 0x6f, 0x75, 0x6e, 0x64, 0x61, 0x72, 0x79, 0x2f, 0x69, 0x6e, 0x74, 0x65, 0x72, 0x6e, 0x61, + 0x6c, 0x2f, 0x67, 0x65, 0x6e, 0x2f, 0x63, 0x6f, 0x6e, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x65, 0x72, + 0x2f, 0x61, 0x70, 0x69, 0x2f, 0x72, 0x65, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x73, 0x2f, 0x73, + 0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x73, 0x3b, 0x73, 0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x73, + 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, +} + +var ( + file_controller_api_resources_sessions_v1_session_proto_rawDescOnce sync.Once + file_controller_api_resources_sessions_v1_session_proto_rawDescData = file_controller_api_resources_sessions_v1_session_proto_rawDesc +) + +func file_controller_api_resources_sessions_v1_session_proto_rawDescGZIP() []byte { + file_controller_api_resources_sessions_v1_session_proto_rawDescOnce.Do(func() { + file_controller_api_resources_sessions_v1_session_proto_rawDescData = protoimpl.X.CompressGZIP(file_controller_api_resources_sessions_v1_session_proto_rawDescData) + }) + return file_controller_api_resources_sessions_v1_session_proto_rawDescData +} + +var file_controller_api_resources_sessions_v1_session_proto_msgTypes = make([]protoimpl.MessageInfo, 2) +var file_controller_api_resources_sessions_v1_session_proto_goTypes = []interface{}{ + (*WorkerInfo)(nil), // 0: controller.api.resources.sessions.v1.WorkerInfo + (*Session)(nil), // 1: controller.api.resources.sessions.v1.Session + (*scopes.ScopeInfo)(nil), // 2: controller.api.resources.scopes.v1.ScopeInfo + (*timestamp.Timestamp)(nil), // 3: google.protobuf.Timestamp +} +var file_controller_api_resources_sessions_v1_session_proto_depIdxs = []int32{ + 2, // 0: controller.api.resources.sessions.v1.Session.scope:type_name -> controller.api.resources.scopes.v1.ScopeInfo + 3, // 1: controller.api.resources.sessions.v1.Session.created_time:type_name -> google.protobuf.Timestamp + 3, // 2: controller.api.resources.sessions.v1.Session.updated_time:type_name -> google.protobuf.Timestamp + 3, // 3: controller.api.resources.sessions.v1.Session.expiration_time:type_name -> google.protobuf.Timestamp + 0, // 4: controller.api.resources.sessions.v1.Session.worker_info:type_name -> controller.api.resources.sessions.v1.WorkerInfo + 5, // [5:5] is the sub-list for method output_type + 5, // [5:5] is the sub-list for method input_type + 5, // [5:5] is the sub-list for extension type_name + 5, // [5:5] is the sub-list for extension extendee + 0, // [0:5] is the sub-list for field type_name +} + +func init() { file_controller_api_resources_sessions_v1_session_proto_init() } +func file_controller_api_resources_sessions_v1_session_proto_init() { + if File_controller_api_resources_sessions_v1_session_proto != nil { + return + } + if !protoimpl.UnsafeEnabled { + file_controller_api_resources_sessions_v1_session_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*WorkerInfo); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_controller_api_resources_sessions_v1_session_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*Session); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + } + type x struct{} + out := protoimpl.TypeBuilder{ + File: protoimpl.DescBuilder{ + GoPackagePath: reflect.TypeOf(x{}).PkgPath(), + RawDescriptor: file_controller_api_resources_sessions_v1_session_proto_rawDesc, + NumEnums: 0, + NumMessages: 2, + NumExtensions: 0, + NumServices: 0, + }, + GoTypes: file_controller_api_resources_sessions_v1_session_proto_goTypes, + DependencyIndexes: file_controller_api_resources_sessions_v1_session_proto_depIdxs, + MessageInfos: file_controller_api_resources_sessions_v1_session_proto_msgTypes, + }.Build() + File_controller_api_resources_sessions_v1_session_proto = out.File + file_controller_api_resources_sessions_v1_session_proto_rawDesc = nil + file_controller_api_resources_sessions_v1_session_proto_goTypes = nil + file_controller_api_resources_sessions_v1_session_proto_depIdxs = nil +} diff --git a/internal/gen/controller/api/services/worker_service.pb.go b/internal/gen/controller/api/services/worker_service.pb.go deleted file mode 100644 index 603882a352..0000000000 --- a/internal/gen/controller/api/services/worker_service.pb.go +++ /dev/null @@ -1,689 +0,0 @@ -// Code generated by protoc-gen-go. DO NOT EDIT. -// versions: -// protoc-gen-go v1.25.0 -// protoc v3.12.4 -// source: controller/api/services/v1/worker_service.proto - -package services - -import ( - context "context" - proto "github.com/golang/protobuf/proto" - timestamp "github.com/golang/protobuf/ptypes/timestamp" - servers "github.com/hashicorp/boundary/internal/servers" - grpc "google.golang.org/grpc" - codes "google.golang.org/grpc/codes" - status "google.golang.org/grpc/status" - protoreflect "google.golang.org/protobuf/reflect/protoreflect" - protoimpl "google.golang.org/protobuf/runtime/protoimpl" - reflect "reflect" - sync "sync" -) - -const ( - // Verify that this generated code is sufficiently up-to-date. - _ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion) - // Verify that runtime/protoimpl is sufficiently up-to-date. - _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20) -) - -// This is a compile-time assertion that a sufficiently up-to-date version -// of the legacy proto package is being used. -const _ = proto.ProtoPackageIsVersion4 - -type StatusRequest struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - // The worker info. We could use information from the TLS connection but this - // is easier and going the other route doesn't provide much benefit -- if you - // get access to the key and spoof the connection, you're already compromised. - Worker *servers.Server `protobuf:"bytes,10,opt,name=worker,proto3" json:"worker,omitempty"` - // Jobs currently active on this worker. - ActiveJobIds []string `protobuf:"bytes,20,rep,name=active_job_ids,json=activeJobIds,proto3" json:"active_job_ids,omitempty"` -} - -func (x *StatusRequest) Reset() { - *x = StatusRequest{} - if protoimpl.UnsafeEnabled { - mi := &file_controller_api_services_v1_worker_service_proto_msgTypes[0] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *StatusRequest) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*StatusRequest) ProtoMessage() {} - -func (x *StatusRequest) ProtoReflect() protoreflect.Message { - mi := &file_controller_api_services_v1_worker_service_proto_msgTypes[0] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use StatusRequest.ProtoReflect.Descriptor instead. -func (*StatusRequest) Descriptor() ([]byte, []int) { - return file_controller_api_services_v1_worker_service_proto_rawDescGZIP(), []int{0} -} - -func (x *StatusRequest) GetWorker() *servers.Server { - if x != nil { - return x.Worker - } - return nil -} - -func (x *StatusRequest) GetActiveJobIds() []string { - if x != nil { - return x.ActiveJobIds - } - return nil -} - -type StatusResponse struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - // Active controllers. This can be used (eventually) for conneciton - // management. - Controllers []*servers.Server `protobuf:"bytes,10,rep,name=controllers,proto3" json:"controllers,omitempty"` - // Jobs that should be canceled: ones assigned to this worker that have been - // reported as active but are in canceling state in the database. Once the - // worker cancels the job, it will no longer show up in active_jobs in the - // next heartbeat, and we can move the job to canceled state. - CancelJobIds []string `protobuf:"bytes,20,rep,name=cancel_job_ids,json=cancelJobIds,proto3" json:"cancel_job_ids,omitempty"` -} - -func (x *StatusResponse) Reset() { - *x = StatusResponse{} - if protoimpl.UnsafeEnabled { - mi := &file_controller_api_services_v1_worker_service_proto_msgTypes[1] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *StatusResponse) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*StatusResponse) ProtoMessage() {} - -func (x *StatusResponse) ProtoReflect() protoreflect.Message { - mi := &file_controller_api_services_v1_worker_service_proto_msgTypes[1] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use StatusResponse.ProtoReflect.Descriptor instead. -func (*StatusResponse) Descriptor() ([]byte, []int) { - return file_controller_api_services_v1_worker_service_proto_rawDescGZIP(), []int{1} -} - -func (x *StatusResponse) GetControllers() []*servers.Server { - if x != nil { - return x.Controllers - } - return nil -} - -func (x *StatusResponse) GetCancelJobIds() []string { - if x != nil { - return x.CancelJobIds - } - return nil -} - -type ValidateSessionRequest struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - // The session ID from the client - Id string `protobuf:"bytes,10,opt,name=id,proto3" json:"id,omitempty"` -} - -func (x *ValidateSessionRequest) Reset() { - *x = ValidateSessionRequest{} - if protoimpl.UnsafeEnabled { - mi := &file_controller_api_services_v1_worker_service_proto_msgTypes[2] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *ValidateSessionRequest) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*ValidateSessionRequest) ProtoMessage() {} - -func (x *ValidateSessionRequest) ProtoReflect() protoreflect.Message { - mi := &file_controller_api_services_v1_worker_service_proto_msgTypes[2] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use ValidateSessionRequest.ProtoReflect.Descriptor instead. -func (*ValidateSessionRequest) Descriptor() ([]byte, []int) { - return file_controller_api_services_v1_worker_service_proto_rawDescGZIP(), []int{2} -} - -func (x *ValidateSessionRequest) GetId() string { - if x != nil { - return x.Id - } - return "" -} - -// SessionResponse contains information necessary for a client to establish a session -type ValidateSessionResponse struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - // ID of the session job - Id string `protobuf:"bytes,10,opt,name=id,proto3" json:"id,omitempty"` - // The scope the job was created in - ScopeId string `protobuf:"bytes,20,opt,name=scope_id,json=scopeId,proto3" json:"scope_id,omitempty"` - // The ID of the user that requested the session - UserId string `protobuf:"bytes,30,opt,name=user_id,json=userId,proto3" json:"user_id,omitempty"` - // Type of the session (e.g. tcp, ssh, etc.) - Type string `protobuf:"bytes,40,opt,name=type,proto3" json:"type,omitempty"` - // The endpoint to connect to, in a manner that makes sense for the type - Endpoint string `protobuf:"bytes,50,opt,name=endpoint,proto3" json:"endpoint,omitempty"` - // The certificate to use when connecting (or if using custom certs, to - // serve as the "login"). Raw DER bytes. - Certificate []byte `protobuf:"bytes,60,opt,name=certificate,proto3" json:"certificate,omitempty"` - // The private key to use when connecting (or if using custom certs, to pass - // as the "password"). - PrivateKey []byte `protobuf:"bytes,70,opt,name=private_key,json=privateKey,proto3" json:"private_key,omitempty"` - // After this time the connection will be expired, e.g. forcefully terminated - ExpirationTime *timestamp.Timestamp `protobuf:"bytes,80,opt,name=expiration_time,json=expirationTime,proto3" json:"expiration_time,omitempty"` - // Worker information. The first worker in the slice should be prioritized. - WorkerInfo []*WorkerInfo `protobuf:"bytes,90,rep,name=worker_info,json=workerInfo,proto3" json:"worker_info,omitempty"` -} - -func (x *ValidateSessionResponse) Reset() { - *x = ValidateSessionResponse{} - if protoimpl.UnsafeEnabled { - mi := &file_controller_api_services_v1_worker_service_proto_msgTypes[3] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *ValidateSessionResponse) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*ValidateSessionResponse) ProtoMessage() {} - -func (x *ValidateSessionResponse) ProtoReflect() protoreflect.Message { - mi := &file_controller_api_services_v1_worker_service_proto_msgTypes[3] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use ValidateSessionResponse.ProtoReflect.Descriptor instead. -func (*ValidateSessionResponse) Descriptor() ([]byte, []int) { - return file_controller_api_services_v1_worker_service_proto_rawDescGZIP(), []int{3} -} - -func (x *ValidateSessionResponse) GetId() string { - if x != nil { - return x.Id - } - return "" -} - -func (x *ValidateSessionResponse) GetScopeId() string { - if x != nil { - return x.ScopeId - } - return "" -} - -func (x *ValidateSessionResponse) GetUserId() string { - if x != nil { - return x.UserId - } - return "" -} - -func (x *ValidateSessionResponse) GetType() string { - if x != nil { - return x.Type - } - return "" -} - -func (x *ValidateSessionResponse) GetEndpoint() string { - if x != nil { - return x.Endpoint - } - return "" -} - -func (x *ValidateSessionResponse) GetCertificate() []byte { - if x != nil { - return x.Certificate - } - return nil -} - -func (x *ValidateSessionResponse) GetPrivateKey() []byte { - if x != nil { - return x.PrivateKey - } - return nil -} - -func (x *ValidateSessionResponse) GetExpirationTime() *timestamp.Timestamp { - if x != nil { - return x.ExpirationTime - } - return nil -} - -func (x *ValidateSessionResponse) GetWorkerInfo() []*WorkerInfo { - if x != nil { - return x.WorkerInfo - } - return nil -} - -type WorkerInfo struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - // The address of the worker - Address string `protobuf:"bytes,10,opt,name=address,proto3" json:"address,omitempty"` -} - -func (x *WorkerInfo) Reset() { - *x = WorkerInfo{} - if protoimpl.UnsafeEnabled { - mi := &file_controller_api_services_v1_worker_service_proto_msgTypes[4] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *WorkerInfo) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*WorkerInfo) ProtoMessage() {} - -func (x *WorkerInfo) ProtoReflect() protoreflect.Message { - mi := &file_controller_api_services_v1_worker_service_proto_msgTypes[4] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use WorkerInfo.ProtoReflect.Descriptor instead. -func (*WorkerInfo) Descriptor() ([]byte, []int) { - return file_controller_api_services_v1_worker_service_proto_rawDescGZIP(), []int{4} -} - -func (x *WorkerInfo) GetAddress() string { - if x != nil { - return x.Address - } - return "" -} - -var File_controller_api_services_v1_worker_service_proto protoreflect.FileDescriptor - -var file_controller_api_services_v1_worker_service_proto_rawDesc = []byte{ - 0x0a, 0x2f, 0x63, 0x6f, 0x6e, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x65, 0x72, 0x2f, 0x61, 0x70, 0x69, - 0x2f, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x73, 0x2f, 0x76, 0x31, 0x2f, 0x77, 0x6f, 0x72, - 0x6b, 0x65, 0x72, 0x5f, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, - 0x6f, 0x12, 0x1a, 0x63, 0x6f, 0x6e, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x65, 0x72, 0x2e, 0x61, 0x70, - 0x69, 0x2e, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x73, 0x2e, 0x76, 0x31, 0x1a, 0x1f, 0x67, - 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2f, 0x74, - 0x69, 0x6d, 0x65, 0x73, 0x74, 0x61, 0x6d, 0x70, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x23, - 0x63, 0x6f, 0x6e, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x65, 0x72, 0x2f, 0x73, 0x65, 0x72, 0x76, 0x65, - 0x72, 0x73, 0x2f, 0x76, 0x31, 0x2f, 0x73, 0x65, 0x72, 0x76, 0x65, 0x72, 0x73, 0x2e, 0x70, 0x72, - 0x6f, 0x74, 0x6f, 0x22, 0x6c, 0x0a, 0x0d, 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, 0x52, 0x65, 0x71, - 0x75, 0x65, 0x73, 0x74, 0x12, 0x35, 0x0a, 0x06, 0x77, 0x6f, 0x72, 0x6b, 0x65, 0x72, 0x18, 0x0a, - 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1d, 0x2e, 0x63, 0x6f, 0x6e, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x65, - 0x72, 0x2e, 0x73, 0x65, 0x72, 0x76, 0x65, 0x72, 0x73, 0x2e, 0x76, 0x31, 0x2e, 0x53, 0x65, 0x72, - 0x76, 0x65, 0x72, 0x52, 0x06, 0x77, 0x6f, 0x72, 0x6b, 0x65, 0x72, 0x12, 0x24, 0x0a, 0x0e, 0x61, - 0x63, 0x74, 0x69, 0x76, 0x65, 0x5f, 0x6a, 0x6f, 0x62, 0x5f, 0x69, 0x64, 0x73, 0x18, 0x14, 0x20, - 0x03, 0x28, 0x09, 0x52, 0x0c, 0x61, 0x63, 0x74, 0x69, 0x76, 0x65, 0x4a, 0x6f, 0x62, 0x49, 0x64, - 0x73, 0x22, 0x77, 0x0a, 0x0e, 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, - 0x6e, 0x73, 0x65, 0x12, 0x3f, 0x0a, 0x0b, 0x63, 0x6f, 0x6e, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x65, - 0x72, 0x73, 0x18, 0x0a, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x1d, 0x2e, 0x63, 0x6f, 0x6e, 0x74, 0x72, - 0x6f, 0x6c, 0x6c, 0x65, 0x72, 0x2e, 0x73, 0x65, 0x72, 0x76, 0x65, 0x72, 0x73, 0x2e, 0x76, 0x31, - 0x2e, 0x53, 0x65, 0x72, 0x76, 0x65, 0x72, 0x52, 0x0b, 0x63, 0x6f, 0x6e, 0x74, 0x72, 0x6f, 0x6c, - 0x6c, 0x65, 0x72, 0x73, 0x12, 0x24, 0x0a, 0x0e, 0x63, 0x61, 0x6e, 0x63, 0x65, 0x6c, 0x5f, 0x6a, - 0x6f, 0x62, 0x5f, 0x69, 0x64, 0x73, 0x18, 0x14, 0x20, 0x03, 0x28, 0x09, 0x52, 0x0c, 0x63, 0x61, - 0x6e, 0x63, 0x65, 0x6c, 0x4a, 0x6f, 0x62, 0x49, 0x64, 0x73, 0x22, 0x28, 0x0a, 0x16, 0x56, 0x61, - 0x6c, 0x69, 0x64, 0x61, 0x74, 0x65, 0x53, 0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x52, 0x65, 0x71, - 0x75, 0x65, 0x73, 0x74, 0x12, 0x0e, 0x0a, 0x02, 0x69, 0x64, 0x18, 0x0a, 0x20, 0x01, 0x28, 0x09, - 0x52, 0x02, 0x69, 0x64, 0x22, 0xde, 0x02, 0x0a, 0x17, 0x56, 0x61, 0x6c, 0x69, 0x64, 0x61, 0x74, - 0x65, 0x53, 0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, - 0x12, 0x0e, 0x0a, 0x02, 0x69, 0x64, 0x18, 0x0a, 0x20, 0x01, 0x28, 0x09, 0x52, 0x02, 0x69, 0x64, - 0x12, 0x19, 0x0a, 0x08, 0x73, 0x63, 0x6f, 0x70, 0x65, 0x5f, 0x69, 0x64, 0x18, 0x14, 0x20, 0x01, - 0x28, 0x09, 0x52, 0x07, 0x73, 0x63, 0x6f, 0x70, 0x65, 0x49, 0x64, 0x12, 0x17, 0x0a, 0x07, 0x75, - 0x73, 0x65, 0x72, 0x5f, 0x69, 0x64, 0x18, 0x1e, 0x20, 0x01, 0x28, 0x09, 0x52, 0x06, 0x75, 0x73, - 0x65, 0x72, 0x49, 0x64, 0x12, 0x12, 0x0a, 0x04, 0x74, 0x79, 0x70, 0x65, 0x18, 0x28, 0x20, 0x01, - 0x28, 0x09, 0x52, 0x04, 0x74, 0x79, 0x70, 0x65, 0x12, 0x1a, 0x0a, 0x08, 0x65, 0x6e, 0x64, 0x70, - 0x6f, 0x69, 0x6e, 0x74, 0x18, 0x32, 0x20, 0x01, 0x28, 0x09, 0x52, 0x08, 0x65, 0x6e, 0x64, 0x70, - 0x6f, 0x69, 0x6e, 0x74, 0x12, 0x20, 0x0a, 0x0b, 0x63, 0x65, 0x72, 0x74, 0x69, 0x66, 0x69, 0x63, - 0x61, 0x74, 0x65, 0x18, 0x3c, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x0b, 0x63, 0x65, 0x72, 0x74, 0x69, - 0x66, 0x69, 0x63, 0x61, 0x74, 0x65, 0x12, 0x1f, 0x0a, 0x0b, 0x70, 0x72, 0x69, 0x76, 0x61, 0x74, - 0x65, 0x5f, 0x6b, 0x65, 0x79, 0x18, 0x46, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x0a, 0x70, 0x72, 0x69, - 0x76, 0x61, 0x74, 0x65, 0x4b, 0x65, 0x79, 0x12, 0x43, 0x0a, 0x0f, 0x65, 0x78, 0x70, 0x69, 0x72, - 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x5f, 0x74, 0x69, 0x6d, 0x65, 0x18, 0x50, 0x20, 0x01, 0x28, 0x0b, - 0x32, 0x1a, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, - 0x75, 0x66, 0x2e, 0x54, 0x69, 0x6d, 0x65, 0x73, 0x74, 0x61, 0x6d, 0x70, 0x52, 0x0e, 0x65, 0x78, - 0x70, 0x69, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x54, 0x69, 0x6d, 0x65, 0x12, 0x47, 0x0a, 0x0b, - 0x77, 0x6f, 0x72, 0x6b, 0x65, 0x72, 0x5f, 0x69, 0x6e, 0x66, 0x6f, 0x18, 0x5a, 0x20, 0x03, 0x28, - 0x0b, 0x32, 0x26, 0x2e, 0x63, 0x6f, 0x6e, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x65, 0x72, 0x2e, 0x61, - 0x70, 0x69, 0x2e, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x73, 0x2e, 0x76, 0x31, 0x2e, 0x57, - 0x6f, 0x72, 0x6b, 0x65, 0x72, 0x49, 0x6e, 0x66, 0x6f, 0x52, 0x0a, 0x77, 0x6f, 0x72, 0x6b, 0x65, - 0x72, 0x49, 0x6e, 0x66, 0x6f, 0x22, 0x26, 0x0a, 0x0a, 0x57, 0x6f, 0x72, 0x6b, 0x65, 0x72, 0x49, - 0x6e, 0x66, 0x6f, 0x12, 0x18, 0x0a, 0x07, 0x61, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x18, 0x0a, - 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x61, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x32, 0xf0, 0x01, - 0x0a, 0x0d, 0x57, 0x6f, 0x72, 0x6b, 0x65, 0x72, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x12, - 0x61, 0x0a, 0x06, 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, 0x12, 0x29, 0x2e, 0x63, 0x6f, 0x6e, 0x74, - 0x72, 0x6f, 0x6c, 0x6c, 0x65, 0x72, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x73, 0x65, 0x72, 0x76, 0x69, - 0x63, 0x65, 0x73, 0x2e, 0x76, 0x31, 0x2e, 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, 0x52, 0x65, 0x71, - 0x75, 0x65, 0x73, 0x74, 0x1a, 0x2a, 0x2e, 0x63, 0x6f, 0x6e, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x65, - 0x72, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x73, 0x2e, 0x76, - 0x31, 0x2e, 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, - 0x22, 0x00, 0x12, 0x7c, 0x0a, 0x0f, 0x56, 0x61, 0x6c, 0x69, 0x64, 0x61, 0x74, 0x65, 0x53, 0x65, - 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x12, 0x32, 0x2e, 0x63, 0x6f, 0x6e, 0x74, 0x72, 0x6f, 0x6c, 0x6c, - 0x65, 0x72, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x73, 0x2e, - 0x76, 0x31, 0x2e, 0x56, 0x61, 0x6c, 0x69, 0x64, 0x61, 0x74, 0x65, 0x53, 0x65, 0x73, 0x73, 0x69, - 0x6f, 0x6e, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x33, 0x2e, 0x63, 0x6f, 0x6e, 0x74, - 0x72, 0x6f, 0x6c, 0x6c, 0x65, 0x72, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x73, 0x65, 0x72, 0x76, 0x69, - 0x63, 0x65, 0x73, 0x2e, 0x76, 0x31, 0x2e, 0x56, 0x61, 0x6c, 0x69, 0x64, 0x61, 0x74, 0x65, 0x53, - 0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x00, - 0x42, 0x4d, 0x5a, 0x4b, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x68, - 0x61, 0x73, 0x68, 0x69, 0x63, 0x6f, 0x72, 0x70, 0x2f, 0x62, 0x6f, 0x75, 0x6e, 0x64, 0x61, 0x72, - 0x79, 0x2f, 0x69, 0x6e, 0x74, 0x65, 0x72, 0x6e, 0x61, 0x6c, 0x2f, 0x67, 0x65, 0x6e, 0x2f, 0x63, - 0x6f, 0x6e, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x65, 0x72, 0x2f, 0x61, 0x70, 0x69, 0x2f, 0x73, 0x65, - 0x72, 0x76, 0x69, 0x63, 0x65, 0x73, 0x3b, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x73, 0x62, - 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, -} - -var ( - file_controller_api_services_v1_worker_service_proto_rawDescOnce sync.Once - file_controller_api_services_v1_worker_service_proto_rawDescData = file_controller_api_services_v1_worker_service_proto_rawDesc -) - -func file_controller_api_services_v1_worker_service_proto_rawDescGZIP() []byte { - file_controller_api_services_v1_worker_service_proto_rawDescOnce.Do(func() { - file_controller_api_services_v1_worker_service_proto_rawDescData = protoimpl.X.CompressGZIP(file_controller_api_services_v1_worker_service_proto_rawDescData) - }) - return file_controller_api_services_v1_worker_service_proto_rawDescData -} - -var file_controller_api_services_v1_worker_service_proto_msgTypes = make([]protoimpl.MessageInfo, 5) -var file_controller_api_services_v1_worker_service_proto_goTypes = []interface{}{ - (*StatusRequest)(nil), // 0: controller.api.services.v1.StatusRequest - (*StatusResponse)(nil), // 1: controller.api.services.v1.StatusResponse - (*ValidateSessionRequest)(nil), // 2: controller.api.services.v1.ValidateSessionRequest - (*ValidateSessionResponse)(nil), // 3: controller.api.services.v1.ValidateSessionResponse - (*WorkerInfo)(nil), // 4: controller.api.services.v1.WorkerInfo - (*servers.Server)(nil), // 5: controller.servers.v1.Server - (*timestamp.Timestamp)(nil), // 6: google.protobuf.Timestamp -} -var file_controller_api_services_v1_worker_service_proto_depIdxs = []int32{ - 5, // 0: controller.api.services.v1.StatusRequest.worker:type_name -> controller.servers.v1.Server - 5, // 1: controller.api.services.v1.StatusResponse.controllers:type_name -> controller.servers.v1.Server - 6, // 2: controller.api.services.v1.ValidateSessionResponse.expiration_time:type_name -> google.protobuf.Timestamp - 4, // 3: controller.api.services.v1.ValidateSessionResponse.worker_info:type_name -> controller.api.services.v1.WorkerInfo - 0, // 4: controller.api.services.v1.WorkerService.Status:input_type -> controller.api.services.v1.StatusRequest - 2, // 5: controller.api.services.v1.WorkerService.ValidateSession:input_type -> controller.api.services.v1.ValidateSessionRequest - 1, // 6: controller.api.services.v1.WorkerService.Status:output_type -> controller.api.services.v1.StatusResponse - 3, // 7: controller.api.services.v1.WorkerService.ValidateSession:output_type -> controller.api.services.v1.ValidateSessionResponse - 6, // [6:8] is the sub-list for method output_type - 4, // [4:6] is the sub-list for method input_type - 4, // [4:4] is the sub-list for extension type_name - 4, // [4:4] is the sub-list for extension extendee - 0, // [0:4] is the sub-list for field type_name -} - -func init() { file_controller_api_services_v1_worker_service_proto_init() } -func file_controller_api_services_v1_worker_service_proto_init() { - if File_controller_api_services_v1_worker_service_proto != nil { - return - } - if !protoimpl.UnsafeEnabled { - file_controller_api_services_v1_worker_service_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*StatusRequest); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_controller_api_services_v1_worker_service_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*StatusResponse); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_controller_api_services_v1_worker_service_proto_msgTypes[2].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*ValidateSessionRequest); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_controller_api_services_v1_worker_service_proto_msgTypes[3].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*ValidateSessionResponse); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_controller_api_services_v1_worker_service_proto_msgTypes[4].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*WorkerInfo); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - } - type x struct{} - out := protoimpl.TypeBuilder{ - File: protoimpl.DescBuilder{ - GoPackagePath: reflect.TypeOf(x{}).PkgPath(), - RawDescriptor: file_controller_api_services_v1_worker_service_proto_rawDesc, - NumEnums: 0, - NumMessages: 5, - NumExtensions: 0, - NumServices: 1, - }, - GoTypes: file_controller_api_services_v1_worker_service_proto_goTypes, - DependencyIndexes: file_controller_api_services_v1_worker_service_proto_depIdxs, - MessageInfos: file_controller_api_services_v1_worker_service_proto_msgTypes, - }.Build() - File_controller_api_services_v1_worker_service_proto = out.File - file_controller_api_services_v1_worker_service_proto_rawDesc = nil - file_controller_api_services_v1_worker_service_proto_goTypes = nil - file_controller_api_services_v1_worker_service_proto_depIdxs = nil -} - -// Reference imports to suppress errors if they are not otherwise used. -var _ context.Context -var _ grpc.ClientConnInterface - -// This is a compile-time assertion to ensure that this generated file -// is compatible with the grpc package it is being compiled against. -const _ = grpc.SupportPackageIsVersion6 - -// WorkerServiceClient is the client API for WorkerService service. -// -// For semantics around ctx use and closing/ending streaming RPCs, please refer to https://godoc.org/google.golang.org/grpc#ClientConn.NewStream. -type WorkerServiceClient interface { - Status(ctx context.Context, in *StatusRequest, opts ...grpc.CallOption) (*StatusResponse, error) - ValidateSession(ctx context.Context, in *ValidateSessionRequest, opts ...grpc.CallOption) (*ValidateSessionResponse, error) -} - -type workerServiceClient struct { - cc grpc.ClientConnInterface -} - -func NewWorkerServiceClient(cc grpc.ClientConnInterface) WorkerServiceClient { - return &workerServiceClient{cc} -} - -func (c *workerServiceClient) Status(ctx context.Context, in *StatusRequest, opts ...grpc.CallOption) (*StatusResponse, error) { - out := new(StatusResponse) - err := c.cc.Invoke(ctx, "/controller.api.services.v1.WorkerService/Status", in, out, opts...) - if err != nil { - return nil, err - } - return out, nil -} - -func (c *workerServiceClient) ValidateSession(ctx context.Context, in *ValidateSessionRequest, opts ...grpc.CallOption) (*ValidateSessionResponse, error) { - out := new(ValidateSessionResponse) - err := c.cc.Invoke(ctx, "/controller.api.services.v1.WorkerService/ValidateSession", in, out, opts...) - if err != nil { - return nil, err - } - return out, nil -} - -// WorkerServiceServer is the server API for WorkerService service. -type WorkerServiceServer interface { - Status(context.Context, *StatusRequest) (*StatusResponse, error) - ValidateSession(context.Context, *ValidateSessionRequest) (*ValidateSessionResponse, error) -} - -// UnimplementedWorkerServiceServer can be embedded to have forward compatible implementations. -type UnimplementedWorkerServiceServer struct { -} - -func (*UnimplementedWorkerServiceServer) Status(context.Context, *StatusRequest) (*StatusResponse, error) { - return nil, status.Errorf(codes.Unimplemented, "method Status not implemented") -} -func (*UnimplementedWorkerServiceServer) ValidateSession(context.Context, *ValidateSessionRequest) (*ValidateSessionResponse, error) { - return nil, status.Errorf(codes.Unimplemented, "method ValidateSession not implemented") -} - -func RegisterWorkerServiceServer(s *grpc.Server, srv WorkerServiceServer) { - s.RegisterService(&_WorkerService_serviceDesc, srv) -} - -func _WorkerService_Status_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(StatusRequest) - if err := dec(in); err != nil { - return nil, err - } - if interceptor == nil { - return srv.(WorkerServiceServer).Status(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: "/controller.api.services.v1.WorkerService/Status", - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(WorkerServiceServer).Status(ctx, req.(*StatusRequest)) - } - return interceptor(ctx, in, info, handler) -} - -func _WorkerService_ValidateSession_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(ValidateSessionRequest) - if err := dec(in); err != nil { - return nil, err - } - if interceptor == nil { - return srv.(WorkerServiceServer).ValidateSession(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: "/controller.api.services.v1.WorkerService/ValidateSession", - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(WorkerServiceServer).ValidateSession(ctx, req.(*ValidateSessionRequest)) - } - return interceptor(ctx, in, info, handler) -} - -var _WorkerService_serviceDesc = grpc.ServiceDesc{ - ServiceName: "controller.api.services.v1.WorkerService", - HandlerType: (*WorkerServiceServer)(nil), - Methods: []grpc.MethodDesc{ - { - MethodName: "Status", - Handler: _WorkerService_Status_Handler, - }, - { - MethodName: "ValidateSession", - Handler: _WorkerService_ValidateSession_Handler, - }, - }, - Streams: []grpc.StreamDesc{}, - Metadata: "controller/api/services/v1/worker_service.proto", -} diff --git a/internal/gen/controller/servers/services/server_coordination_service.pb.go b/internal/gen/controller/servers/services/server_coordination_service.pb.go new file mode 100644 index 0000000000..8131311a43 --- /dev/null +++ b/internal/gen/controller/servers/services/server_coordination_service.pb.go @@ -0,0 +1,928 @@ +// Code generated by protoc-gen-go. DO NOT EDIT. +// versions: +// protoc-gen-go v1.25.0 +// protoc v3.12.4 +// source: controller/servers/services/v1/server_coordination_service.proto + +package services + +import ( + context "context" + proto "github.com/golang/protobuf/proto" + _ "github.com/golang/protobuf/ptypes/timestamp" + servers "github.com/hashicorp/boundary/internal/servers" + grpc "google.golang.org/grpc" + codes "google.golang.org/grpc/codes" + status "google.golang.org/grpc/status" + protoreflect "google.golang.org/protobuf/reflect/protoreflect" + protoimpl "google.golang.org/protobuf/runtime/protoimpl" + reflect "reflect" + sync "sync" +) + +const ( + // Verify that this generated code is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion) + // Verify that runtime/protoimpl is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20) +) + +// This is a compile-time assertion that a sufficiently up-to-date version +// of the legacy proto package is being used. +const _ = proto.ProtoPackageIsVersion4 + +type Job_JOBTYPE int32 + +const ( + Job_JOBTYPE_UNSPECIFIED Job_JOBTYPE = 0 + Job_JOBTYPE_SESSION Job_JOBTYPE = 1 +) + +// Enum value maps for Job_JOBTYPE. +var ( + Job_JOBTYPE_name = map[int32]string{ + 0: "JOBTYPE_UNSPECIFIED", + 1: "JOBTYPE_SESSION", + } + Job_JOBTYPE_value = map[string]int32{ + "JOBTYPE_UNSPECIFIED": 0, + "JOBTYPE_SESSION": 1, + } +) + +func (x Job_JOBTYPE) Enum() *Job_JOBTYPE { + p := new(Job_JOBTYPE) + *p = x + return p +} + +func (x Job_JOBTYPE) String() string { + return protoimpl.X.EnumStringOf(x.Descriptor(), protoreflect.EnumNumber(x)) +} + +func (Job_JOBTYPE) Descriptor() protoreflect.EnumDescriptor { + return file_controller_servers_services_v1_server_coordination_service_proto_enumTypes[0].Descriptor() +} + +func (Job_JOBTYPE) Type() protoreflect.EnumType { + return &file_controller_servers_services_v1_server_coordination_service_proto_enumTypes[0] +} + +func (x Job_JOBTYPE) Number() protoreflect.EnumNumber { + return protoreflect.EnumNumber(x) +} + +// Deprecated: Use Job_JOBTYPE.Descriptor instead. +func (Job_JOBTYPE) EnumDescriptor() ([]byte, []int) { + return file_controller_servers_services_v1_server_coordination_service_proto_rawDescGZIP(), []int{2, 0} +} + +type JobStatus_STATUS int32 + +const ( + // TODO: Get a better picture of what states general jobs can be in. + JobStatus_STATUS_UNSPECIFIED JobStatus_STATUS = 0 + // Specifies that the job is actively being handled by the worker. + JobStatus_STATUS_ACTIVE JobStatus_STATUS = 1 + JobStatus_STATUS_CANCELLED JobStatus_STATUS = 2 + JobStatus_STATUS_COMPLETED JobStatus_STATUS = 3 +) + +// Enum value maps for JobStatus_STATUS. +var ( + JobStatus_STATUS_name = map[int32]string{ + 0: "STATUS_UNSPECIFIED", + 1: "STATUS_ACTIVE", + 2: "STATUS_CANCELLED", + 3: "STATUS_COMPLETED", + } + JobStatus_STATUS_value = map[string]int32{ + "STATUS_UNSPECIFIED": 0, + "STATUS_ACTIVE": 1, + "STATUS_CANCELLED": 2, + "STATUS_COMPLETED": 3, + } +) + +func (x JobStatus_STATUS) Enum() *JobStatus_STATUS { + p := new(JobStatus_STATUS) + *p = x + return p +} + +func (x JobStatus_STATUS) String() string { + return protoimpl.X.EnumStringOf(x.Descriptor(), protoreflect.EnumNumber(x)) +} + +func (JobStatus_STATUS) Descriptor() protoreflect.EnumDescriptor { + return file_controller_servers_services_v1_server_coordination_service_proto_enumTypes[1].Descriptor() +} + +func (JobStatus_STATUS) Type() protoreflect.EnumType { + return &file_controller_servers_services_v1_server_coordination_service_proto_enumTypes[1] +} + +func (x JobStatus_STATUS) Number() protoreflect.EnumNumber { + return protoreflect.EnumNumber(x) +} + +// Deprecated: Use JobStatus_STATUS.Descriptor instead. +func (JobStatus_STATUS) EnumDescriptor() ([]byte, []int) { + return file_controller_servers_services_v1_server_coordination_service_proto_rawDescGZIP(), []int{3, 0} +} + +type JobChangeRequest_CHANGETYPE int32 + +const ( + JobChangeRequest_CHANGETYPE_UNSPECIFIED JobChangeRequest_CHANGETYPE = 0 + // Indicates that the job should be cancelled on the worker. + JobChangeRequest_CHANGETYPE_CANCEL JobChangeRequest_CHANGETYPE = 1 +) + +// Enum value maps for JobChangeRequest_CHANGETYPE. +var ( + JobChangeRequest_CHANGETYPE_name = map[int32]string{ + 0: "CHANGETYPE_UNSPECIFIED", + 1: "CHANGETYPE_CANCEL", + } + JobChangeRequest_CHANGETYPE_value = map[string]int32{ + "CHANGETYPE_UNSPECIFIED": 0, + "CHANGETYPE_CANCEL": 1, + } +) + +func (x JobChangeRequest_CHANGETYPE) Enum() *JobChangeRequest_CHANGETYPE { + p := new(JobChangeRequest_CHANGETYPE) + *p = x + return p +} + +func (x JobChangeRequest_CHANGETYPE) String() string { + return protoimpl.X.EnumStringOf(x.Descriptor(), protoreflect.EnumNumber(x)) +} + +func (JobChangeRequest_CHANGETYPE) Descriptor() protoreflect.EnumDescriptor { + return file_controller_servers_services_v1_server_coordination_service_proto_enumTypes[2].Descriptor() +} + +func (JobChangeRequest_CHANGETYPE) Type() protoreflect.EnumType { + return &file_controller_servers_services_v1_server_coordination_service_proto_enumTypes[2] +} + +func (x JobChangeRequest_CHANGETYPE) Number() protoreflect.EnumNumber { + return protoreflect.EnumNumber(x) +} + +// Deprecated: Use JobChangeRequest_CHANGETYPE.Descriptor instead. +func (JobChangeRequest_CHANGETYPE) EnumDescriptor() ([]byte, []int) { + return file_controller_servers_services_v1_server_coordination_service_proto_rawDescGZIP(), []int{5, 0} +} + +type Connection struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields +} + +func (x *Connection) Reset() { + *x = Connection{} + if protoimpl.UnsafeEnabled { + mi := &file_controller_servers_services_v1_server_coordination_service_proto_msgTypes[0] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *Connection) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*Connection) ProtoMessage() {} + +func (x *Connection) ProtoReflect() protoreflect.Message { + mi := &file_controller_servers_services_v1_server_coordination_service_proto_msgTypes[0] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use Connection.ProtoReflect.Descriptor instead. +func (*Connection) Descriptor() ([]byte, []int) { + return file_controller_servers_services_v1_server_coordination_service_proto_rawDescGZIP(), []int{0} +} + +type SessionJobInfo struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Connections []*Connection `protobuf:"bytes,1,rep,name=connections,proto3" json:"connections,omitempty"` +} + +func (x *SessionJobInfo) Reset() { + *x = SessionJobInfo{} + if protoimpl.UnsafeEnabled { + mi := &file_controller_servers_services_v1_server_coordination_service_proto_msgTypes[1] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *SessionJobInfo) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*SessionJobInfo) ProtoMessage() {} + +func (x *SessionJobInfo) ProtoReflect() protoreflect.Message { + mi := &file_controller_servers_services_v1_server_coordination_service_proto_msgTypes[1] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use SessionJobInfo.ProtoReflect.Descriptor instead. +func (*SessionJobInfo) Descriptor() ([]byte, []int) { + return file_controller_servers_services_v1_server_coordination_service_proto_rawDescGZIP(), []int{1} +} + +func (x *SessionJobInfo) GetConnections() []*Connection { + if x != nil { + return x.Connections + } + return nil +} + +type Job struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + JobId string `protobuf:"bytes,1,opt,name=job_id,json=jobId,proto3" json:"job_id,omitempty"` + Type Job_JOBTYPE `protobuf:"varint,2,opt,name=type,proto3,enum=controller.servers.services.v1.Job_JOBTYPE" json:"type,omitempty"` + // Types that are assignable to JobInfo: + // *Job_SessionInfo + JobInfo isJob_JobInfo `protobuf_oneof:"job_info"` +} + +func (x *Job) Reset() { + *x = Job{} + if protoimpl.UnsafeEnabled { + mi := &file_controller_servers_services_v1_server_coordination_service_proto_msgTypes[2] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *Job) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*Job) ProtoMessage() {} + +func (x *Job) ProtoReflect() protoreflect.Message { + mi := &file_controller_servers_services_v1_server_coordination_service_proto_msgTypes[2] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use Job.ProtoReflect.Descriptor instead. +func (*Job) Descriptor() ([]byte, []int) { + return file_controller_servers_services_v1_server_coordination_service_proto_rawDescGZIP(), []int{2} +} + +func (x *Job) GetJobId() string { + if x != nil { + return x.JobId + } + return "" +} + +func (x *Job) GetType() Job_JOBTYPE { + if x != nil { + return x.Type + } + return Job_JOBTYPE_UNSPECIFIED +} + +func (m *Job) GetJobInfo() isJob_JobInfo { + if m != nil { + return m.JobInfo + } + return nil +} + +func (x *Job) GetSessionInfo() *SessionJobInfo { + if x, ok := x.GetJobInfo().(*Job_SessionInfo); ok { + return x.SessionInfo + } + return nil +} + +type isJob_JobInfo interface { + isJob_JobInfo() +} + +type Job_SessionInfo struct { + // This value is specified when type is JOBTYPE_SESSION. + SessionInfo *SessionJobInfo `protobuf:"bytes,3,opt,name=session_info,json=sessionInfo,proto3,oneof"` +} + +func (*Job_SessionInfo) isJob_JobInfo() {} + +type JobStatus struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Job *Job `protobuf:"bytes,1,opt,name=job,proto3" json:"job,omitempty"` + Status JobStatus_STATUS `protobuf:"varint,3,opt,name=status,proto3,enum=controller.servers.services.v1.JobStatus_STATUS" json:"status,omitempty"` +} + +func (x *JobStatus) Reset() { + *x = JobStatus{} + if protoimpl.UnsafeEnabled { + mi := &file_controller_servers_services_v1_server_coordination_service_proto_msgTypes[3] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *JobStatus) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*JobStatus) ProtoMessage() {} + +func (x *JobStatus) ProtoReflect() protoreflect.Message { + mi := &file_controller_servers_services_v1_server_coordination_service_proto_msgTypes[3] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use JobStatus.ProtoReflect.Descriptor instead. +func (*JobStatus) Descriptor() ([]byte, []int) { + return file_controller_servers_services_v1_server_coordination_service_proto_rawDescGZIP(), []int{3} +} + +func (x *JobStatus) GetJob() *Job { + if x != nil { + return x.Job + } + return nil +} + +func (x *JobStatus) GetStatus() JobStatus_STATUS { + if x != nil { + return x.Status + } + return JobStatus_STATUS_UNSPECIFIED +} + +type StatusRequest struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + // The worker info. We could use information from the TLS connection but this + // is easier and going the other route doesn't provide much benefit -- if you + // get access to the key and spoof the connection, you're already compromised. + Worker *servers.Server `protobuf:"bytes,10,opt,name=worker,proto3" json:"worker,omitempty"` + // Jobs which this worker wants to report the status. + Jobs []*JobStatus `protobuf:"bytes,20,rep,name=jobs,proto3" json:"jobs,omitempty"` +} + +func (x *StatusRequest) Reset() { + *x = StatusRequest{} + if protoimpl.UnsafeEnabled { + mi := &file_controller_servers_services_v1_server_coordination_service_proto_msgTypes[4] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *StatusRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*StatusRequest) ProtoMessage() {} + +func (x *StatusRequest) ProtoReflect() protoreflect.Message { + mi := &file_controller_servers_services_v1_server_coordination_service_proto_msgTypes[4] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use StatusRequest.ProtoReflect.Descriptor instead. +func (*StatusRequest) Descriptor() ([]byte, []int) { + return file_controller_servers_services_v1_server_coordination_service_proto_rawDescGZIP(), []int{4} +} + +func (x *StatusRequest) GetWorker() *servers.Server { + if x != nil { + return x.Worker + } + return nil +} + +func (x *StatusRequest) GetJobs() []*JobStatus { + if x != nil { + return x.Jobs + } + return nil +} + +type JobChangeRequest struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Job *Job `protobuf:"bytes,1,opt,name=job,proto3" json:"job,omitempty"` + RequestType JobChangeRequest_CHANGETYPE `protobuf:"varint,2,opt,name=request_type,json=requestType,proto3,enum=controller.servers.services.v1.JobChangeRequest_CHANGETYPE" json:"request_type,omitempty"` +} + +func (x *JobChangeRequest) Reset() { + *x = JobChangeRequest{} + if protoimpl.UnsafeEnabled { + mi := &file_controller_servers_services_v1_server_coordination_service_proto_msgTypes[5] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *JobChangeRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*JobChangeRequest) ProtoMessage() {} + +func (x *JobChangeRequest) ProtoReflect() protoreflect.Message { + mi := &file_controller_servers_services_v1_server_coordination_service_proto_msgTypes[5] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use JobChangeRequest.ProtoReflect.Descriptor instead. +func (*JobChangeRequest) Descriptor() ([]byte, []int) { + return file_controller_servers_services_v1_server_coordination_service_proto_rawDescGZIP(), []int{5} +} + +func (x *JobChangeRequest) GetJob() *Job { + if x != nil { + return x.Job + } + return nil +} + +func (x *JobChangeRequest) GetRequestType() JobChangeRequest_CHANGETYPE { + if x != nil { + return x.RequestType + } + return JobChangeRequest_CHANGETYPE_UNSPECIFIED +} + +type StatusResponse struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + // Active controllers. This can be used (eventually) for connection + // management. + Controllers []*servers.Server `protobuf:"bytes,10,rep,name=controllers,proto3" json:"controllers,omitempty"` + // List of jobs and the expected state changes. For example, this will include jobs witch + // change type of cancelled for jobs which are active on a worker but should be cancelled. + // This could also contain a request to start a job such as a worker -> worker proxy for + // establishing a session through an enclave. + JobsRequests []*JobChangeRequest `protobuf:"bytes,20,rep,name=jobs_requests,json=jobsRequests,proto3" json:"jobs_requests,omitempty"` +} + +func (x *StatusResponse) Reset() { + *x = StatusResponse{} + if protoimpl.UnsafeEnabled { + mi := &file_controller_servers_services_v1_server_coordination_service_proto_msgTypes[6] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *StatusResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*StatusResponse) ProtoMessage() {} + +func (x *StatusResponse) ProtoReflect() protoreflect.Message { + mi := &file_controller_servers_services_v1_server_coordination_service_proto_msgTypes[6] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use StatusResponse.ProtoReflect.Descriptor instead. +func (*StatusResponse) Descriptor() ([]byte, []int) { + return file_controller_servers_services_v1_server_coordination_service_proto_rawDescGZIP(), []int{6} +} + +func (x *StatusResponse) GetControllers() []*servers.Server { + if x != nil { + return x.Controllers + } + return nil +} + +func (x *StatusResponse) GetJobsRequests() []*JobChangeRequest { + if x != nil { + return x.JobsRequests + } + return nil +} + +var File_controller_servers_services_v1_server_coordination_service_proto protoreflect.FileDescriptor + +var file_controller_servers_services_v1_server_coordination_service_proto_rawDesc = []byte{ + 0x0a, 0x40, 0x63, 0x6f, 0x6e, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x65, 0x72, 0x2f, 0x73, 0x65, 0x72, + 0x76, 0x65, 0x72, 0x73, 0x2f, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x73, 0x2f, 0x76, 0x31, + 0x2f, 0x73, 0x65, 0x72, 0x76, 0x65, 0x72, 0x5f, 0x63, 0x6f, 0x6f, 0x72, 0x64, 0x69, 0x6e, 0x61, + 0x74, 0x69, 0x6f, 0x6e, 0x5f, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x2e, 0x70, 0x72, 0x6f, + 0x74, 0x6f, 0x12, 0x1e, 0x63, 0x6f, 0x6e, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x65, 0x72, 0x2e, 0x73, + 0x65, 0x72, 0x76, 0x65, 0x72, 0x73, 0x2e, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x73, 0x2e, + 0x76, 0x31, 0x1a, 0x1f, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, + 0x62, 0x75, 0x66, 0x2f, 0x74, 0x69, 0x6d, 0x65, 0x73, 0x74, 0x61, 0x6d, 0x70, 0x2e, 0x70, 0x72, + 0x6f, 0x74, 0x6f, 0x1a, 0x23, 0x63, 0x6f, 0x6e, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x65, 0x72, 0x2f, + 0x73, 0x65, 0x72, 0x76, 0x65, 0x72, 0x73, 0x2f, 0x76, 0x31, 0x2f, 0x73, 0x65, 0x72, 0x76, 0x65, + 0x72, 0x73, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, 0x0c, 0x0a, 0x0a, 0x43, 0x6f, 0x6e, 0x6e, + 0x65, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x22, 0x5e, 0x0a, 0x0e, 0x53, 0x65, 0x73, 0x73, 0x69, 0x6f, + 0x6e, 0x4a, 0x6f, 0x62, 0x49, 0x6e, 0x66, 0x6f, 0x12, 0x4c, 0x0a, 0x0b, 0x63, 0x6f, 0x6e, 0x6e, + 0x65, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x2a, 0x2e, + 0x63, 0x6f, 0x6e, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x65, 0x72, 0x2e, 0x73, 0x65, 0x72, 0x76, 0x65, + 0x72, 0x73, 0x2e, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x73, 0x2e, 0x76, 0x31, 0x2e, 0x43, + 0x6f, 0x6e, 0x6e, 0x65, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x0b, 0x63, 0x6f, 0x6e, 0x6e, 0x65, + 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x22, 0xf7, 0x01, 0x0a, 0x03, 0x4a, 0x6f, 0x62, 0x12, 0x15, + 0x0a, 0x06, 0x6a, 0x6f, 0x62, 0x5f, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, + 0x6a, 0x6f, 0x62, 0x49, 0x64, 0x12, 0x3f, 0x0a, 0x04, 0x74, 0x79, 0x70, 0x65, 0x18, 0x02, 0x20, + 0x01, 0x28, 0x0e, 0x32, 0x2b, 0x2e, 0x63, 0x6f, 0x6e, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x65, 0x72, + 0x2e, 0x73, 0x65, 0x72, 0x76, 0x65, 0x72, 0x73, 0x2e, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, + 0x73, 0x2e, 0x76, 0x31, 0x2e, 0x4a, 0x6f, 0x62, 0x2e, 0x4a, 0x4f, 0x42, 0x54, 0x59, 0x50, 0x45, + 0x52, 0x04, 0x74, 0x79, 0x70, 0x65, 0x12, 0x53, 0x0a, 0x0c, 0x73, 0x65, 0x73, 0x73, 0x69, 0x6f, + 0x6e, 0x5f, 0x69, 0x6e, 0x66, 0x6f, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x2e, 0x2e, 0x63, + 0x6f, 0x6e, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x65, 0x72, 0x2e, 0x73, 0x65, 0x72, 0x76, 0x65, 0x72, + 0x73, 0x2e, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x73, 0x2e, 0x76, 0x31, 0x2e, 0x53, 0x65, + 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x4a, 0x6f, 0x62, 0x49, 0x6e, 0x66, 0x6f, 0x48, 0x00, 0x52, 0x0b, + 0x73, 0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x49, 0x6e, 0x66, 0x6f, 0x22, 0x37, 0x0a, 0x07, 0x4a, + 0x4f, 0x42, 0x54, 0x59, 0x50, 0x45, 0x12, 0x17, 0x0a, 0x13, 0x4a, 0x4f, 0x42, 0x54, 0x59, 0x50, + 0x45, 0x5f, 0x55, 0x4e, 0x53, 0x50, 0x45, 0x43, 0x49, 0x46, 0x49, 0x45, 0x44, 0x10, 0x00, 0x12, + 0x13, 0x0a, 0x0f, 0x4a, 0x4f, 0x42, 0x54, 0x59, 0x50, 0x45, 0x5f, 0x53, 0x45, 0x53, 0x53, 0x49, + 0x4f, 0x4e, 0x10, 0x01, 0x42, 0x0a, 0x0a, 0x08, 0x6a, 0x6f, 0x62, 0x5f, 0x69, 0x6e, 0x66, 0x6f, + 0x22, 0xed, 0x01, 0x0a, 0x09, 0x4a, 0x6f, 0x62, 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, 0x12, 0x35, + 0x0a, 0x03, 0x6a, 0x6f, 0x62, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x23, 0x2e, 0x63, 0x6f, + 0x6e, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x65, 0x72, 0x2e, 0x73, 0x65, 0x72, 0x76, 0x65, 0x72, 0x73, + 0x2e, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x73, 0x2e, 0x76, 0x31, 0x2e, 0x4a, 0x6f, 0x62, + 0x52, 0x03, 0x6a, 0x6f, 0x62, 0x12, 0x48, 0x0a, 0x06, 0x73, 0x74, 0x61, 0x74, 0x75, 0x73, 0x18, + 0x03, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x30, 0x2e, 0x63, 0x6f, 0x6e, 0x74, 0x72, 0x6f, 0x6c, 0x6c, + 0x65, 0x72, 0x2e, 0x73, 0x65, 0x72, 0x76, 0x65, 0x72, 0x73, 0x2e, 0x73, 0x65, 0x72, 0x76, 0x69, + 0x63, 0x65, 0x73, 0x2e, 0x76, 0x31, 0x2e, 0x4a, 0x6f, 0x62, 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, + 0x2e, 0x53, 0x54, 0x41, 0x54, 0x55, 0x53, 0x52, 0x06, 0x73, 0x74, 0x61, 0x74, 0x75, 0x73, 0x22, + 0x5f, 0x0a, 0x06, 0x53, 0x54, 0x41, 0x54, 0x55, 0x53, 0x12, 0x16, 0x0a, 0x12, 0x53, 0x54, 0x41, + 0x54, 0x55, 0x53, 0x5f, 0x55, 0x4e, 0x53, 0x50, 0x45, 0x43, 0x49, 0x46, 0x49, 0x45, 0x44, 0x10, + 0x00, 0x12, 0x11, 0x0a, 0x0d, 0x53, 0x54, 0x41, 0x54, 0x55, 0x53, 0x5f, 0x41, 0x43, 0x54, 0x49, + 0x56, 0x45, 0x10, 0x01, 0x12, 0x14, 0x0a, 0x10, 0x53, 0x54, 0x41, 0x54, 0x55, 0x53, 0x5f, 0x43, + 0x41, 0x4e, 0x43, 0x45, 0x4c, 0x4c, 0x45, 0x44, 0x10, 0x02, 0x12, 0x14, 0x0a, 0x10, 0x53, 0x54, + 0x41, 0x54, 0x55, 0x53, 0x5f, 0x43, 0x4f, 0x4d, 0x50, 0x4c, 0x45, 0x54, 0x45, 0x44, 0x10, 0x03, + 0x22, 0x85, 0x01, 0x0a, 0x0d, 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, + 0x73, 0x74, 0x12, 0x35, 0x0a, 0x06, 0x77, 0x6f, 0x72, 0x6b, 0x65, 0x72, 0x18, 0x0a, 0x20, 0x01, + 0x28, 0x0b, 0x32, 0x1d, 0x2e, 0x63, 0x6f, 0x6e, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x65, 0x72, 0x2e, + 0x73, 0x65, 0x72, 0x76, 0x65, 0x72, 0x73, 0x2e, 0x76, 0x31, 0x2e, 0x53, 0x65, 0x72, 0x76, 0x65, + 0x72, 0x52, 0x06, 0x77, 0x6f, 0x72, 0x6b, 0x65, 0x72, 0x12, 0x3d, 0x0a, 0x04, 0x6a, 0x6f, 0x62, + 0x73, 0x18, 0x14, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x29, 0x2e, 0x63, 0x6f, 0x6e, 0x74, 0x72, 0x6f, + 0x6c, 0x6c, 0x65, 0x72, 0x2e, 0x73, 0x65, 0x72, 0x76, 0x65, 0x72, 0x73, 0x2e, 0x73, 0x65, 0x72, + 0x76, 0x69, 0x63, 0x65, 0x73, 0x2e, 0x76, 0x31, 0x2e, 0x4a, 0x6f, 0x62, 0x53, 0x74, 0x61, 0x74, + 0x75, 0x73, 0x52, 0x04, 0x6a, 0x6f, 0x62, 0x73, 0x22, 0xea, 0x01, 0x0a, 0x10, 0x4a, 0x6f, 0x62, + 0x43, 0x68, 0x61, 0x6e, 0x67, 0x65, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x35, 0x0a, + 0x03, 0x6a, 0x6f, 0x62, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x23, 0x2e, 0x63, 0x6f, 0x6e, + 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x65, 0x72, 0x2e, 0x73, 0x65, 0x72, 0x76, 0x65, 0x72, 0x73, 0x2e, + 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x73, 0x2e, 0x76, 0x31, 0x2e, 0x4a, 0x6f, 0x62, 0x52, + 0x03, 0x6a, 0x6f, 0x62, 0x12, 0x5e, 0x0a, 0x0c, 0x72, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x5f, + 0x74, 0x79, 0x70, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x3b, 0x2e, 0x63, 0x6f, 0x6e, + 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x65, 0x72, 0x2e, 0x73, 0x65, 0x72, 0x76, 0x65, 0x72, 0x73, 0x2e, + 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x73, 0x2e, 0x76, 0x31, 0x2e, 0x4a, 0x6f, 0x62, 0x43, + 0x68, 0x61, 0x6e, 0x67, 0x65, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x2e, 0x43, 0x48, 0x41, + 0x4e, 0x47, 0x45, 0x54, 0x59, 0x50, 0x45, 0x52, 0x0b, 0x72, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, + 0x54, 0x79, 0x70, 0x65, 0x22, 0x3f, 0x0a, 0x0a, 0x43, 0x48, 0x41, 0x4e, 0x47, 0x45, 0x54, 0x59, + 0x50, 0x45, 0x12, 0x1a, 0x0a, 0x16, 0x43, 0x48, 0x41, 0x4e, 0x47, 0x45, 0x54, 0x59, 0x50, 0x45, + 0x5f, 0x55, 0x4e, 0x53, 0x50, 0x45, 0x43, 0x49, 0x46, 0x49, 0x45, 0x44, 0x10, 0x00, 0x12, 0x15, + 0x0a, 0x11, 0x43, 0x48, 0x41, 0x4e, 0x47, 0x45, 0x54, 0x59, 0x50, 0x45, 0x5f, 0x43, 0x41, 0x4e, + 0x43, 0x45, 0x4c, 0x10, 0x01, 0x22, 0xa8, 0x01, 0x0a, 0x0e, 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, + 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x3f, 0x0a, 0x0b, 0x63, 0x6f, 0x6e, 0x74, + 0x72, 0x6f, 0x6c, 0x6c, 0x65, 0x72, 0x73, 0x18, 0x0a, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x1d, 0x2e, + 0x63, 0x6f, 0x6e, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x65, 0x72, 0x2e, 0x73, 0x65, 0x72, 0x76, 0x65, + 0x72, 0x73, 0x2e, 0x76, 0x31, 0x2e, 0x53, 0x65, 0x72, 0x76, 0x65, 0x72, 0x52, 0x0b, 0x63, 0x6f, + 0x6e, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x65, 0x72, 0x73, 0x12, 0x55, 0x0a, 0x0d, 0x6a, 0x6f, 0x62, + 0x73, 0x5f, 0x72, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x73, 0x18, 0x14, 0x20, 0x03, 0x28, 0x0b, + 0x32, 0x30, 0x2e, 0x63, 0x6f, 0x6e, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x65, 0x72, 0x2e, 0x73, 0x65, + 0x72, 0x76, 0x65, 0x72, 0x73, 0x2e, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x73, 0x2e, 0x76, + 0x31, 0x2e, 0x4a, 0x6f, 0x62, 0x43, 0x68, 0x61, 0x6e, 0x67, 0x65, 0x52, 0x65, 0x71, 0x75, 0x65, + 0x73, 0x74, 0x52, 0x0c, 0x6a, 0x6f, 0x62, 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x73, + 0x32, 0x86, 0x01, 0x0a, 0x19, 0x53, 0x65, 0x72, 0x76, 0x65, 0x72, 0x43, 0x6f, 0x6f, 0x72, 0x64, + 0x69, 0x6e, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x12, 0x69, + 0x0a, 0x06, 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, 0x12, 0x2d, 0x2e, 0x63, 0x6f, 0x6e, 0x74, 0x72, + 0x6f, 0x6c, 0x6c, 0x65, 0x72, 0x2e, 0x73, 0x65, 0x72, 0x76, 0x65, 0x72, 0x73, 0x2e, 0x73, 0x65, + 0x72, 0x76, 0x69, 0x63, 0x65, 0x73, 0x2e, 0x76, 0x31, 0x2e, 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, + 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x2e, 0x2e, 0x63, 0x6f, 0x6e, 0x74, 0x72, 0x6f, + 0x6c, 0x6c, 0x65, 0x72, 0x2e, 0x73, 0x65, 0x72, 0x76, 0x65, 0x72, 0x73, 0x2e, 0x73, 0x65, 0x72, + 0x76, 0x69, 0x63, 0x65, 0x73, 0x2e, 0x76, 0x31, 0x2e, 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, 0x52, + 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x00, 0x42, 0x51, 0x5a, 0x4f, 0x67, 0x69, 0x74, + 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x68, 0x61, 0x73, 0x68, 0x69, 0x63, 0x6f, 0x72, + 0x70, 0x2f, 0x62, 0x6f, 0x75, 0x6e, 0x64, 0x61, 0x72, 0x79, 0x2f, 0x69, 0x6e, 0x74, 0x65, 0x72, + 0x6e, 0x61, 0x6c, 0x2f, 0x67, 0x65, 0x6e, 0x2f, 0x63, 0x6f, 0x6e, 0x74, 0x72, 0x6f, 0x6c, 0x6c, + 0x65, 0x72, 0x2f, 0x73, 0x65, 0x72, 0x76, 0x65, 0x72, 0x73, 0x2f, 0x73, 0x65, 0x72, 0x76, 0x69, + 0x63, 0x65, 0x73, 0x3b, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x73, 0x62, 0x06, 0x70, 0x72, + 0x6f, 0x74, 0x6f, 0x33, +} + +var ( + file_controller_servers_services_v1_server_coordination_service_proto_rawDescOnce sync.Once + file_controller_servers_services_v1_server_coordination_service_proto_rawDescData = file_controller_servers_services_v1_server_coordination_service_proto_rawDesc +) + +func file_controller_servers_services_v1_server_coordination_service_proto_rawDescGZIP() []byte { + file_controller_servers_services_v1_server_coordination_service_proto_rawDescOnce.Do(func() { + file_controller_servers_services_v1_server_coordination_service_proto_rawDescData = protoimpl.X.CompressGZIP(file_controller_servers_services_v1_server_coordination_service_proto_rawDescData) + }) + return file_controller_servers_services_v1_server_coordination_service_proto_rawDescData +} + +var file_controller_servers_services_v1_server_coordination_service_proto_enumTypes = make([]protoimpl.EnumInfo, 3) +var file_controller_servers_services_v1_server_coordination_service_proto_msgTypes = make([]protoimpl.MessageInfo, 7) +var file_controller_servers_services_v1_server_coordination_service_proto_goTypes = []interface{}{ + (Job_JOBTYPE)(0), // 0: controller.servers.services.v1.Job.JOBTYPE + (JobStatus_STATUS)(0), // 1: controller.servers.services.v1.JobStatus.STATUS + (JobChangeRequest_CHANGETYPE)(0), // 2: controller.servers.services.v1.JobChangeRequest.CHANGETYPE + (*Connection)(nil), // 3: controller.servers.services.v1.Connection + (*SessionJobInfo)(nil), // 4: controller.servers.services.v1.SessionJobInfo + (*Job)(nil), // 5: controller.servers.services.v1.Job + (*JobStatus)(nil), // 6: controller.servers.services.v1.JobStatus + (*StatusRequest)(nil), // 7: controller.servers.services.v1.StatusRequest + (*JobChangeRequest)(nil), // 8: controller.servers.services.v1.JobChangeRequest + (*StatusResponse)(nil), // 9: controller.servers.services.v1.StatusResponse + (*servers.Server)(nil), // 10: controller.servers.v1.Server +} +var file_controller_servers_services_v1_server_coordination_service_proto_depIdxs = []int32{ + 3, // 0: controller.servers.services.v1.SessionJobInfo.connections:type_name -> controller.servers.services.v1.Connection + 0, // 1: controller.servers.services.v1.Job.type:type_name -> controller.servers.services.v1.Job.JOBTYPE + 4, // 2: controller.servers.services.v1.Job.session_info:type_name -> controller.servers.services.v1.SessionJobInfo + 5, // 3: controller.servers.services.v1.JobStatus.job:type_name -> controller.servers.services.v1.Job + 1, // 4: controller.servers.services.v1.JobStatus.status:type_name -> controller.servers.services.v1.JobStatus.STATUS + 10, // 5: controller.servers.services.v1.StatusRequest.worker:type_name -> controller.servers.v1.Server + 6, // 6: controller.servers.services.v1.StatusRequest.jobs:type_name -> controller.servers.services.v1.JobStatus + 5, // 7: controller.servers.services.v1.JobChangeRequest.job:type_name -> controller.servers.services.v1.Job + 2, // 8: controller.servers.services.v1.JobChangeRequest.request_type:type_name -> controller.servers.services.v1.JobChangeRequest.CHANGETYPE + 10, // 9: controller.servers.services.v1.StatusResponse.controllers:type_name -> controller.servers.v1.Server + 8, // 10: controller.servers.services.v1.StatusResponse.jobs_requests:type_name -> controller.servers.services.v1.JobChangeRequest + 7, // 11: controller.servers.services.v1.ServerCoordinationService.Status:input_type -> controller.servers.services.v1.StatusRequest + 9, // 12: controller.servers.services.v1.ServerCoordinationService.Status:output_type -> controller.servers.services.v1.StatusResponse + 12, // [12:13] is the sub-list for method output_type + 11, // [11:12] is the sub-list for method input_type + 11, // [11:11] is the sub-list for extension type_name + 11, // [11:11] is the sub-list for extension extendee + 0, // [0:11] is the sub-list for field type_name +} + +func init() { file_controller_servers_services_v1_server_coordination_service_proto_init() } +func file_controller_servers_services_v1_server_coordination_service_proto_init() { + if File_controller_servers_services_v1_server_coordination_service_proto != nil { + return + } + if !protoimpl.UnsafeEnabled { + file_controller_servers_services_v1_server_coordination_service_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*Connection); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_controller_servers_services_v1_server_coordination_service_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*SessionJobInfo); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_controller_servers_services_v1_server_coordination_service_proto_msgTypes[2].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*Job); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_controller_servers_services_v1_server_coordination_service_proto_msgTypes[3].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*JobStatus); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_controller_servers_services_v1_server_coordination_service_proto_msgTypes[4].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*StatusRequest); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_controller_servers_services_v1_server_coordination_service_proto_msgTypes[5].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*JobChangeRequest); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_controller_servers_services_v1_server_coordination_service_proto_msgTypes[6].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*StatusResponse); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + } + file_controller_servers_services_v1_server_coordination_service_proto_msgTypes[2].OneofWrappers = []interface{}{ + (*Job_SessionInfo)(nil), + } + type x struct{} + out := protoimpl.TypeBuilder{ + File: protoimpl.DescBuilder{ + GoPackagePath: reflect.TypeOf(x{}).PkgPath(), + RawDescriptor: file_controller_servers_services_v1_server_coordination_service_proto_rawDesc, + NumEnums: 3, + NumMessages: 7, + NumExtensions: 0, + NumServices: 1, + }, + GoTypes: file_controller_servers_services_v1_server_coordination_service_proto_goTypes, + DependencyIndexes: file_controller_servers_services_v1_server_coordination_service_proto_depIdxs, + EnumInfos: file_controller_servers_services_v1_server_coordination_service_proto_enumTypes, + MessageInfos: file_controller_servers_services_v1_server_coordination_service_proto_msgTypes, + }.Build() + File_controller_servers_services_v1_server_coordination_service_proto = out.File + file_controller_servers_services_v1_server_coordination_service_proto_rawDesc = nil + file_controller_servers_services_v1_server_coordination_service_proto_goTypes = nil + file_controller_servers_services_v1_server_coordination_service_proto_depIdxs = nil +} + +// Reference imports to suppress errors if they are not otherwise used. +var _ context.Context +var _ grpc.ClientConnInterface + +// This is a compile-time assertion to ensure that this generated file +// is compatible with the grpc package it is being compiled against. +const _ = grpc.SupportPackageIsVersion6 + +// ServerCoordinationServiceClient is the client API for ServerCoordinationService service. +// +// For semantics around ctx use and closing/ending streaming RPCs, please refer to https://godoc.org/google.golang.org/grpc#ClientConn.NewStream. +type ServerCoordinationServiceClient interface { + // Status gets worker status requests which include the ongoing jobs the worker is handling and + // returns the status response which includes the changes the controller would like to make to + // jobs as well as provide a list of the controllers in the system. + Status(ctx context.Context, in *StatusRequest, opts ...grpc.CallOption) (*StatusResponse, error) +} + +type serverCoordinationServiceClient struct { + cc grpc.ClientConnInterface +} + +func NewServerCoordinationServiceClient(cc grpc.ClientConnInterface) ServerCoordinationServiceClient { + return &serverCoordinationServiceClient{cc} +} + +func (c *serverCoordinationServiceClient) Status(ctx context.Context, in *StatusRequest, opts ...grpc.CallOption) (*StatusResponse, error) { + out := new(StatusResponse) + err := c.cc.Invoke(ctx, "/controller.servers.services.v1.ServerCoordinationService/Status", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +// ServerCoordinationServiceServer is the server API for ServerCoordinationService service. +type ServerCoordinationServiceServer interface { + // Status gets worker status requests which include the ongoing jobs the worker is handling and + // returns the status response which includes the changes the controller would like to make to + // jobs as well as provide a list of the controllers in the system. + Status(context.Context, *StatusRequest) (*StatusResponse, error) +} + +// UnimplementedServerCoordinationServiceServer can be embedded to have forward compatible implementations. +type UnimplementedServerCoordinationServiceServer struct { +} + +func (*UnimplementedServerCoordinationServiceServer) Status(context.Context, *StatusRequest) (*StatusResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method Status not implemented") +} + +func RegisterServerCoordinationServiceServer(s *grpc.Server, srv ServerCoordinationServiceServer) { + s.RegisterService(&_ServerCoordinationService_serviceDesc, srv) +} + +func _ServerCoordinationService_Status_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(StatusRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(ServerCoordinationServiceServer).Status(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/controller.servers.services.v1.ServerCoordinationService/Status", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(ServerCoordinationServiceServer).Status(ctx, req.(*StatusRequest)) + } + return interceptor(ctx, in, info, handler) +} + +var _ServerCoordinationService_serviceDesc = grpc.ServiceDesc{ + ServiceName: "controller.servers.services.v1.ServerCoordinationService", + HandlerType: (*ServerCoordinationServiceServer)(nil), + Methods: []grpc.MethodDesc{ + { + MethodName: "Status", + Handler: _ServerCoordinationService_Status_Handler, + }, + }, + Streams: []grpc.StreamDesc{}, + Metadata: "controller/servers/services/v1/server_coordination_service.proto", +} diff --git a/internal/gen/controller/servers/services/session_service.pb.go b/internal/gen/controller/servers/services/session_service.pb.go new file mode 100644 index 0000000000..fe610b1406 --- /dev/null +++ b/internal/gen/controller/servers/services/session_service.pb.go @@ -0,0 +1,334 @@ +// Code generated by protoc-gen-go. DO NOT EDIT. +// versions: +// protoc-gen-go v1.25.0 +// protoc v3.12.4 +// source: controller/servers/services/v1/session_service.proto + +package services + +import ( + context "context" + proto "github.com/golang/protobuf/proto" + _ "github.com/golang/protobuf/ptypes/timestamp" + sessions "github.com/hashicorp/boundary/internal/gen/controller/api/resources/sessions" + _ "github.com/hashicorp/boundary/internal/servers" + grpc "google.golang.org/grpc" + codes "google.golang.org/grpc/codes" + status "google.golang.org/grpc/status" + protoreflect "google.golang.org/protobuf/reflect/protoreflect" + protoimpl "google.golang.org/protobuf/runtime/protoimpl" + reflect "reflect" + sync "sync" +) + +const ( + // Verify that this generated code is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion) + // Verify that runtime/protoimpl is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20) +) + +// This is a compile-time assertion that a sufficiently up-to-date version +// of the legacy proto package is being used. +const _ = proto.ProtoPackageIsVersion4 + +type GetSessionRequest struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + // The session ID from the client + Id string `protobuf:"bytes,10,opt,name=id,proto3" json:"id,omitempty"` +} + +func (x *GetSessionRequest) Reset() { + *x = GetSessionRequest{} + if protoimpl.UnsafeEnabled { + mi := &file_controller_servers_services_v1_session_service_proto_msgTypes[0] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *GetSessionRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*GetSessionRequest) ProtoMessage() {} + +func (x *GetSessionRequest) ProtoReflect() protoreflect.Message { + mi := &file_controller_servers_services_v1_session_service_proto_msgTypes[0] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use GetSessionRequest.ProtoReflect.Descriptor instead. +func (*GetSessionRequest) Descriptor() ([]byte, []int) { + return file_controller_servers_services_v1_session_service_proto_rawDescGZIP(), []int{0} +} + +func (x *GetSessionRequest) GetId() string { + if x != nil { + return x.Id + } + return "" +} + +// SessionResponse contains information necessary for a client to establish a session +type GetSessionResponse struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Session *sessions.Session `protobuf:"bytes,1,opt,name=session,proto3" json:"session,omitempty"` +} + +func (x *GetSessionResponse) Reset() { + *x = GetSessionResponse{} + if protoimpl.UnsafeEnabled { + mi := &file_controller_servers_services_v1_session_service_proto_msgTypes[1] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *GetSessionResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*GetSessionResponse) ProtoMessage() {} + +func (x *GetSessionResponse) ProtoReflect() protoreflect.Message { + mi := &file_controller_servers_services_v1_session_service_proto_msgTypes[1] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use GetSessionResponse.ProtoReflect.Descriptor instead. +func (*GetSessionResponse) Descriptor() ([]byte, []int) { + return file_controller_servers_services_v1_session_service_proto_rawDescGZIP(), []int{1} +} + +func (x *GetSessionResponse) GetSession() *sessions.Session { + if x != nil { + return x.Session + } + return nil +} + +var File_controller_servers_services_v1_session_service_proto protoreflect.FileDescriptor + +var file_controller_servers_services_v1_session_service_proto_rawDesc = []byte{ + 0x0a, 0x34, 0x63, 0x6f, 0x6e, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x65, 0x72, 0x2f, 0x73, 0x65, 0x72, + 0x76, 0x65, 0x72, 0x73, 0x2f, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x73, 0x2f, 0x76, 0x31, + 0x2f, 0x73, 0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x5f, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, + 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x1e, 0x63, 0x6f, 0x6e, 0x74, 0x72, 0x6f, 0x6c, 0x6c, + 0x65, 0x72, 0x2e, 0x73, 0x65, 0x72, 0x76, 0x65, 0x72, 0x73, 0x2e, 0x73, 0x65, 0x72, 0x76, 0x69, + 0x63, 0x65, 0x73, 0x2e, 0x76, 0x31, 0x1a, 0x1f, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2f, 0x70, + 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2f, 0x74, 0x69, 0x6d, 0x65, 0x73, 0x74, 0x61, 0x6d, + 0x70, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x23, 0x63, 0x6f, 0x6e, 0x74, 0x72, 0x6f, 0x6c, + 0x6c, 0x65, 0x72, 0x2f, 0x73, 0x65, 0x72, 0x76, 0x65, 0x72, 0x73, 0x2f, 0x76, 0x31, 0x2f, 0x73, + 0x65, 0x72, 0x76, 0x65, 0x72, 0x73, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x32, 0x63, 0x6f, + 0x6e, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x65, 0x72, 0x2f, 0x61, 0x70, 0x69, 0x2f, 0x72, 0x65, 0x73, + 0x6f, 0x75, 0x72, 0x63, 0x65, 0x73, 0x2f, 0x73, 0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x73, 0x2f, + 0x76, 0x31, 0x2f, 0x73, 0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, + 0x22, 0x23, 0x0a, 0x11, 0x47, 0x65, 0x74, 0x53, 0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x52, 0x65, + 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x0e, 0x0a, 0x02, 0x69, 0x64, 0x18, 0x0a, 0x20, 0x01, 0x28, + 0x09, 0x52, 0x02, 0x69, 0x64, 0x22, 0x5d, 0x0a, 0x12, 0x47, 0x65, 0x74, 0x53, 0x65, 0x73, 0x73, + 0x69, 0x6f, 0x6e, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x47, 0x0a, 0x07, 0x73, + 0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x2d, 0x2e, 0x63, + 0x6f, 0x6e, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x65, 0x72, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x72, 0x65, + 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x73, 0x2e, 0x73, 0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x73, + 0x2e, 0x76, 0x31, 0x2e, 0x53, 0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x52, 0x07, 0x73, 0x65, 0x73, + 0x73, 0x69, 0x6f, 0x6e, 0x32, 0x87, 0x01, 0x0a, 0x0e, 0x53, 0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e, + 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x12, 0x75, 0x0a, 0x0a, 0x47, 0x65, 0x74, 0x53, 0x65, + 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x12, 0x31, 0x2e, 0x63, 0x6f, 0x6e, 0x74, 0x72, 0x6f, 0x6c, 0x6c, + 0x65, 0x72, 0x2e, 0x73, 0x65, 0x72, 0x76, 0x65, 0x72, 0x73, 0x2e, 0x73, 0x65, 0x72, 0x76, 0x69, + 0x63, 0x65, 0x73, 0x2e, 0x76, 0x31, 0x2e, 0x47, 0x65, 0x74, 0x53, 0x65, 0x73, 0x73, 0x69, 0x6f, + 0x6e, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x32, 0x2e, 0x63, 0x6f, 0x6e, 0x74, 0x72, + 0x6f, 0x6c, 0x6c, 0x65, 0x72, 0x2e, 0x73, 0x65, 0x72, 0x76, 0x65, 0x72, 0x73, 0x2e, 0x73, 0x65, + 0x72, 0x76, 0x69, 0x63, 0x65, 0x73, 0x2e, 0x76, 0x31, 0x2e, 0x47, 0x65, 0x74, 0x53, 0x65, 0x73, + 0x73, 0x69, 0x6f, 0x6e, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x00, 0x42, 0x51, + 0x5a, 0x4f, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x68, 0x61, 0x73, + 0x68, 0x69, 0x63, 0x6f, 0x72, 0x70, 0x2f, 0x62, 0x6f, 0x75, 0x6e, 0x64, 0x61, 0x72, 0x79, 0x2f, + 0x69, 0x6e, 0x74, 0x65, 0x72, 0x6e, 0x61, 0x6c, 0x2f, 0x67, 0x65, 0x6e, 0x2f, 0x63, 0x6f, 0x6e, + 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x65, 0x72, 0x2f, 0x73, 0x65, 0x72, 0x76, 0x65, 0x72, 0x73, 0x2f, + 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x73, 0x3b, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, + 0x73, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, +} + +var ( + file_controller_servers_services_v1_session_service_proto_rawDescOnce sync.Once + file_controller_servers_services_v1_session_service_proto_rawDescData = file_controller_servers_services_v1_session_service_proto_rawDesc +) + +func file_controller_servers_services_v1_session_service_proto_rawDescGZIP() []byte { + file_controller_servers_services_v1_session_service_proto_rawDescOnce.Do(func() { + file_controller_servers_services_v1_session_service_proto_rawDescData = protoimpl.X.CompressGZIP(file_controller_servers_services_v1_session_service_proto_rawDescData) + }) + return file_controller_servers_services_v1_session_service_proto_rawDescData +} + +var file_controller_servers_services_v1_session_service_proto_msgTypes = make([]protoimpl.MessageInfo, 2) +var file_controller_servers_services_v1_session_service_proto_goTypes = []interface{}{ + (*GetSessionRequest)(nil), // 0: controller.servers.services.v1.GetSessionRequest + (*GetSessionResponse)(nil), // 1: controller.servers.services.v1.GetSessionResponse + (*sessions.Session)(nil), // 2: controller.api.resources.sessions.v1.Session +} +var file_controller_servers_services_v1_session_service_proto_depIdxs = []int32{ + 2, // 0: controller.servers.services.v1.GetSessionResponse.session:type_name -> controller.api.resources.sessions.v1.Session + 0, // 1: controller.servers.services.v1.SessionService.GetSession:input_type -> controller.servers.services.v1.GetSessionRequest + 1, // 2: controller.servers.services.v1.SessionService.GetSession:output_type -> controller.servers.services.v1.GetSessionResponse + 2, // [2:3] is the sub-list for method output_type + 1, // [1:2] is the sub-list for method input_type + 1, // [1:1] is the sub-list for extension type_name + 1, // [1:1] is the sub-list for extension extendee + 0, // [0:1] is the sub-list for field type_name +} + +func init() { file_controller_servers_services_v1_session_service_proto_init() } +func file_controller_servers_services_v1_session_service_proto_init() { + if File_controller_servers_services_v1_session_service_proto != nil { + return + } + if !protoimpl.UnsafeEnabled { + file_controller_servers_services_v1_session_service_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*GetSessionRequest); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_controller_servers_services_v1_session_service_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*GetSessionResponse); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + } + type x struct{} + out := protoimpl.TypeBuilder{ + File: protoimpl.DescBuilder{ + GoPackagePath: reflect.TypeOf(x{}).PkgPath(), + RawDescriptor: file_controller_servers_services_v1_session_service_proto_rawDesc, + NumEnums: 0, + NumMessages: 2, + NumExtensions: 0, + NumServices: 1, + }, + GoTypes: file_controller_servers_services_v1_session_service_proto_goTypes, + DependencyIndexes: file_controller_servers_services_v1_session_service_proto_depIdxs, + MessageInfos: file_controller_servers_services_v1_session_service_proto_msgTypes, + }.Build() + File_controller_servers_services_v1_session_service_proto = out.File + file_controller_servers_services_v1_session_service_proto_rawDesc = nil + file_controller_servers_services_v1_session_service_proto_goTypes = nil + file_controller_servers_services_v1_session_service_proto_depIdxs = nil +} + +// Reference imports to suppress errors if they are not otherwise used. +var _ context.Context +var _ grpc.ClientConnInterface + +// This is a compile-time assertion to ensure that this generated file +// is compatible with the grpc package it is being compiled against. +const _ = grpc.SupportPackageIsVersion6 + +// SessionServiceClient is the client API for SessionService service. +// +// For semantics around ctx use and closing/ending streaming RPCs, please refer to https://godoc.org/google.golang.org/grpc#ClientConn.NewStream. +type SessionServiceClient interface { + // Validate session allows a worker to retrieve session information from the controller. + // This endpoint validates the session + GetSession(ctx context.Context, in *GetSessionRequest, opts ...grpc.CallOption) (*GetSessionResponse, error) +} + +type sessionServiceClient struct { + cc grpc.ClientConnInterface +} + +func NewSessionServiceClient(cc grpc.ClientConnInterface) SessionServiceClient { + return &sessionServiceClient{cc} +} + +func (c *sessionServiceClient) GetSession(ctx context.Context, in *GetSessionRequest, opts ...grpc.CallOption) (*GetSessionResponse, error) { + out := new(GetSessionResponse) + err := c.cc.Invoke(ctx, "/controller.servers.services.v1.SessionService/GetSession", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +// SessionServiceServer is the server API for SessionService service. +type SessionServiceServer interface { + // Validate session allows a worker to retrieve session information from the controller. + // This endpoint validates the session + GetSession(context.Context, *GetSessionRequest) (*GetSessionResponse, error) +} + +// UnimplementedSessionServiceServer can be embedded to have forward compatible implementations. +type UnimplementedSessionServiceServer struct { +} + +func (*UnimplementedSessionServiceServer) GetSession(context.Context, *GetSessionRequest) (*GetSessionResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method GetSession not implemented") +} + +func RegisterSessionServiceServer(s *grpc.Server, srv SessionServiceServer) { + s.RegisterService(&_SessionService_serviceDesc, srv) +} + +func _SessionService_GetSession_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(GetSessionRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(SessionServiceServer).GetSession(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/controller.servers.services.v1.SessionService/GetSession", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(SessionServiceServer).GetSession(ctx, req.(*GetSessionRequest)) + } + return interceptor(ctx, in, info, handler) +} + +var _SessionService_serviceDesc = grpc.ServiceDesc{ + ServiceName: "controller.servers.services.v1.SessionService", + HandlerType: (*SessionServiceServer)(nil), + Methods: []grpc.MethodDesc{ + { + MethodName: "GetSession", + Handler: _SessionService_GetSession_Handler, + }, + }, + Streams: []grpc.StreamDesc{}, + Metadata: "controller/servers/services/v1/session_service.proto", +} diff --git a/internal/proto/local/controller/api/resources/sessions/v1/session.proto b/internal/proto/local/controller/api/resources/sessions/v1/session.proto new file mode 100644 index 0000000000..8d6f22ac67 --- /dev/null +++ b/internal/proto/local/controller/api/resources/sessions/v1/session.proto @@ -0,0 +1,70 @@ +syntax = "proto3"; + +package controller.api.resources.sessions.v1; + +option go_package = "github.com/hashicorp/boundary/internal/gen/controller/api/resources/sessions;sessions"; + +import "google/protobuf/timestamp.proto"; +import "google/protobuf/wrappers.proto"; +import "google/protobuf/struct.proto"; +import "controller/api/resources/scopes/v1/scope.proto"; +import "controller/custom_options/v1/options.proto"; + + +message WorkerInfo { + // The address of the worker + string address = 10; +} + +// Session contains all fields related to a Session resource +message Session { + // The ID of the resource + // Output only. + string id = 10; + + // The id of the parent of this resource. This must be defined for creation of this resource, but is otherwise + // read only. + string target_id = 20 [json_name="target_id"]; + + // Scope information for this resource + // Output only. + resources.scopes.v1.ScopeInfo scope = 30; + + // The time this resource was created + // Output only. + google.protobuf.Timestamp created_time = 40 [json_name="created_time"]; + + // The time this resource was last updated. + // Output only. + google.protobuf.Timestamp updated_time = 50 [json_name="updated_time"]; + + // After this time the connection will be expired, e.g. forcefully terminated + google.protobuf.Timestamp expiration_time = 60 [json_name="expiration_time"]; + + // The version can be used in subsequent write requests to ensure this + // resource has not changed and to fail the write if it has. + uint32 version = 70; + + // Type of the session (e.g. tcp, ssh, etc.) + string type = 80; + + // The ID of the user that requested the session + string user_id = 90 [json_name="user_id"]; + + string host_id = 100 [json_name="host_id"]; + + string scope_id = 110 [json_name="scope_id"]; + + // The certificate to use when connecting (or if using custom certs, to + // serve as the "login"). Raw DER bytes. + bytes certificate = 120; + + // The private key to use when connecting (or if using custom certs, to pass + // as the "password"). + bytes private_key = 130 [json_name="private_key"]; + + string endpoint = 140; + + // Worker information. The first worker in the slice should be prioritized. + repeated WorkerInfo worker_info = 150 [json_name="worker_info"]; +} diff --git a/internal/proto/local/controller/api/services/v1/worker_service.proto b/internal/proto/local/controller/api/services/v1/worker_service.proto deleted file mode 100644 index 7a805f489b..0000000000 --- a/internal/proto/local/controller/api/services/v1/worker_service.proto +++ /dev/null @@ -1,77 +0,0 @@ -syntax = "proto3"; - -package controller.api.services.v1; - -option go_package = "github.com/hashicorp/boundary/internal/gen/controller/api/services;services"; - -import "google/protobuf/timestamp.proto"; -import "controller/servers/v1/servers.proto"; - -service WorkerService { - rpc Status(StatusRequest) returns (StatusResponse) {} - rpc ValidateSession(ValidateSessionRequest) returns (ValidateSessionResponse) {} -} - -message StatusRequest { - // The worker info. We could use information from the TLS connection but this - // is easier and going the other route doesn't provide much benefit -- if you - // get access to the key and spoof the connection, you're already compromised. - servers.v1.Server worker = 10; - - // Jobs currently active on this worker. - repeated string active_job_ids = 20; -} - -message StatusResponse { - // Active controllers. This can be used (eventually) for conneciton - // management. - repeated servers.v1.Server controllers = 10; - - // Jobs that should be canceled: ones assigned to this worker that have been - // reported as active but are in canceling state in the database. Once the - // worker cancels the job, it will no longer show up in active_jobs in the - // next heartbeat, and we can move the job to canceled state. - repeated string cancel_job_ids = 20; -} - -message ValidateSessionRequest { - // The session ID from the client - string id = 10; -} - -// SessionResponse contains information necessary for a client to establish a session -message ValidateSessionResponse { - // ID of the session job - string id = 10; - - // The scope the job was created in - string scope_id = 20; - - // The ID of the user that requested the session - string user_id = 30; - - // Type of the session (e.g. tcp, ssh, etc.) - string type = 40; - - // The endpoint to connect to, in a manner that makes sense for the type - string endpoint = 50; - - // The certificate to use when connecting (or if using custom certs, to - // serve as the "login"). Raw DER bytes. - bytes certificate = 60; - - // The private key to use when connecting (or if using custom certs, to pass - // as the "password"). - bytes private_key = 70; - - // After this time the connection will be expired, e.g. forcefully terminated - google.protobuf.Timestamp expiration_time = 80; - - // Worker information. The first worker in the slice should be prioritized. - repeated WorkerInfo worker_info = 90; -} - -message WorkerInfo { - // The address of the worker - string address = 10; -} \ No newline at end of file diff --git a/internal/proto/local/controller/servers/services/v1/server_coordination_service.proto b/internal/proto/local/controller/servers/services/v1/server_coordination_service.proto new file mode 100644 index 0000000000..abcc6df0b6 --- /dev/null +++ b/internal/proto/local/controller/servers/services/v1/server_coordination_service.proto @@ -0,0 +1,84 @@ +syntax = "proto3"; + +package controller.servers.services.v1; + +option go_package = "github.com/hashicorp/boundary/internal/gen/controller/servers/services;services"; + +import "google/protobuf/timestamp.proto"; +import "controller/servers/v1/servers.proto"; + +service ServerCoordinationService { + // Status gets worker status requests which include the ongoing jobs the worker is handling and + // returns the status response which includes the changes the controller would like to make to + // jobs as well as provide a list of the controllers in the system. + rpc Status(StatusRequest) returns (StatusResponse) {} +} + +message Connection { + // TODO: Populate the connection specific info. + // byte up/down + // duration + // etc... +} + +message SessionJobInfo { + repeated Connection connections = 1; +} + +message Job { + string job_id = 1; + enum JOBTYPE { + JOBTYPE_UNSPECIFIED = 0; + JOBTYPE_SESSION = 1; + } + JOBTYPE type = 2; + oneof job_info { + // This value is specified when type is JOBTYPE_SESSION. + SessionJobInfo session_info = 3; + } +} + +message JobStatus { + enum STATUS { + // TODO: Get a better picture of what states general jobs can be in. + STATUS_UNSPECIFIED = 0; + // Specifies that the job is actively being handled by the worker. + STATUS_ACTIVE = 1; + STATUS_CANCELLED = 2; + STATUS_COMPLETED = 3; + } + Job job = 1; + STATUS status = 3; +} + +message StatusRequest { + // The worker info. We could use information from the TLS connection but this + // is easier and going the other route doesn't provide much benefit -- if you + // get access to the key and spoof the connection, you're already compromised. + servers.v1.Server worker = 10; + + // Jobs which this worker wants to report the status. + repeated JobStatus jobs = 20; +} + +message JobChangeRequest { + enum CHANGETYPE { + CHANGETYPE_UNSPECIFIED = 0; + // Indicates that the job should be cancelled on the worker. + CHANGETYPE_CANCEL = 1; + } + Job job = 1; + CHANGETYPE request_type = 2; +} + +message StatusResponse { + // Active controllers. This can be used (eventually) for connection + // management. + repeated servers.v1.Server controllers = 10; + + // List of jobs and the expected state changes. For example, this will include jobs witch + // change type of cancelled for jobs which are active on a worker but should be cancelled. + // This could also contain a request to start a job such as a worker -> worker proxy for + // establishing a session through an enclave. + repeated JobChangeRequest jobs_requests = 20; +} diff --git a/internal/proto/local/controller/servers/services/v1/session_service.proto b/internal/proto/local/controller/servers/services/v1/session_service.proto new file mode 100644 index 0000000000..e69d9d6494 --- /dev/null +++ b/internal/proto/local/controller/servers/services/v1/session_service.proto @@ -0,0 +1,25 @@ +syntax = "proto3"; + +package controller.servers.services.v1; + +option go_package = "github.com/hashicorp/boundary/internal/gen/controller/servers/services;services"; + +import "google/protobuf/timestamp.proto"; +import "controller/servers/v1/servers.proto"; +import "controller/api/resources/sessions/v1/session.proto"; + +service SessionService { + // Validate session allows a worker to retrieve session information from the controller. + // This endpoint validates the session + rpc GetSession(GetSessionRequest) returns (GetSessionResponse) {} +} + +message GetSessionRequest { + // The session ID from the client + string id = 10; +} + +// SessionResponse contains information necessary for a client to establish a session +message GetSessionResponse { + api.resources.sessions.v1.Session session = 1; +} \ No newline at end of file diff --git a/internal/servers/controller/handler.go b/internal/servers/controller/handler.go index a184f2236d..a564d4870d 100644 --- a/internal/servers/controller/handler.go +++ b/internal/servers/controller/handler.go @@ -19,7 +19,9 @@ import ( "github.com/hashicorp/boundary/api" "github.com/hashicorp/boundary/globals" "github.com/hashicorp/boundary/internal/auth" + pb "github.com/hashicorp/boundary/internal/gen/controller/api/resources/sessions" "github.com/hashicorp/boundary/internal/gen/controller/api/services" + wpbs "github.com/hashicorp/boundary/internal/gen/controller/servers/services" "github.com/hashicorp/boundary/internal/kms" "github.com/hashicorp/boundary/internal/servers" "github.com/hashicorp/boundary/internal/servers/controller/handlers/accounts" @@ -342,7 +344,7 @@ func jobTestingHandler(c *Controller) http.Handler { } } - var workers []*services.WorkerInfo + var workers []*pb.WorkerInfo repo, err := c.ServersRepoFn() if err != nil { errorResp(err) @@ -354,7 +356,7 @@ func jobTestingHandler(c *Controller) http.Handler { return } for _, v := range servers { - workers = append(workers, &services.WorkerInfo{Address: v.Address}) + workers = append(workers, &pb.WorkerInfo{Address: v.Address}) } wrapper, err := c.kms.GetWrapper(r.Context(), scope.Global.String(), kms.KeyPurposeSessions) @@ -390,16 +392,18 @@ func jobTestingHandler(c *Controller) http.Handler { return } - ret := &services.ValidateSessionResponse{ - Id: jobId, - ScopeId: scope.Global.String(), - UserId: "u_1234567890", - Type: "tcp", - Endpoint: endpoint, - Certificate: certBytes, - PrivateKey: privKey, - WorkerInfo: workers, - ExpirationTime: ×tamppb.Timestamp{Seconds: time.Now().Add(timeout).Unix()}, + ret := &wpbs.GetSessionResponse{ + Session: &pb.Session{ + Id: jobId, + ScopeId: scope.Global.String(), + UserId: "u_1234567890", + Type: "tcp", + Endpoint: endpoint, + Certificate: certBytes, + PrivateKey: privKey, + WorkerInfo: workers, + ExpirationTime: ×tamppb.Timestamp{Seconds: time.Now().Add(timeout).Unix()}, + }, } marshaled, err := proto.Marshal(ret) @@ -413,8 +417,8 @@ func jobTestingHandler(c *Controller) http.Handler { return } - ret.PrivateKey = nil - c.jobMap.Store(jobId, ret) + ret.Session.PrivateKey = nil + c.jobMap.Store(jobId, ret.GetSession()) }) } diff --git a/internal/servers/controller/handlers/workers/worker_service.go b/internal/servers/controller/handlers/workers/worker_service.go index cac841ad58..20c405ddbe 100644 --- a/internal/servers/controller/handlers/workers/worker_service.go +++ b/internal/servers/controller/handlers/workers/worker_service.go @@ -5,7 +5,8 @@ import ( "sync" "time" - pbs "github.com/hashicorp/boundary/internal/gen/controller/api/services" + pb "github.com/hashicorp/boundary/internal/gen/controller/api/resources/sessions" + pbs "github.com/hashicorp/boundary/internal/gen/controller/servers/services" "github.com/hashicorp/boundary/internal/kms" "github.com/hashicorp/boundary/internal/servers/controller/common" "github.com/hashicorp/boundary/internal/sessions" @@ -35,8 +36,11 @@ func NewWorkerServiceServer(logger hclog.Logger, repoFn common.ServersRepoFactor } } +var _ pbs.SessionServiceServer = &workerServiceServer{} +var _ pbs.ServerCoordinationServiceServer = &workerServiceServer{} + func (ws *workerServiceServer) Status(ctx context.Context, req *pbs.StatusRequest) (*pbs.StatusResponse, error) { - ws.logger.Trace("got status request from worker", "name", req.Worker.Name, "address", req.Worker.Address, "active_jobs", req.ActiveJobIds) + ws.logger.Trace("got status request from worker", "name", req.Worker.Name, "address", req.Worker.Address, "jobs", req.GetJobs()) ws.updateTimes.Store(req.Worker.Name, time.Now()) repo, err := ws.repoFn() if err != nil { @@ -53,41 +57,47 @@ func (ws *workerServiceServer) Status(ctx context.Context, req *pbs.StatusReques Controllers: controllers, } ws.jobCancelMap.Range(func(key, value interface{}) bool { - ret.CancelJobIds = append(ret.CancelJobIds, key.(string)) + ret.JobsRequests = append(ret.JobsRequests, &pbs.JobChangeRequest{ + Job: &pbs.Job{ + JobId: key.(string), + Type: pbs.Job_JOBTYPE_SESSION, + }, + RequestType: 0, + }) return true }) - for _, id := range ret.CancelJobIds { - ws.jobCancelMap.Delete(id) + for _, j := range ret.JobsRequests { + ws.jobCancelMap.Delete(j.GetJob().GetJobId()) } return ret, nil } -func (ws *workerServiceServer) ValidateSession(ctx context.Context, req *pbs.ValidateSessionRequest) (*pbs.ValidateSessionResponse, error) { +func (ws *workerServiceServer) GetSession(ctx context.Context, req *pbs.GetSessionRequest) (*pbs.GetSessionResponse, error) { ws.logger.Trace("got validate session request from worker", "job_id", req.GetId()) // Look up the job info storedSessionInfo, loaded := ws.jobMap.LoadAndDelete(req.GetId()) if !loaded { - return &pbs.ValidateSessionResponse{}, status.Errorf(codes.PermissionDenied, "Unknown job ID: %v", req.GetId()) + return nil, status.Errorf(codes.PermissionDenied, "Unknown job ID: %v", req.GetId()) } - sessionInfo := storedSessionInfo.(*pbs.ValidateSessionResponse) + sessionInfo := storedSessionInfo.(*pb.Session) wrapper, err := ws.kms.GetWrapper(ctx, sessionInfo.ScopeId, kms.KeyPurposeSessions) if err != nil { - return &pbs.ValidateSessionResponse{}, status.Errorf(codes.Internal, "Error getting sessions wrapper: %v", err) + return nil, status.Errorf(codes.Internal, "Error getting sessions wrapper: %v", err) } // Derive the private key, which should match. Deriving on both ends allows // us to not store it in the DB. _, privKey, err := sessions.DeriveED25519Key(wrapper, sessionInfo.GetUserId(), req.GetId()) if err != nil { - return &pbs.ValidateSessionResponse{}, status.Errorf(codes.Internal, "Error deriving session key: %v", err) + return nil, status.Errorf(codes.Internal, "Error deriving session key: %v", err) } if sessionInfo.ExpirationTime.GetSeconds() > 0 { timeDiff := time.Until(sessionInfo.GetExpirationTime().AsTime()) if timeDiff < 0 { - return &pbs.ValidateSessionResponse{}, status.Errorf(codes.OutOfRange, "Session has already expired") + return nil, status.Errorf(codes.OutOfRange, "Session has already expired") } defer func() { time.AfterFunc(timeDiff, func() { @@ -97,5 +107,5 @@ func (ws *workerServiceServer) ValidateSession(ctx context.Context, req *pbs.Val } sessionInfo.PrivateKey = privKey - return sessionInfo, nil + return &pbs.GetSessionResponse{Session: sessionInfo}, nil } diff --git a/internal/servers/controller/listeners.go b/internal/servers/controller/listeners.go index 3b71cae0f4..249942c6ca 100644 --- a/internal/servers/controller/listeners.go +++ b/internal/servers/controller/listeners.go @@ -12,7 +12,7 @@ import ( "time" "github.com/hashicorp/boundary/internal/cmd/base" - "github.com/hashicorp/boundary/internal/gen/controller/api/services" + pbs "github.com/hashicorp/boundary/internal/gen/controller/servers/services" "github.com/hashicorp/boundary/internal/servers/controller/handlers/workers" "github.com/hashicorp/go-alpnmux" "github.com/hashicorp/go-multierror" @@ -120,7 +120,9 @@ func (c *Controller) startListeners() error { grpc.MaxRecvMsgSize(math.MaxInt32), grpc.MaxSendMsgSize(math.MaxInt32), ) - services.RegisterWorkerServiceServer(workerServer, workers.NewWorkerServiceServer(c.logger.Named("worker-handler"), c.ServersRepoFn, c.workerStatusUpdateTimes, c.kms, c.jobMap)) + workerService := workers.NewWorkerServiceServer(c.logger.Named("worker-handler"), c.ServersRepoFn, c.workerStatusUpdateTimes, c.kms, c.jobMap) + pbs.RegisterServerCoordinationServiceServer(workerServer, workerService) + pbs.RegisterSessionServiceServer(workerServer, workerService) interceptor := newInterceptingListener(c, l) ln.ALPNListener = interceptor diff --git a/internal/servers/worker/controller_connection.go b/internal/servers/worker/controller_connection.go index 684510dfb2..7328c78d12 100644 --- a/internal/servers/worker/controller_connection.go +++ b/internal/servers/worker/controller_connection.go @@ -19,7 +19,7 @@ import ( "time" "github.com/hashicorp/boundary/internal/cmd/base" - "github.com/hashicorp/boundary/internal/gen/controller/api/services" + pbs "github.com/hashicorp/boundary/internal/gen/controller/servers/services" "github.com/hashicorp/vault/sdk/helper/base62" "google.golang.org/grpc" "google.golang.org/grpc/resolver" @@ -111,7 +111,7 @@ func (w *Worker) createClientConn(addr string) error { return fmt.Errorf("error dialing controller for worker auth: %w", err) } - client := services.NewWorkerServiceClient(cc) + client := pbs.NewServerCoordinationServiceClient(cc) w.controllerConn.Store(client) w.logger.Info("connected to controller", "address", addr) diff --git a/internal/servers/worker/handler.go b/internal/servers/worker/handler.go index 81b647811d..6d42bd95b4 100644 --- a/internal/servers/worker/handler.go +++ b/internal/servers/worker/handler.go @@ -6,7 +6,7 @@ import ( "time" "github.com/hashicorp/boundary/globals" - "github.com/hashicorp/boundary/internal/gen/controller/api/services" + pb "github.com/hashicorp/boundary/internal/gen/controller/api/resources/sessions" "github.com/hashicorp/boundary/internal/proxy" "github.com/hashicorp/shared-secure-libs/configutil" "nhooyr.io/websocket" @@ -45,7 +45,7 @@ func (w *Worker) handleProxy() http.HandlerFunc { wr.WriteHeader(http.StatusInternalServerError) return } - jobInfo := jobInfoRaw.(*services.ValidateSessionResponse) + jobInfo := jobInfoRaw.(*pb.Session) opts := &websocket.AcceptOptions{ Subprotocols: []string{globals.TcpProxyV1}, diff --git a/internal/servers/worker/job.go b/internal/servers/worker/job.go index 317b00d66f..bd0a3eb983 100644 --- a/internal/servers/worker/job.go +++ b/internal/servers/worker/job.go @@ -10,7 +10,7 @@ import ( "strings" "time" - "github.com/hashicorp/boundary/internal/gen/controller/api/services" + pbs "github.com/hashicorp/boundary/internal/gen/controller/servers/services" ) const ( @@ -30,7 +30,7 @@ func (w *Worker) getJobTls(hello *tls.ClientHelloInfo) (*tls.Config, error) { if rawConn == nil { return nil, errors.New("could not get a controller client") } - conn, ok := rawConn.(services.WorkerServiceClient) + conn, ok := rawConn.(pbs.SessionServiceClient) if !ok { return nil, errors.New("could not cast atomic controller client to the real thing") } @@ -41,14 +41,14 @@ func (w *Worker) getJobTls(hello *tls.ClientHelloInfo) (*tls.Config, error) { timeoutContext, cancel := context.WithTimeout(w.baseContext, validateSessionTimeout) defer cancel() - resp, err := conn.ValidateSession(timeoutContext, &services.ValidateSessionRequest{ + resp, err := conn.GetSession(timeoutContext, &pbs.GetSessionRequest{ Id: jobId, }) if err != nil { return nil, fmt.Errorf("error validating session: %w", err) } - parsedCert, err := x509.ParseCertificate(resp.GetCertificate()) + parsedCert, err := x509.ParseCertificate(resp.GetSession().GetCertificate()) if err != nil { return nil, fmt.Errorf("error parsing session certificate: %w", err) } @@ -63,8 +63,8 @@ func (w *Worker) getJobTls(hello *tls.ClientHelloInfo) (*tls.Config, error) { tlsConf := &tls.Config{ Certificates: []tls.Certificate{ { - Certificate: [][]byte{resp.GetCertificate()}, - PrivateKey: ed25519.PrivateKey(resp.GetPrivateKey()), + Certificate: [][]byte{resp.GetSession().GetCertificate()}, + PrivateKey: ed25519.PrivateKey(resp.GetSession().GetPrivateKey()), Leaf: parsedCert, }, }, diff --git a/internal/servers/worker/status.go b/internal/servers/worker/status.go index 91515790c6..1e83cd6268 100644 --- a/internal/servers/worker/status.go +++ b/internal/servers/worker/status.go @@ -5,8 +5,7 @@ import ( "math/rand" "time" - "github.com/hashicorp/boundary/internal/gen/controller/api/services" - pbs "github.com/hashicorp/boundary/internal/gen/controller/api/services" + pbs "github.com/hashicorp/boundary/internal/gen/controller/servers/services" "github.com/hashicorp/boundary/internal/servers" "github.com/hashicorp/boundary/internal/types/resource" "google.golang.org/grpc/resolver" @@ -46,14 +45,17 @@ func (w *Worker) startStatusTicking(cancelCtx context.Context) { return case <-timer.C: - var activeJobs []string + var activeJobs []*pbs.JobStatus w.cancellationMap.Range(func(key, value interface{}) bool { - activeJobs = append(activeJobs, key.(string)) + activeJobs = append(activeJobs, &pbs.JobStatus{ + Job: &pbs.Job{JobId: key.(string)}, + Status: pbs.JobStatus_STATUS_ACTIVE, + }) return true }) - client := w.controllerConn.Load().(services.WorkerServiceClient) + client := w.controllerConn.Load().(pbs.ServerCoordinationServiceClient) result, err := client.Status(cancelCtx, &pbs.StatusRequest{ - ActiveJobIds: activeJobs, + Jobs: activeJobs, Worker: &servers.Server{ PrivateId: w.conf.RawConfig.Worker.Name, Name: w.conf.RawConfig.Worker.Name, @@ -76,7 +78,7 @@ func (w *Worker) startStatusTicking(cancelCtx context.Context) { w.logger.Trace("found controllers", "addresses", strAddrs) w.lastStatusSuccess.Store(&LastStatusInformation{StatusResponse: result, StatusTime: time.Now()}) - for _, id := range result.GetCancelJobIds() { + for _, id := range result.GetJobsRequests() { if cancel, ok := w.cancellationMap.LoadAndDelete(id); ok { cancel.(context.CancelFunc)() w.logger.Info("canceled job", "job_id", id) diff --git a/internal/servers/worker/tcp_proxy.go b/internal/servers/worker/tcp_proxy.go index fc61808950..086c59aee4 100644 --- a/internal/servers/worker/tcp_proxy.go +++ b/internal/servers/worker/tcp_proxy.go @@ -6,11 +6,11 @@ import ( "net" "sync" - "github.com/hashicorp/boundary/internal/gen/controller/api/services" + pb "github.com/hashicorp/boundary/internal/gen/controller/api/resources/sessions" "nhooyr.io/websocket" ) -func (w *Worker) handleTcpProxyV1(jobCtx context.Context, conn *websocket.Conn, jobInfo *services.ValidateSessionResponse) { +func (w *Worker) handleTcpProxyV1(jobCtx context.Context, conn *websocket.Conn, jobInfo *pb.Session) { remoteConn, err := net.Dial("tcp", jobInfo.Endpoint) if err != nil { w.logger.Error("error dialing endpoint", "error", err, "endpoint", jobInfo.Endpoint)