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

Remove "locked" flag of DNS records #1618

Merged
merged 1 commit into from Mar 27, 2024
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.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
3 changes: 3 additions & 0 deletions .changelog/1618.txt
@@ -0,0 +1,3 @@
```release-note:breaking-change
dns: Remove "locked" flag which is always false
```
6 changes: 3 additions & 3 deletions cmd/flarectl/README.md
Expand Up @@ -98,9 +98,9 @@ a23b50de3c064a5a860e8b84cd2b382c Challenge Chrome v61 challenge Mozilla/5.0 (Mac
```sh
~ flarectl dns create --zone="example.com" --name="app" --type="CNAME" --content="myapp.herokuapp.com" --proxy

ID Name Type Content TTL Proxiable Proxy Locked
-------------------------------- ------------------------- ----- ------------------- --- --------- ----- ------
5c5d051f7944cf4715127270dd4d05f4 app.questionable.services CNAME myapp.herokuapp.com 1 true true false
ID Name Type Content TTL Proxiable Proxy
-------------------------------- ------------------------- ----- ------------------- --- --------- -----
5c5d051f7944cf4715127270dd4d05f4 app.questionable.services CNAME myapp.herokuapp.com 1 true true
```

## License
Expand Down
5 changes: 2 additions & 3 deletions cmd/flarectl/dns.go
Expand Up @@ -20,7 +20,6 @@ func formatDNSRecord(record cloudflare.DNSRecord) []string {
strconv.FormatInt(int64(record.TTL), 10),
strconv.FormatBool(record.Proxiable),
strconv.FormatBool(*record.Proxied),
strconv.FormatBool(record.Locked),
}
}

Expand Down Expand Up @@ -60,7 +59,7 @@ func dnsCreate(c *cli.Context) error {
formatDNSRecord(result),
}

writeTable(c, output, "ID", "Name", "Type", "Content", "TTL", "Proxiable", "Proxy", "Locked")
writeTable(c, output, "ID", "Name", "Type", "Content", "TTL", "Proxiable", "Proxy")

return nil
}
Expand Down Expand Up @@ -135,7 +134,7 @@ func dnsCreateOrUpdate(c *cli.Context) error {
formatDNSRecord(result),
}

writeTable(c, output, "ID", "Name", "Type", "Content", "TTL", "Proxiable", "Proxy", "Locked")
writeTable(c, output, "ID", "Name", "Type", "Content", "TTL", "Proxiable", "Proxy")

