github.com/wallyworld/juju@v0.0.0-20161013125918-6cf1bc9d917a/provider/vsphere/credentials.go (about)

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