Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Ensure all relevant 'create' input fields are using pointers. #382

Merged
merged 51 commits into from
Nov 7, 2022
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
51 commits
Select commit Hold shift + click to select a range
29c397a
ACLs
Integralist Nov 3, 2022
b92b4e9
ERLs
Integralist Nov 3, 2022
04e170a
Loggly
Integralist Nov 4, 2022
5961426
SFTP
Integralist Nov 4, 2022
f9d489a
FTP
Integralist Nov 4, 2022
7c31282
S3
Integralist Nov 4, 2022
01aff1f
Azure Blob Storage
Integralist Nov 4, 2022
dcf619d
Datadog
Integralist Nov 4, 2022
a3d80ac
LogShuttle
Integralist Nov 4, 2022
a4220b7
Papertrail
Integralist Nov 4, 2022
41cc747
GCS
Integralist Nov 4, 2022
607a938
HTTPS
Integralist Nov 4, 2022
b9089f1
Honeycomb
Integralist Nov 4, 2022
fd52cbb
Elasticsearch
Integralist Nov 4, 2022
b986419
Gzip
Integralist Nov 4, 2022
89be1b4
NewRelic
Integralist Nov 4, 2022
5381c11
Logentries
Integralist Nov 4, 2022
8f2ef3b
Splunk
Integralist Nov 4, 2022
256b7e4
Digital Ocean
Integralist Nov 4, 2022
3800696
Sumologic
Integralist Nov 4, 2022
cfa1743
Heroku
Integralist Nov 4, 2022
b8f13e8
Syslog
Integralist Nov 4, 2022
98bf48d
Kafka
Integralist Nov 4, 2022
91945a3
Scalyr
Integralist Nov 4, 2022
562dbbd
Kinesis
Integralist Nov 4, 2022
21aab93
OpenStack
Integralist Nov 4, 2022
ec37b2a
BigQuery
Integralist Nov 4, 2022
3147f10
Cloudfiles
Integralist Nov 4, 2022
2ef225c
Headers
Integralist Nov 4, 2022
59c3f33
Backend
Integralist Nov 4, 2022
87ac220
Directors
Integralist Nov 4, 2022
c709f72
Server
Integralist Nov 4, 2022
2e62b91
Domains
Integralist Nov 4, 2022
c0e0be2
PubSub
Integralist Nov 4, 2022
bd977c3
Versions
Integralist Nov 4, 2022
d204bc4
Services
Integralist Nov 4, 2022
935c066
User
Integralist Nov 4, 2022
98cf1b1
Health checks
Integralist Nov 7, 2022
53b615f
VCL
Integralist Nov 7, 2022
963e563
VCL Snippets
Integralist Nov 7, 2022
0b57c95
Conditions
Integralist Nov 7, 2022
e14d396
ACL Entries
Integralist Nov 7, 2022
a91ba80
Pools
Integralist Nov 7, 2022
f1a7d05
Response Objects
Integralist Nov 7, 2022
75ec167
Cache Settings
Integralist Nov 7, 2022
a0fe2b2
Request Settings
Integralist Nov 7, 2022
0b6b220
Service Authorizations
Integralist Nov 7, 2022
171cd7d
Object Store
Integralist Nov 7, 2022
a7087d1
Dictionaries
Integralist Nov 7, 2022
c5d2f77
Dictionary Item
Integralist Nov 7, 2022
a87439d
Token
Integralist Nov 7, 2022
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
Prev Previous commit
Next Next commit
ACL Entries
  • Loading branch information
Integralist committed Nov 7, 2022
commit e14d39635f733d9183bc3975431e0566a4423ef2
6 changes: 3 additions & 3 deletions fastly/acl_entries_batch_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import (
"testing"
)

