MCPcopy Create free account
hub / github.com/cloudfoundry/credhub-cli / ExportCredentials

Function ExportCredentials

models/credential_bulk_export.go:25–47  ·  view source on GitHub ↗
(credentials []credentials.Credential, outputJSON bool)

Source from the content-addressed store, hash-verified

23}
24
25func ExportCredentials(credentials []credentials.Credential, outputJSON bool) (*CredentialBulkExport, error) {
26 exportCreds := exportCredentials{make([]exportCredential, len(credentials))}
27
28 for i, credential := range credentials {
29 exportCreds.Credentials[i] = exportCredential{
30 credential.Name,
31 credential.Type,
32 credential.Value,
33 credential.Metadata,
34 }
35 }
36
37 result, err := yaml.Marshal(exportCreds)
38 if outputJSON {
39 result, err = json.Marshal(exportCreds)
40 }
41
42 if err != nil {
43 return nil, err
44 }
45
46 return &CredentialBulkExport{result}, nil
47}
48
49func (credentialBulkExport *CredentialBulkExport) String() string {
50 return string(credentialBulkExport.Bytes)

Callers 2

ExecuteMethod · 0.92

Calls

no outgoing calls

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…