github.com/niedbalski/juju@v0.0.0-20190215020005-8ff100488e47/provider/vsphere/credentials.go (about) 1 // Copyright 2015 Canonical Ltd. 2 // Licensed under the AGPLv3, see LICENCE file for details. 3 4 package vsphere 5 6 import ( 7 "github.com/juju/errors" 8 9 "github.com/juju/juju/cloud" 10 "github.com/juju/juju/environs" 11 ) 12 13 const ( 14 credAttrUser = "user" 15 credAttrPassword = "password" 16 ) 17 18 type environProviderCredentials struct{} 19 20 // CredentialSchemas is part of the environs.ProviderCredentials interface. 21 func (environProviderCredentials) CredentialSchemas() map[cloud.AuthType]cloud.CredentialSchema { 22 return map[cloud.AuthType]cloud.CredentialSchema{ 23 cloud.UserPassAuthType: { 24 { 25 credAttrUser, cloud.CredentialAttr{Description: "The username to authenticate with."}, 26 }, { 27 credAttrPassword, cloud.CredentialAttr{ 28 Description: "The password to authenticate with.", 29 Hidden: true, 30 }, 31 }, 32 }, 33 } 34 } 35 36 // DetectCredentials is part of the environs.ProviderCredentials interface. 37 func (environProviderCredentials) DetectCredentials() (*cloud.CloudCredential, error) { 38 return nil, errors.NotFoundf("credentials") 39 } 40 41 // FinalizeCredential is part of the environs.ProviderCredentials interface. 42 func (environProviderCredentials) FinalizeCredential(_ environs.FinalizeCredentialContext, args environs.FinalizeCredentialParams) (*cloud.Credential, error) { 43 return &args.Credential, nil 44 }