Skip to content

Commit 33ef9f4

Browse files
mbrownepatryk
authored andcommitted
Added Priority field to ZoneLockdown type (#266)
* added Priority field to ZoneLockdown type
1 parent 9f66b84 commit 33ef9f4

File tree

2 files changed

+34
-0
lines changed

2 files changed

+34
-0
lines changed

lockdown.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ type ZoneLockdown struct {
1616
URLs []string `json:"urls"`
1717
Configurations []ZoneLockdownConfig `json:"configurations"`
1818
Paused bool `json:"paused"`
19+
Priority int `json:"priority,omitempty"`
1920
}
2021

2122
// ZoneLockdownConfig represents a Zone Lockdown config, which comprises

lockdown_example_test.go

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,3 +29,36 @@ func ExampleAPI_ListZoneLockdowns_all() {
2929
fmt.Printf("%s: %s\n", strings.Join(r.URLs, ", "), r.Configurations)
3030
}
3131
}
32+
33+
func ExampleAPI_CreateZoneLockdown() {
34+
api, err := cloudflare.New("deadbeef", "test@example.org")
35+
if err != nil {
36+
log.Fatal(err)
37+
}
38+
39+
zoneID, err := api.ZoneIDByName("example.org")
40+
if err != nil {
41+
log.Fatal(err)
42+
}
43+
44+
newZoneLockdown := cloudflare.ZoneLockdown{
45+
Description: "Test Zone Lockdown Rule",
46+
URLs: []string{
47+
"*.example.org/test",
48+
},
49+
Configurations: []cloudflare.ZoneLockdownConfig{
50+
cloudflare.ZoneLockdownConfig{
51+
Target: "ip",
52+
Value: "127.0.0.1",
53+
},
54+
},
55+
Paused: false,
56+
Priority: 1,
57+
}
58+
59+
response, err := api.CreateZoneLockdown(zoneID, newZoneLockdown)
60+
if err != nil {
61+
log.Fatal(err)
62+
}
63+
fmt.Println("Response: ", response)
64+
}

0 commit comments

Comments
 (0)