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

Function ExampleOpenVariable

runtimevar/awsparamstore/example_test.go:27–45  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

25)
26
27func ExampleOpenVariable() {
28 // PRAGMA: This example is used on gocloud.dev; PRAGMA comments adjust how it is shown and can be ignored.
29
30 // Establish a AWS V2 Config.
31 // See https://aws.github.io/aws-sdk-go-v2/docs/configuring-sdk/ for more info.
32 ctx := context.Background()
33 cfg, err := config.LoadDefaultConfig(ctx)
34 if err != nil {
35 log.Fatal(err)
36 }
37
38 // Construct a *runtimevar.Variable that watches the variable.
39 client := ssm.NewFromConfig(cfg)
40 v, err := awsparamstore.OpenVariable(client, "cfg-variable-name", runtimevar.StringDecoder, nil)
41 if err != nil {
42 log.Fatal(err)
43 }
44 defer v.Close()
45}
46
47func Example_openVariableFromURL() {
48 // PRAGMA: This example is used on gocloud.dev; PRAGMA comments adjust how it is shown and can be ignored.

Callers

nothing calls this directly

Calls 2

OpenVariableFunction · 0.92
CloseMethod · 0.65

Tested by

no test coverage detected