-
Notifications
You must be signed in to change notification settings - Fork 4
Expand file tree
/
Copy pathstripe.go
More file actions
39 lines (35 loc) · 959 Bytes
/
stripe.go
File metadata and controls
39 lines (35 loc) · 959 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
package plugins
import (
"flag"
"fmt"
)
// Stripe returns an Integration configured for the Stripe API.
func Stripe(name, tokenRef string) Integration {
return Integration{
Name: name,
Destination: "https://api.stripe.com",
InRateLimit: 100,
OutRateLimit: 100,
OutgoingAuth: []AuthPluginConfig{{
Type: "token",
Params: map[string]interface{}{
"secrets": []string{tokenRef},
"header": "Authorization",
"prefix": "Bearer ",
},
}},
}
}
func init() { Register("stripe", stripeBuilder) }
func stripeBuilder(args []string) (Integration, error) {
fs := flag.NewFlagSet("stripe", flag.ContinueOnError)
name := fs.String("name", "stripe", "integration name")
token := fs.String("token", "", "secret reference for API token")
if err := fs.Parse(args); err != nil {
return Integration{}, err
}
if *token == "" {
return Integration{}, fmt.Errorf("-token is required")
}
return Stripe(*name, *token), nil
}