本文整理匯總了Golang中github.com/rancher/rancher-catalog-service/model.Template.Bindings方法的典型用法代碼示例。如果您正苦於以下問題:Golang Template.Bindings方法的具體用法?Golang Template.Bindings怎麽用?Golang Template.Bindings使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類github.com/rancher/rancher-catalog-service/model.Template
的用法示例。
在下文中一共展示了Template.Bindings方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Golang代碼示例。
示例1: readRancherCompose
func readRancherCompose(relativePath string, newTemplate *model.Template) error {
composeBytes, err := readFile(relativePath, "rancher-compose.yml")
if err != nil {
return err
}
catalogConfig, err := lookup.ParseCatalogConfig(*composeBytes)
if err != nil {
return err
}
newTemplate.Questions = catalogConfig.Questions
newTemplate.Name = catalogConfig.Name
newTemplate.Description = catalogConfig.Description
newTemplate.Version = catalogConfig.Version
newTemplate.MinimumRancherVersion = catalogConfig.MinimumRancherVersion
newTemplate.Output = catalogConfig.Output
newTemplate.Labels = catalogConfig.Labels
binding, err := model.CreateBindings(relativePath)
if err != nil {
return err
}
newTemplate.Bindings = binding
newTemplate.MaximumRancherVersion = catalogConfig.MaximumRancherVersion
newTemplate.UpgradeFrom = catalogConfig.UpgradeFrom
return nil
}