feat(init): First commit
This commit is contained in:
commit
f92368748a
22 changed files with 1298 additions and 0 deletions
8
pkg/providers/configs/ovh.go
Normal file
8
pkg/providers/configs/ovh.go
Normal file
|
@ -0,0 +1,8 @@
|
|||
package configs
|
||||
|
||||
type OVHConfig struct {
|
||||
Endpoint string `yaml:"endpoint"`
|
||||
ApplicationKey string `yaml:"application_key"`
|
||||
ApplicationSecret string `yaml:"application_secret"`
|
||||
ConsumerKey string `yaml:"consumer_key"`
|
||||
}
|
35
pkg/providers/ovh/ovh.go
Normal file
35
pkg/providers/ovh/ovh.go
Normal file
|
@ -0,0 +1,35 @@
|
|||
package ovh
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
|
||||
"git.maurice.fr/thomas/mailout/pkg/config"
|
||||
ovhgo "github.com/ovh/go-ovh/ovh"
|
||||
)
|
||||
|
||||
type OVHProvider struct {
|
||||
Client *ovhgo.Client
|
||||
}
|
||||
|
||||
func NewOVHProvider(cfg *config.Config) (*OVHProvider, error) {
|
||||
config := cfg.Providers.OVH
|
||||
|
||||
if config == nil {
|
||||
return nil, fmt.Errorf("no ovh configuration specified")
|
||||
}
|
||||
|
||||
c, err := ovhgo.NewClient(
|
||||
config.Endpoint,
|
||||
config.ApplicationKey,
|
||||
config.ApplicationSecret,
|
||||
config.ConsumerKey,
|
||||
)
|
||||
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
return &OVHProvider{
|
||||
Client: c,
|
||||
}, nil
|
||||
}
|
1
pkg/providers/provider.go
Normal file
1
pkg/providers/provider.go
Normal file
|
@ -0,0 +1 @@
|
|||
package provider
|
Loading…
Add table
Add a link
Reference in a new issue