Fix golint issues #377
Signed-off-by: Siddharth Subramanian <sidsbrmnn@gmail.com>
This commit is contained in:
parent
7ca5525843
commit
8f6a22230b
|
@ -269,7 +269,7 @@ type DatabaseCreateUserRequest struct {
|
|||
MySQLSettings *DatabaseMySQLUserSettings `json:"mysql_settings,omitempty"`
|
||||
}
|
||||
|
||||
// DatabaseResetUserAuth request is used to reset a users DB auth
|
||||
// DatabaseResetUserAuthRequest is used to reset a users DB auth
|
||||
type DatabaseResetUserAuthRequest struct {
|
||||
MySQLSettings *DatabaseMySQLUserSettings `json:"mysql_settings,omitempty"`
|
||||
}
|
||||
|
@ -537,6 +537,7 @@ func (svc *DatabasesServiceOp) CreateUser(ctx context.Context, databaseID string
|
|||
return root.User, resp, nil
|
||||
}
|
||||
|
||||
// ResetUserAuth will reset user authentication
|
||||
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)
|
||||
|
|
|
@ -101,6 +101,7 @@ func (d Domain) String() string {
|
|||
return Stringify(d)
|
||||
}
|
||||
|
||||
// URN returns the domain name in a valid DO API URN form.
|
||||
func (d Domain) URN() string {
|
||||
return ToURN("Domain", d.Name)
|
||||
}
|
||||
|
|
|
@ -126,6 +126,7 @@ func (d Droplet) String() string {
|
|||
return Stringify(d)
|
||||
}
|
||||
|
||||
// URN returns the droplet ID in a valid DO API URN form.
|
||||
func (d Droplet) URN() string {
|
||||
return ToURN("Droplet", d.ID)
|
||||
}
|
||||
|
|
|
@ -49,6 +49,7 @@ func (fw Firewall) String() string {
|
|||
return Stringify(fw)
|
||||
}
|
||||
|
||||
// URN returns the firewall name in a valid DO API URN form.
|
||||
func (fw Firewall) URN() string {
|
||||
return ToURN("Firewall", fw.ID)
|
||||
}
|
||||
|
|
|
@ -37,6 +37,7 @@ func (f FloatingIP) String() string {
|
|||
return Stringify(f)
|
||||
}
|
||||
|
||||
// URN returns the floating IP in a valid DO API URN form.
|
||||
func (f FloatingIP) URN() string {
|
||||
return ToURN("FloatingIP", f.IP)
|
||||
}
|
||||
|
|
|
@ -58,7 +58,7 @@ type ImageUpdateRequest struct {
|
|||
// CustomImageCreateRequest represents a request to create a custom image.
|
||||
type CustomImageCreateRequest struct {
|
||||
Name string `json:"name"`
|
||||
Url string `json:"url"`
|
||||
URL string `json:"url"`
|
||||
Region string `json:"region"`
|
||||
Distribution string `json:"distribution,omitempty"`
|
||||
Description string `json:"description,omitempty"`
|
||||
|
@ -132,6 +132,7 @@ func (s *ImagesServiceOp) GetBySlug(ctx context.Context, slug string) (*Image, *
|
|||
return s.get(ctx, interface{}(slug))
|
||||
}
|
||||
|
||||
// Create a new image
|
||||
func (s *ImagesServiceOp) Create(ctx context.Context, createRequest *CustomImageCreateRequest) (*Image, *Response, error) {
|
||||
if createRequest == nil {
|
||||
return nil, nil, NewArgError("createRequest", "cannot be nil")
|
||||
|
|
|
@ -308,7 +308,7 @@ func TestImages_Create(t *testing.T) {
|
|||
|
||||
createRequest := &CustomImageCreateRequest{
|
||||
Name: "my-new-image",
|
||||
Url: "http://example.com/distro-amd64.img",
|
||||
URL: "http://example.com/distro-amd64.img",
|
||||
Region: "nyc3",
|
||||
Distribution: "Ubuntu",
|
||||
Description: "My new custom image",
|
||||
|
|
|
@ -171,7 +171,7 @@ func (s *InvoicesServiceOp) List(ctx context.Context, opt *ListOptions) (*Invoic
|
|||
return root, resp, err
|
||||
}
|
||||
|
||||
// Get a summary of metadata and summarized usage for an Invoice
|
||||
// GetSummary returns 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)
|
||||
|
||||
|
@ -189,7 +189,7 @@ func (s *InvoicesServiceOp) GetSummary(ctx context.Context, invoiceUUID string)
|
|||
return root, resp, err
|
||||
}
|
||||
|
||||
// Get the pdf for an Invoice
|
||||
// GetPDF returns 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)
|
||||
|
||||
|
@ -207,7 +207,7 @@ func (s *InvoicesServiceOp) GetPDF(ctx context.Context, invoiceUUID string) ([]b
|
|||
return root.Bytes(), resp, err
|
||||
}
|
||||
|
||||
// Get the csv for an Invoice
|
||||
// GetCSV returns 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)
|
||||
|
||||
|
|
|
@ -198,13 +198,36 @@ type KubernetesMaintenancePolicy struct {
|
|||
type KubernetesMaintenancePolicyDay int
|
||||
|
||||
const (
|
||||
// KubernetesMaintenanceDayAny sets the KubernetesMaintenancePolicyDay to any
|
||||
// day of the week
|
||||
KubernetesMaintenanceDayAny KubernetesMaintenancePolicyDay = iota
|
||||
|
||||
// KubernetesMaintenanceDayMonday sets the KubernetesMaintenancePolicyDay to
|
||||
// Monday
|
||||
KubernetesMaintenanceDayMonday
|
||||
|
||||
// KubernetesMaintenanceDayTuesday sets the KubernetesMaintenancePolicyDay to
|
||||
// Tuesday
|
||||
KubernetesMaintenanceDayTuesday
|
||||
|
||||
// KubernetesMaintenanceDayWednesday sets the KubernetesMaintenancePolicyDay to
|
||||
// Wednesday
|
||||
KubernetesMaintenanceDayWednesday
|
||||
|
||||
// KubernetesMaintenanceDayThursday sets the KubernetesMaintenancePolicyDay to
|
||||
// Thursday
|
||||
KubernetesMaintenanceDayThursday
|
||||
|
||||
// KubernetesMaintenanceDayFriday sets the KubernetesMaintenancePolicyDay to
|
||||
// Friday
|
||||
KubernetesMaintenanceDayFriday
|
||||
|
||||
// KubernetesMaintenanceDaySaturday sets the KubernetesMaintenancePolicyDay to
|
||||
// Saturday
|
||||
KubernetesMaintenanceDaySaturday
|
||||
|
||||
// KubernetesMaintenanceDaySunday sets the KubernetesMaintenancePolicyDay to
|
||||
// Sunday
|
||||
KubernetesMaintenanceDaySunday
|
||||
)
|
||||
|
||||
|
@ -250,6 +273,7 @@ func (k KubernetesMaintenancePolicyDay) String() string {
|
|||
|
||||
}
|
||||
|
||||
// UnmarshalJSON parses the JSON string into KubernetesMaintenancePolicyDay
|
||||
func (k *KubernetesMaintenancePolicyDay) UnmarshalJSON(data []byte) error {
|
||||
var val string
|
||||
if err := json.Unmarshal(data, &val); err != nil {
|
||||
|
@ -264,6 +288,7 @@ func (k *KubernetesMaintenancePolicyDay) UnmarshalJSON(data []byte) error {
|
|||
return nil
|
||||
}
|
||||
|
||||
// MarshalJSON returns the JSON string for KubernetesMaintenancePolicyDay
|
||||
func (k KubernetesMaintenancePolicyDay) MarshalJSON() ([]byte, error) {
|
||||
if KubernetesMaintenanceDayAny <= k && k <= KubernetesMaintenanceDaySunday {
|
||||
return json.Marshal(days[k])
|
||||
|
|
|
@ -42,7 +42,7 @@ type LoadBalancer struct {
|
|||
DropletIDs []int `json:"droplet_ids,omitempty"`
|
||||
Tag string `json:"tag,omitempty"`
|
||||
Tags []string `json:"tags,omitempty"`
|
||||
RedirectHttpToHttps bool `json:"redirect_http_to_https,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"`
|
||||
|
@ -53,6 +53,7 @@ func (l LoadBalancer) String() string {
|
|||
return Stringify(l)
|
||||
}
|
||||
|
||||
// URN returns the load balancer ID in a valid DO API URN form.
|
||||
func (l LoadBalancer) URN() string {
|
||||
return ToURN("LoadBalancer", l.ID)
|
||||
}
|
||||
|
@ -67,7 +68,7 @@ func (l LoadBalancer) AsRequest() *LoadBalancerRequest {
|
|||
ForwardingRules: append([]ForwardingRule(nil), l.ForwardingRules...),
|
||||
DropletIDs: append([]int(nil), l.DropletIDs...),
|
||||
Tag: l.Tag,
|
||||
RedirectHttpToHttps: l.RedirectHttpToHttps,
|
||||
RedirectHTTPToHTTPS: l.RedirectHTTPToHTTPS,
|
||||
EnableProxyProtocol: l.EnableProxyProtocol,
|
||||
EnableBackendKeepalive: l.EnableBackendKeepalive,
|
||||
HealthCheck: l.HealthCheck,
|
||||
|
@ -95,7 +96,7 @@ type ForwardingRule struct {
|
|||
TargetProtocol string `json:"target_protocol,omitempty"`
|
||||
TargetPort int `json:"target_port,omitempty"`
|
||||
CertificateID string `json:"certificate_id,omitempty"`
|
||||
TlsPassthrough bool `json:"tls_passthrough,omitempty"`
|
||||
TLSPassthrough bool `json:"tls_passthrough,omitempty"`
|
||||
}
|
||||
|
||||
// String creates a human-readable description of a ForwardingRule.
|
||||
|
@ -123,7 +124,7 @@ func (h HealthCheck) String() string {
|
|||
type StickySessions struct {
|
||||
Type string `json:"type,omitempty"`
|
||||
CookieName string `json:"cookie_name,omitempty"`
|
||||
CookieTtlSeconds int `json:"cookie_ttl_seconds,omitempty"`
|
||||
CookieTTLSeconds int `json:"cookie_ttl_seconds,omitempty"`
|
||||
}
|
||||
|
||||
// String creates a human-readable description of a StickySessions instance.
|
||||
|
@ -143,7 +144,7 @@ type LoadBalancerRequest struct {
|
|||
DropletIDs []int `json:"droplet_ids,omitempty"`
|
||||
Tag string `json:"tag,omitempty"`
|
||||
Tags []string `json:"tags,omitempty"`
|
||||
RedirectHttpToHttps bool `json:"redirect_http_to_https,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"`
|
||||
|
|
|
@ -279,14 +279,14 @@ func TestLoadBalancers_Get(t *testing.T) {
|
|||
defer teardown()
|
||||
|
||||
path := "/v2/load_balancers"
|
||||
loadBalancerId := "37e6be88-01ec-4ec7-9bc6-a514d4719057"
|
||||
path = fmt.Sprintf("%s/%s", path, loadBalancerId)
|
||||
loadBalancerID := "37e6be88-01ec-4ec7-9bc6-a514d4719057"
|
||||
path = fmt.Sprintf("%s/%s", path, loadBalancerID)
|
||||
mux.HandleFunc(path, func(w http.ResponseWriter, r *http.Request) {
|
||||
testMethod(t, r, http.MethodGet)
|
||||
fmt.Fprint(w, lbGetJSONResponse)
|
||||
})
|
||||
|
||||
loadBalancer, _, err := client.LoadBalancers.Get(ctx, loadBalancerId)
|
||||
loadBalancer, _, err := client.LoadBalancers.Get(ctx, loadBalancerID)
|
||||
if err != nil {
|
||||
t.Errorf("LoadBalancers.Get returned error: %v", err)
|
||||
}
|
||||
|
@ -305,7 +305,7 @@ func TestLoadBalancers_Get(t *testing.T) {
|
|||
TargetProtocol: "http",
|
||||
TargetPort: 80,
|
||||
CertificateID: "a-b-c",
|
||||
TlsPassthrough: false,
|
||||
TLSPassthrough: false,
|
||||
},
|
||||
},
|
||||
HealthCheck: &HealthCheck{
|
||||
|
@ -320,7 +320,7 @@ func TestLoadBalancers_Get(t *testing.T) {
|
|||
StickySessions: &StickySessions{
|
||||
Type: "cookies",
|
||||
CookieName: "DO-LB",
|
||||
CookieTtlSeconds: 5,
|
||||
CookieTTLSeconds: 5,
|
||||
},
|
||||
Region: &Region{
|
||||
Slug: "nyc1",
|
||||
|
@ -364,12 +364,12 @@ func TestLoadBalancers_Create(t *testing.T) {
|
|||
StickySessions: &StickySessions{
|
||||
Type: "cookies",
|
||||
CookieName: "DO-LB",
|
||||
CookieTtlSeconds: 5,
|
||||
CookieTTLSeconds: 5,
|
||||
},
|
||||
Tag: "my-tag",
|
||||
Tags: []string{"my-tag"},
|
||||
DropletIDs: []int{2, 21},
|
||||
RedirectHttpToHttps: true,
|
||||
RedirectHTTPToHTTPS: true,
|
||||
VPCUUID: "880b7f98-f062-404d-b33c-458d545696f6",
|
||||
}
|
||||
|
||||
|
@ -405,7 +405,7 @@ func TestLoadBalancers_Create(t *testing.T) {
|
|||
TargetProtocol: "http",
|
||||
TargetPort: 80,
|
||||
CertificateID: "a-b-c",
|
||||
TlsPassthrough: false,
|
||||
TLSPassthrough: false,
|
||||
},
|
||||
{
|
||||
EntryProtocol: "https",
|
||||
|
@ -413,7 +413,7 @@ func TestLoadBalancers_Create(t *testing.T) {
|
|||
TargetProtocol: "https",
|
||||
TargetPort: 443,
|
||||
CertificateID: "",
|
||||
TlsPassthrough: true,
|
||||
TLSPassthrough: true,
|
||||
},
|
||||
},
|
||||
HealthCheck: &HealthCheck{
|
||||
|
@ -428,7 +428,7 @@ func TestLoadBalancers_Create(t *testing.T) {
|
|||
StickySessions: &StickySessions{
|
||||
Type: "cookies",
|
||||
CookieName: "DO-LB",
|
||||
CookieTtlSeconds: 5,
|
||||
CookieTTLSeconds: 5,
|
||||
},
|
||||
Region: &Region{
|
||||
Slug: "nyc1",
|
||||
|
@ -439,7 +439,7 @@ func TestLoadBalancers_Create(t *testing.T) {
|
|||
},
|
||||
Tags: []string{"my-tag"},
|
||||
DropletIDs: []int{2, 21},
|
||||
RedirectHttpToHttps: true,
|
||||
RedirectHTTPToHTTPS: true,
|
||||
VPCUUID: "880b7f98-f062-404d-b33c-458d545696f6",
|
||||
}
|
||||
|
||||
|
@ -485,8 +485,8 @@ func TestLoadBalancers_Update(t *testing.T) {
|
|||
}
|
||||
|
||||
path := "/v2/load_balancers"
|
||||
loadBalancerId := "8268a81c-fcf5-423e-a337-bbfe95817f23"
|
||||
path = fmt.Sprintf("%s/%s", path, loadBalancerId)
|
||||
loadBalancerID := "8268a81c-fcf5-423e-a337-bbfe95817f23"
|
||||
path = fmt.Sprintf("%s/%s", path, loadBalancerID)
|
||||
|
||||
mux.HandleFunc(path, func(w http.ResponseWriter, r *http.Request) {
|
||||
v := new(LoadBalancerRequest)
|
||||
|
@ -501,7 +501,7 @@ func TestLoadBalancers_Update(t *testing.T) {
|
|||
fmt.Fprint(w, lbUpdateJSONResponse)
|
||||
})
|
||||
|
||||
loadBalancer, _, err := client.LoadBalancers.Update(ctx, loadBalancerId, updateRequest)
|
||||
loadBalancer, _, err := client.LoadBalancers.Update(ctx, loadBalancerID, updateRequest)
|
||||
if err != nil {
|
||||
t.Errorf("LoadBalancers.Update returned error: %v", err)
|
||||
}
|
||||
|
@ -598,7 +598,7 @@ func TestLoadBalancers_List(t *testing.T) {
|
|||
StickySessions: &StickySessions{
|
||||
Type: "cookies",
|
||||
CookieName: "DO-LB",
|
||||
CookieTtlSeconds: 5,
|
||||
CookieTTLSeconds: 5,
|
||||
},
|
||||
Region: &Region{
|
||||
Slug: "nyc1",
|
||||
|
@ -825,12 +825,12 @@ func TestLoadBalancers_AsRequest(t *testing.T) {
|
|||
StickySessions: &StickySessions{
|
||||
Type: "cookies",
|
||||
CookieName: "nomnom",
|
||||
CookieTtlSeconds: 32,
|
||||
CookieTTLSeconds: 32,
|
||||
},
|
||||
Region: &Region{
|
||||
Slug: "lon1",
|
||||
},
|
||||
RedirectHttpToHttps: true,
|
||||
RedirectHTTPToHTTPS: true,
|
||||
EnableProxyProtocol: true,
|
||||
EnableBackendKeepalive: true,
|
||||
VPCUUID: "880b7f98-f062-404d-b33c-458d545696f6",
|
||||
|
@ -868,10 +868,10 @@ func TestLoadBalancers_AsRequest(t *testing.T) {
|
|||
StickySessions: &StickySessions{
|
||||
Type: "cookies",
|
||||
CookieName: "nomnom",
|
||||
CookieTtlSeconds: 32,
|
||||
CookieTTLSeconds: 32,
|
||||
},
|
||||
DropletIDs: []int{12345},
|
||||
RedirectHttpToHttps: true,
|
||||
RedirectHTTPToHTTPS: true,
|
||||
EnableProxyProtocol: true,
|
||||
EnableBackendKeepalive: true,
|
||||
VPCUUID: "880b7f98-f062-404d-b33c-458d545696f6",
|
||||
|
@ -888,7 +888,7 @@ func TestLoadBalancers_AsRequest(t *testing.T) {
|
|||
EntryPort: 443,
|
||||
TargetProtocol: "https",
|
||||
TargetPort: 443,
|
||||
TlsPassthrough: true,
|
||||
TLSPassthrough: true,
|
||||
})
|
||||
|
||||
// Check that original LoadBalancer hasn't changed
|
||||
|
@ -912,7 +912,7 @@ func TestLoadBalancers_AsRequest(t *testing.T) {
|
|||
EntryPort: 443,
|
||||
TargetProtocol: "https",
|
||||
TargetPort: 443,
|
||||
TlsPassthrough: true,
|
||||
TLSPassthrough: true,
|
||||
},
|
||||
}, r.ForwardingRules)
|
||||
}
|
||||
|
|
|
@ -117,7 +117,7 @@ type ProjectResource struct {
|
|||
Status string `json:"status,omitempty"`
|
||||
}
|
||||
|
||||
// ProjetResourceLinks specify the link for more information about the resource.
|
||||
// ProjectResourceLinks specify the link for more information about the resource.
|
||||
type ProjectResourceLinks struct {
|
||||
Self string `json:"self"`
|
||||
}
|
||||
|
@ -252,7 +252,6 @@ func (p *ProjectsServiceOp) ListResources(ctx context.Context, projectID string,
|
|||
|
||||
// AssignResources assigns one or more resources to a project. AssignResources
|
||||
// accepts resources in two possible formats:
|
||||
|
||||
// 1. The resource type, like `&Droplet{ID: 1}` or `&FloatingIP{IP: "1.2.3.4"}`
|
||||
// 2. A valid DO URN as a string, like "do:droplet:1234"
|
||||
//
|
||||
|
|
|
@ -60,6 +60,7 @@ func (f Volume) String() string {
|
|||
return Stringify(f)
|
||||
}
|
||||
|
||||
// URN returns the volume ID as a valid DO API URN
|
||||
func (f Volume) URN() string {
|
||||
return ToURN("Volume", f.ID)
|
||||
}
|
||||
|
|
|
@ -10,6 +10,8 @@ import (
|
|||
|
||||
var timestampType = reflect.TypeOf(Timestamp{})
|
||||
|
||||
// ResourceWithURN is an interface for interfacing with the types
|
||||
// that implement the URN method.
|
||||
type ResourceWithURN interface {
|
||||
URN() string
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue