Skip to content

Commit

Permalink
Merge pull request #100 from jmpfar/service-commands
Browse files Browse the repository at this point in the history
Improvements to the System API group
  • Loading branch information
k8s-ci-robot authored Oct 22, 2020
2 parents 4322716 + 992723e commit 04aa676
Show file tree
Hide file tree
Showing 6 changed files with 289 additions and 253 deletions.
170 changes: 89 additions & 81 deletions client/api/system/v1alpha1/api.pb.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

94 changes: 50 additions & 44 deletions client/api/system/v1alpha1/api.proto
Original file line number Diff line number Diff line change
Expand Up @@ -5,83 +5,89 @@ package v1alpha1;
option go_package = "github.com/kubernetes-csi/csi-proxy/client/api/system/v1alpha1";

service System {
// GetBIOSSerialNumber returns the device's serial number
rpc GetBIOSSerialNumber(GetBIOSSerialNumberRequest) returns (GetBIOSSerialNumberResponse) {}

// StartService starts a Windows service
rpc StartService(StartServiceRequest) returns (StartServiceResponse) {}

// StopService stops a Windows service
rpc StopService(StopServiceRequest) returns (StopServiceResponse) {}

// GetService queries a Windows service state
rpc GetService(GetServiceRequest) returns (GetServiceResponse) {}
// GetBIOSSerialNumber returns the device's serial number
rpc GetBIOSSerialNumber(GetBIOSSerialNumberRequest)
returns (GetBIOSSerialNumberResponse) {}

// StartService starts a Windows service
// NOTE: This method affects global node state and should only be used
// with consideration to other CSI drivers that run concurrently.
rpc StartService(StartServiceRequest) returns (StartServiceResponse) {}

// StopService stops a Windows service
// NOTE: This method affects global node state and should only be used
// with consideration to other CSI drivers that run concurrently.
rpc StopService(StopServiceRequest) returns (StopServiceResponse) {}

// GetService queries a Windows service state
rpc GetService(GetServiceRequest) returns (GetServiceResponse) {}
}

message GetBIOSSerialNumberRequest {
// Intentionally empty
// Intentionally empty
}

message GetBIOSSerialNumberResponse {
// Serial number
string serial_number = 1;
// Serial number
string serial_number = 1;
}

message StartServiceRequest {
// Service name (as listed in System\CCS\Services keys)
string name = 1;
// Service name (as listed in System\CCS\Services keys)
string name = 1;
}

message StartServiceResponse {
// Intentionally empty
// Intentionally empty
}

message StopServiceRequest {
// Service name (as listed in System\CCS\Services keys)
string name = 1;
// Service name (as listed in System\CCS\Services keys)
string name = 1;

// Forces stopping of services that has dependant services
bool force = 2;
// Forces stopping of services that has dependant services
bool force = 2;
}

message StopServiceResponse {
// Intentionally empty
// Intentionally empty
}


// https://docs.microsoft.com/en-us/windows/win32/api/winsvc/ns-winsvc-service_status#members
enum ServiceStatus {
SERVICE_STATUS_UNKNOWN = 0;
SERVICE_STATUS_STOPPED = 1;
SERVICE_STATUS_START_PENDING = 2;
SERVICE_STATUS_STOP_PENDING = 3;
SERVICE_STATUS_RUNNING = 4;
SERVICE_STATUS_CONTINUE_PENDING = 5;
SERVICE_STATUS_PAUSE_PENDING = 6;
SERVICE_STATUS_PAUSED = 7;
UNKNOWN = 0;
STOPPED = 1;
START_PENDING = 2;
STOP_PENDING = 3;
RUNNING = 4;
CONTINUE_PENDING = 5;
PAUSE_PENDING = 6;
PAUSED = 7;
}

// https://docs.microsoft.com/en-us/windows/win32/api/winsvc/nf-winsvc-changeserviceconfiga
enum StartType {
START_TYPE_BOOT = 0;
START_TYPE_SYSTEM = 1;
START_TYPE_AUTOMATIC = 2;
START_TYPE_MANUAL = 3;
START_TYPE_DISABLED = 4;
BOOT = 0;
SYSTEM = 1;
AUTOMATIC = 2;
MANUAL = 3;
DISABLED = 4;
}

message GetServiceRequest {
// Service name (as listed in System\CCS\Services keys)
string name = 1;
// Service name (as listed in System\CCS\Services keys)
string name = 1;
}

message GetServiceResponse {
// Service display name
string display_name = 1;
// Service display name
string display_name = 1;

// Service start type
StartType start_type = 2;
// Service start type.
// Used to control whether a service will start on boot, and if so on which
// boot phase.
StartType start_type = 2;

// Service status
ServiceStatus status = 3;
// Service status, e.g. stopped, running, paused
ServiceStatus status = 3;
}
Loading

0 comments on commit 04aa676

Please sign in to comment.