當前位置: 首頁>>代碼示例>>Golang>>正文


Golang plugin.ClientConfig類代碼示例

本文整理匯總了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
	}
}
開發者ID:GeorgeErickson,項目名稱:terraform-1,代碼行數:26,代碼來源:config.go

示例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()
	}
}
開發者ID:koding,項目名稱:koding,代碼行數:16,代碼來源:config.go

示例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()
	}
}
開發者ID:koding,項目名稱:koding,代碼行數:18,代碼來源:config.go

示例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()
}
開發者ID:apparentlymart,項目名稱:terraflex,代碼行數:18,代碼來源:plugins.go


注:本文中的github.com/hashicorp/terraform/plugin.ClientConfig類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。