mirror of
https://github.com/StackExchange/dnscontrol.git
synced 2024-05-11 05:55:12 +00:00
go -u github.com/digitalocean/godo
This commit is contained in:
27
vendor/github.com/digitalocean/godo/godo.go
generated
vendored
27
vendor/github.com/digitalocean/godo/godo.go
generated
vendored
@ -14,10 +14,11 @@ import (
|
||||
"time"
|
||||
|
||||
"github.com/google/go-querystring/query"
|
||||
"golang.org/x/oauth2"
|
||||
)
|
||||
|
||||
const (
|
||||
libraryVersion = "1.30.0"
|
||||
libraryVersion = "1.33.0"
|
||||
defaultBaseURL = "https://api.digitalocean.com/"
|
||||
userAgent = "godo/" + libraryVersion
|
||||
mediaType = "application/json"
|
||||
@ -46,12 +47,14 @@ type Client struct {
|
||||
Account AccountService
|
||||
Actions ActionsService
|
||||
Balance BalanceService
|
||||
BillingHistory BillingHistoryService
|
||||
CDNs CDNService
|
||||
Domains DomainsService
|
||||
Droplets DropletsService
|
||||
DropletActions DropletActionsService
|
||||
Images ImagesService
|
||||
ImageActions ImageActionsService
|
||||
Invoices InvoicesService
|
||||
Keys KeysService
|
||||
Regions RegionsService
|
||||
Sizes SizesService
|
||||
@ -155,7 +158,23 @@ func addOptions(s string, opt interface{}) (string, error) {
|
||||
return origURL.String(), nil
|
||||
}
|
||||
|
||||
// NewClient returns a new DigitalOcean API client.
|
||||
// NewFromToken returns a new DigitalOcean API client with the given API
|
||||
// token.
|
||||
func NewFromToken(token string) *Client {
|
||||
ctx := context.Background()
|
||||
|
||||
config := &oauth2.Config{}
|
||||
ts := config.TokenSource(ctx, &oauth2.Token{AccessToken: token})
|
||||
|
||||
return NewClient(oauth2.NewClient(ctx, ts))
|
||||
}
|
||||
|
||||
// NewClient returns a new DigitalOcean API client, using the given
|
||||
// http.Client to perform all requests.
|
||||
//
|
||||
// Users who wish to pass their own http.Client should use this method. If
|
||||
// you're in need of further customization, the godo.New method allows more
|
||||
// options, such as setting a custom URL or a custom user agent string.
|
||||
func NewClient(httpClient *http.Client) *Client {
|
||||
if httpClient == nil {
|
||||
httpClient = http.DefaultClient
|
||||
@ -167,6 +186,7 @@ func NewClient(httpClient *http.Client) *Client {
|
||||
c.Account = &AccountServiceOp{client: c}
|
||||
c.Actions = &ActionsServiceOp{client: c}
|
||||
c.Balance = &BalanceServiceOp{client: c}
|
||||
c.BillingHistory = &BillingHistoryServiceOp{client: c}
|
||||
c.CDNs = &CDNServiceOp{client: c}
|
||||
c.Certificates = &CertificatesServiceOp{client: c}
|
||||
c.Domains = &DomainsServiceOp{client: c}
|
||||
@ -177,6 +197,7 @@ func NewClient(httpClient *http.Client) *Client {
|
||||
c.FloatingIPActions = &FloatingIPActionsServiceOp{client: c}
|
||||
c.Images = &ImagesServiceOp{client: c}
|
||||
c.ImageActions = &ImageActionsServiceOp{client: c}
|
||||
c.Invoices = &InvoicesServiceOp{client: c}
|
||||
c.Keys = &KeysServiceOp{client: c}
|
||||
c.LoadBalancers = &LoadBalancersServiceOp{client: c}
|
||||
c.Projects = &ProjectsServiceOp{client: c}
|
||||
@ -197,7 +218,7 @@ func NewClient(httpClient *http.Client) *Client {
|
||||
// ClientOpt are options for New.
|
||||
type ClientOpt func(*Client) error
|
||||
|
||||
// New returns a new DIgitalOcean API client instance.
|
||||
// New returns a new DigitalOcean API client instance.
|
||||
func New(httpClient *http.Client, opts ...ClientOpt) (*Client, error) {
|
||||
c := NewClient(httpClient)
|
||||
for _, opt := range opts {
|
||||
|
Reference in New Issue
Block a user