MCPcopy Create free account
hub / github.com/google/go-cloud / getParameter

Function getParameter

runtimevar/awsparamstore/awsparamstore.go:244–257  ·  view source on GitHub ↗
(ctx context.Context, client *ssm.Client, name string)

Source from the content-addressed store, hash-verified

242}
243
244func 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
259func (w *watcher) WatchVariable(ctx context.Context, prev driver.State) (driver.State, time.Duration) {
260 lastVersion := int64(-1)

Callers 1

WatchVariableMethod · 0.85

Calls 1

StringMethod · 0.65

Tested by

no test coverage detected