Browse Source

feature: Cloudflare支持原生创建域名与更改付费计划API

世祺 10 months ago
parent
commit
a5bb12edb5

+ 1 - 1
cloudflareApi/cache/purge/purge.pb.go

@@ -1,7 +1,7 @@
 // Code generated by protoc-gen-go. DO NOT EDIT.
 // versions:
 // 	protoc-gen-go v1.28.1
-// 	protoc        v3.19.1
+// 	protoc        v4.25.3
 // source: proto/purge.proto
 
 package purge

+ 1 - 1
cloudflareApi/cache/purge/purge_grpc.pb.go

@@ -1,7 +1,7 @@
 // Code generated by protoc-gen-go-grpc. DO NOT EDIT.
 // versions:
 // - protoc-gen-go-grpc v1.2.0
-// - protoc             v3.19.1
+// - protoc             v4.25.3
 // source: proto/purge.proto
 
 package purge

+ 1 - 1
cloudflareApi/certificate/certificate.pb.go

@@ -1,7 +1,7 @@
 // Code generated by protoc-gen-go. DO NOT EDIT.
 // versions:
 // 	protoc-gen-go v1.28.1
-// 	protoc        v3.19.1
+// 	protoc        v4.25.3
 // source: proto/certificate.proto
 
 package certificate

+ 1 - 1
cloudflareApi/certificate/certificate_grpc.pb.go

@@ -1,7 +1,7 @@
 // Code generated by protoc-gen-go-grpc. DO NOT EDIT.
 // versions:
 // - protoc-gen-go-grpc v1.2.0
-// - protoc             v3.19.1
+// - protoc             v4.25.3
 // source: proto/certificate.proto
 
 package certificate

+ 1 - 1
cloudflareApi/dns/dns.pb.go

@@ -1,7 +1,7 @@
 // Code generated by protoc-gen-go. DO NOT EDIT.
 // versions:
 // 	protoc-gen-go v1.28.1
-// 	protoc        v3.19.1
+// 	protoc        v4.25.3
 // source: proto/dns.proto
 
 package dns

+ 1 - 1
cloudflareApi/dns/dns_grpc.pb.go

@@ -1,7 +1,7 @@
 // Code generated by protoc-gen-go-grpc. DO NOT EDIT.
 // versions:
 // - protoc-gen-go-grpc v1.2.0
-// - protoc             v3.19.1
+// - protoc             v4.25.3
 // source: proto/dns.proto
 
 package dns

+ 1 - 1
cloudflareApi/loadBalancer/loadBalancer.pb.go

@@ -1,7 +1,7 @@
 // Code generated by protoc-gen-go. DO NOT EDIT.
 // versions:
 // 	protoc-gen-go v1.28.1
-// 	protoc        v3.19.1
+// 	protoc        v4.25.3
 // source: proto/loadBalancer.proto
 
 package loadBalancer

+ 1 - 1
cloudflareApi/loadBalancer/loadBalancer_grpc.pb.go

@@ -1,7 +1,7 @@
 // Code generated by protoc-gen-go-grpc. DO NOT EDIT.
 // versions:
 // - protoc-gen-go-grpc v1.2.0
-// - protoc             v3.19.1
+// - protoc             v4.25.3
 // source: proto/loadBalancer.proto
 
 package loadBalancer

+ 1 - 1
cloudflareApi/loadBalancerPool/loadBalancerPool.pb.go

@@ -1,7 +1,7 @@
 // Code generated by protoc-gen-go. DO NOT EDIT.
 // versions:
 // 	protoc-gen-go v1.28.1
-// 	protoc        v3.19.1
+// 	protoc        v4.25.3
 // source: proto/loadBalancerPool.proto
 
 package loadBalancerPool

+ 1 - 1
cloudflareApi/loadBalancerPool/loadBalancerPool_grpc.pb.go

@@ -1,7 +1,7 @@
 // Code generated by protoc-gen-go-grpc. DO NOT EDIT.
 // versions:
 // - protoc-gen-go-grpc v1.2.0
-// - protoc             v3.19.1
+// - protoc             v4.25.3
 // source: proto/loadBalancerPool.proto
 
 package loadBalancerPool

+ 1 - 1
cloudflareApi/logPush/logPush.pb.go

