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:
18
vendor/github.com/digitalocean/godo/CHANGELOG.md
generated
vendored
18
vendor/github.com/digitalocean/godo/CHANGELOG.md
generated
vendored
@ -1,5 +1,23 @@
|
||||
# Change Log
|
||||
|
||||
## unreleased
|
||||
|
||||
## [v1.33.0] - 2020-03-20
|
||||
|
||||
- #310 Add BillingHistory service and List endpoint - @rbutler
|
||||
- #316 load balancers: add new enable_backend_keepalive field - @anitgandhi
|
||||
|
||||
## [v1.32.0] - 2020-03-04
|
||||
|
||||
- #311 Add reset database user auth method - @zbarahal-do
|
||||
|
||||
## [v1.31.0] - 2020-02-28
|
||||
|
||||
- #305 invoices: GetPDF and GetCSV methods - @rbutler
|
||||
- #304 Add NewFromToken convenience method to init client - @bentranter
|
||||
- #301 invoices: Get, Summary, and List methods - @rbutler
|
||||
- #299 Fix param expiry_seconds for kubernetes.GetCredentials request - @velp
|
||||
|
||||
## [v1.30.0] - 2020-02-03
|
||||
|
||||
- #295 registry: support the created_at field - @adamwg
|
||||
|
28
vendor/github.com/digitalocean/godo/README.md
generated
vendored
28
vendor/github.com/digitalocean/godo/README.md
generated
vendored
@ -43,36 +43,16 @@ You can then use your token to create a new client:
|
||||
package main
|
||||
|
||||
import (
|
||||
"context"
|
||||
"github.com/digitalocean/godo"
|
||||
"golang.org/x/oauth2"
|
||||
"github.com/digitalocean/godo"
|
||||
)
|
||||
|
||||
const (
|
||||
pat = "mytoken"
|
||||
)
|
||||
|
||||
type TokenSource struct {
|
||||
AccessToken string
|
||||
}
|
||||
|
||||
func (t *TokenSource) Token() (*oauth2.Token, error) {
|
||||
token := &oauth2.Token{
|
||||
AccessToken: t.AccessToken,
|
||||
}
|
||||
return token, nil
|
||||
}
|
||||
|
||||
func main() {
|
||||
tokenSource := &TokenSource{
|
||||
AccessToken: pat,
|
||||
}
|
||||
|
||||
oauthClient := oauth2.NewClient(context.Background(), tokenSource)
|
||||
client := godo.NewClient(oauthClient)
|
||||
client := godo.NewFromToken("my-digitalocean-api-token")
|
||||
}
|
||||
```
|
||||
|
||||
If you need to provide a `context.Context` to your new client, you should use [`godo.NewClient`](https://godoc.org/github.com/digitalocean/godo#NewClient) to manually construct a client instead.
|
||||
|
||||
## Examples
|
||||
|
||||
|
||||
|
72
vendor/github.com/digitalocean/godo/billing_history.go
generated
vendored
Normal file
72
vendor/github.com/digitalocean/godo/billing_history.go
generated
vendored
Normal file
@ -0,0 +1,72 @@
|
||||
package godo
|
||||
|
||||
import (
|
||||
"context"
|
||||
"net/http"
|
||||
"time"
|
||||
)
|
||||
|
||||
const billingHistoryBasePath = "v2/customers/my/billing_history"
|
||||
|
||||
// BillingHistoryService is an interface for interfacing with the BillingHistory
|
||||
// endpoints of the DigitalOcean API
|
||||
// See: https://developers.digitalocean.com/documentation/v2/#billing_history
|
||||
type BillingHistoryService interface {
|
||||
List(context.Context, *ListOptions) (*BillingHistory, *Response, error)
|
||||
}
|
||||
|
||||
// BillingHistoryServiceOp handles communication with the BillingHistory related methods of
|
||||
// the DigitalOcean API.
|
||||
type BillingHistoryServiceOp struct {
|
||||
client *Client
|
||||
}
|
||||
|
||||
var _ BillingHistoryService = &BillingHistoryServiceOp{}
|
||||
|
||||
// BillingHistory represents a DigitalOcean Billing History
|
||||
type BillingHistory struct {
|
||||
BillingHistory []BillingHistoryEntry `json:"billing_history"`
|
||||
Links *Links `json:"links"`
|
||||
Meta *Meta `json:"meta"`
|
||||
}
|
||||
|
||||
// BillingHistoryEntry represents an entry in a customer's Billing History
|
||||
type BillingHistoryEntry struct {
|
||||
Description string `json:"description"`
|
||||
Amount string `json:"amount"`
|
||||
InvoiceID *string `json:"invoice_id"`
|
||||
InvoiceUUID *string `json:"invoice_uuid"`
|
||||
Date time.Time `json:"date"`
|
||||
Type string `json:"type"`
|
||||
}
|
||||
|
||||
func (b BillingHistory) String() string {
|
||||
return Stringify(b)
|
||||
}
|
||||
|
||||
// List the Billing History for a customer
|
||||
func (s *BillingHistoryServiceOp) List(ctx context.Context, opt *ListOptions) (*BillingHistory, *Response, error) {
|
||||
path, err := addOptions(billingHistoryBasePath, opt)
|
||||
if err != nil {
|
||||
return nil, nil, err
|
||||
}
|
||||
|
||||
req, err := s.client.NewRequest(ctx, http.MethodGet, path, nil)
|
||||
if err != nil {
|
||||
return nil, nil, err
|
||||
}
|
||||
|
||||
root := new(BillingHistory)
|
||||
resp, err := s.client.Do(ctx, req, root)
|
||||
if err != nil {
|
||||
return nil, resp, err
|
||||
}
|
||||
if l := root.Links; l != nil {
|
||||
resp.Links = l
|
||||
}
|
||||
if m := root.Meta; m != nil {
|
||||
resp.Meta = m
|
||||
}
|
||||
|
||||
return root, resp, err
|
||||
}
|
21
vendor/github.com/digitalocean/godo/databases.go
generated
vendored
21
vendor/github.com/digitalocean/godo/databases.go
generated
vendored
@ -17,6 +17,7 @@ const (
|
||||
databaseBackupsPath = databaseBasePath + "/%s/backups"
|
||||
databaseUsersPath = databaseBasePath + "/%s/users"
|
||||
databaseUserPath = databaseBasePath + "/%s/users/%s"
|
||||
databaseResetUserAuthPath = databaseUserPath + "/reset_auth"
|
||||
databaseDBPath = databaseBasePath + "/%s/dbs/%s"
|
||||
databaseDBsPath = databaseBasePath + "/%s/dbs"
|
||||
databasePoolPath = databaseBasePath + "/%s/pools/%s"
|
||||
@ -100,6 +101,7 @@ type DatabasesService interface {
|
||||
ListUsers(context.Context, string, *ListOptions) ([]DatabaseUser, *Response, error)
|
||||
CreateUser(context.Context, string, *DatabaseCreateUserRequest) (*DatabaseUser, *Response, error)
|
||||
DeleteUser(context.Context, string, string) (*Response, error)
|
||||
ResetUserAuth(context.Context, string, string, *DatabaseResetUserAuthRequest) (*DatabaseUser, *Response, error)
|
||||
ListDBs(context.Context, string, *ListOptions) ([]DatabaseDB, *Response, error)
|
||||
CreateDB(context.Context, string, *DatabaseCreateDBRequest) (*DatabaseDB, *Response, error)
|
||||
GetDB(context.Context, string, string) (*DatabaseDB, *Response, error)
|
||||
@ -267,6 +269,11 @@ type DatabaseCreateUserRequest struct {
|
||||
MySQLSettings *DatabaseMySQLUserSettings `json:"mysql_settings,omitempty"`
|
||||
}
|
||||
|
||||
// DatabaseResetUserAuth request is used to reset a users DB auth
|
||||
type DatabaseResetUserAuthRequest struct {
|
||||
MySQLSettings *DatabaseMySQLUserSettings `json:"mysql_settings,omitempty"`
|
||||
}
|
||||
|
||||
// DatabaseCreateDBRequest is used to create a new engine-specific database within the cluster
|
||||
type DatabaseCreateDBRequest struct {
|
||||
Name string `json:"name"`
|
||||
@ -530,6 +537,20 @@ func (svc *DatabasesServiceOp) CreateUser(ctx context.Context, databaseID string
|
||||
return root.User, resp, nil
|
||||
}
|
||||
|
||||
func (svc *DatabasesServiceOp) ResetUserAuth(ctx context.Context, databaseID, userID string, resetAuth *DatabaseResetUserAuthRequest) (*DatabaseUser, *Response, error) {
|
||||
path := fmt.Sprintf(databaseResetUserAuthPath, databaseID, userID)
|
||||
req, err := svc.client.NewRequest(ctx, http.MethodPost, path, resetAuth)
|
||||
if err != nil {
|
||||
return nil, nil, err
|
||||
}
|
||||
root := new(databaseUserRoot)
|
||||
resp, err := svc.client.Do(ctx, req, root)
|
||||
if err != nil {
|
||||
return nil, resp, err
|
||||
}
|
||||
return root.User, resp, nil
|
||||
}
|
||||
|
||||
// DeleteUser will delete an existing database user
|
||||
func (svc *DatabasesServiceOp) DeleteUser(ctx context.Context, databaseID, userID string) (*Response, error) {
|
||||
path := fmt.Sprintf(databaseUserPath, databaseID, userID)
|
||||
|
1
vendor/github.com/digitalocean/godo/go.sum
generated
vendored
1
vendor/github.com/digitalocean/godo/go.sum
generated
vendored
@ -7,6 +7,7 @@ github.com/google/go-querystring v1.0.0 h1:Xkwi/a1rcvNg1PPYe5vI8GbeBY/jrVuDX5ASu
|
||||
github.com/google/go-querystring v1.0.0/go.mod h1:odCYkC5MyYFN7vkCjXpyrEuKhc/BUO6wN/zVPAxq5ck=
|
||||
github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM=
|
||||
github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=
|
||||
github.com/stretchr/objx v0.1.0 h1:4G4v2dO3VZwixGIRoQ5Lfboy6nUhCyYzaqnIAPPhYs4=
|
||||
github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME=
|
||||
github.com/stretchr/testify v1.3.0 h1:TivCn/peBQ7UY8ooIcPgZFpTNSz0Q2U6UrFlUfqbe0Q=
|
||||
github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UVUgZn+9EI=
|
||||
|
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 {
|
||||
|
225
vendor/github.com/digitalocean/godo/invoices.go
generated
vendored
Normal file
225
vendor/github.com/digitalocean/godo/invoices.go
generated
vendored
Normal file
@ -0,0 +1,225 @@
|
||||
package godo
|
||||
|
||||
import (
|
||||
"bytes"
|
||||
"context"
|
||||
"fmt"
|
||||
"net/http"
|
||||
"time"
|
||||
)
|
||||
|
||||
const invoicesBasePath = "v2/customers/my/invoices"
|
||||
|
||||
// InvoicesService is an interface for interfacing with the Invoice
|
||||
// endpoints of the DigitalOcean API
|
||||
// See: https://developers.digitalocean.com/documentation/v2/#invoices
|
||||
type InvoicesService interface {
|
||||
Get(context.Context, string, *ListOptions) (*Invoice, *Response, error)
|
||||
GetPDF(context.Context, string) ([]byte, *Response, error)
|
||||
GetCSV(context.Context, string) ([]byte, *Response, error)
|
||||
List(context.Context, *ListOptions) (*InvoiceList, *Response, error)
|
||||
GetSummary(context.Context, string) (*InvoiceSummary, *Response, error)
|
||||
}
|
||||
|
||||
// InvoicesServiceOp handles communication with the Invoice related methods of
|
||||
// the DigitalOcean API.
|
||||
type InvoicesServiceOp struct {
|
||||
client *Client
|
||||
}
|
||||
|
||||
var _ InvoicesService = &InvoicesServiceOp{}
|
||||
|
||||
// Invoice represents a DigitalOcean Invoice
|
||||
type Invoice struct {
|
||||
InvoiceItems []InvoiceItem `json:"invoice_items"`
|
||||
Links *Links `json:"links"`
|
||||
Meta *Meta `json:"meta"`
|
||||
}
|
||||
|
||||
// InvoiceItem represents a line-item on a DigitalOcean Invoice
|
||||
type InvoiceItem struct {
|
||||
Product string `json:"product"`
|
||||
ResourceID string `json:"resource_id"`
|
||||
ResourceUUID string `json:"resource_uuid"`
|
||||
GroupDescription string `json:"group_description"`
|
||||
Description string `json:"description"`
|
||||
Amount string `json:"amount"`
|
||||
Duration string `json:"duration"`
|
||||
DurationUnit string `json:"duration_unit"`
|
||||
StartTime time.Time `json:"start_time"`
|
||||
EndTime time.Time `json:"end_time"`
|
||||
ProjectName string `json:"project_name"`
|
||||
}
|
||||
|
||||
// InvoiceList contains a paginated list of all of a customer's invoices.
|
||||
// The InvoicePreview is the month-to-date usage generated by DigitalOcean.
|
||||
type InvoiceList struct {
|
||||
Invoices []InvoiceListItem `json:"invoices"`
|
||||
InvoicePreview InvoiceListItem `json:"invoice_preview"`
|
||||
Links *Links `json:"links"`
|
||||
Meta *Meta `json:"meta"`
|
||||
}
|
||||
|
||||
// InvoiceListItem contains a small list of information about a customer's invoice.
|
||||
// More information can be found in the Invoice or InvoiceSummary
|
||||
type InvoiceListItem struct {
|
||||
InvoiceUUID string `json:"invoice_uuid"`
|
||||
Amount string `json:"amount"`
|
||||
InvoicePeriod string `json:"invoice_period"`
|
||||
UpdatedAt time.Time `json:"updated_at"`
|
||||
}
|
||||
|
||||
// InvoiceSummary contains metadata and summarized usage for an invoice generated by DigitalOcean
|
||||
type InvoiceSummary struct {
|
||||
InvoiceUUID string `json:"invoice_uuid"`
|
||||
BillingPeriod string `json:"billing_period"`
|
||||
Amount string `json:"amount"`
|
||||
UserName string `json:"user_name"`
|
||||
UserBillingAddress Address `json:"user_billing_address"`
|
||||
UserCompany string `json:"user_company"`
|
||||
UserEmail string `json:"user_email"`
|
||||
ProductCharges InvoiceSummaryBreakdown `json:"product_charges"`
|
||||
Overages InvoiceSummaryBreakdown `json:"overages"`
|
||||
Taxes InvoiceSummaryBreakdown `json:"taxes"`
|
||||
CreditsAndAdjustments InvoiceSummaryBreakdown `json:"credits_and_adjustments"`
|
||||
}
|
||||
|
||||
// Address represents the billing address of a customer
|
||||
type Address struct {
|
||||
AddressLine1 string `json:"address_line1"`
|
||||
AddressLine2 string `json:"address_line2"`
|
||||
City string `json:"city"`
|
||||
Region string `json:"region"`
|
||||
PostalCode string `json:"postal_code"`
|
||||
CountryISO2Code string `json:"country_iso2_code"`
|
||||
CreatedAt time.Time `json:"created_at"`
|
||||
UpdatedAt time.Time `json:"updated_at"`
|
||||
}
|
||||
|
||||
// InvoiceSummaryBreakdown is a grouped set of InvoiceItems from an invoice
|
||||
type InvoiceSummaryBreakdown struct {
|
||||
Name string `json:"name"`
|
||||
Amount string `json:"amount"`
|
||||
Items []InvoiceSummaryBreakdownItem `json:"items"`
|
||||
}
|
||||
|
||||
// InvoiceSummaryBreakdownItem further breaks down the InvoiceSummary by product
|
||||
type InvoiceSummaryBreakdownItem struct {
|
||||
Name string `json:"name"`
|
||||
Amount string `json:"amount"`
|
||||
Count string `json:"count"`
|
||||
}
|
||||
|
||||
func (i Invoice) String() string {
|
||||
return Stringify(i)
|
||||
}
|
||||
|
||||
// Get detailed invoice items for an Invoice
|
||||
func (s *InvoicesServiceOp) Get(ctx context.Context, invoiceUUID string, opt *ListOptions) (*Invoice, *Response, error) {
|
||||
path := fmt.Sprintf("%s/%s", invoicesBasePath, invoiceUUID)
|
||||
path, err := addOptions(path, opt)
|
||||
if err != nil {
|
||||
return nil, nil, err
|
||||
}
|
||||
|
||||
req, err := s.client.NewRequest(ctx, http.MethodGet, path, nil)
|
||||
if err != nil {
|
||||
return nil, nil, err
|
||||
}
|
||||
|
||||
root := new(Invoice)
|
||||
resp, err := s.client.Do(ctx, req, root)
|
||||
if err != nil {
|
||||
return nil, resp, err
|
||||
}
|
||||
if l := root.Links; l != nil {
|
||||
resp.Links = l
|
||||
}
|
||||
if m := root.Meta; m != nil {
|
||||
resp.Meta = m
|
||||
}
|
||||
|
||||
return root, resp, err
|
||||
}
|
||||
|
||||
// List invoices for a customer
|
||||
func (s *InvoicesServiceOp) List(ctx context.Context, opt *ListOptions) (*InvoiceList, *Response, error) {
|
||||
path := invoicesBasePath
|
||||
path, err := addOptions(path, opt)
|
||||
if err != nil {
|
||||
return nil, nil, err
|
||||
}
|
||||
|
||||
req, err := s.client.NewRequest(ctx, http.MethodGet, path, nil)
|
||||
if err != nil {
|
||||
return nil, nil, err
|
||||
}
|
||||
|
||||
root := new(InvoiceList)
|
||||
resp, err := s.client.Do(ctx, req, root)
|
||||
if err != nil {
|
||||
return nil, resp, err
|
||||
}
|
||||
if l := root.Links; l != nil {
|
||||
resp.Links = l
|
||||
}
|
||||
if m := root.Meta; m != nil {
|
||||
resp.Meta = m
|
||||
}
|
||||
|
||||
return root, resp, err
|
||||
}
|
||||
|
||||
// Get a summary of metadata and summarized usage for an Invoice
|
||||
func (s *InvoicesServiceOp) GetSummary(ctx context.Context, invoiceUUID string) (*InvoiceSummary, *Response, error) {
|
||||
path := fmt.Sprintf("%s/%s/summary", invoicesBasePath, invoiceUUID)
|
||||
|
||||
req, err := s.client.NewRequest(ctx, http.MethodGet, path, nil)
|
||||
if err != nil {
|
||||
return nil, nil, err
|
||||
}
|
||||
|
||||
root := new(InvoiceSummary)
|
||||
resp, err := s.client.Do(ctx, req, root)
|
||||
if err != nil {
|
||||
return nil, resp, err
|
||||
}
|
||||
|
||||
return root, resp, err
|
||||
}
|
||||
|
||||
// Get the pdf for an Invoice
|
||||
func (s *InvoicesServiceOp) GetPDF(ctx context.Context, invoiceUUID string) ([]byte, *Response, error) {
|
||||
path := fmt.Sprintf("%s/%s/pdf", invoicesBasePath, invoiceUUID)
|
||||
|
||||
req, err := s.client.NewRequest(ctx, http.MethodGet, path, nil)
|
||||
if err != nil {
|
||||
return nil, nil, err
|
||||
}
|
||||
|
||||
var root bytes.Buffer
|
||||
resp, err := s.client.Do(ctx, req, &root)
|
||||
if err != nil {
|
||||
return nil, resp, err
|
||||
}
|
||||
|
||||
return root.Bytes(), resp, err
|
||||
}
|
||||
|
||||
// Get the csv for an Invoice
|
||||
func (s *InvoicesServiceOp) GetCSV(ctx context.Context, invoiceUUID string) ([]byte, *Response, error) {
|
||||
path := fmt.Sprintf("%s/%s/csv", invoicesBasePath, invoiceUUID)
|
||||
|
||||
req, err := s.client.NewRequest(ctx, http.MethodGet, path, nil)
|
||||
if err != nil {
|
||||
return nil, nil, err
|
||||
}
|
||||
|
||||
var root bytes.Buffer
|
||||
resp, err := s.client.Do(ctx, req, &root)
|
||||
if err != nil {
|
||||
return nil, resp, err
|
||||
}
|
||||
|
||||
return root.Bytes(), resp, err
|
||||
}
|
1
vendor/github.com/digitalocean/godo/kubernetes.go
generated
vendored
1
vendor/github.com/digitalocean/godo/kubernetes.go
generated
vendored
@ -520,6 +520,7 @@ func (svc *KubernetesServiceOp) GetCredentials(ctx context.Context, clusterID st
|
||||
if get.ExpirySeconds != nil {
|
||||
q.Add("expiry_seconds", strconv.Itoa(*get.ExpirySeconds))
|
||||
}
|
||||
req.URL.RawQuery = q.Encode()
|
||||
credentials := new(KubernetesClusterCredentials)
|
||||
resp, err := svc.client.Do(ctx, req, credentials)
|
||||
if err != nil {
|
||||
|
77
vendor/github.com/digitalocean/godo/load_balancers.go
generated
vendored
77
vendor/github.com/digitalocean/godo/load_balancers.go
generated
vendored
@ -28,22 +28,23 @@ type LoadBalancersService interface {
|
||||
// LoadBalancer represents a DigitalOcean load balancer configuration.
|
||||
// Tags can only be provided upon the creation of a Load Balancer.
|
||||
type LoadBalancer struct {
|
||||
ID string `json:"id,omitempty"`
|
||||
Name string `json:"name,omitempty"`
|
||||
IP string `json:"ip,omitempty"`
|
||||
Algorithm string `json:"algorithm,omitempty"`
|
||||
Status string `json:"status,omitempty"`
|
||||
Created string `json:"created_at,omitempty"`
|
||||
ForwardingRules []ForwardingRule `json:"forwarding_rules,omitempty"`
|
||||
HealthCheck *HealthCheck `json:"health_check,omitempty"`
|
||||
StickySessions *StickySessions `json:"sticky_sessions,omitempty"`
|
||||
Region *Region `json:"region,omitempty"`
|
||||
DropletIDs []int `json:"droplet_ids,omitempty"`
|
||||
Tag string `json:"tag,omitempty"`
|
||||
Tags []string `json:"tags,omitempty"`
|
||||
RedirectHttpToHttps bool `json:"redirect_http_to_https,omitempty"`
|
||||
EnableProxyProtocol bool `json:"enable_proxy_protocol,omitempty"`
|
||||
VPCUUID string `json:"vpc_uuid,omitempty"`
|
||||
ID string `json:"id,omitempty"`
|
||||
Name string `json:"name,omitempty"`
|
||||
IP string `json:"ip,omitempty"`
|
||||
Algorithm string `json:"algorithm,omitempty"`
|
||||
Status string `json:"status,omitempty"`
|
||||
Created string `json:"created_at,omitempty"`
|
||||
ForwardingRules []ForwardingRule `json:"forwarding_rules,omitempty"`
|
||||
HealthCheck *HealthCheck `json:"health_check,omitempty"`
|
||||
StickySessions *StickySessions `json:"sticky_sessions,omitempty"`
|
||||
Region *Region `json:"region,omitempty"`
|
||||
DropletIDs []int `json:"droplet_ids,omitempty"`
|
||||
Tag string `json:"tag,omitempty"`
|
||||
Tags []string `json:"tags,omitempty"`
|
||||
RedirectHttpToHttps bool `json:"redirect_http_to_https,omitempty"`
|
||||
EnableProxyProtocol bool `json:"enable_proxy_protocol,omitempty"`
|
||||
EnableBackendKeepalive bool `json:"enable_backend_keepalive,omitempty"`
|
||||
VPCUUID string `json:"vpc_uuid,omitempty"`
|
||||
}
|
||||
|
||||
// String creates a human-readable description of a LoadBalancer.
|
||||
@ -59,15 +60,16 @@ func (l LoadBalancer) URN() string {
|
||||
// Modifying the returned LoadBalancerRequest will not modify the original LoadBalancer.
|
||||
func (l LoadBalancer) AsRequest() *LoadBalancerRequest {
|
||||
r := LoadBalancerRequest{
|
||||
Name: l.Name,
|
||||
Algorithm: l.Algorithm,
|
||||
ForwardingRules: append([]ForwardingRule(nil), l.ForwardingRules...),
|
||||
DropletIDs: append([]int(nil), l.DropletIDs...),
|
||||
Tag: l.Tag,
|
||||
RedirectHttpToHttps: l.RedirectHttpToHttps,
|
||||
EnableProxyProtocol: l.EnableProxyProtocol,
|
||||
HealthCheck: l.HealthCheck,
|
||||
VPCUUID: l.VPCUUID,
|
||||
Name: l.Name,
|
||||
Algorithm: l.Algorithm,
|
||||
ForwardingRules: append([]ForwardingRule(nil), l.ForwardingRules...),
|
||||
DropletIDs: append([]int(nil), l.DropletIDs...),
|
||||
Tag: l.Tag,
|
||||
RedirectHttpToHttps: l.RedirectHttpToHttps,
|
||||
EnableProxyProtocol: l.EnableProxyProtocol,
|
||||
EnableBackendKeepalive: l.EnableBackendKeepalive,
|
||||
HealthCheck: l.HealthCheck,
|
||||
VPCUUID: l.VPCUUID,
|
||||
}
|
||||
|
||||
if l.HealthCheck != nil {
|
||||
@ -129,18 +131,19 @@ func (s StickySessions) String() string {
|
||||
|
||||
// LoadBalancerRequest represents the configuration to be applied to an existing or a new load balancer.
|
||||
type LoadBalancerRequest struct {
|
||||
Name string `json:"name,omitempty"`
|
||||
Algorithm string `json:"algorithm,omitempty"`
|
||||
Region string `json:"region,omitempty"`
|
||||
ForwardingRules []ForwardingRule `json:"forwarding_rules,omitempty"`
|
||||
HealthCheck *HealthCheck `json:"health_check,omitempty"`
|
||||
StickySessions *StickySessions `json:"sticky_sessions,omitempty"`
|
||||
DropletIDs []int `json:"droplet_ids,omitempty"`
|
||||
Tag string `json:"tag,omitempty"`
|
||||
Tags []string `json:"tags,omitempty"`
|
||||
RedirectHttpToHttps bool `json:"redirect_http_to_https,omitempty"`
|
||||
EnableProxyProtocol bool `json:"enable_proxy_protocol,omitempty"`
|
||||
VPCUUID string `json:"vpc_uuid,omitempty"`
|
||||
Name string `json:"name,omitempty"`
|
||||
Algorithm string `json:"algorithm,omitempty"`
|
||||
Region string `json:"region,omitempty"`
|
||||
ForwardingRules []ForwardingRule `json:"forwarding_rules,omitempty"`
|
||||
HealthCheck *HealthCheck `json:"health_check,omitempty"`
|
||||
StickySessions *StickySessions `json:"sticky_sessions,omitempty"`
|
||||
DropletIDs []int `json:"droplet_ids,omitempty"`
|
||||
Tag string `json:"tag,omitempty"`
|
||||
Tags []string `json:"tags,omitempty"`
|
||||
RedirectHttpToHttps bool `json:"redirect_http_to_https,omitempty"`
|
||||
EnableProxyProtocol bool `json:"enable_proxy_protocol,omitempty"`
|
||||
EnableBackendKeepalive bool `json:"enable_backend_keepalive,omitempty"`
|
||||
VPCUUID string `json:"vpc_uuid,omitempty"`
|
||||
}
|
||||
|
||||
// String creates a human-readable description of a LoadBalancerRequest.
|
||||
|
2
vendor/github.com/digitalocean/godo/registry.go
generated
vendored
2
vendor/github.com/digitalocean/godo/registry.go
generated
vendored
@ -10,6 +10,8 @@ import (
|
||||
|
||||
const (
|
||||
registryPath = "/v2/registry"
|
||||
// RegistryServer is the hostname of the DigitalOcean registry service
|
||||
RegistryServer = "registry.digitalocean.com"
|
||||
)
|
||||
|
||||
// RegistryService is an interface for interfacing with the Registry endpoints
|
||||
|
Reference in New Issue
Block a user