本文整理匯總了Golang中github.com/juju/juju/cloud.Credential.AuthType方法的典型用法代碼示例。如果您正苦於以下問題:Golang Credential.AuthType方法的具體用法?Golang Credential.AuthType怎麽用?Golang Credential.AuthType使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類github.com/juju/juju/cloud.Credential
的用法示例。
在下文中一共展示了Credential.AuthType方法的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Golang代碼示例。
示例1: updateCloudCredentialOp
// updateCloudCredentialOp returns a txn.Op that will update
// a cloud credential.
func updateCloudCredentialOp(tag names.CloudCredentialTag, cred cloud.Credential) txn.Op {
return txn.Op{
C: cloudCredentialsC,
Id: cloudCredentialDocID(tag),
Assert: txn.DocExists,
Update: bson.D{{"$set", bson.D{
{"auth-type", string(cred.AuthType())},
{"attributes", cred.Attributes()},
{"revoked", cred.Revoked},
}}},
}
}
示例2: createCloudCredentialOp
// createCloudCredentialOp returns a txn.Op that will create
// a cloud credential.
func createCloudCredentialOp(tag names.CloudCredentialTag, cred cloud.Credential) txn.Op {
return txn.Op{
C: cloudCredentialsC,
Id: cloudCredentialDocID(tag),
Assert: txn.DocMissing,
Insert: &cloudCredentialDoc{
Owner: tag.Owner().Id(),
Cloud: tag.Cloud().Id(),
Name: tag.Name(),
AuthType: string(cred.AuthType()),
Attributes: cred.Attributes(),
Revoked: cred.Revoked,
},
}
}
示例3: UpdateCredential
// UpdateCredential updates a cloud credentials.
func (c *Client) UpdateCredential(tag names.CloudCredentialTag, credential jujucloud.Credential) error {
var results params.ErrorResults
args := params.UpdateCloudCredentials{
Credentials: []params.UpdateCloudCredential{{
Tag: tag.String(),
Credential: params.CloudCredential{
AuthType: string(credential.AuthType()),
Attributes: credential.Attributes(),
},
}},
}
if err := c.facade.FacadeCall("UpdateCredentials", args, &results); err != nil {
return errors.Trace(err)
}
return results.OneError()
}