func TestClient_BatchModifyAclEntries_Create(t *testing.T) {
func TestClient_BatchModifyACLEntries_Create(t *testing.T) {
fixtureBase := "acl_entries_batch/create/"
nameSuffix := "BatchModifyAclEntries_Create"

Expand Down Expand Up @@ -101,7 +101,7 @@ func TestClient_BatchModifyAclEntries_Create(t *testing.T) {
}
}

func TestClient_BatchModifyAclEntries_Delete(t *testing.T) {
func TestClient_BatchModifyACLEntries_Delete(t *testing.T) {
fixtureBase := "acl_entries_batch/delete/"
nameSuffix := "BatchModifyAclEntries_Delete"

Expand Down Expand Up @@ -200,7 +200,7 @@ func TestClient_BatchModifyAclEntries_Delete(t *testing.T) {
}
}

func TestClient_BatchModifyAclEntries_Update(t *testing.T) {
func TestClient_BatchModifyACLEntries_Update(t *testing.T) {
fixtureBase := "acl_entries_batch/update/"
nameSuffix := "BatchModifyAclEntries_Update"

Expand Down
95 changes: 41 additions & 54 deletions fastly/acl_entry.go
Original file line number Diff line number Diff line change
Expand Up @@ -44,15 +44,15 @@ func (s entriesByID) Less(i, j int) bool {

// ListACLEntriesInput is the input parameter to ListACLEntries function.
type ListACLEntriesInput struct {
// ACLID is an alphanumeric string identifying a ACL.
// ACLID is an alphanumeric string identifying a ACL (required).
ACLID string
// Direction is the direction in which to sort results.
Direction string
// Page is the current page.
Page int
// PerPage is the number of records per page.
PerPage int
// ServiceID is an alphanumeric string identifying the service.
// ServiceID is an alphanumeric string identifying the service (required).
ServiceID string
// Sort is the field on which to sort.
Sort string
Expand All @@ -79,12 +79,12 @@ func (l *ListACLEntriesInput) formatFilters() map[string]string {

// ListACLEntries retrieves all resources.
func (c *Client) ListACLEntries(i *ListACLEntriesInput) ([]*ACLEntry, error) {
if i.ServiceID == "" {
return nil, ErrMissingServiceID
}
if i.ACLID == "" {
return nil, ErrMissingACLID
}
if i.ServiceID == "" {
return nil, ErrMissingServiceID
}

path := fmt.Sprintf("/service/%s/acl/%s/entries", i.ServiceID, i.ACLID)

Expand Down Expand Up @@ -225,27 +225,25 @@ func (c *Client) listACLEntriesWithPage(i *ListACLEntriesInput, p *ListACLEntrie

// GetACLEntryInput is the input parameter to GetACLEntry function.
type GetACLEntryInput struct {
// ACLID is an alphanumeric string identifying an ACL Entry.
// ACLID is an alphanumeric string identifying an ACL Entry (required).
ACLID string
// ID is an alphanumeric string identifying an ACL Entry.
// ID is an alphanumeric string identifying an ACL Entry (required).
ID string
// ServiceID is an alphanumeric string identifying the service.
// ServiceID is an alphanumeric string identifying the service (required).
ServiceID string
}

// GetACLEntry retrieves the specified resource.
func (c *Client) GetACLEntry(i *GetACLEntryInput) (*ACLEntry, error) {
if i.ServiceID == "" {
return nil, ErrMissingServiceID
}

if i.ACLID == "" {
return nil, ErrMissingACLID
}

if i.ID == "" {
return nil, ErrMissingID
}
if i.ServiceID == "" {
return nil, ErrMissingServiceID
}

path := fmt.Sprintf("/service/%s/acl/%s/entry/%s", i.ServiceID, i.ACLID, i.ID)

Expand All @@ -265,32 +263,27 @@ func (c *Client) GetACLEntry(i *GetACLEntryInput) (*ACLEntry, error) {

// CreateACLEntryInput is the input parameter to the CreateACLEntry function.
type CreateACLEntryInput struct {
// ACLID is an alphanumeric string identifying a ACL.
ACLID string
// ACLID is an alphanumeric string identifying a ACL (required).
ACLID string `url:"-"`
// Comment is a freeform descriptive note.
Comment string `url:"comment,omitempty"`
Comment *string `url:"comment,omitempty"`
// IP is an IP address.
IP string `url:"ip"`
IP *string `url:"ip,omitempty"`
// Negated is whether to negate the match. Useful primarily when creating individual exceptions to larger subnets.
Negated Compatibool `url:"negated,omitempty"`
// ServiceID is an alphanumeric string identifying the service.
ServiceID string
Negated *Compatibool `url:"negated,omitempty"`
// ServiceID is an alphanumeric string identifying the service (required).
ServiceID string `url:"-"`
// Subnet is a number of bits for the subnet mask applied to the IP address.
Subnet int `url:"subnet,omitempty"`
Subnet *int `url:"subnet,omitempty"`
}

// CreateACLEntry creates a new resource.
func (c *Client) CreateACLEntry(i *CreateACLEntryInput) (*ACLEntry, error) {
if i.ServiceID == "" {
return nil, ErrMissingServiceID
}

if i.ACLID == "" {
return nil, ErrMissingACLID
}

if i.IP == "" {
return nil, ErrMissingIP
if i.ServiceID == "" {
return nil, ErrMissingServiceID
}

path := fmt.Sprintf("/service/%s/acl/%s/entry", i.ServiceID, i.ACLID)
Expand All @@ -311,27 +304,25 @@ func (c *Client) CreateACLEntry(i *CreateACLEntryInput) (*ACLEntry, error) {

// DeleteACLEntryInput the input parameter to DeleteACLEntry function.
type DeleteACLEntryInput struct {
// ACLID is an alphanumeric string identifying a ACL.
// ACLID is an alphanumeric string identifying a ACL (required).
ACLID string
// ID is an alphanumeric string identifying an ACL Entry.
// ID is an alphanumeric string identifying an ACL Entry (required).
ID string
// ServiceID is an alphanumeric string identifying the service.
// ServiceID is an alphanumeric string identifying the service (required).
ServiceID string
}

// DeleteACLEntry deletes the specified resource.
func (c *Client) DeleteACLEntry(i *DeleteACLEntryInput) error {
if i.ServiceID == "" {
return ErrMissingServiceID
}

if i.ACLID == "" {
return ErrMissingACLID
}

if i.ID == "" {
return ErrMissingID
}
if i.ServiceID == "" {
return ErrMissingServiceID
}

path := fmt.Sprintf("/service/%s/acl/%s/entry/%s", i.ServiceID, i.ACLID, i.ID)

Expand All @@ -355,35 +346,33 @@ func (c *Client) DeleteACLEntry(i *DeleteACLEntryInput) error {

// UpdateACLEntryInput is the input parameter to UpdateACLEntry function.
type UpdateACLEntryInput struct {
// ACLID is an alphanumeric string identifying a ACL.
ACLID string
// ACLID is an alphanumeric string identifying a ACL (required).
ACLID string `url:"-"`
// Comment is a freeform descriptive note.
Comment *string `url:"comment,omitempty"`
// ID is an alphanumeric string identifying an ACL Entry.
ID string
// ID is an alphanumeric string identifying an ACL Entry (required).
ID string `url:"-"`
// IP is an IP address.
IP *string `url:"ip,omitempty"`
// Negated is whether to negate the match. Useful primarily when creating individual exceptions to larger subnets.
Negated *Compatibool `url:"negated,omitempty"`
// ServiceID is an alphanumeric string identifying the service.
ServiceID string
// ServiceID is an alphanumeric string identifying the service (required).
ServiceID string `url:"-"`
// Subnet is a number of bits for the subnet mask applied to the IP address.
Subnet *int `url:"subnet,omitempty"`
}

// UpdateACLEntry updates the specified resource.
func (c *Client) UpdateACLEntry(i *UpdateACLEntryInput) (*ACLEntry, error) {
if i.ServiceID == "" {
return nil, ErrMissingServiceID
}

if i.ACLID == "" {
return nil, ErrMissingACLID
}

if i.ID == "" {
return nil, ErrMissingID
}
if i.ServiceID == "" {
return nil, ErrMissingServiceID
}

path := fmt.Sprintf("/service/%s/acl/%s/entry/%s", i.ServiceID, i.ACLID, i.ID)

Expand All @@ -404,11 +393,11 @@ func (c *Client) UpdateACLEntry(i *UpdateACLEntryInput) (*ACLEntry, error) {
// BatchModifyACLEntriesInput is the input parameter to the
// BatchModifyACLEntries function.
type BatchModifyACLEntriesInput struct {
// ACLID is an alphanumeric string identifying a ACL.
// ACLID is an alphanumeric string identifying a ACL (required).
ACLID string `json:"-"`
// Entries is a list of ACL entries.
Entries []*BatchACLEntry `json:"entries"`
// ServiceID is an alphanumeric string identifying the service.
// ServiceID is an alphanumeric string identifying the service (required).
ServiceID string `json:"-"`
}

Expand All @@ -430,14 +419,12 @@ type BatchACLEntry struct {

// BatchModifyACLEntries updates the specified resources.
func (c *Client) BatchModifyACLEntries(i *BatchModifyACLEntriesInput) error {
if i.ServiceID == "" {
return ErrMissingServiceID
}

if i.ACLID == "" {
return ErrMissingACLID
}

if i.ServiceID == "" {
return ErrMissingServiceID
}
if len(i.Entries) > BatchModifyMaximumOperations {
return ErrMaxExceededEntries
}
Expand Down
Loading