MCPcopy Create free account
hub / github.com/chainloop-dev/chainloop / newGCPCredentialsManager

Function newGCPCredentialsManager

pkg/credentials/manager/manager.go:136–155  ·  view source on GitHub ↗
(conf *api.Credentials_GCPSecretManager, prefix string, r credentials.Role, l log.Logger)

Source from the content-addressed store, hash-verified

134}
135
136func newGCPCredentialsManager(conf *api.Credentials_GCPSecretManager, prefix string, r credentials.Role, l log.Logger) (*gcp.Manager, error) {
137 if err := validateConfig(conf); err != nil {
138 return nil, fmt.Errorf("uncompleted configuration for GCP secret manager: %w", err)
139 }
140
141 opts := &gcp.NewManagerOpts{
142 ProjectID: conf.ProjectId,
143 ServiceAccountKey: conf.ServiceAccountKey,
144 Logger: l,
145 SecretPrefix: prefix,
146 Role: r,
147 }
148
149 m, err := gcp.NewManager(opts)
150 if err != nil {
151 return nil, fmt.Errorf("configuring the GCP secret manager: %w", err)
152 }
153
154 return m, nil
155}

Callers 1

NewFromConfigFunction · 0.85

Calls 2

NewManagerFunction · 0.92
validateConfigFunction · 0.85

Tested by

no test coverage detected