plugin: new API for ImportState
This commit is contained in:
parent
2bb814e3de
commit
a6b4bb4932
|
@ -177,10 +177,12 @@ func (p *ResourceProvider) Refresh(
|
||||||
}
|
}
|
||||||
|
|
||||||
func (p *ResourceProvider) ImportState(
|
func (p *ResourceProvider) ImportState(
|
||||||
info *terraform.InstanceInfo) ([]*terraform.InstanceState, error) {
|
info *terraform.InstanceInfo,
|
||||||
|
id string) ([]*terraform.InstanceState, error) {
|
||||||
var resp ResourceProviderImportStateResponse
|
var resp ResourceProviderImportStateResponse
|
||||||
args := &ResourceProviderImportStateArgs{
|
args := &ResourceProviderImportStateArgs{
|
||||||
Info: info,
|
Info: info,
|
||||||
|
Id: id,
|
||||||
}
|
}
|
||||||
|
|
||||||
err := p.Client.Call("Plugin.ImportState", args, &resp)
|
err := p.Client.Call("Plugin.ImportState", args, &resp)
|
||||||
|
@ -265,6 +267,7 @@ type ResourceProviderRefreshResponse struct {
|
||||||
|
|
||||||
type ResourceProviderImportStateArgs struct {
|
type ResourceProviderImportStateArgs struct {
|
||||||
Info *terraform.InstanceInfo
|
Info *terraform.InstanceInfo
|
||||||
|
Id string
|
||||||
}
|
}
|
||||||
|
|
||||||
type ResourceProviderImportStateResponse struct {
|
type ResourceProviderImportStateResponse struct {
|
||||||
|
@ -391,7 +394,7 @@ func (s *ResourceProviderServer) Refresh(
|
||||||
func (s *ResourceProviderServer) ImportState(
|
func (s *ResourceProviderServer) ImportState(
|
||||||
args *ResourceProviderImportStateArgs,
|
args *ResourceProviderImportStateArgs,
|
||||||
result *ResourceProviderImportStateResponse) error {
|
result *ResourceProviderImportStateResponse) error {
|
||||||
states, err := s.Provider.ImportState(args.Info)
|
states, err := s.Provider.ImportState(args.Info, args.Id)
|
||||||
*result = ResourceProviderImportStateResponse{
|
*result = ResourceProviderImportStateResponse{
|
||||||
State: states,
|
State: states,
|
||||||
Error: plugin.NewBasicError(err),
|
Error: plugin.NewBasicError(err),
|
||||||
|
|
Loading…
Reference in New Issue