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

Function Example_openVariableFromURL

runtimevar/awssecretsmanager/example_test.go:48–61  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

46}
47
48func Example_openVariableFromURL() {
49 // PRAGMA: This example is used on gocloud.dev; PRAGMA comments adjust how it is shown and can be ignored.
50 // PRAGMA: On gocloud.dev, add a blank import: _ "gocloud.dev/runtimevar/awssecretsmanager"
51 // PRAGMA: On gocloud.dev, hide lines until the next blank line.
52 ctx := context.Background()
53
54 // runtimevar.OpenVariable creates a *runtimevar.Variable from a URL.
55 // `secret-variable-name` must be a friendly name of the secret, NOT the Amazon Resource Name (ARN).
56 v, err := runtimevar.OpenVariable(ctx, "awssecretsmanager://secret-variable-name?region=us-east-2&decoder=string")
57 if err != nil {
58 log.Fatal(err)
59 }
60 defer v.Close()
61}

Callers

nothing calls this directly

Calls 2

OpenVariableFunction · 0.92
CloseMethod · 0.65

Tested by

no test coverage detected