本文整理匯總了Golang中github.com/hashicorp/terraform/plugin.ClientConfig類的典型用法代碼示例。如果您正苦於以下問題:Golang ClientConfig類的具體用法?Golang ClientConfig怎麽用?Golang ClientConfig使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。
在下文中一共展示了ClientConfig類的4個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Golang代碼示例。
示例1: provisionerFactory
func (c *Config) provisionerFactory(path string) terraform.ResourceProvisionerFactory {
return func() (terraform.ResourceProvisioner, error) {
// Build the plugin client configuration and init the plugin
var config plugin.ClientConfig
config.Cmd = pluginCmd(path)
config.Managed = true
client := plugin.NewClient(&config)
// Request the RPC client and service name from the client
// so we can build the actual RPC-implemented provider.
rpcClient, err := client.Client()
if err != nil {
return nil, err
}
service, err := client.Service()
if err != nil {
return nil, err
}
return &rpc.ResourceProvisioner{
Client: rpcClient,
Name: service,
}, nil
}
}
示例2: provisionerFactory
func (c *Config) provisionerFactory(path string) terraform.ResourceProvisionerFactory {
// Build the plugin client configuration and init the plugin
var config plugin.ClientConfig
config.Cmd = pluginCmd(path)
config.Managed = true
client := plugin.NewClient(&config)
return func() (terraform.ResourceProvisioner, error) {
rpcClient, err := client.Client()
if err != nil {
return nil, err
}
return rpcClient.ResourceProvisioner()
}
}
示例3: providerFactory
func (c *Config) providerFactory(path string) terraform.ResourceProviderFactory {
// Build the plugin client configuration and init the plugin
var config plugin.ClientConfig
config.Cmd = pluginCmd(path)
config.Managed = true
client := plugin.NewClient(&config)
return func() (terraform.ResourceProvider, error) {
// Request the RPC client so we can get the provider
// so we can build the actual RPC-implemented provider.
rpcClient, err := client.Client()
if err != nil {
return nil, err
}
return rpcClient.ResourceProvider()
}
}
示例4: OpenProvisioner
func (p *Plugins) OpenProvisioner(name string) (terraform.ResourceProvisioner, error) {
path, ok := p.provisionerNames[name]
if !ok {
return nil, fmt.Errorf("No provisioner named %#v", name)
}
var config plugin.ClientConfig
config.Cmd = pluginCmd(path)
config.Managed = true
client := plugin.NewClient(&config)
rpcClient, err := client.Client()
if err != nil {
return nil, err
}
return rpcClient.ResourceProvisioner()
}