Skip to content

Commit

Permalink
Merge 625eaf2 into c478739
Browse files Browse the repository at this point in the history
  • Loading branch information
xescugc committed Jul 11, 2019
2 parents c478739 + 625eaf2 commit 9cff3d3
Showing 1 changed file with 28 additions and 29 deletions.
57 changes: 28 additions & 29 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,40 +16,39 @@ Any contributions are welcome!
## Getting started

### Import the library
To get started, you can download/include the library to your code:
```go
import "github.com/cycloidio/raws"
```
To get started, you can download/include the library to your code and use it like so:

### Create a reader
```go
var config *aws.Config = nil
var accessKey string = "xxxxxxxxxxxxxxxx"
var secretKey string = "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"
var region []string = []string{"eu-*"}

c, err := raws.NewAWSReader(accessKey, secretKey, region, config)
if err != nil {
fmt.Printf("Error while getting NewConnector: %s\n", err.Error())
return err
func main() {
var config *aws.Config = nil
var accessKey string = "xxxxxxxxxxxxxxx"
var secretKey string = "xxxxxxxxxxxxxxxxxxxxxxxxxxx"
var region []string = []string{"eu-*"}
var ctx = context.Background()

// Create a reader
c, err := raws.NewAWSReader(ctx, accessKey, secretKey, region, config)
if err != nil {
fmt.Printf("Error while getting NewConnector: %s\n", err.Error())
return
}

// Start making calls
// Errors are intentionally ignored in this example,
// no inputs are provided to those calls, even though one could.
elbs, _ := c.GetLoadBalancersV2(ctx, nil)
fmt.Println(elbs)

instances, _ := c.GetInstances(ctx, nil)
fmt.Println(instances)

vpcs, _ := c.GetVpcs(ctx, nil)
fmt.Println(vpcs)

return
}
```

### Start making call

Errors are intentionally ignored in this example, no inputs are provided to those calls, even though one could.

```go
elbs, _ := c.GetLoadBalancersV2(nil)
fmt.Println(elbs)
instances, _ := c.GetInstances(nil)
fmt.Println(instances)
vpcs, _ := c.GetVpcs(nil)
fmt.Println(vpcs)
```

You can also take a look at the [example file](example/main.go).

### Contribute

We use a custom generation tool located on `cmd/main.go` which basically uses a list of function definitions (`cmd/functions.go`) to generate the wrappers for those,
Expand Down

0 comments on commit 9cff3d3

Please sign in to comment.