altera soa-edit-api para INCEPTION-INCREMENT
This commit is contained in:
@@ -13,7 +13,7 @@ import (
|
||||
"time"
|
||||
)
|
||||
|
||||
const soaEditAPIIncrease = "INCREASE"
|
||||
const soaEditAPIInceptionIncrement = "INCEPTION-INCREMENT"
|
||||
|
||||
type HTTPClient interface {
|
||||
Do(*http.Request) (*http.Response, error)
|
||||
@@ -97,7 +97,7 @@ func (c *Client) ListZones(ctx context.Context) ([]Zone, error) {
|
||||
}
|
||||
|
||||
func (c *Client) CreateZone(ctx context.Context, zone Zone) (Zone, error) {
|
||||
zone.SOAEditAPI = soaEditAPIIncrease
|
||||
zone.SOAEditAPI = soaEditAPIInceptionIncrement
|
||||
var created Zone
|
||||
if err := c.do(ctx, http.MethodPost, c.path("/zones"), zone, &created); err != nil {
|
||||
return Zone{}, err
|
||||
@@ -139,7 +139,7 @@ func (c *Client) EnsureAllZonesSOAEditAPI(ctx context.Context) error {
|
||||
}
|
||||
|
||||
func (c *Client) SetZoneSOAEditAPI(ctx context.Context, zoneID string) error {
|
||||
body := Zone{SOAEditAPI: soaEditAPIIncrease}
|
||||
body := Zone{SOAEditAPI: soaEditAPIInceptionIncrement}
|
||||
return c.do(ctx, http.MethodPut, c.path("/zones/"+url.PathEscape(zoneID)), body, nil)
|
||||
}
|
||||
|
||||
|
||||
@@ -238,7 +238,7 @@ func TestCreateZonePostsZone(t *testing.T) {
|
||||
if payload.Name != "example.org." || payload.Kind != "Native" {
|
||||
t.Fatalf("unexpected payload: %#v", payload)
|
||||
}
|
||||
if payload.SOAEditAPI != soaEditAPIIncrease {
|
||||
if payload.SOAEditAPI != "INCEPTION-INCREMENT" {
|
||||
t.Fatalf("unexpected soa_edit_api: %q", payload.SOAEditAPI)
|
||||
}
|
||||
w.WriteHeader(http.StatusCreated)
|
||||
@@ -252,7 +252,7 @@ func TestCreateZonePostsZone(t *testing.T) {
|
||||
if err := json.NewDecoder(r.Body).Decode(&payload); err != nil {
|
||||
t.Fatalf("decode request: %v", err)
|
||||
}
|
||||
if payload.SOAEditAPI != soaEditAPIIncrease {
|
||||
if payload.SOAEditAPI != "INCEPTION-INCREMENT" {
|
||||
t.Fatalf("unexpected soa_edit_api: %q", payload.SOAEditAPI)
|
||||
}
|
||||
w.WriteHeader(http.StatusNoContent)
|
||||
@@ -285,7 +285,7 @@ func TestEnsureAllZonesSOAEditAPIUpdatesAllZones(t *testing.T) {
|
||||
t.Fatalf("unexpected path: %s", r.URL.Path)
|
||||
}
|
||||
_ = json.NewEncoder(w).Encode([]Zone{
|
||||
{ID: "already.example.org.", Name: "already.example.org.", SOAEditAPI: soaEditAPIIncrease},
|
||||
{ID: "already.example.org.", Name: "already.example.org.", SOAEditAPI: soaEditAPIInceptionIncrement},
|
||||
{ID: "missing.example.org.", Name: "missing.example.org."},
|
||||
{ID: "", Name: "fallback.example.org.", SOAEditAPI: "DEFAULT"},
|
||||
})
|
||||
@@ -294,7 +294,7 @@ func TestEnsureAllZonesSOAEditAPIUpdatesAllZones(t *testing.T) {
|
||||
if err := json.NewDecoder(r.Body).Decode(&payload); err != nil {
|
||||
t.Fatalf("decode request: %v", err)
|
||||
}
|
||||
if payload.SOAEditAPI != soaEditAPIIncrease {
|
||||
if payload.SOAEditAPI != "INCEPTION-INCREMENT" {
|
||||
t.Fatalf("unexpected soa_edit_api: %q", payload.SOAEditAPI)
|
||||
}
|
||||
updated = append(updated, strings.TrimPrefix(r.URL.Path, "/api/v1/servers/localhost/zones/"))
|
||||
@@ -331,7 +331,7 @@ func TestSetZoneSOAEditAPIUsesPUT(t *testing.T) {
|
||||
if err := json.NewDecoder(r.Body).Decode(&payload); err != nil {
|
||||
t.Fatalf("decode request: %v", err)
|
||||
}
|
||||
if payload.SOAEditAPI != soaEditAPIIncrease {
|
||||
if payload.SOAEditAPI != "INCEPTION-INCREMENT" {
|
||||
t.Fatalf("unexpected soa_edit_api: %q", payload.SOAEditAPI)
|
||||
}
|
||||
w.WriteHeader(http.StatusNoContent)
|
||||
|
||||
Reference in New Issue
Block a user