diff --git a/.editorconfig b/.editorconfig index 8705ef086..294754154 100644 --- a/.editorconfig +++ b/.editorconfig @@ -1,15 +1,15 @@ root = true [*] -insert_final_newline = true charset = utf-8 -trim_trailing_whitespace = true -indent_style = space indent_size = 2 +indent_style = space +insert_final_newline = true +trim_trailing_whitespace = true [{Makefile,go.mod,go.sum,*.go,.gitmodules,*.sh}] -indent_style = tab indent_size = 8 +indent_style = tab [*.md] indent_size = 4 diff --git a/protos/hardware/hardware.proto b/protos/hardware/hardware.proto index c5a744e64..d5a7d2461 100644 --- a/protos/hardware/hardware.proto +++ b/protos/hardware/hardware.proto @@ -16,127 +16,127 @@ import "google/api/annotations.proto"; // Read access to individual hardware profiles is provided through the unique // ID, MAC, and IP hardware properties. service HardwareService { - // Push adds a new Hardware profile to the data store. - rpc Push (PushRequest) returns (Empty) { - option (google.api.http) = { - post: "/v1/hardware" - body: "*" - }; - }; - - // ByMac returns the Hardware with the given hardware MAC Address. - rpc ByMAC(GetRequest) returns (Hardware) { - option (google.api.http) = { - post: "/v1/hardware/mac" - body: "*" - }; - }; - - // ByIP returns the Hardware with the given IP Address. - rpc ByIP(GetRequest) returns (Hardware) { - option (google.api.http) = { - post: "/v1/hardware/ip" - body: "*" - }; - }; - - // ByID returns the Hardware with the given ID. - rpc ByID(GetRequest) returns (Hardware) { - option (google.api.http) = { - get: "/v1/hardware/{id}" - }; - }; - - // All returns all of the Hardware profiles. - rpc All(Empty) returns (stream Hardware) { - option (google.api.http) = { - get: "/v1/hardware" - }; - }; - - // Watch watches for events on the given hardware and streams the matching Hardware. - rpc Watch(GetRequest) returns (stream Hardware); - - // Delete deletes the given hardware from the data store. - rpc Delete(DeleteRequest) returns (Empty) { + // Push adds a new Hardware profile to the data store. + rpc Push (PushRequest) returns (Empty) { option (google.api.http) = { - delete: "/v1/hardware/{id}" - }; + post: "/v1/hardware" + body: "*" + }; + }; + + // ByMac returns the Hardware with the given hardware MAC Address. + rpc ByMAC(GetRequest) returns (Hardware) { + option (google.api.http) = { + post: "/v1/hardware/mac" + body: "*" + }; + }; + + // ByIP returns the Hardware with the given IP Address. + rpc ByIP(GetRequest) returns (Hardware) { + option (google.api.http) = { + post: "/v1/hardware/ip" + body: "*" + }; + }; + + // ByID returns the Hardware with the given ID. + rpc ByID(GetRequest) returns (Hardware) { + option (google.api.http) = { + get: "/v1/hardware/{id}" + }; + }; + + // All returns all of the Hardware profiles. + rpc All(Empty) returns (stream Hardware) { + option (google.api.http) = { + get: "/v1/hardware" + }; + }; + + // Watch watches for events on the given hardware and streams the matching Hardware. + rpc Watch(GetRequest) returns (stream Hardware); + + // Delete deletes the given hardware from the data store. + rpc Delete(DeleteRequest) returns (Empty) { + option (google.api.http) = { + delete: "/v1/hardware/{id}" + }; }; } message PushRequest { - Hardware data = 1; + Hardware data = 1; } message Empty { } message GetRequest { - string mac = 1; - string ip = 2; - string id = 3; + string mac = 1; + string ip = 2; + string id = 3; } message Hardware { - message DHCP { - message IP { - string address = 1; - string netmask = 2; - string gateway = 3; - int64 family = 4; - } - string mac = 1; - reserved 2; // obsolete ip - string hostname = 3; - int64 lease_time = 4; - repeated string name_servers = 5; - repeated string time_servers = 6; - reserved 7; // obsolete gateway - string arch = 8; - bool uefi = 9; - string iface_name = 10; - IP ip = 11; - } - message Netboot { - message IPXE { - string url = 1; - string contents = 2; - } - message Osie { - string base_url = 1; - string kernel = 2; - string initrd = 3; - } - - bool allow_pxe = 1; - bool allow_workflow = 2; - IPXE ipxe = 3; - reserved 4; // obsolete bootstrapper - Osie osie = 5; - } - message Network { - message Interface { - DHCP dhcp = 1; - Netboot netboot = 2; - } - reserved 1; // obsolete dhcp - reserved 2; // obsolete netboot - repeated Interface interfaces = 3; - reserved 4; // obsolete default - } - - reserved 1; // obsolete json - reserved 2; // obsolete dhcp - reserved 3; // obsolete netboot - reserved 4; // obsolete network - reserved 5; // obsolete metadata - Network network = 6; - string id = 7; - int64 version = 8; + message DHCP { + message IP { + string address = 1; + string netmask = 2; + string gateway = 3; + int64 family = 4; + } + string mac = 1; + reserved 2; // obsolete ip + string hostname = 3; + int64 lease_time = 4; + repeated string name_servers = 5; + repeated string time_servers = 6; + reserved 7; // obsolete gateway + string arch = 8; + bool uefi = 9; + string iface_name = 10; + IP ip = 11; + } + message Netboot { + message IPXE { + string url = 1; + string contents = 2; + } + message Osie { + string base_url = 1; + string kernel = 2; + string initrd = 3; + } + + bool allow_pxe = 1; + bool allow_workflow = 2; + IPXE ipxe = 3; + reserved 4; // obsolete bootstrapper + Osie osie = 5; + } + message Network { + message Interface { + DHCP dhcp = 1; + Netboot netboot = 2; + } + reserved 1; // obsolete dhcp + reserved 2; // obsolete netboot + repeated Interface interfaces = 3; + reserved 4; // obsolete default + } + + reserved 1; // obsolete json + reserved 2; // obsolete dhcp + reserved 3; // obsolete netboot + reserved 4; // obsolete network + reserved 5; // obsolete metadata + Network network = 6; + string id = 7; + int64 version = 8; string metadata = 9; } message DeleteRequest { - string id = 1; + string id = 1; } diff --git a/protos/template/template.proto b/protos/template/template.proto index db852f66c..9b66450cc 100644 --- a/protos/template/template.proto +++ b/protos/template/template.proto @@ -8,47 +8,47 @@ import "google/api/annotations.proto"; import "google/protobuf/timestamp.proto"; service Template { - rpc CreateTemplate(WorkflowTemplate) returns (CreateResponse) { - option (google.api.http) = { - post: "/v1/templates" - body: "*" - }; - }; - rpc GetTemplate(GetRequest) returns (WorkflowTemplate) { - option (google.api.http) = { - get: "/v1/templates/{id}" - }; - }; - rpc DeleteTemplate(GetRequest) returns (Empty) { - option (google.api.http) = { - delete: "/v1/templates/{id}" - }; - }; - rpc ListTemplates(Empty) returns (stream WorkflowTemplate) { - option (google.api.http) = { - get: "/v1/templates" - }; - }; - rpc UpdateTemplate(WorkflowTemplate) returns (Empty); + rpc CreateTemplate(WorkflowTemplate) returns (CreateResponse) { + option (google.api.http) = { + post: "/v1/templates" + body: "*" + }; + }; + rpc GetTemplate(GetRequest) returns (WorkflowTemplate) { + option (google.api.http) = { + get: "/v1/templates/{id}" + }; + }; + rpc DeleteTemplate(GetRequest) returns (Empty) { + option (google.api.http) = { + delete: "/v1/templates/{id}" + }; + }; + rpc ListTemplates(Empty) returns (stream WorkflowTemplate) { + option (google.api.http) = { + get: "/v1/templates" + }; + }; + rpc UpdateTemplate(WorkflowTemplate) returns (Empty); } message Empty { } message WorkflowTemplate { - string id = 1; - string name = 2; - reserved 3; // obsolete data - google.protobuf.Timestamp createdAt = 4; - google.protobuf.Timestamp updatedAt = 5; - google.protobuf.Timestamp deletedAt = 6; - string data = 7; + string id = 1; + string name = 2; + reserved 3; // obsolete data + google.protobuf.Timestamp createdAt = 4; + google.protobuf.Timestamp updatedAt = 5; + google.protobuf.Timestamp deletedAt = 6; + string data = 7; } message CreateResponse { - string id = 1; + string id = 1; } message GetRequest { - string id = 1; + string id = 1; } diff --git a/protos/workflow/workflow.proto b/protos/workflow/workflow.proto index b53898745..6a5ef90f6 100644 --- a/protos/workflow/workflow.proto +++ b/protos/workflow/workflow.proto @@ -8,154 +8,153 @@ import "google/api/annotations.proto"; import "google/protobuf/timestamp.proto"; service WorkflowSvc { - rpc CreateWorkflow(CreateRequest) returns (CreateResponse) { - option (google.api.http) = { - post: "/v1/workflows" - body: "*" - }; + rpc CreateWorkflow(CreateRequest) returns (CreateResponse) { + option (google.api.http) = { + post: "/v1/workflows" + body: "*" }; - rpc GetWorkflow(GetRequest) returns (Workflow) { - option (google.api.http) = { - get: "/v1/workflows/{id}" - }; + }; + rpc GetWorkflow(GetRequest) returns (Workflow) { + option (google.api.http) = { + get: "/v1/workflows/{id}" }; - rpc DeleteWorkflow(GetRequest) returns (Empty) { - option (google.api.http) = { - delete: "/v1/workflows/{id}" - }; + }; + rpc DeleteWorkflow(GetRequest) returns (Empty) { + option (google.api.http) = { + delete: "/v1/workflows/{id}" }; - rpc ListWorkflows(Empty) returns (stream Workflow) { - option (google.api.http) = { - get: "/v1/workflows" - }; + }; + rpc ListWorkflows(Empty) returns (stream Workflow) { + option (google.api.http) = { + get: "/v1/workflows" }; - - rpc GetWorkflowContext(GetRequest) returns (WorkflowContext) { - option (google.api.http) = { - get: "/v1/workflows/{id}/state" - }; + }; + rpc GetWorkflowContext(GetRequest) returns (WorkflowContext) { + option (google.api.http) = { + get: "/v1/workflows/{id}/state" }; - rpc ShowWorkflowEvents(GetRequest) returns (stream WorkflowActionStatus) { - option (google.api.http) = { - get: "/v1/workflows/{id}/events" - }; + }; + rpc ShowWorkflowEvents(GetRequest) returns (stream WorkflowActionStatus) { + option (google.api.http) = { + get: "/v1/workflows/{id}/events" }; + }; - rpc GetWorkflowContextList(WorkflowContextRequest) returns (WorkflowContextList) {} - rpc GetWorkflowContexts(WorkflowContextRequest) returns (stream WorkflowContext) {} - rpc GetWorkflowActions(WorkflowActionsRequest) returns (WorkflowActionList) {} - rpc ReportActionStatus(WorkflowActionStatus) returns (Empty) {} - rpc GetWorkflowData(GetWorkflowDataRequest) returns (GetWorkflowDataResponse) {} - rpc GetWorkflowMetadata(GetWorkflowDataRequest) returns (GetWorkflowDataResponse) {} - rpc GetWorkflowDataVersion(GetWorkflowDataRequest) returns (GetWorkflowDataResponse) {} - rpc UpdateWorkflowData(UpdateWorkflowDataRequest) returns (Empty) {} + rpc GetWorkflowContextList(WorkflowContextRequest) returns (WorkflowContextList) {} + rpc GetWorkflowContexts(WorkflowContextRequest) returns (stream WorkflowContext) {} + rpc GetWorkflowActions(WorkflowActionsRequest) returns (WorkflowActionList) {} + rpc ReportActionStatus(WorkflowActionStatus) returns (Empty) {} + rpc GetWorkflowData(GetWorkflowDataRequest) returns (GetWorkflowDataResponse) {} + rpc GetWorkflowMetadata(GetWorkflowDataRequest) returns (GetWorkflowDataResponse) {} + rpc GetWorkflowDataVersion(GetWorkflowDataRequest) returns (GetWorkflowDataResponse) {} + rpc UpdateWorkflowData(UpdateWorkflowDataRequest) returns (Empty) {} } message Empty { } message Workflow { - string id = 1; - string template = 2; - string hardware = 3; - State state = 4; - google.protobuf.Timestamp createdAt = 5; - google.protobuf.Timestamp updatedAt = 6; - google.protobuf.Timestamp deletedAt = 7; - string data = 8; + string id = 1; + string template = 2; + string hardware = 3; + State state = 4; + google.protobuf.Timestamp createdAt = 5; + google.protobuf.Timestamp updatedAt = 6; + google.protobuf.Timestamp deletedAt = 7; + string data = 8; } enum State { - PENDING = 0; - RUNNING = 1; - FAILED = 2; - TIMEOUT = 3; - SUCCESS = 4; + PENDING = 0; + RUNNING = 1; + FAILED = 2; + TIMEOUT = 3; + SUCCESS = 4; } message CreateRequest { - string template = 1; - string hardware = 2; + string template = 1; + string hardware = 2; } message CreateResponse { - string id = 1; + string id = 1; } message GetRequest { - string id = 1; + string id = 1; } enum ActionState { - ACTION_PENDING = 0; - ACTION_IN_PROGRESS = 1; - ACTION_SUCCESS = 2; - ACTION_FAILED = 3; - ACTION_TIMEOUT = 4; + ACTION_PENDING = 0; + ACTION_IN_PROGRESS = 1; + ACTION_SUCCESS = 2; + ACTION_FAILED = 3; + ACTION_TIMEOUT = 4; } message WorkflowContext { - string workflow_id = 1; - string current_worker = 2; - string current_task = 3; - string current_action = 4; - int64 current_action_index = 5; - ActionState current_action_state = 6; - int64 total_number_of_actions = 7; + string workflow_id = 1; + string current_worker = 2; + string current_task = 3; + string current_action = 4; + int64 current_action_index = 5; + ActionState current_action_state = 6; + int64 total_number_of_actions = 7; } message WorkflowActionStatus { - string workflow_id = 1; - string task_name = 2; - string action_name = 3; - ActionState action_status = 4; - int64 seconds = 5; - string message = 6; - google.protobuf.Timestamp createdAt = 7; - string worker_id = 8; + string workflow_id = 1; + string task_name = 2; + string action_name = 3; + ActionState action_status = 4; + int64 seconds = 5; + string message = 6; + google.protobuf.Timestamp createdAt = 7; + string worker_id = 8; } message WorkflowContextRequest { - string worker_id = 1; + string worker_id = 1; } message WorkflowContextList { - repeated WorkflowContext workflow_contexts = 1; + repeated WorkflowContext workflow_contexts = 1; } message WorkflowActionsRequest { - string workflow_id = 1; + string workflow_id = 1; } message WorkflowAction { - string task_name = 1; - string name = 2; - string image = 3; - int64 timeout = 4; - repeated string command = 5; - repeated string on_timeout = 6; - repeated string on_failure = 7; - string worker_id = 8; - repeated string volumes = 9; - repeated string environment = 10; + string task_name = 1; + string name = 2; + string image = 3; + int64 timeout = 4; + repeated string command = 5; + repeated string on_timeout = 6; + repeated string on_failure = 7; + string worker_id = 8; + repeated string volumes = 9; + repeated string environment = 10; } message WorkflowActionList { - repeated WorkflowAction action_list = 1; + repeated WorkflowAction action_list = 1; } message GetWorkflowDataRequest { - string workflow_iD = 1; - int32 version = 2; + string workflow_iD = 1; + int32 version = 2; } message GetWorkflowDataResponse { - bytes data = 1; - int32 version = 2; + bytes data = 1; + int32 version = 2; } message UpdateWorkflowDataRequest { - string workflow_iD = 1; - bytes metadata = 2; - bytes data = 3; + string workflow_iD = 1; + bytes metadata = 2; + bytes data = 3; }