Services Trait
API Service: ServicesApi
| Method | Request Type | Response Type | Description |
|---|---|---|---|
| GetService | GetServiceRequest | Service | |
| PullService | PullServiceRequest | PullServiceResponse stream | |
| CreateService | CreateServiceRequest | Service | |
| DeleteService | DeleteServiceRequest | Service | |
| ListServices | ListServicesRequest | ListServicesResponse | |
| PullServices | PullServicesRequest | PullServicesResponse stream | |
| StartService | StartServiceRequest | Service | |
| ConfigureService | ConfigureServiceRequest | Service | |
| StopService | StopServiceRequest | Service | |
| GetServiceMetadata | GetServiceMetadataRequest | ServiceMetadata | Get service metadata: how many service are there, what types exist, etc. |
| PullServiceMetadata | PullServiceMetadataRequest | PullServiceMetadataResponse stream |
Service
| Field Name | Type | Description |
|---|---|---|
| id | string | The unique id for this service. If the service collection only supports one instance of each type, like configured services, then the id is equal to the service type. |
| type | string | The type of service. Required, written on create. For example for driver services this might be "bacnet". |
| active | bool | Whether the service is active or inactive, i.e. running or stopped. Writable only during create, use StartService or StopService to update. |
| last_inactive_time | google.protobuf.Timestamp | The time the service was last inactive Output only. |
| last_active_time | google.protobuf.Timestamp | The time the service was last active Output only. |
| loading | bool | Whether the service is currently applying changes from a recent config update. Output only. |
| last_loading_start_time | google.protobuf.Timestamp | The time the service last started loading Output only. |
| last_loading_end_time | google.protobuf.Timestamp | The time the service last completed loading Output only. |
| error | string | Any error that occurred while loading. Output only. |
| last_error_time | google.protobuf.Timestamp | The time the service last recorded an error Output only. |
| config_raw | string | Encoded config data for the service, typically a JSON string, but check the docs for each type of service to be sure. Writable only during create, use ConfigureService to update. |
| last_config_time | google.protobuf.Timestamp | The time the service last accepted configuration Output only. |
| failed_attempts | int32 | A count of how many times the service has failed to start. Reset on stop or config update. |
| next_attempt_time | google.protobuf.Timestamp | If the service is failing and retries are enabled, contains the time the next attempt will be made. |
ServiceMetadata
| Field Name | Type | Description |
|---|---|---|
| total_count | uint32 | |
| type_counts | map<string, uint32> | |
| total_active_count | uint32 | The total number of active services, services whose active property is true. |
| total_error_count | uint32 | The total number of services who are inactive due to error. |
GetServiceRequest
| Field Name | Type | Description |
|---|---|---|
| name | string | The name of the device managing the service. |
| id | string | The id of the service to get. |
| read_mask | google.protobuf.FieldMask |
PullServiceRequest
| Field Name | Type | Description |
|---|---|---|
| name | string | The name of the device managing the service. |
| id | string | The id of the service to get |
| updates_only | bool | |
| read_mask | google.protobuf.FieldMask |
PullServiceResponse
| Field Name | Type | Description |
|---|---|---|
| changes | repeated PullServiceResponse.Change |
PullServiceResponse.Change
| Field Name | Type | Description |
|---|---|---|
| name | string | The name of the device managing the service. |
| service | Service | |
| change_time | google.protobuf.Timestamp |
CreateServiceRequest
| Field Name | Type | Description |
|---|---|---|
| name | string | The name of the device managing the service |
| service | Service | The details for the service. Type is required, id, active, and config_raw are optional, other fields are not allowed. Some devices do not allow for more than one service of the same type to be created. Creating a service that has the same name as an existing service will result in an error. |
DeleteServiceRequest
| Field Name | Type | Description |
|---|---|---|
| name | string | The name of the device managing the service |
| id | string | The id of the service to delete. |
| allow_missing | bool | If true do not report an error if a service with the given id does not exist. |
ListServicesRequest
| Field Name | Type | Description |
|---|---|---|
| name | string | The name of the device managing the service |
| read_mask | google.protobuf.FieldMask | Fields to fetch relative to the Service type |
| page_size | int32 | The maximum number of modes to return. The service may return fewer than this value. If unspecified, at most 50 items will be returned. The maximum value is 1000; values above 1000 will be coerced to 1000. |
| page_token | string | A page token, received from a previous ListServicesResponse call. Provide this to retrieve the subsequent page. |
ListServicesResponse
| Field Name | Type | Description |
|---|---|---|
| services | repeated Service | |
| next_page_token | string | A token, which can be sent as page_token to retrieve the next page. If this field is omitted, there are no subsequent pages. |
| total_size | int32 | If non-zero this is the total number of services after filtering is applied. This may be an estimate. |
PullServicesRequest
| Field Name | Type | Description |
|---|---|---|
| name | string | Name of the device that manages the services |
| read_mask | google.protobuf.FieldMask | Fields to fetch relative to the Service type |
| updates_only | bool | When true, don't send the initial data. Only send a response when changes have happened. |
PullServicesResponse
| Field Name | Type | Description |
|---|---|---|
| changes | repeated PullServicesResponse.Change | The list of changes which have occurred |
PullServicesResponse.Change
| Field Name | Type | Description |
|---|---|---|
| name | string | The name of the device that emitted this change |
| type | smartcore.types.ChangeType | The type of change (e.g. ADD, UPDATE, etc...) |
| new_value | Service | The new value to use for ADD |
| old_value | Service | The old value to use for UPDATE |
| change_time | google.protobuf.Timestamp | When the change occurred |
StartServiceRequest
| Field Name | Type | Description |
|---|---|---|
| name | string | The name of the device managing the service |
| id | string | The id of the service. |
| allow_active | bool | Unless true, starting a service that is already ACTIVE will return a PreconditionFailed error. |
ConfigureServiceRequest
| Field Name | Type | Description |
|---|---|---|
| name | string | The name of the device managing the service |
| id | string | The id of the service. |
| config_raw | string | Raw configuration data, typically encoded JSON as defined by the service implementation. |
StopServiceRequest
| Field Name | Type | Description |
|---|---|---|
| name | string | The name of the device managing the service |
| id | string | The id of the service. |
| allow_inactive | bool | Unless true, starting a service that is already INACTIVE or ERROR will return a PreconditionFailed error. |
GetServiceMetadataRequest
| Field Name | Type | Description |
|---|---|---|
| name | string | Name of the device managing the services |
| read_mask | google.protobuf.FieldMask |
PullServiceMetadataRequest
| Field Name | Type | Description |
|---|---|---|
| name | string | Name of the device managing the services |
| updates_only | bool | If true, only changes to the count are returned, otherwise the current total will be returned immediately. |
| read_mask | google.protobuf.FieldMask |
PullServiceMetadataResponse
| Field Name | Type | Description |
|---|---|---|
| changes | repeated PullServiceMetadataResponse.Change |
PullServiceMetadataResponse.Change
| Field Name | Type | Description |
|---|---|---|
| name | string | The name of the device that emitted this change |
| metadata | ServiceMetadata | Information about the services in aggregate. |
| change_time | google.protobuf.Timestamp | When the change occurred |