| 242 | } |
| 243 | |
| 244 | func getParameter(ctx context.Context, client *ssm.Client, name string) (int64, []byte, time.Time, *ssm.GetParameterOutput, error) { |
| 245 | getResp, err := client.GetParameter(ctx, &ssm.GetParameterInput{ |
| 246 | Name: aws.String(name), |
| 247 | // Ignored if the parameter is not encrypted. |
| 248 | WithDecryption: aws.Bool(true), |
| 249 | }) |
| 250 | if err != nil { |
| 251 | return 0, nil, time.Time{}, nil, err |
| 252 | } |
| 253 | if getResp.Parameter == nil { |
| 254 | return 0, nil, time.Time{}, getResp, fmt.Errorf("unable to get %q parameter", name) |
| 255 | } |
| 256 | return getResp.Parameter.Version, []byte(aws.ToString(getResp.Parameter.Value)), aws.ToTime(getResp.Parameter.LastModifiedDate), getResp, nil |
| 257 | } |
| 258 | |
| 259 | func (w *watcher) WatchVariable(ctx context.Context, prev driver.State) (driver.State, time.Duration) { |
| 260 | lastVersion := int64(-1) |