func FinalizeCredential(
	credential Credential,
	schemas map[AuthType]CredentialSchema,
	readFile func(string) ([]byte, error),
) (*Credential, error) {
	schema, ok := schemas[credential.authType]
	if !ok {
		return nil, errors.NotSupportedf("auth-type %q", credential.authType)
	}
	attrs, err := schema.Finalize(credential.attributes, readFile)
	if err != nil {
		return nil, errors.Trace(err)
	}
	return &Credential{authType: credential.authType, attributes: attrs}, nil
}
// FinalizeCredential finalizes a credential by matching it with one of the
// provided credential schemas, and reading any file attributes into their
// corresponding non-file attributes. This will also validate the credential.
//
// If there is no schema with the matching auth-type, an error satisfying
// errors.IsNotSupported will be returned.
FinalizeCredential finalizes a credential by matching it with one of the
provided credential schemas, and reading any file attributes into their
corresponding non-file attributes. This will also validate the credential.

If there is no schema with the matching auth-type, an error satisfying
errors.IsNotSupported will be returned.
// FinalizeCredential finalizes a credential by matching it with one of the // provided credential schemas and reading any file attributes into their // corresponding non - file attributes . This will also validate the credential . // // If there is no schema with the matching auth - type an error satisfying // errors . IsNotSupported will be returned .
func FinalizeCredential(
	credential Credential,
	schemas map[AuthType]CredentialSchema,
	readFile func(string) ([]byte, error),
) (*Credential, error) {
	schema, ok := schemas[credential.authType]
	if !ok {
		return nil, errors.NotSupportedf("auth-type %q", credential.authType)
	}
	attrs, err := schema.Finalize(credential.attributes, readFile)
	if err != nil {
		return nil, errors.Trace(err)
	}
	return &Credential{authType: credential.authType, attributes: attrs}, nil
}
func FinalizeCredential ( credential Credential , schemas map [ AuthType ] CredentialSchema , readFile func ( string ) ( [ ] byte , error ) , ) ( * Credential , error ) { schema , ok := schemas [ credential . authType ] if ! ok { return nil , errors . NotSupportedf ( " " , credential . authType ) } attrs , err := schema . Finalize ( credential . attributes , readFile ) if err != nil { return nil , errors . Trace ( err ) } return & Credential { authType : credential . authType , attributes : attrs } , nil }
FinalizeCredential finalizes a credential by matching it with one of the
provided credential schemas, and reading any file attributes into their
corresponding non-file attributes.
FinalizeCredential finalizes a credential by matching it with one of the provided credential schemas and reading any file attributes into their corresponding non - file attributes .