@@ -1,7 +1,7 @@
 // Code generated by protoc-gen-go. DO NOT EDIT.
 // versions:
 // 	protoc-gen-go v1.28.1
-// 	protoc        v3.19.1
+// 	protoc        v4.25.3
 // source: proto/logPush.proto
 
 package logPush

+ 1 - 1
cloudflareApi/logPush/logPush_grpc.pb.go

@@ -1,7 +1,7 @@
 // Code generated by protoc-gen-go-grpc. DO NOT EDIT.
 // versions:
 // - protoc-gen-go-grpc v1.2.0
-// - protoc             v3.19.1
+// - protoc             v4.25.3
 // source: proto/logPush.proto
 
 package logPush

File diff suppressed because it is too large
+ 762 - 423
cloudflareApi/zone/zone.pb.go


+ 73 - 1
cloudflareApi/zone/zone_grpc.pb.go

@@ -1,7 +1,7 @@
 // Code generated by protoc-gen-go-grpc. DO NOT EDIT.
 // versions:
 // - protoc-gen-go-grpc v1.2.0
-// - protoc             v3.19.1
+// - protoc             v4.25.3
 // source: proto/zone.proto
 
 package zone
@@ -31,6 +31,8 @@ type ZoneCloudflareClient interface {
 	ListZones(ctx context.Context, in *ListZonesRequestCloudflare, opts ...grpc.CallOption) (*ZonesList, error)
 	ListZonesByAccountId(ctx context.Context, in *ListZonesByAccountIdRequestCloudflare, opts ...grpc.CallOption) (*ZonesList, error)
 	ActivationCheck(ctx context.Context, in *ActivationCheckRequestCloudflare, opts ...grpc.CallOption) (*ActivationCheckReplyCloudflare, error)
+	CreateZone(ctx context.Context, in *CreateZoneRequestCloudflare, opts ...grpc.CallOption) (*CreateZoneReplyCloudflare, error)
+	SetZonePlan(ctx context.Context, in *SetZonePlanRequestCloudflare, opts ...grpc.CallOption) (*SetZonePlanReplyCloudflare, error)
 	// PageRule CURD
 	ListPageRule(ctx context.Context, in *ListPageRuleRequestCloudflare, opts ...grpc.CallOption) (*PageRuleList, error)
 	CreatePageRule(ctx context.Context, in *CreatePageRuleRequestCloudflare, opts ...grpc.CallOption) (*PageRule, error)
@@ -127,6 +129,24 @@ func (c *zoneCloudflareClient) ActivationCheck(ctx context.Context, in *Activati
 	return out, nil
 }
 
+func (c *zoneCloudflareClient) CreateZone(ctx context.Context, in *CreateZoneRequestCloudflare, opts ...grpc.CallOption) (*CreateZoneReplyCloudflare, error) {
+	out := new(CreateZoneReplyCloudflare)
+	err := c.cc.Invoke(ctx, "/cloudflareApi.zone.ZoneCloudflare/CreateZone", in, out, opts...)
+	if err != nil {
+		return nil, err
+	}
+	return out, nil
+}
+
+func (c *zoneCloudflareClient) SetZonePlan(ctx context.Context, in *SetZonePlanRequestCloudflare, opts ...grpc.CallOption) (*SetZonePlanReplyCloudflare, error) {
+	out := new(SetZonePlanReplyCloudflare)
+	err := c.cc.Invoke(ctx, "/cloudflareApi.zone.ZoneCloudflare/SetZonePlan", in, out, opts...)
+	if err != nil {
+		return nil, err
+	}
+	return out, nil
+}
+
 func (c *zoneCloudflareClient) ListPageRule(ctx context.Context, in *ListPageRuleRequestCloudflare, opts ...grpc.CallOption) (*PageRuleList, error) {
 	out := new(PageRuleList)
 	err := c.cc.Invoke(ctx, "/cloudflareApi.zone.ZoneCloudflare/ListPageRule", in, out, opts...)
@@ -239,6 +259,8 @@ type ZoneCloudflareServer interface {
 	ListZones(context.Context, *ListZonesRequestCloudflare) (*ZonesList, error)
 	ListZonesByAccountId(context.Context, *ListZonesByAccountIdRequestCloudflare) (*ZonesList, error)
 	ActivationCheck(context.Context, *ActivationCheckRequestCloudflare) (*ActivationCheckReplyCloudflare, error)
+	CreateZone(context.Context, *CreateZoneRequestCloudflare) (*CreateZoneReplyCloudflare, error)
+	SetZonePlan(context.Context, *SetZonePlanRequestCloudflare) (*SetZonePlanReplyCloudflare, error)
 	// PageRule CURD
 	ListPageRule(context.Context, *ListPageRuleRequestCloudflare) (*PageRuleList, error)
 	CreatePageRule(context.Context, *CreatePageRuleRequestCloudflare) (*PageRule, error)
@@ -284,6 +306,12 @@ func (UnimplementedZoneCloudflareServer) ListZonesByAccountId(context.Context, *
 func (UnimplementedZoneCloudflareServer) ActivationCheck(context.Context, *ActivationCheckRequestCloudflare) (*ActivationCheckReplyCloudflare, error) {
 	return nil, status.Errorf(codes.Unimplemented, "method ActivationCheck not implemented")
 }
+func (UnimplementedZoneCloudflareServer) CreateZone(context.Context, *CreateZoneRequestCloudflare) (*CreateZoneReplyCloudflare, error) {
+	return nil, status.Errorf(codes.Unimplemented, "method CreateZone not implemented")
+}
+func (UnimplementedZoneCloudflareServer) SetZonePlan(context.Context, *SetZonePlanRequestCloudflare) (*SetZonePlanReplyCloudflare, error) {
+	return nil, status.Errorf(codes.Unimplemented, "method SetZonePlan not implemented")
+}
 func (UnimplementedZoneCloudflareServer) ListPageRule(context.Context, *ListPageRuleRequestCloudflare) (*PageRuleList, error) {
 	return nil, status.Errorf(codes.Unimplemented, "method ListPageRule not implemented")
 }
@@ -474,6 +502,42 @@ func _ZoneCloudflare_ActivationCheck_Handler(srv interface{}, ctx context.Contex
 	return interceptor(ctx, in, info, handler)
 }
 
+func _ZoneCloudflare_CreateZone_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
+	in := new(CreateZoneRequestCloudflare)
+	if err := dec(in); err != nil {
+		return nil, err
+	}
+	if interceptor == nil {
+		return srv.(ZoneCloudflareServer).CreateZone(ctx, in)
+	}
+	info := &grpc.UnaryServerInfo{
+		Server:     srv,
+		FullMethod: "/cloudflareApi.zone.ZoneCloudflare/CreateZone",
+	}
+	handler := func(ctx context.Context, req interface{}) (interface{}, error) {
+		return srv.(ZoneCloudflareServer).CreateZone(ctx, req.(*CreateZoneRequestCloudflare))
+	}
+	return interceptor(ctx, in, info, handler)
+}
+
+func _ZoneCloudflare_SetZonePlan_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
+	in := new(SetZonePlanRequestCloudflare)
+	if err := dec(in); err != nil {
+		return nil, err
+	}
+	if interceptor == nil {
+		return srv.(ZoneCloudflareServer).SetZonePlan(ctx, in)
+	}
+	info := &grpc.UnaryServerInfo{
+		Server:     srv,
+		FullMethod: "/cloudflareApi.zone.ZoneCloudflare/SetZonePlan",
+	}
+	handler := func(ctx context.Context, req interface{}) (interface{}, error) {
+		return srv.(ZoneCloudflareServer).SetZonePlan(ctx, req.(*SetZonePlanRequestCloudflare))
+	}
+	return interceptor(ctx, in, info, handler)
+}
+
 func _ZoneCloudflare_ListPageRule_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
 	in := new(ListPageRuleRequestCloudflare)
 	if err := dec(in); err != nil {
@@ -711,6 +775,14 @@ var ZoneCloudflare_ServiceDesc = grpc.ServiceDesc{
 			MethodName: "ActivationCheck",
 			Handler:    _ZoneCloudflare_ActivationCheck_Handler,
 		},
+		{
+			MethodName: "CreateZone",
+			Handler:    _ZoneCloudflare_CreateZone_Handler,
+		},
+		{
+			MethodName: "SetZonePlan",
+			Handler:    _ZoneCloudflare_SetZonePlan_Handler,
+		},
 		{
 			MethodName: "ListPageRule",
 			Handler:    _ZoneCloudflare_ListPageRule_Handler,

+ 45 - 0
server/ZoneCloudflareServer.go

@@ -402,6 +402,51 @@ func (s *ZoneServer) DeleteZone(ctx context.Context, requestCloudflare *zone.Del
 	}, nil
 }
 
+func (s *ZoneServer) CreateZone(ctx context.Context, requestCloudflare *zone.CreateZoneRequestCloudflare) (*zone.CreateZoneReplyCloudflare, error) {
+	log.Printf("request Received: %+v", requestCloudflare)
+
+	api, err := cloudflare.New(requestCloudflare.GetApiKey(), requestCloudflare.GetApiEmail())
+	if err != nil {
+		return nil, err
+	}
+
+	ctxAPI := context.Background()
+	account, _, err := api.Account(ctxAPI, requestCloudflare.GetAccountId())
+	if err != nil {
+		return nil, err
+	}
+
+	createZone, err := api.CreateZone(ctxAPI, requestCloudflare.GetDomain(), false, account, "partial")
+	if err != nil {
+		return nil, err
+	}
+
+	return &zone.CreateZoneReplyCloudflare{
+		Success: true,
+		Id:      createZone.ID,
+	}, nil
+
+}
+
+func (s *ZoneServer) SetZonePlan(ctx context.Context, requestCloudflare *zone.SetZonePlanRequestCloudflare) (*zone.SetZonePlanReplyCloudflare, error) {
+	log.Printf("request Received: %+v", requestCloudflare)
+
+	api, err := cloudflare.New(requestCloudflare.GetApiKey(), requestCloudflare.GetApiEmail())
+	if err != nil {
+		return nil, err
+	}
+
+	ctxAPI := context.Background()
+	err = api.ZoneSetPlan(ctxAPI, requestCloudflare.GetZoneId(), requestCloudflare.GetZonePlan())
+	if err != nil {
+		return nil, err
+	}
+
+	return &zone.SetZonePlanReplyCloudflare{
+		Success: true,
+	}, nil
+}
+
 func (s *ZoneServer) ActivationCheck(ctx context.Context, requestCloudflare *zone.ActivationCheckRequestCloudflare) (*zone.ActivationCheckReplyCloudflare, error) {
 	log.Printf("apiKey Received: %v", requestCloudflare.GetApiKey())
 	log.Printf("apiEmail Received: %v", requestCloudflare.GetApiEmail())

+ 195 - 64
server/ZoneCloudflareServer_test.go

@@ -2,90 +2,93 @@ package server
 
 import (
 	"cfTest/cloudflareApi/zone"
-	"reflect"
-
 	"context"
+	"github.com/cloudflare/cloudflare-go"
 	"github.com/samber/lo"
 	"log"
+	"reflect"
 	"testing"
+	"time"
 )
 
-//func TestCreateRuleSet(t *testing.T) {
-//	type args struct {
-//		zoneID       string
-//		rulesetPhase string
-//		ruleset      cloudflare.Ruleset
-//	}
+//	func TestCreateRuleSet(t *testing.T) {
+//		type args struct {
+//			zoneID       string
+//			rulesetPhase string
+//			ruleset      cloudflare.Ruleset
+//		}
 //
-//	var (
-//		True        = true
-//		CONST604800 = uint(604800)
-//	)
+//		var (
+//			True        = true
+//			CONST604800 = uint(604800)
+//		)
 //
-//	tests := []struct {
-//		name    string
-//		args    args
-//		want    interface{}
-//		wantErr bool
-//	}{
-//		{
-//			name: "Test1",
-//			args: args{
-//				zoneID:       "e29551894461bf16e43a113e5ab09ed3",
-//				rulesetPhase: "http_request_cache_settings",
-//				ruleset: cloudflare.Ruleset{
-//					Rules: []cloudflare.RulesetRule{
-//						{
-//							Expression:  "(starts_with(http.request.uri.path, \"/\"))",
-//							Enabled:     true,
-//							Description: "test1",
-//							Action:      "set_cache_settings",
-//							ActionParameters: &cloudflare.RulesetRuleActionParameters{
-//								Cache: &True,
-//								CacheKey: &cloudflare.RulesetRuleActionParametersCacheKey{
-//									CustomKey: &cloudflare.RulesetRuleActionParametersCustomKey{
-//										Query: &cloudflare.RulesetRuleActionParametersCustomKeyQuery{
-//											Exclude: &cloudflare.RulesetRuleActionParametersCustomKeyList{
-//												List: []string{
-//													"abc",
+//		tests := []struct {
+//			name    string
+//			args    args
+//			want    interface{}
+//			wantErr bool
+//		}{
+//			{
+//				name: "Test1",
+//				args: args{
+//					zoneID:       "e29551894461bf16e43a113e5ab09ed3",
+//					rulesetPhase: "http_request_cache_settings",
+//					ruleset: cloudflare.Ruleset{
+//						Rules: []cloudflare.RulesetRule{
+//							{
+//								Expression:  "(starts_with(http.request.uri.path, \"/\"))",
+//								Enabled:     true,
+//								Description: "test1",
+//								Action:      "set_cache_settings",
+//								ActionParameters: &cloudflare.RulesetRuleActionParameters{
+//									Cache: &True,
+//									CacheKey: &cloudflare.RulesetRuleActionParametersCacheKey{
+//										CustomKey: &cloudflare.RulesetRuleActionParametersCustomKey{
+//											Query: &cloudflare.RulesetRuleActionParametersCustomKeyQuery{
+//												Exclude: &cloudflare.RulesetRuleActionParametersCustomKeyList{
+//													List: []string{
+//														"abc",
+//													},
+//													All: false,
 //												},
-//												All: false,
 //											},
 //										},
 //									},
-//								},
-//								EdgeTTL: &cloudflare.RulesetRuleActionParametersEdgeTTL{
-//									Mode:    "override_origin",
-//									Default: &CONST604800,
+//									EdgeTTL: &cloudflare.RulesetRuleActionParametersEdgeTTL{
+//										Mode:    "override_origin",
+//										Default: &CONST604800,
+//									},
 //								},
 //							},
 //						},
 //					},
 //				},
+//				want:    nil,
+//				wantErr: false,
 //			},
-//			want:    nil,
-//			wantErr: false,
-//		},
+//		}
+//		for _, tt := range tests {
+//			t.Run(tt.name, func(t *testing.T) {
+//				got, err := UpdateRuleSet("", "", tt.args.zoneID, tt.args.rulesetPhase, tt.args.ruleset)
+//				if (err != nil) != tt.wantErr {
+//					t.Errorf("UpdateRuleSet() error = %v, wantErr %v", err, tt.wantErr)
+//					return
+//				}
+//				if !reflect.DeepEqual(got, tt.want) {
+//					t.Errorf("UpdateRuleSet() got = %v, want %v", got, tt.want)
+//				}
+//			})
+//		}
 //	}
-//	for _, tt := range tests {
-//		t.Run(tt.name, func(t *testing.T) {
-//			got, err := UpdateRuleSet("", "", tt.args.zoneID, tt.args.rulesetPhase, tt.args.ruleset)
-//			if (err != nil) != tt.wantErr {
-//				t.Errorf("UpdateRuleSet() error = %v, wantErr %v", err, tt.wantErr)
-//				return
-//			}
-//			if !reflect.DeepEqual(got, tt.want) {
-//				t.Errorf("UpdateRuleSet() got = %v, want %v", got, tt.want)
-//			}
-//		})
+//
+//	func newUint32(a uint32) *uint32 {
+//		return &a
+//	}
+//
+//	func newStr(a string) *string {
+//		return &a
 //	}
-//}
-//func newUint32(a uint32) *uint32 {
-//	return &a
-//}
-//func newStr(a string) *string {
-//	return &a
-//}
 var (
 	apiKey   = "2cc87f6213a4c40e5a90c8dced3c9c577eda5"
 	apiEmail = "ll@centcloud.net"
@@ -498,3 +501,131 @@ func TestZoneServer_CreateArgoSettingSubscription(t *testing.T) {
 		})
 	}
 }
+
+func TestCreateZone(t *testing.T) {
+	api, err := cloudflare.New("d2589c4f617b0493357ae187a7b4518171d07", "shiqi@centcloud.net")
+	if err != nil {
+		t.Fatal(err)
+	}
+	ctx := context.Background()
+	account, r, err := api.Account(ctx, "b9145a83318cae896ad9b23bdf1681a5")
+	if err != nil {
+		t.Fatal(err)
+	}
+	t.Logf("Account Info:%+v", r)
+
+	createZone, err := api.CreateZone(ctx, "cf004.shiqi.website", false, account, "partial")
+	if err != nil {
+		t.Fatal(err)
+	}
+	t.Logf("createZone: %+v", createZone)
+
+	time.Sleep(time.Second)
+
+	zoneId := createZone.ID
+
+	err = api.ZoneSetPlan(ctx, zoneId, "PARTNERS_ENT")
+	if err != nil {
+		t.Fatal(err)
+	}
+}
+
+func TestZoneServer_CreateZone(t *testing.T) {
+	type fields struct {
+		UnimplementedZoneCloudflareServer zone.UnimplementedZoneCloudflareServer
+	}
+	type args struct {
+		ctx               context.Context
+		requestCloudflare *zone.CreateZoneRequestCloudflare
+	}
+	tests := []struct {
+		name    string
+		fields  fields
+		args    args
+		want    *zone.CreateZoneReplyCloudflare
+		wantErr bool
+	}{
+		{
+			name: "测试用例1",
+			fields: fields{
+				UnimplementedZoneCloudflareServer: zone.UnimplementedZoneCloudflareServer{},
+			},
+			args: args{
+				ctx: context.Background(),
+				requestCloudflare: &zone.CreateZoneRequestCloudflare{
+					ApiKey:    "d2589c4f617b0493357ae187a7b4518171d07",
+					ApiEmail:  "shiqi@centcloud.net",
+					AccountId: "b9145a83318cae896ad9b23bdf1681a5",
+					Domain:    "cf005.shiqi.website",
+				},
+			},
+			want:    nil,
+			wantErr: false,
+		},
+	}
+	for _, tt := range tests {
+		t.Run(tt.name, func(t *testing.T) {
+			s := &ZoneServer{
+				UnimplementedZoneCloudflareServer: tt.fields.UnimplementedZoneCloudflareServer,
+			}
+			got, err := s.CreateZone(tt.args.ctx, tt.args.requestCloudflare)
+			if (err != nil) != tt.wantErr {
+				t.Errorf("CreateZone() error = %v, wantErr %v", err, tt.wantErr)
+				return
+			}
+
+			t.Logf("CreateZone() got = %v", got)
+
+		})
+	}
+}
+
+func TestZoneServer_SetZonePlan(t *testing.T) {
+	type fields struct {
+		UnimplementedZoneCloudflareServer zone.UnimplementedZoneCloudflareServer
+	}
+	type args struct {
+		ctx               context.Context
+		requestCloudflare *zone.SetZonePlanRequestCloudflare
+	}
+	tests := []struct {
+		name    string
+		fields  fields
+		args    args
+		want    *zone.SetZonePlanReplyCloudflare
+		wantErr bool
+	}{
+		{
+			name: "测试用例1",
+			fields: fields{
+				UnimplementedZoneCloudflareServer: zone.UnimplementedZoneCloudflareServer{},
+			},
+			args: args{
+				ctx: context.Background(),
+				requestCloudflare: &zone.SetZonePlanRequestCloudflare{
+					ApiKey:   "d2589c4f617b0493357ae187a7b4518171d07",
+					ApiEmail: "shiqi@centcloud.net",
+					ZoneId:   "19e7978bb9292fe11d3c75ff39f87685",
+					ZonePlan: "PARTNERS_ENT",
+				},
+			},
+			want:    &zone.SetZonePlanReplyCloudflare{Success: true},
+			wantErr: false,
+		},
+	}
+	for _, tt := range tests {
+		t.Run(tt.name, func(t *testing.T) {
+			s := &ZoneServer{
+				UnimplementedZoneCloudflareServer: tt.fields.UnimplementedZoneCloudflareServer,
+			}
+			got, err := s.SetZonePlan(tt.args.ctx, tt.args.requestCloudflare)
+			if (err != nil) != tt.wantErr {
+				t.Errorf("SetZonePlan() error = %v, wantErr %v", err, tt.wantErr)
+				return
+			}
+			if !reflect.DeepEqual(got, tt.want) {
+				t.Errorf("SetZonePlan() got = %v, want %v", got, tt.want)
+			}
+		})
+	}
+}