-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Update to work with latest OCR API spec
- Loading branch information
Showing
11 changed files
with
132 additions
and
123 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
package chainlink | ||
|
||
import ( | ||
"fmt" | ||
"github.com/hashicorp/terraform/helper/schema" | ||
) | ||
|
||
func DataSourceETHKey() *schema.Resource { | ||
return &schema.Resource{ | ||
Read: resourceETHKeyRead, | ||
|
||
Schema: mergeSchemaWithNodeProperties(map[string]*schema.Schema{ | ||
"id": { | ||
Type: schema.TypeString, | ||
Computed: true, | ||
}, | ||
"index": { | ||
Type: schema.TypeInt, | ||
Optional: true, | ||
Default: 0, | ||
}, | ||
}), | ||
} | ||
} | ||
|
||
func resourceETHKeyRead(d *schema.ResourceData, m interface{}) error { | ||
c, err := NewClientFromModel(d, m) | ||
if err != nil { | ||
return err | ||
} | ||
|
||
keys, err := c.ReadETHKeys() | ||
if err != nil { | ||
return err | ||
} | ||
|
||
index, ok := d.Get("index").(int) | ||
if !ok { | ||
return fmt.Errorf("provided index of %s is not an integer", fmt.Sprint(index)) | ||
} | ||
if index >= len(keys.Data) { | ||
return fmt.Errorf("provided index of %d exceeds %d amount of keys returned", index, len(keys.Data)) | ||
} | ||
|
||
d.SetId(keys.Data[index].Attributes.Address) | ||
return nil | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.