SyncStatus gets the status of a unit and its dependencies.
(ctx context.Context, unitName unit.ID)
| 108 | |
| 109 | // SyncStatus gets the status of a unit and its dependencies. |
| 110 | func (c *Client) SyncStatus(ctx context.Context, unitName unit.ID) (SyncStatusResponse, error) { |
| 111 | resp, err := c.client.SyncStatus(ctx, &proto.SyncStatusRequest{ |
| 112 | Unit: string(unitName), |
| 113 | }) |
| 114 | if err != nil { |
| 115 | return SyncStatusResponse{}, err |
| 116 | } |
| 117 | |
| 118 | var dependencies []DependencyInfo |
| 119 | for _, dep := range resp.Dependencies { |
| 120 | dependencies = append(dependencies, DependencyInfo{ |
| 121 | DependsOn: unit.ID(dep.DependsOn), |
| 122 | RequiredStatus: unit.Status(dep.RequiredStatus), |
| 123 | CurrentStatus: unit.Status(dep.CurrentStatus), |
| 124 | IsSatisfied: dep.IsSatisfied, |
| 125 | }) |
| 126 | } |
| 127 | |
| 128 | return SyncStatusResponse{ |
| 129 | UnitName: unitName, |
| 130 | Status: unit.Status(resp.Status), |
| 131 | IsReady: resp.IsReady, |
| 132 | Dependencies: dependencies, |
| 133 | }, nil |
| 134 | } |
| 135 | |
| 136 | // UpdateAppStatus forwards an app status update to coderd via the agent. |
| 137 | func (c *Client) UpdateAppStatus(ctx context.Context, req *agentproto.UpdateAppStatusRequest) (*agentproto.UpdateAppStatusResponse, error) { |
no test coverage detected