return nil
}
Expand Down
2 changes: 0 additions & 2 deletions dns.go
Expand Up @@ -33,7 +33,6 @@ type DNSRecord struct {
TTL int `json:"ttl,omitempty"`
Proxied *bool `json:"proxied,omitempty"`
Proxiable bool `json:"proxiable,omitempty"`
Locked bool `json:"locked,omitempty"`
Comment string `json:"comment,omitempty"` // the server will omit the comment field when the comment is empty
Tags []string `json:"tags,omitempty"`
}
Expand Down Expand Up @@ -192,7 +191,6 @@ type CreateDNSRecordParams struct {
TTL int `json:"ttl,omitempty"`
Proxied *bool `json:"proxied,omitempty" url:"proxied,omitempty"`
Proxiable bool `json:"proxiable,omitempty"`
Locked bool `json:"locked,omitempty"`
Comment string `json:"comment,omitempty" url:"comment,omitempty"` // to the server, there's no difference between "no comment" and "empty comment"
Tags []string `json:"tags,omitempty"`
}
Expand Down
10 changes: 0 additions & 10 deletions dns_test.go
Expand Up @@ -98,7 +98,6 @@ func TestCreateDNSRecord(t *testing.T) {
"proxiable": true,
"proxied": false,
"ttl": 120,
"locked": false,
"zone_id": "d56084adb405e0b7e32c52321bf07be6",
"zone_name": "example.com",
"created_on": "2014-01-01T05:20:00Z",
Expand Down Expand Up @@ -180,7 +179,6 @@ func TestListDNSRecords(t *testing.T) {
"proxiable": true,
"proxied": false,
"ttl": 120,
"locked": false,
"zone_id": "d56084adb405e0b7e32c52321bf07be6",
"zone_name": "example.com",
"created_on": "2014-01-01T05:20:00Z",
Expand Down Expand Up @@ -214,7 +212,6 @@ func TestListDNSRecords(t *testing.T) {
Proxiable: true,
Proxied: &proxied,
TTL: 120,
Locked: false,
ZoneID: testZoneID,
ZoneName: "example.com",
CreatedOn: createdOn,
Expand Down Expand Up @@ -275,7 +272,6 @@ func TestListDNSRecordsSearch(t *testing.T) {
"proxiable": true,
"proxied": true,
"ttl": 120,
"locked": false,
"zone_id": "d56084adb405e0b7e32c52321bf07be6",
"zone_name": "example.com",
"created_on": "2014-01-01T05:20:00Z",
Expand Down Expand Up @@ -310,7 +306,6 @@ func TestListDNSRecordsSearch(t *testing.T) {
Proxiable: true,
Proxied: &proxied,
TTL: 120,
Locked: false,
ZoneID: testZoneID,
ZoneName: "example.com",
CreatedOn: createdOn,
Expand Down Expand Up @@ -408,7 +403,6 @@ func TestListDNSRecordsPagination(t *testing.T) {
assert.Equal(t, expected["proxiable"].(bool), actualRecord.Proxiable)
assert.Equal(t, expected["proxied"].(bool), *actualRecord.Proxied)
assert.Equal(t, int(expected["ttl"].(float64)), actualRecord.TTL)
assert.Equal(t, expected["locked"].(bool), actualRecord.Locked)
assert.Equal(t, expected["zone_id"].(string), actualRecord.ZoneID)
assert.Equal(t, expected["zone_name"].(string), actualRecord.ZoneName)
assert.Equal(t, expected["data"], actualRecord.Data)
Expand Down Expand Up @@ -436,7 +430,6 @@ func TestGetDNSRecord(t *testing.T) {
"proxiable": true,
"proxied": false,
"ttl": 120,
"locked": false,
"zone_id": "d56084adb405e0b7e32c52321bf07be6",
"zone_name": "example.com",
"created_on": "2014-01-01T05:20:00Z",
Expand Down Expand Up @@ -528,7 +521,6 @@ func TestUpdateDNSRecord(t *testing.T) {
"proxiable": true,
"proxied": false,
"ttl": 120,
"locked": false,
"zone_id": "d56084adb405e0b7e32c52321bf07be6",
"zone_name": "example.com",
"created_on": "2014-01-01T05:20:00Z",
Expand Down Expand Up @@ -594,7 +586,6 @@ func TestUpdateDNSRecord_ClearComment(t *testing.T) {
"proxiable": true,
"proxied": false,
"ttl": 120,
"locked": false,
"zone_id": "d56084adb405e0b7e32c52321bf07be6",
"zone_name": "example.com",
"created_on": "2014-01-01T05:20:00Z",
Expand Down Expand Up @@ -651,7 +642,6 @@ func TestUpdateDNSRecord_KeepComment(t *testing.T) {
"proxiable": true,
"proxied": false,
"ttl": 120,
"locked": false,
"zone_id": "d56084adb405e0b7e32c52321bf07be6",
"zone_name": "example.com",
"created_on": "2014-01-01T05:20:00Z",
Expand Down
3 changes: 0 additions & 3 deletions testdata/fixtures/dns/list_page_1.json
Expand Up @@ -11,7 +11,6 @@
"proxiable": true,
"proxied": true,
"ttl": 120,
"locked": false,
"zone_id": "d56084adb405e0b7e32c52321bf07be6",
"zone_name": "example.com",
"created_on": "2014-01-01T05:20:00Z",
Expand All @@ -34,7 +33,6 @@
"proxiable": true,
"proxied": false,
"ttl": 120,
"locked": false,
"zone_id": "d56084adb405e0b7e32c52321bf07be6",
"zone_name": "example.com",
"created_on": "2014-01-01T05:20:00Z",
Expand All @@ -57,7 +55,6 @@
"proxiable": true,
"proxied": true,
"ttl": 120,
"locked": false,
"zone_id": "d56084adb405e0b7e32c52321bf07be6",
"zone_name": "example.com",
"created_on": "2014-01-01T05:20:00Z",
Expand Down
2 changes: 0 additions & 2 deletions testdata/fixtures/dns/list_page_2.json
Expand Up @@ -11,7 +11,6 @@
"proxiable": true,
"proxied": false,
"ttl": 120,
"locked": false,
"zone_id": "d56084adb405e0b7e32c52321bf07be6",
"zone_name": "example.com",
"created_on": "2014-01-01T05:20:00Z",
Expand All @@ -34,7 +33,6 @@
"proxiable": true,
"proxied": false,
"ttl": 120,
"locked": false,
"zone_id": "d56084adb405e0b7e32c52321bf07be6",
"zone_name": "example.com",
"created_on": "2014-01-01T05:20:00Z",
Expand Down