Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
48 changes: 24 additions & 24 deletions account.go
Original file line number Diff line number Diff line change
Expand Up @@ -34,34 +34,34 @@ type Account struct {

// AccountUpdateOptions fields are those accepted by UpdateAccount
type AccountUpdateOptions struct {
Address1 string `json:"address_1,omitempty"`
Address2 string `json:"address_2,omitempty"`
City string `json:"city,omitempty"`
Company string `json:"company,omitempty"`
Country string `json:"country,omitempty"`
Email string `json:"email,omitempty"`
FirstName string `json:"first_name,omitempty"`
LastName string `json:"last_name,omitempty"`
Phone string `json:"phone,omitempty"`
State string `json:"state,omitempty"`
TaxID string `json:"tax_id,omitempty"`
Zip string `json:"zip,omitempty"`
Address1 *string `json:"address_1,omitempty"`
Address2 *string `json:"address_2,omitempty"`
City *string `json:"city,omitempty"`
Company *string `json:"company,omitempty"`
Country *string `json:"country,omitempty"`
Email *string `json:"email,omitempty"`
FirstName *string `json:"first_name,omitempty"`
LastName *string `json:"last_name,omitempty"`
Phone *string `json:"phone,omitempty"`
State *string `json:"state,omitempty"`
TaxID *string `json:"tax_id,omitempty"`
Zip *string `json:"zip,omitempty"`
}

// GetUpdateOptions converts an Account to AccountUpdateOptions for use in UpdateAccount
func (i Account) GetUpdateOptions() (o AccountUpdateOptions) {
o.Address1 = i.Address1
o.Address2 = i.Address2
o.City = i.City
o.Company = i.Company
o.Country = i.Country
o.Email = i.Email
o.FirstName = i.FirstName
o.LastName = i.LastName
o.Phone = i.Phone
o.State = i.State
o.TaxID = i.TaxID
o.Zip = i.Zip
o.Address1 = &i.Address1
o.Address2 = &i.Address2
o.City = &i.City
o.Company = &i.Company
o.Country = &i.Country
o.Email = &i.Email
o.FirstName = &i.FirstName
o.LastName = &i.LastName
o.Phone = &i.Phone
o.State = &i.State
o.TaxID = &i.TaxID
o.Zip = &i.Zip

return
}
Expand Down
12 changes: 6 additions & 6 deletions account_agreements.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,16 +11,16 @@ type AccountAgreements struct {

// AccountAgreementsUpdateOptions fields are those accepted by UpdateAccountAgreements
type AccountAgreementsUpdateOptions struct {
EUModel bool `json:"eu_model,omitempty"`
MasterServiceAgreement bool `json:"master_service_agreement,omitempty"`
PrivacyPolicy bool `json:"privacy_policy,omitempty"`
EUModel *bool `json:"eu_model,omitempty"`
MasterServiceAgreement *bool `json:"master_service_agreement,omitempty"`
PrivacyPolicy *bool `json:"privacy_policy,omitempty"`
}

// GetUpdateOptions converts an AccountAgreements to AccountAgreementsUpdateOptions for use in UpdateAccountAgreements
func (i AccountAgreements) GetUpdateOptions() (o AccountAgreementsUpdateOptions) {
o.EUModel = i.EUModel
o.MasterServiceAgreement = i.MasterServiceAgreement
o.PrivacyPolicy = i.PrivacyPolicy
o.EUModel = copyBool(&i.EUModel)
o.MasterServiceAgreement = copyBool(&i.MasterServiceAgreement)
o.PrivacyPolicy = copyBool(&i.PrivacyPolicy)

return
}
Expand Down
2 changes: 1 addition & 1 deletion account_payments.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ type Payment struct {
// PaymentCreateOptions fields are those accepted by CreatePayment
type PaymentCreateOptions struct {
// CVV (Card Verification Value) of the credit card to be used for the Payment
CVV string `json:"cvv,omitempty"`
CVV *string `json:"cvv,omitempty"`

// The amount, in US dollars, of the Payment
USD json.Number `json:"usd"`
Expand Down
10 changes: 5 additions & 5 deletions account_users.go
Original file line number Diff line number Diff line change
Expand Up @@ -45,9 +45,9 @@ type UserCreateOptions struct {

// UserUpdateOptions fields are those accepted by UpdateUser
type UserUpdateOptions struct {
Username string `json:"username,omitempty"`
Restricted *bool `json:"restricted,omitempty"`
Email string `json:"email,omitempty"`
Username *string `json:"username,omitempty"`
Restricted *bool `json:"restricted,omitempty"`
Email *string `json:"email,omitempty"`
}

// UnmarshalJSON implements the json.Unmarshaler interface
Expand Down Expand Up @@ -101,9 +101,9 @@ func (i User) GetCreateOptions() (o UserCreateOptions) {

// GetUpdateOptions converts a User to UserUpdateOptions for use in UpdateUser
func (i User) GetUpdateOptions() (o UserUpdateOptions) {
o.Username = i.Username
o.Username = &i.Username
o.Restricted = copyBool(&i.Restricted)
o.Email = i.Email
o.Email = &i.Email

return
}
Expand Down
4 changes: 2 additions & 2 deletions databases.go
Original file line number Diff line number Diff line change
Expand Up @@ -99,8 +99,8 @@ type Database struct {

// DatabaseHost for Primary/Secondary of Database
type DatabaseHost struct {
Primary string `json:"primary"`
Secondary string `json:"secondary,omitempty"`
Primary string `json:"primary"`
Secondary *string `json:"secondary,omitempty"`
}

// DatabaseEngine is information about Engines supported by Linode Managed Databases
Expand Down
30 changes: 15 additions & 15 deletions domain_records.go
Original file line number Diff line number Diff line change
Expand Up @@ -35,22 +35,22 @@ type DomainRecordCreateOptions struct {
Port *int `json:"port,omitempty"`
Service *string `json:"service,omitempty"`
Protocol *string `json:"protocol,omitempty"`
TTLSec int `json:"ttl_sec,omitempty"` // 0 is not accepted by Linode, so can be omitted
TTLSec *int `json:"ttl_sec,omitempty"`
Tag *string `json:"tag,omitempty"`
}

// DomainRecordUpdateOptions fields are those accepted by UpdateDomainRecord
type DomainRecordUpdateOptions struct {
Type DomainRecordType `json:"type,omitempty"`
Name string `json:"name,omitempty"`
Target string `json:"target,omitempty"`
Priority *int `json:"priority,omitempty"` // 0 is valid, so omit only nil values
Weight *int `json:"weight,omitempty"` // 0 is valid, so omit only nil values
Port *int `json:"port,omitempty"` // 0 is valid to spec, so omit only nil values
Service *string `json:"service,omitempty"`
Protocol *string `json:"protocol,omitempty"`
TTLSec int `json:"ttl_sec,omitempty"` // 0 is not accepted by Linode, so can be omitted
Tag *string `json:"tag,omitempty"`
Type *DomainRecordType `json:"type,omitempty"`
Name *string `json:"name,omitempty"`
Target *string `json:"target,omitempty"`
Priority *int `json:"priority,omitempty"`
Weight *int `json:"weight,omitempty"`
Port *int `json:"port,omitempty"`
Service *string `json:"service,omitempty"`
Protocol *string `json:"protocol,omitempty"`
TTLSec *int `json:"ttl_sec,omitempty"`
Tag *string `json:"tag,omitempty"`
}

// DomainRecordType constants start with RecordType and include Linode API Domain Record Types
Expand Down Expand Up @@ -92,15 +92,15 @@ func (d *DomainRecord) UnmarshalJSON(b []byte) error {

// GetUpdateOptions converts a DomainRecord to DomainRecordUpdateOptions for use in UpdateDomainRecord
func (d DomainRecord) GetUpdateOptions() (du DomainRecordUpdateOptions) {
du.Type = d.Type
du.Name = d.Name
du.Target = d.Target
du.Type = &d.Type
du.Name = &d.Name
du.Target = &d.Target
du.Priority = copyInt(&d.Priority)
du.Weight = copyInt(&d.Weight)
du.Port = copyInt(&d.Port)
du.Service = copyString(d.Service)
du.Protocol = copyString(d.Protocol)
du.TTLSec = d.TTLSec
du.TTLSec = &d.TTLSec
du.Tag = copyString(d.Tag)

return
Expand Down
56 changes: 28 additions & 28 deletions domains.go
Original file line number Diff line number Diff line change
Expand Up @@ -65,21 +65,21 @@ type DomainCreateOptions struct {
Type DomainType `json:"type"`

// Deprecated: The group this Domain belongs to. This is for display purposes only.
Group string `json:"group,omitempty"`
Group *string `json:"group,omitempty"`

// Used to control whether this Domain is currently being rendered.
// Enum:"disabled" "active" "edit_mode" "has_errors"
Status DomainStatus `json:"status,omitempty"`
Status *DomainStatus `json:"status,omitempty"`

// A description for this Domain. This is for display purposes only.
Description string `json:"description,omitempty"`
Description *string `json:"description,omitempty"`

// Start of Authority email address. This is required for master Domains.
SOAEmail string `json:"soa_email,omitempty"`
SOAEmail *string `json:"soa_email,omitempty"`

// The interval, in seconds, at which a failed refresh should be retried.
// Valid values are 300, 3600, 7200, 14400, 28800, 57600, 86400, 172800, 345600, 604800, 1209600, and 2419200 - any other value will be rounded to the nearest valid value.
RetrySec int `json:"retry_sec,omitempty"`
RetrySec *int `json:"retry_sec,omitempty"`

// The IP addresses representing the master DNS for this Domain.
MasterIPs []string `json:"master_ips"`
Expand All @@ -91,40 +91,40 @@ type DomainCreateOptions struct {
Tags []string `json:"tags"`

// The amount of time in seconds that may pass before this Domain is no longer authoritative. Valid values are 300, 3600, 7200, 14400, 28800, 57600, 86400, 172800, 345600, 604800, 1209600, and 2419200 - any other value will be rounded to the nearest valid value.
ExpireSec int `json:"expire_sec,omitempty"`
ExpireSec *int `json:"expire_sec,omitempty"`

// The amount of time in seconds before this Domain should be refreshed. Valid values are 300, 3600, 7200, 14400, 28800, 57600, 86400, 172800, 345600, 604800, 1209600, and 2419200 - any other value will be rounded to the nearest valid value.
RefreshSec int `json:"refresh_sec,omitempty"`
RefreshSec *int `json:"refresh_sec,omitempty"`

// "Time to Live" - the amount of time in seconds that this Domain's records may be cached by resolvers or other domain servers. Valid values are 300, 3600, 7200, 14400, 28800, 57600, 86400, 172800, 345600, 604800, 1209600, and 2419200 - any other value will be rounded to the nearest valid value.
TTLSec int `json:"ttl_sec,omitempty"`
TTLSec *int `json:"ttl_sec,omitempty"`
}

// DomainUpdateOptions converts a Domain to DomainUpdateOptions for use in UpdateDomain
type DomainUpdateOptions struct {
// The domain this Domain represents. These must be unique in our system; you cannot have two Domains representing the same domain.
Domain string `json:"domain,omitempty"`
Domain *string `json:"domain,omitempty"`

// If this Domain represents the authoritative source of information for the domain it describes, or if it is a read-only copy of a master (also called a slave).
// Enum:"master" "slave"
Type DomainType `json:"type,omitempty"`
Type *DomainType `json:"type,omitempty"`

// Deprecated: The group this Domain belongs to. This is for display purposes only.
Group string `json:"group,omitempty"`
Group *string `json:"group,omitempty"`

// Used to control whether this Domain is currently being rendered.
// Enum:"disabled" "active" "edit_mode" "has_errors"
Status DomainStatus `json:"status,omitempty"`
Status *DomainStatus `json:"status,omitempty"`

// A description for this Domain. This is for display purposes only.
Description string `json:"description,omitempty"`
Description *string `json:"description,omitempty"`

// Start of Authority email address. This is required for master Domains.
SOAEmail string `json:"soa_email,omitempty"`
SOAEmail *string `json:"soa_email,omitempty"`

// The interval, in seconds, at which a failed refresh should be retried.
// Valid values are 300, 3600, 7200, 14400, 28800, 57600, 86400, 172800, 345600, 604800, 1209600, and 2419200 - any other value will be rounded to the nearest valid value.
RetrySec int `json:"retry_sec,omitempty"`
RetrySec *int `json:"retry_sec,omitempty"`

// The IP addresses representing the master DNS for this Domain.
MasterIPs []string `json:"master_ips"`
Expand All @@ -136,13 +136,13 @@ type DomainUpdateOptions struct {
Tags []string `json:"tags"`

// The amount of time in seconds that may pass before this Domain is no longer authoritative. Valid values are 300, 3600, 7200, 14400, 28800, 57600, 86400, 172800, 345600, 604800, 1209600, and 2419200 - any other value will be rounded to the nearest valid value.
ExpireSec int `json:"expire_sec,omitempty"`
ExpireSec *int `json:"expire_sec,omitempty"`

// The amount of time in seconds before this Domain should be refreshed. Valid values are 300, 3600, 7200, 14400, 28800, 57600, 86400, 172800, 345600, 604800, 1209600, and 2419200 - any other value will be rounded to the nearest valid value.
RefreshSec int `json:"refresh_sec,omitempty"`
RefreshSec *int `json:"refresh_sec,omitempty"`

// "Time to Live" - the amount of time in seconds that this Domain's records may be cached by resolvers or other domain servers. Valid values are 300, 3600, 7200, 14400, 28800, 57600, 86400, 172800, 345600, 604800, 1209600, and 2419200 - any other value will be rounded to the nearest valid value.
TTLSec int `json:"ttl_sec,omitempty"`
TTLSec *int `json:"ttl_sec,omitempty"`
}

// DomainType constants start with DomainType and include Linode API Domain Type values
Expand Down Expand Up @@ -176,19 +176,19 @@ type DomainImportOptions struct {

// GetUpdateOptions converts a Domain to DomainUpdateOptions for use in UpdateDomain
func (d Domain) GetUpdateOptions() (du DomainUpdateOptions) {
du.Domain = d.Domain
du.Type = d.Type
du.Group = d.Group
du.Status = d.Status
du.Description = d.Description
du.SOAEmail = d.SOAEmail
du.RetrySec = d.RetrySec
du.Domain = &d.Domain
du.Type = &d.Type
du.Group = &d.Group
du.Status = &d.Status
du.Description = &d.Description
du.SOAEmail = &d.SOAEmail
du.RetrySec = &d.RetrySec
du.MasterIPs = d.MasterIPs
du.AXfrIPs = d.AXfrIPs
du.Tags = d.Tags
du.ExpireSec = d.ExpireSec
du.RefreshSec = d.RefreshSec
du.TTLSec = d.TTLSec
du.ExpireSec = &d.ExpireSec
du.RefreshSec = &d.RefreshSec
du.TTLSec = &d.TTLSec

return
}
Expand Down
8 changes: 4 additions & 4 deletions firewall_rules.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,16 +17,16 @@ const (

// NetworkAddresses are arrays of ipv4 and v6 addresses
type NetworkAddresses struct {
IPv4 *[]string `json:"ipv4,omitempty"`
IPv6 *[]string `json:"ipv6,omitempty"`
IPv4 []string `json:"ipv4,omitempty"`
IPv6 []string `json:"ipv6,omitempty"`
}

// A FirewallRule is a whitelist of ports, protocols, and addresses for which traffic should be allowed.
type FirewallRule struct {
Action string `json:"action"`
Label string `json:"label"`
Description string `json:"description,omitempty"`
Ports string `json:"ports,omitempty"`
Description *string `json:"description,omitempty"`
Ports *string `json:"ports,omitempty"`
Protocol NetworkProtocol `json:"protocol"`
Addresses NetworkAddresses `json:"addresses"`
}
Expand Down
20 changes: 10 additions & 10 deletions firewalls.go
Original file line number Diff line number Diff line change
Expand Up @@ -37,25 +37,25 @@ type DevicesCreationOptions struct {

// FirewallCreateOptions fields are those accepted by CreateFirewall
type FirewallCreateOptions struct {
Label string `json:"label,omitempty"`
Rules FirewallRuleSet `json:"rules"`
Tags []string `json:"tags,omitempty"`
Devices DevicesCreationOptions `json:"devices,omitempty"`
Label *string `json:"label,omitempty"`
Rules FirewallRuleSet `json:"rules"`
Tags []string `json:"tags,omitempty"`
Devices *DevicesCreationOptions `json:"devices,omitempty"`
}

// FirewallUpdateOptions is an options struct used when Updating a Firewall
type FirewallUpdateOptions struct {
Label string `json:"label,omitempty"`
Status FirewallStatus `json:"status,omitempty"`
Tags *[]string `json:"tags,omitempty"`
Label *string `json:"label,omitempty"`
Status *FirewallStatus `json:"status,omitempty"`
Tags []string `json:"tags,omitempty"`
}

// GetUpdateOptions converts a Firewall to FirewallUpdateOptions for use in Client.UpdateFirewall.
func (f *Firewall) GetUpdateOptions() FirewallUpdateOptions {
return FirewallUpdateOptions{
Label: f.Label,
Status: f.Status,
Tags: &f.Tags,
Label: &f.Label,
Status: &f.Status,
Tags: f.Tags,
}
}

Expand Down
Loading
Loading