MCPcopy Index your code
hub / github.com/GoogleCloudPlatform/cloud-sql-proxy / parseConnName

Function parseConnName

internal/proxy/proxy.go:59–75  ·  view source on GitHub ↗

parseConnName initializes a new connName struct.

(cn string)

Source from the content-addressed store, hash-verified

57
58// parseConnName initializes a new connName struct.
59func parseConnName(cn string) (connName, error) {
60 b := []byte(cn)
61 m := connNameRegex.FindSubmatch(b)
62 if m == nil {
63 return connName{}, fmt.Errorf(
64 "invalid instance connection name, want = PROJECT:REGION:INSTANCE, got = %v",
65 cn,
66 )
67 }
68
69 c := connName{
70 project: string(m[1]),
71 region: string(m[3]),
72 name: string(m[4]),
73 }
74 return c, nil
75}
76
77// InstanceConnConfig holds the configuration for an individual instance
78// connection.

Callers 1

LookupMethod · 0.85

Calls 1

ErrorfMethod · 0.65

Tested by

no test coverage detected