(credentials []credentials.Credential, outputJSON bool)
| 23 | } |
| 24 | |
| 25 | func 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 | |
| 49 | func (credentialBulkExport *CredentialBulkExport) String() string { |
| 50 | return string(credentialBulkExport.Bytes) |
no outgoing calls
no test coverage detected
searching dependent graphs…