rpc: conform to new types

This commit is contained in:
Mitchell Hashimoto 2014-06-12 18:06:26 -07:00
parent 7e421dd89b
commit f15746f692
2 changed files with 19 additions and 9 deletions

View File

@ -13,7 +13,7 @@ type ResourceProvider struct {
Name string
}
func (p *ResourceProvider) Configure(c map[string]interface{}) error {
func (p *ResourceProvider) Configure(c *terraform.ResourceConfig) error {
var resp ResourceProviderConfigureResponse
err := p.Client.Call(p.Name+".Configure", c, &resp)
if err != nil {
@ -28,7 +28,7 @@ func (p *ResourceProvider) Configure(c map[string]interface{}) error {
func (p *ResourceProvider) Diff(
s *terraform.ResourceState,
c map[string]interface{}) (*terraform.ResourceDiff, error) {
c *terraform.ResourceConfig) (*terraform.ResourceDiff, error) {
var resp ResourceProviderDiffResponse
args := &ResourceProviderDiffArgs{
State: s,
@ -69,7 +69,7 @@ type ResourceProviderConfigureResponse struct {
type ResourceProviderDiffArgs struct {
State *terraform.ResourceState
Config map[string]interface{}
Config *terraform.ResourceConfig
}
type ResourceProviderDiffResponse struct {
@ -78,7 +78,7 @@ type ResourceProviderDiffResponse struct {
}
func (s *ResourceProviderServer) Configure(
config map[string]interface{},
config *terraform.ResourceConfig,
reply *ResourceProviderConfigureResponse) error {
err := s.Provider.Configure(config)
*reply = ResourceProviderConfigureResponse{

View File

@ -18,7 +18,9 @@ func TestResourceProvider_configure(t *testing.T) {
provider := &ResourceProvider{Client: client, Name: name}
// Configure
config := map[string]interface{}{"foo": "bar"}
config := &terraform.ResourceConfig{
Raw: map[string]interface{}{"foo": "bar"},
}
e := provider.Configure(config)
if !p.ConfigureCalled {
t.Fatal("configure should be called")
@ -43,7 +45,9 @@ func TestResourceProvider_configure_errors(t *testing.T) {
p.ConfigureReturnError = errors.New("foo")
// Configure
config := map[string]interface{}{"foo": "bar"}
config := &terraform.ResourceConfig{
Raw: map[string]interface{}{"foo": "bar"},
}
e := provider.Configure(config)
if !p.ConfigureCalled {
t.Fatal("configure should be called")
@ -69,7 +73,9 @@ func TestResourceProvider_configure_warnings(t *testing.T) {
provider := &ResourceProvider{Client: client, Name: name}
// Configure
config := map[string]interface{}{"foo": "bar"}
config := &terraform.ResourceConfig{
Raw: map[string]interface{}{"foo": "bar"},
}
e := provider.Configure(config)
if !p.ConfigureCalled {
t.Fatal("configure should be called")
@ -102,7 +108,9 @@ func TestResourceProvider_diff(t *testing.T) {
// Diff
state := &terraform.ResourceState{}
config := map[string]interface{}{"foo": "bar"}
config := &terraform.ResourceConfig{
Raw: map[string]interface{}{"foo": "bar"},
}
diff, err := provider.Diff(state, config)
if !p.DiffCalled {
t.Fatal("diff should be called")
@ -131,7 +139,9 @@ func TestResourceProvider_diff_error(t *testing.T) {
// Diff
state := &terraform.ResourceState{}
config := map[string]interface{}{"foo": "bar"}
config := &terraform.ResourceConfig{
Raw: map[string]interface{}{"foo": "bar"},
}
diff, err := provider.Diff(state, config)
if !p.DiffCalled {
t.Fatal("diff should be called")