From 1d3698a0966f788f4539a018d3e18c2c3f31bba9 Mon Sep 17 00:00:00 2001 From: Stefan Majer Date: Fri, 29 Jul 2022 14:40:14 +0200 Subject: [PATCH] Expose Usage via grpc (#86) --- README.md | 2 +- api/v1/apiv1connect/ipam.connect.go | 22 ++ api/v1/ipam.pb.go | 510 +++++++++++++++++++--------- go.mod | 8 +- go.sum | 16 +- ipam.go | 3 - pkg/service/ipam-service.go | 19 +- prefix.go | 6 +- prefix_benchmark_test.go | 3 +- prefix_test.go | 2 +- proto/api/v1/ipam.proto | 20 ++ 11 files changed, 426 insertions(+), 185 deletions(-) diff --git a/README.md b/README.md index f4fe0f8..2df96df 100644 --- a/README.md +++ b/README.md @@ -59,7 +59,7 @@ func main() { if err != nil { panic(err) } - cp1, err := ipam.AcquireChildPrefix(prefix.Cidr, 64) + cp1, err := ipam.AcquireChildPrefix(ctx, prefix.Cidr, 64) if err != nil { panic(err) } diff --git a/api/v1/apiv1connect/ipam.connect.go b/api/v1/apiv1connect/ipam.connect.go index 41bcc64..74de657 100644 --- a/api/v1/apiv1connect/ipam.connect.go +++ b/api/v1/apiv1connect/ipam.connect.go @@ -31,6 +31,7 @@ type IpamServiceClient interface { DeletePrefix(context.Context, *connect_go.Request[v1.DeletePrefixRequest]) (*connect_go.Response[v1.DeletePrefixResponse], error) GetPrefix(context.Context, *connect_go.Request[v1.GetPrefixRequest]) (*connect_go.Response[v1.GetPrefixResponse], error) ListPrefixes(context.Context, *connect_go.Request[v1.ListPrefixesRequest]) (*connect_go.Response[v1.ListPrefixesResponse], error) + PrefixUsage(context.Context, *connect_go.Request[v1.PrefixUsageRequest]) (*connect_go.Response[v1.PrefixUsageResponse], error) AcquireChildPrefix(context.Context, *connect_go.Request[v1.AcquireChildPrefixRequest]) (*connect_go.Response[v1.AcquireChildPrefixResponse], error) ReleaseChildPrefix(context.Context, *connect_go.Request[v1.ReleaseChildPrefixRequest]) (*connect_go.Response[v1.ReleaseChildPrefixResponse], error) AcquireIP(context.Context, *connect_go.Request[v1.AcquireIPRequest]) (*connect_go.Response[v1.AcquireIPResponse], error) @@ -69,6 +70,11 @@ func NewIpamServiceClient(httpClient connect_go.HTTPClient, baseURL string, opts baseURL+"/api.v1.IpamService/ListPrefixes", opts..., ), + prefixUsage: connect_go.NewClient[v1.PrefixUsageRequest, v1.PrefixUsageResponse]( + httpClient, + baseURL+"/api.v1.IpamService/PrefixUsage", + opts..., + ), acquireChildPrefix: connect_go.NewClient[v1.AcquireChildPrefixRequest, v1.AcquireChildPrefixResponse]( httpClient, baseURL+"/api.v1.IpamService/AcquireChildPrefix", @@ -108,6 +114,7 @@ type ipamServiceClient struct { deletePrefix *connect_go.Client[v1.DeletePrefixRequest, v1.DeletePrefixResponse] getPrefix *connect_go.Client[v1.GetPrefixRequest, v1.GetPrefixResponse] listPrefixes *connect_go.Client[v1.ListPrefixesRequest, v1.ListPrefixesResponse] + prefixUsage *connect_go.Client[v1.PrefixUsageRequest, v1.PrefixUsageResponse] acquireChildPrefix *connect_go.Client[v1.AcquireChildPrefixRequest, v1.AcquireChildPrefixResponse] releaseChildPrefix *connect_go.Client[v1.ReleaseChildPrefixRequest, v1.ReleaseChildPrefixResponse] acquireIP *connect_go.Client[v1.AcquireIPRequest, v1.AcquireIPResponse] @@ -136,6 +143,11 @@ func (c *ipamServiceClient) ListPrefixes(ctx context.Context, req *connect_go.Re return c.listPrefixes.CallUnary(ctx, req) } +// PrefixUsage calls api.v1.IpamService.PrefixUsage. +func (c *ipamServiceClient) PrefixUsage(ctx context.Context, req *connect_go.Request[v1.PrefixUsageRequest]) (*connect_go.Response[v1.PrefixUsageResponse], error) { + return c.prefixUsage.CallUnary(ctx, req) +} + // AcquireChildPrefix calls api.v1.IpamService.AcquireChildPrefix. func (c *ipamServiceClient) AcquireChildPrefix(ctx context.Context, req *connect_go.Request[v1.AcquireChildPrefixRequest]) (*connect_go.Response[v1.AcquireChildPrefixResponse], error) { return c.acquireChildPrefix.CallUnary(ctx, req) @@ -172,6 +184,7 @@ type IpamServiceHandler interface { DeletePrefix(context.Context, *connect_go.Request[v1.DeletePrefixRequest]) (*connect_go.Response[v1.DeletePrefixResponse], error) GetPrefix(context.Context, *connect_go.Request[v1.GetPrefixRequest]) (*connect_go.Response[v1.GetPrefixResponse], error) ListPrefixes(context.Context, *connect_go.Request[v1.ListPrefixesRequest]) (*connect_go.Response[v1.ListPrefixesResponse], error) + PrefixUsage(context.Context, *connect_go.Request[v1.PrefixUsageRequest]) (*connect_go.Response[v1.PrefixUsageResponse], error) AcquireChildPrefix(context.Context, *connect_go.Request[v1.AcquireChildPrefixRequest]) (*connect_go.Response[v1.AcquireChildPrefixResponse], error) ReleaseChildPrefix(context.Context, *connect_go.Request[v1.ReleaseChildPrefixRequest]) (*connect_go.Response[v1.ReleaseChildPrefixResponse], error) AcquireIP(context.Context, *connect_go.Request[v1.AcquireIPRequest]) (*connect_go.Response[v1.AcquireIPResponse], error) @@ -207,6 +220,11 @@ func NewIpamServiceHandler(svc IpamServiceHandler, opts ...connect_go.HandlerOpt svc.ListPrefixes, opts..., )) + mux.Handle("/api.v1.IpamService/PrefixUsage", connect_go.NewUnaryHandler( + "/api.v1.IpamService/PrefixUsage", + svc.PrefixUsage, + opts..., + )) mux.Handle("/api.v1.IpamService/AcquireChildPrefix", connect_go.NewUnaryHandler( "/api.v1.IpamService/AcquireChildPrefix", svc.AcquireChildPrefix, @@ -259,6 +277,10 @@ func (UnimplementedIpamServiceHandler) ListPrefixes(context.Context, *connect_go return nil, connect_go.NewError(connect_go.CodeUnimplemented, errors.New("api.v1.IpamService.ListPrefixes is not implemented")) } +func (UnimplementedIpamServiceHandler) PrefixUsage(context.Context, *connect_go.Request[v1.PrefixUsageRequest]) (*connect_go.Response[v1.PrefixUsageResponse], error) { + return nil, connect_go.NewError(connect_go.CodeUnimplemented, errors.New("api.v1.IpamService.PrefixUsage is not implemented")) +} + func (UnimplementedIpamServiceHandler) AcquireChildPrefix(context.Context, *connect_go.Request[v1.AcquireChildPrefixRequest]) (*connect_go.Response[v1.AcquireChildPrefixResponse], error) { return nil, connect_go.NewError(connect_go.CodeUnimplemented, errors.New("api.v1.IpamService.AcquireChildPrefix is not implemented")) } diff --git a/api/v1/ipam.pb.go b/api/v1/ipam.pb.go index 1553aa9..d4f00fb 100644 --- a/api/v1/ipam.pb.go +++ b/api/v1/ipam.pb.go @@ -536,6 +536,139 @@ func (x *ListPrefixesResponse) GetPrefixes() []*Prefix { return nil } +type PrefixUsageRequest struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Cidr string `protobuf:"bytes,1,opt,name=cidr,proto3" json:"cidr,omitempty"` +} + +func (x *PrefixUsageRequest) Reset() { + *x = PrefixUsageRequest{} + if protoimpl.UnsafeEnabled { + mi := &file_api_v1_ipam_proto_msgTypes[11] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *PrefixUsageRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*PrefixUsageRequest) ProtoMessage() {} + +func (x *PrefixUsageRequest) ProtoReflect() protoreflect.Message { + mi := &file_api_v1_ipam_proto_msgTypes[11] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use PrefixUsageRequest.ProtoReflect.Descriptor instead. +func (*PrefixUsageRequest) Descriptor() ([]byte, []int) { + return file_api_v1_ipam_proto_rawDescGZIP(), []int{11} +} + +func (x *PrefixUsageRequest) GetCidr() string { + if x != nil { + return x.Cidr + } + return "" +} + +type PrefixUsageResponse struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + // AvailableIPs the number of available IPs if this is not a parent prefix + // No more than 2^31 available IPs are reported + AvailableIps uint64 `protobuf:"varint,1,opt,name=available_ips,json=availableIps,proto3" json:"available_ips,omitempty"` + // AcquiredIPs the number of acquired IPs if this is not a parent prefix + AcquiredIps uint64 `protobuf:"varint,2,opt,name=acquired_ips,json=acquiredIps,proto3" json:"acquired_ips,omitempty"` + // AvailableSmallestPrefixes is the count of available Prefixes with 2 countable Bits + // No more than 2^31 available Prefixes are reported + AvailableSmallestPrefixes uint64 `protobuf:"varint,3,opt,name=available_smallest_prefixes,json=availableSmallestPrefixes,proto3" json:"available_smallest_prefixes,omitempty"` + // AvailablePrefixes is a list of prefixes which are available + AvailablePrefixes []string `protobuf:"bytes,4,rep,name=available_prefixes,json=availablePrefixes,proto3" json:"available_prefixes,omitempty"` + // AcquiredPrefixes the number of acquired prefixes if this is a parent prefix + AcquiredPrefixes uint64 `protobuf:"varint,5,opt,name=acquired_prefixes,json=acquiredPrefixes,proto3" json:"acquired_prefixes,omitempty"` +} + +func (x *PrefixUsageResponse) Reset() { + *x = PrefixUsageResponse{} + if protoimpl.UnsafeEnabled { + mi := &file_api_v1_ipam_proto_msgTypes[12] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *PrefixUsageResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*PrefixUsageResponse) ProtoMessage() {} + +func (x *PrefixUsageResponse) ProtoReflect() protoreflect.Message { + mi := &file_api_v1_ipam_proto_msgTypes[12] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use PrefixUsageResponse.ProtoReflect.Descriptor instead. +func (*PrefixUsageResponse) Descriptor() ([]byte, []int) { + return file_api_v1_ipam_proto_rawDescGZIP(), []int{12} +} + +func (x *PrefixUsageResponse) GetAvailableIps() uint64 { + if x != nil { + return x.AvailableIps + } + return 0 +} + +func (x *PrefixUsageResponse) GetAcquiredIps() uint64 { + if x != nil { + return x.AcquiredIps + } + return 0 +} + +func (x *PrefixUsageResponse) GetAvailableSmallestPrefixes() uint64 { + if x != nil { + return x.AvailableSmallestPrefixes + } + return 0 +} + +func (x *PrefixUsageResponse) GetAvailablePrefixes() []string { + if x != nil { + return x.AvailablePrefixes + } + return nil +} + +func (x *PrefixUsageResponse) GetAcquiredPrefixes() uint64 { + if x != nil { + return x.AcquiredPrefixes + } + return 0 +} + type AcquireChildPrefixRequest struct { state protoimpl.MessageState sizeCache protoimpl.SizeCache @@ -548,7 +681,7 @@ type AcquireChildPrefixRequest struct { func (x *AcquireChildPrefixRequest) Reset() { *x = AcquireChildPrefixRequest{} if protoimpl.UnsafeEnabled { - mi := &file_api_v1_ipam_proto_msgTypes[11] + mi := &file_api_v1_ipam_proto_msgTypes[13] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -561,7 +694,7 @@ func (x *AcquireChildPrefixRequest) String() string { func (*AcquireChildPrefixRequest) ProtoMessage() {} func (x *AcquireChildPrefixRequest) ProtoReflect() protoreflect.Message { - mi := &file_api_v1_ipam_proto_msgTypes[11] + mi := &file_api_v1_ipam_proto_msgTypes[13] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -574,7 +707,7 @@ func (x *AcquireChildPrefixRequest) ProtoReflect() protoreflect.Message { // Deprecated: Use AcquireChildPrefixRequest.ProtoReflect.Descriptor instead. func (*AcquireChildPrefixRequest) Descriptor() ([]byte, []int) { - return file_api_v1_ipam_proto_rawDescGZIP(), []int{11} + return file_api_v1_ipam_proto_rawDescGZIP(), []int{13} } func (x *AcquireChildPrefixRequest) GetCidr() string { @@ -602,7 +735,7 @@ type ReleaseChildPrefixRequest struct { func (x *ReleaseChildPrefixRequest) Reset() { *x = ReleaseChildPrefixRequest{} if protoimpl.UnsafeEnabled { - mi := &file_api_v1_ipam_proto_msgTypes[12] + mi := &file_api_v1_ipam_proto_msgTypes[14] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -615,7 +748,7 @@ func (x *ReleaseChildPrefixRequest) String() string { func (*ReleaseChildPrefixRequest) ProtoMessage() {} func (x *ReleaseChildPrefixRequest) ProtoReflect() protoreflect.Message { - mi := &file_api_v1_ipam_proto_msgTypes[12] + mi := &file_api_v1_ipam_proto_msgTypes[14] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -628,7 +761,7 @@ func (x *ReleaseChildPrefixRequest) ProtoReflect() protoreflect.Message { // Deprecated: Use ReleaseChildPrefixRequest.ProtoReflect.Descriptor instead. func (*ReleaseChildPrefixRequest) Descriptor() ([]byte, []int) { - return file_api_v1_ipam_proto_rawDescGZIP(), []int{12} + return file_api_v1_ipam_proto_rawDescGZIP(), []int{14} } func (x *ReleaseChildPrefixRequest) GetCidr() string { @@ -650,7 +783,7 @@ type IP struct { func (x *IP) Reset() { *x = IP{} if protoimpl.UnsafeEnabled { - mi := &file_api_v1_ipam_proto_msgTypes[13] + mi := &file_api_v1_ipam_proto_msgTypes[15] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -663,7 +796,7 @@ func (x *IP) String() string { func (*IP) ProtoMessage() {} func (x *IP) ProtoReflect() protoreflect.Message { - mi := &file_api_v1_ipam_proto_msgTypes[13] + mi := &file_api_v1_ipam_proto_msgTypes[15] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -676,7 +809,7 @@ func (x *IP) ProtoReflect() protoreflect.Message { // Deprecated: Use IP.ProtoReflect.Descriptor instead. func (*IP) Descriptor() ([]byte, []int) { - return file_api_v1_ipam_proto_rawDescGZIP(), []int{13} + return file_api_v1_ipam_proto_rawDescGZIP(), []int{15} } func (x *IP) GetIp() string { @@ -704,7 +837,7 @@ type AcquireIPResponse struct { func (x *AcquireIPResponse) Reset() { *x = AcquireIPResponse{} if protoimpl.UnsafeEnabled { - mi := &file_api_v1_ipam_proto_msgTypes[14] + mi := &file_api_v1_ipam_proto_msgTypes[16] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -717,7 +850,7 @@ func (x *AcquireIPResponse) String() string { func (*AcquireIPResponse) ProtoMessage() {} func (x *AcquireIPResponse) ProtoReflect() protoreflect.Message { - mi := &file_api_v1_ipam_proto_msgTypes[14] + mi := &file_api_v1_ipam_proto_msgTypes[16] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -730,7 +863,7 @@ func (x *AcquireIPResponse) ProtoReflect() protoreflect.Message { // Deprecated: Use AcquireIPResponse.ProtoReflect.Descriptor instead. func (*AcquireIPResponse) Descriptor() ([]byte, []int) { - return file_api_v1_ipam_proto_rawDescGZIP(), []int{14} + return file_api_v1_ipam_proto_rawDescGZIP(), []int{16} } func (x *AcquireIPResponse) GetIp() *IP { @@ -751,7 +884,7 @@ type ReleaseIPResponse struct { func (x *ReleaseIPResponse) Reset() { *x = ReleaseIPResponse{} if protoimpl.UnsafeEnabled { - mi := &file_api_v1_ipam_proto_msgTypes[15] + mi := &file_api_v1_ipam_proto_msgTypes[17] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -764,7 +897,7 @@ func (x *ReleaseIPResponse) String() string { func (*ReleaseIPResponse) ProtoMessage() {} func (x *ReleaseIPResponse) ProtoReflect() protoreflect.Message { - mi := &file_api_v1_ipam_proto_msgTypes[15] + mi := &file_api_v1_ipam_proto_msgTypes[17] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -777,7 +910,7 @@ func (x *ReleaseIPResponse) ProtoReflect() protoreflect.Message { // Deprecated: Use ReleaseIPResponse.ProtoReflect.Descriptor instead. func (*ReleaseIPResponse) Descriptor() ([]byte, []int) { - return file_api_v1_ipam_proto_rawDescGZIP(), []int{15} + return file_api_v1_ipam_proto_rawDescGZIP(), []int{17} } func (x *ReleaseIPResponse) GetIp() *IP { @@ -799,7 +932,7 @@ type AcquireIPRequest struct { func (x *AcquireIPRequest) Reset() { *x = AcquireIPRequest{} if protoimpl.UnsafeEnabled { - mi := &file_api_v1_ipam_proto_msgTypes[16] + mi := &file_api_v1_ipam_proto_msgTypes[18] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -812,7 +945,7 @@ func (x *AcquireIPRequest) String() string { func (*AcquireIPRequest) ProtoMessage() {} func (x *AcquireIPRequest) ProtoReflect() protoreflect.Message { - mi := &file_api_v1_ipam_proto_msgTypes[16] + mi := &file_api_v1_ipam_proto_msgTypes[18] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -825,7 +958,7 @@ func (x *AcquireIPRequest) ProtoReflect() protoreflect.Message { // Deprecated: Use AcquireIPRequest.ProtoReflect.Descriptor instead. func (*AcquireIPRequest) Descriptor() ([]byte, []int) { - return file_api_v1_ipam_proto_rawDescGZIP(), []int{16} + return file_api_v1_ipam_proto_rawDescGZIP(), []int{18} } func (x *AcquireIPRequest) GetPrefixCidr() string { @@ -854,7 +987,7 @@ type ReleaseIPRequest struct { func (x *ReleaseIPRequest) Reset() { *x = ReleaseIPRequest{} if protoimpl.UnsafeEnabled { - mi := &file_api_v1_ipam_proto_msgTypes[17] + mi := &file_api_v1_ipam_proto_msgTypes[19] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -867,7 +1000,7 @@ func (x *ReleaseIPRequest) String() string { func (*ReleaseIPRequest) ProtoMessage() {} func (x *ReleaseIPRequest) ProtoReflect() protoreflect.Message { - mi := &file_api_v1_ipam_proto_msgTypes[17] + mi := &file_api_v1_ipam_proto_msgTypes[19] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -880,7 +1013,7 @@ func (x *ReleaseIPRequest) ProtoReflect() protoreflect.Message { // Deprecated: Use ReleaseIPRequest.ProtoReflect.Descriptor instead. func (*ReleaseIPRequest) Descriptor() ([]byte, []int) { - return file_api_v1_ipam_proto_rawDescGZIP(), []int{17} + return file_api_v1_ipam_proto_rawDescGZIP(), []int{19} } func (x *ReleaseIPRequest) GetPrefixCidr() string { @@ -906,7 +1039,7 @@ type DumpRequest struct { func (x *DumpRequest) Reset() { *x = DumpRequest{} if protoimpl.UnsafeEnabled { - mi := &file_api_v1_ipam_proto_msgTypes[18] + mi := &file_api_v1_ipam_proto_msgTypes[20] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -919,7 +1052,7 @@ func (x *DumpRequest) String() string { func (*DumpRequest) ProtoMessage() {} func (x *DumpRequest) ProtoReflect() protoreflect.Message { - mi := &file_api_v1_ipam_proto_msgTypes[18] + mi := &file_api_v1_ipam_proto_msgTypes[20] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -932,7 +1065,7 @@ func (x *DumpRequest) ProtoReflect() protoreflect.Message { // Deprecated: Use DumpRequest.ProtoReflect.Descriptor instead. func (*DumpRequest) Descriptor() ([]byte, []int) { - return file_api_v1_ipam_proto_rawDescGZIP(), []int{18} + return file_api_v1_ipam_proto_rawDescGZIP(), []int{20} } type DumpResponse struct { @@ -946,7 +1079,7 @@ type DumpResponse struct { func (x *DumpResponse) Reset() { *x = DumpResponse{} if protoimpl.UnsafeEnabled { - mi := &file_api_v1_ipam_proto_msgTypes[19] + mi := &file_api_v1_ipam_proto_msgTypes[21] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -959,7 +1092,7 @@ func (x *DumpResponse) String() string { func (*DumpResponse) ProtoMessage() {} func (x *DumpResponse) ProtoReflect() protoreflect.Message { - mi := &file_api_v1_ipam_proto_msgTypes[19] + mi := &file_api_v1_ipam_proto_msgTypes[21] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -972,7 +1105,7 @@ func (x *DumpResponse) ProtoReflect() protoreflect.Message { // Deprecated: Use DumpResponse.ProtoReflect.Descriptor instead. func (*DumpResponse) Descriptor() ([]byte, []int) { - return file_api_v1_ipam_proto_rawDescGZIP(), []int{19} + return file_api_v1_ipam_proto_rawDescGZIP(), []int{21} } func (x *DumpResponse) GetDump() string { @@ -993,7 +1126,7 @@ type LoadRequest struct { func (x *LoadRequest) Reset() { *x = LoadRequest{} if protoimpl.UnsafeEnabled { - mi := &file_api_v1_ipam_proto_msgTypes[20] + mi := &file_api_v1_ipam_proto_msgTypes[22] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -1006,7 +1139,7 @@ func (x *LoadRequest) String() string { func (*LoadRequest) ProtoMessage() {} func (x *LoadRequest) ProtoReflect() protoreflect.Message { - mi := &file_api_v1_ipam_proto_msgTypes[20] + mi := &file_api_v1_ipam_proto_msgTypes[22] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -1019,7 +1152,7 @@ func (x *LoadRequest) ProtoReflect() protoreflect.Message { // Deprecated: Use LoadRequest.ProtoReflect.Descriptor instead. func (*LoadRequest) Descriptor() ([]byte, []int) { - return file_api_v1_ipam_proto_rawDescGZIP(), []int{20} + return file_api_v1_ipam_proto_rawDescGZIP(), []int{22} } func (x *LoadRequest) GetDump() string { @@ -1038,7 +1171,7 @@ type LoadResponse struct { func (x *LoadResponse) Reset() { *x = LoadResponse{} if protoimpl.UnsafeEnabled { - mi := &file_api_v1_ipam_proto_msgTypes[21] + mi := &file_api_v1_ipam_proto_msgTypes[23] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -1051,7 +1184,7 @@ func (x *LoadResponse) String() string { func (*LoadResponse) ProtoMessage() {} func (x *LoadResponse) ProtoReflect() protoreflect.Message { - mi := &file_api_v1_ipam_proto_msgTypes[21] + mi := &file_api_v1_ipam_proto_msgTypes[23] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -1064,7 +1197,7 @@ func (x *LoadResponse) ProtoReflect() protoreflect.Message { // Deprecated: Use LoadResponse.ProtoReflect.Descriptor instead. func (*LoadResponse) Descriptor() ([]byte, []int) { - return file_api_v1_ipam_proto_rawDescGZIP(), []int{21} + return file_api_v1_ipam_proto_rawDescGZIP(), []int{23} } var File_api_v1_ipam_proto protoreflect.FileDescriptor @@ -1109,94 +1242,117 @@ var file_api_v1_ipam_proto_rawDesc = []byte{ 0x50, 0x72, 0x65, 0x66, 0x69, 0x78, 0x65, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x2a, 0x0a, 0x08, 0x70, 0x72, 0x65, 0x66, 0x69, 0x78, 0x65, 0x73, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x0e, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x31, 0x2e, 0x50, 0x72, 0x65, 0x66, - 0x69, 0x78, 0x52, 0x08, 0x70, 0x72, 0x65, 0x66, 0x69, 0x78, 0x65, 0x73, 0x22, 0x47, 0x0a, 0x19, - 0x41, 0x63, 0x71, 0x75, 0x69, 0x72, 0x65, 0x43, 0x68, 0x69, 0x6c, 0x64, 0x50, 0x72, 0x65, 0x66, - 0x69, 0x78, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x12, 0x0a, 0x04, 0x63, 0x69, 0x64, - 0x72, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x63, 0x69, 0x64, 0x72, 0x12, 0x16, 0x0a, - 0x06, 0x6c, 0x65, 0x6e, 0x67, 0x74, 0x68, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0d, 0x52, 0x06, 0x6c, - 0x65, 0x6e, 0x67, 0x74, 0x68, 0x22, 0x2f, 0x0a, 0x19, 0x52, 0x65, 0x6c, 0x65, 0x61, 0x73, 0x65, - 0x43, 0x68, 0x69, 0x6c, 0x64, 0x50, 0x72, 0x65, 0x66, 0x69, 0x78, 0x52, 0x65, 0x71, 0x75, 0x65, + 0x69, 0x78, 0x52, 0x08, 0x70, 0x72, 0x65, 0x66, 0x69, 0x78, 0x65, 0x73, 0x22, 0x28, 0x0a, 0x12, + 0x50, 0x72, 0x65, 0x66, 0x69, 0x78, 0x55, 0x73, 0x61, 0x67, 0x65, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x12, 0x0a, 0x04, 0x63, 0x69, 0x64, 0x72, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, - 0x52, 0x04, 0x63, 0x69, 0x64, 0x72, 0x22, 0x39, 0x0a, 0x02, 0x49, 0x50, 0x12, 0x0e, 0x0a, 0x02, - 0x69, 0x70, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x02, 0x69, 0x70, 0x12, 0x23, 0x0a, 0x0d, - 0x70, 0x61, 0x72, 0x65, 0x6e, 0x74, 0x5f, 0x70, 0x72, 0x65, 0x66, 0x69, 0x78, 0x18, 0x02, 0x20, - 0x01, 0x28, 0x09, 0x52, 0x0c, 0x70, 0x61, 0x72, 0x65, 0x6e, 0x74, 0x50, 0x72, 0x65, 0x66, 0x69, - 0x78, 0x22, 0x2f, 0x0a, 0x11, 0x41, 0x63, 0x71, 0x75, 0x69, 0x72, 0x65, 0x49, 0x50, 0x52, 0x65, - 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x1a, 0x0a, 0x02, 0x69, 0x70, 0x18, 0x01, 0x20, 0x01, - 0x28, 0x0b, 0x32, 0x0a, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x31, 0x2e, 0x49, 0x50, 0x52, 0x02, - 0x69, 0x70, 0x22, 0x2f, 0x0a, 0x11, 0x52, 0x65, 0x6c, 0x65, 0x61, 0x73, 0x65, 0x49, 0x50, 0x52, - 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x1a, 0x0a, 0x02, 0x69, 0x70, 0x18, 0x01, 0x20, - 0x01, 0x28, 0x0b, 0x32, 0x0a, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x31, 0x2e, 0x49, 0x50, 0x52, - 0x02, 0x69, 0x70, 0x22, 0x4f, 0x0a, 0x10, 0x41, 0x63, 0x71, 0x75, 0x69, 0x72, 0x65, 0x49, 0x50, - 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x1f, 0x0a, 0x0b, 0x70, 0x72, 0x65, 0x66, 0x69, - 0x78, 0x5f, 0x63, 0x69, 0x64, 0x72, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0a, 0x70, 0x72, - 0x65, 0x66, 0x69, 0x78, 0x43, 0x69, 0x64, 0x72, 0x12, 0x13, 0x0a, 0x02, 0x69, 0x70, 0x18, 0x02, - 0x20, 0x01, 0x28, 0x09, 0x48, 0x00, 0x52, 0x02, 0x69, 0x70, 0x88, 0x01, 0x01, 0x42, 0x05, 0x0a, - 0x03, 0x5f, 0x69, 0x70, 0x22, 0x43, 0x0a, 0x10, 0x52, 0x65, 0x6c, 0x65, 0x61, 0x73, 0x65, 0x49, - 0x50, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x1f, 0x0a, 0x0b, 0x70, 0x72, 0x65, 0x66, - 0x69, 0x78, 0x5f, 0x63, 0x69, 0x64, 0x72, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0a, 0x70, - 0x72, 0x65, 0x66, 0x69, 0x78, 0x43, 0x69, 0x64, 0x72, 0x12, 0x0e, 0x0a, 0x02, 0x69, 0x70, 0x18, - 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x02, 0x69, 0x70, 0x22, 0x0d, 0x0a, 0x0b, 0x44, 0x75, 0x6d, - 0x70, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x22, 0x22, 0x0a, 0x0c, 0x44, 0x75, 0x6d, 0x70, - 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x12, 0x0a, 0x04, 0x64, 0x75, 0x6d, 0x70, - 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x64, 0x75, 0x6d, 0x70, 0x22, 0x21, 0x0a, 0x0b, - 0x4c, 0x6f, 0x61, 0x64, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x12, 0x0a, 0x04, 0x64, - 0x75, 0x6d, 0x70, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x64, 0x75, 0x6d, 0x70, 0x22, - 0x0e, 0x0a, 0x0c, 0x4c, 0x6f, 0x61, 0x64, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x32, - 0xd4, 0x05, 0x0a, 0x0b, 0x49, 0x70, 0x61, 0x6d, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x12, - 0x49, 0x0a, 0x0c, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x50, 0x72, 0x65, 0x66, 0x69, 0x78, 0x12, - 0x1b, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x31, 0x2e, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x50, - 0x72, 0x65, 0x66, 0x69, 0x78, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x1c, 0x2e, 0x61, - 0x70, 0x69, 0x2e, 0x76, 0x31, 0x2e, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x50, 0x72, 0x65, 0x66, - 0x69, 0x78, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x49, 0x0a, 0x0c, 0x44, 0x65, - 0x6c, 0x65, 0x74, 0x65, 0x50, 0x72, 0x65, 0x66, 0x69, 0x78, 0x12, 0x1b, 0x2e, 0x61, 0x70, 0x69, - 0x2e, 0x76, 0x31, 0x2e, 0x44, 0x65, 0x6c, 0x65, 0x74, 0x65, 0x50, 0x72, 0x65, 0x66, 0x69, 0x78, - 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x1c, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x31, - 0x2e, 0x44, 0x65, 0x6c, 0x65, 0x74, 0x65, 0x50, 0x72, 0x65, 0x66, 0x69, 0x78, 0x52, 0x65, 0x73, - 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x40, 0x0a, 0x09, 0x47, 0x65, 0x74, 0x50, 0x72, 0x65, 0x66, - 0x69, 0x78, 0x12, 0x18, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x31, 0x2e, 0x47, 0x65, 0x74, 0x50, - 0x72, 0x65, 0x66, 0x69, 0x78, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x19, 0x2e, 0x61, - 0x70, 0x69, 0x2e, 0x76, 0x31, 0x2e, 0x47, 0x65, 0x74, 0x50, 0x72, 0x65, 0x66, 0x69, 0x78, 0x52, - 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x49, 0x0a, 0x0c, 0x4c, 0x69, 0x73, 0x74, 0x50, - 0x72, 0x65, 0x66, 0x69, 0x78, 0x65, 0x73, 0x12, 0x1b, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x31, - 0x2e, 0x4c, 0x69, 0x73, 0x74, 0x50, 0x72, 0x65, 0x66, 0x69, 0x78, 0x65, 0x73, 0x52, 0x65, 0x71, - 0x75, 0x65, 0x73, 0x74, 0x1a, 0x1c, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x31, 0x2e, 0x4c, 0x69, - 0x73, 0x74, 0x50, 0x72, 0x65, 0x66, 0x69, 0x78, 0x65, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, - 0x73, 0x65, 0x12, 0x5b, 0x0a, 0x12, 0x41, 0x63, 0x71, 0x75, 0x69, 0x72, 0x65, 0x43, 0x68, 0x69, - 0x6c, 0x64, 0x50, 0x72, 0x65, 0x66, 0x69, 0x78, 0x12, 0x21, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x76, - 0x31, 0x2e, 0x41, 0x63, 0x71, 0x75, 0x69, 0x72, 0x65, 0x43, 0x68, 0x69, 0x6c, 0x64, 0x50, 0x72, - 0x65, 0x66, 0x69, 0x78, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x22, 0x2e, 0x61, 0x70, - 0x69, 0x2e, 0x76, 0x31, 0x2e, 0x41, 0x63, 0x71, 0x75, 0x69, 0x72, 0x65, 0x43, 0x68, 0x69, 0x6c, - 0x64, 0x50, 0x72, 0x65, 0x66, 0x69, 0x78, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, - 0x5b, 0x0a, 0x12, 0x52, 0x65, 0x6c, 0x65, 0x61, 0x73, 0x65, 0x43, 0x68, 0x69, 0x6c, 0x64, 0x50, - 0x72, 0x65, 0x66, 0x69, 0x78, 0x12, 0x21, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x31, 0x2e, 0x52, + 0x52, 0x04, 0x63, 0x69, 0x64, 0x72, 0x22, 0xf9, 0x01, 0x0a, 0x13, 0x50, 0x72, 0x65, 0x66, 0x69, + 0x78, 0x55, 0x73, 0x61, 0x67, 0x65, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x23, + 0x0a, 0x0d, 0x61, 0x76, 0x61, 0x69, 0x6c, 0x61, 0x62, 0x6c, 0x65, 0x5f, 0x69, 0x70, 0x73, 0x18, + 0x01, 0x20, 0x01, 0x28, 0x04, 0x52, 0x0c, 0x61, 0x76, 0x61, 0x69, 0x6c, 0x61, 0x62, 0x6c, 0x65, + 0x49, 0x70, 0x73, 0x12, 0x21, 0x0a, 0x0c, 0x61, 0x63, 0x71, 0x75, 0x69, 0x72, 0x65, 0x64, 0x5f, + 0x69, 0x70, 0x73, 0x18, 0x02, 0x20, 0x01, 0x28, 0x04, 0x52, 0x0b, 0x61, 0x63, 0x71, 0x75, 0x69, + 0x72, 0x65, 0x64, 0x49, 0x70, 0x73, 0x12, 0x3e, 0x0a, 0x1b, 0x61, 0x76, 0x61, 0x69, 0x6c, 0x61, + 0x62, 0x6c, 0x65, 0x5f, 0x73, 0x6d, 0x61, 0x6c, 0x6c, 0x65, 0x73, 0x74, 0x5f, 0x70, 0x72, 0x65, + 0x66, 0x69, 0x78, 0x65, 0x73, 0x18, 0x03, 0x20, 0x01, 0x28, 0x04, 0x52, 0x19, 0x61, 0x76, 0x61, + 0x69, 0x6c, 0x61, 0x62, 0x6c, 0x65, 0x53, 0x6d, 0x61, 0x6c, 0x6c, 0x65, 0x73, 0x74, 0x50, 0x72, + 0x65, 0x66, 0x69, 0x78, 0x65, 0x73, 0x12, 0x2d, 0x0a, 0x12, 0x61, 0x76, 0x61, 0x69, 0x6c, 0x61, + 0x62, 0x6c, 0x65, 0x5f, 0x70, 0x72, 0x65, 0x66, 0x69, 0x78, 0x65, 0x73, 0x18, 0x04, 0x20, 0x03, + 0x28, 0x09, 0x52, 0x11, 0x61, 0x76, 0x61, 0x69, 0x6c, 0x61, 0x62, 0x6c, 0x65, 0x50, 0x72, 0x65, + 0x66, 0x69, 0x78, 0x65, 0x73, 0x12, 0x2b, 0x0a, 0x11, 0x61, 0x63, 0x71, 0x75, 0x69, 0x72, 0x65, + 0x64, 0x5f, 0x70, 0x72, 0x65, 0x66, 0x69, 0x78, 0x65, 0x73, 0x18, 0x05, 0x20, 0x01, 0x28, 0x04, + 0x52, 0x10, 0x61, 0x63, 0x71, 0x75, 0x69, 0x72, 0x65, 0x64, 0x50, 0x72, 0x65, 0x66, 0x69, 0x78, + 0x65, 0x73, 0x22, 0x47, 0x0a, 0x19, 0x41, 0x63, 0x71, 0x75, 0x69, 0x72, 0x65, 0x43, 0x68, 0x69, + 0x6c, 0x64, 0x50, 0x72, 0x65, 0x66, 0x69, 0x78, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, + 0x12, 0x0a, 0x04, 0x63, 0x69, 0x64, 0x72, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x63, + 0x69, 0x64, 0x72, 0x12, 0x16, 0x0a, 0x06, 0x6c, 0x65, 0x6e, 0x67, 0x74, 0x68, 0x18, 0x02, 0x20, + 0x01, 0x28, 0x0d, 0x52, 0x06, 0x6c, 0x65, 0x6e, 0x67, 0x74, 0x68, 0x22, 0x2f, 0x0a, 0x19, 0x52, 0x65, 0x6c, 0x65, 0x61, 0x73, 0x65, 0x43, 0x68, 0x69, 0x6c, 0x64, 0x50, 0x72, 0x65, 0x66, 0x69, - 0x78, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x22, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x76, - 0x31, 0x2e, 0x52, 0x65, 0x6c, 0x65, 0x61, 0x73, 0x65, 0x43, 0x68, 0x69, 0x6c, 0x64, 0x50, 0x72, - 0x65, 0x66, 0x69, 0x78, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x40, 0x0a, 0x09, - 0x41, 0x63, 0x71, 0x75, 0x69, 0x72, 0x65, 0x49, 0x50, 0x12, 0x18, 0x2e, 0x61, 0x70, 0x69, 0x2e, - 0x76, 0x31, 0x2e, 0x41, 0x63, 0x71, 0x75, 0x69, 0x72, 0x65, 0x49, 0x50, 0x52, 0x65, 0x71, 0x75, - 0x65, 0x73, 0x74, 0x1a, 0x19, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x31, 0x2e, 0x41, 0x63, 0x71, - 0x75, 0x69, 0x72, 0x65, 0x49, 0x50, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x40, - 0x0a, 0x09, 0x52, 0x65, 0x6c, 0x65, 0x61, 0x73, 0x65, 0x49, 0x50, 0x12, 0x18, 0x2e, 0x61, 0x70, - 0x69, 0x2e, 0x76, 0x31, 0x2e, 0x52, 0x65, 0x6c, 0x65, 0x61, 0x73, 0x65, 0x49, 0x50, 0x52, 0x65, - 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x19, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x31, 0x2e, 0x52, - 0x65, 0x6c, 0x65, 0x61, 0x73, 0x65, 0x49, 0x50, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, - 0x12, 0x31, 0x0a, 0x04, 0x44, 0x75, 0x6d, 0x70, 0x12, 0x13, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x76, - 0x31, 0x2e, 0x44, 0x75, 0x6d, 0x70, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x14, 0x2e, - 0x61, 0x70, 0x69, 0x2e, 0x76, 0x31, 0x2e, 0x44, 0x75, 0x6d, 0x70, 0x52, 0x65, 0x73, 0x70, 0x6f, - 0x6e, 0x73, 0x65, 0x12, 0x31, 0x0a, 0x04, 0x4c, 0x6f, 0x61, 0x64, 0x12, 0x13, 0x2e, 0x61, 0x70, - 0x69, 0x2e, 0x76, 0x31, 0x2e, 0x4c, 0x6f, 0x61, 0x64, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, - 0x1a, 0x14, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x31, 0x2e, 0x4c, 0x6f, 0x61, 0x64, 0x52, 0x65, - 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x42, 0x7d, 0x0a, 0x0a, 0x63, 0x6f, 0x6d, 0x2e, 0x61, 0x70, - 0x69, 0x2e, 0x76, 0x31, 0x42, 0x09, 0x49, 0x70, 0x61, 0x6d, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x50, - 0x01, 0x5a, 0x2b, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x6d, 0x65, - 0x74, 0x61, 0x6c, 0x2d, 0x73, 0x74, 0x61, 0x63, 0x6b, 0x2f, 0x67, 0x6f, 0x2d, 0x69, 0x70, 0x61, - 0x6d, 0x2f, 0x61, 0x70, 0x69, 0x2f, 0x76, 0x31, 0x3b, 0x61, 0x70, 0x69, 0x76, 0x31, 0xa2, 0x02, - 0x03, 0x41, 0x58, 0x58, 0xaa, 0x02, 0x06, 0x41, 0x70, 0x69, 0x2e, 0x56, 0x31, 0xca, 0x02, 0x06, - 0x41, 0x70, 0x69, 0x5c, 0x56, 0x31, 0xe2, 0x02, 0x12, 0x41, 0x70, 0x69, 0x5c, 0x56, 0x31, 0x5c, - 0x47, 0x50, 0x42, 0x4d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0xea, 0x02, 0x07, 0x41, 0x70, - 0x69, 0x3a, 0x3a, 0x56, 0x31, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, + 0x78, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x12, 0x0a, 0x04, 0x63, 0x69, 0x64, 0x72, + 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x63, 0x69, 0x64, 0x72, 0x22, 0x39, 0x0a, 0x02, + 0x49, 0x50, 0x12, 0x0e, 0x0a, 0x02, 0x69, 0x70, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x02, + 0x69, 0x70, 0x12, 0x23, 0x0a, 0x0d, 0x70, 0x61, 0x72, 0x65, 0x6e, 0x74, 0x5f, 0x70, 0x72, 0x65, + 0x66, 0x69, 0x78, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0c, 0x70, 0x61, 0x72, 0x65, 0x6e, + 0x74, 0x50, 0x72, 0x65, 0x66, 0x69, 0x78, 0x22, 0x2f, 0x0a, 0x11, 0x41, 0x63, 0x71, 0x75, 0x69, + 0x72, 0x65, 0x49, 0x50, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x1a, 0x0a, 0x02, + 0x69, 0x70, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x0a, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x76, + 0x31, 0x2e, 0x49, 0x50, 0x52, 0x02, 0x69, 0x70, 0x22, 0x2f, 0x0a, 0x11, 0x52, 0x65, 0x6c, 0x65, + 0x61, 0x73, 0x65, 0x49, 0x50, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x1a, 0x0a, + 0x02, 0x69, 0x70, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x0a, 0x2e, 0x61, 0x70, 0x69, 0x2e, + 0x76, 0x31, 0x2e, 0x49, 0x50, 0x52, 0x02, 0x69, 0x70, 0x22, 0x4f, 0x0a, 0x10, 0x41, 0x63, 0x71, + 0x75, 0x69, 0x72, 0x65, 0x49, 0x50, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x1f, 0x0a, + 0x0b, 0x70, 0x72, 0x65, 0x66, 0x69, 0x78, 0x5f, 0x63, 0x69, 0x64, 0x72, 0x18, 0x01, 0x20, 0x01, + 0x28, 0x09, 0x52, 0x0a, 0x70, 0x72, 0x65, 0x66, 0x69, 0x78, 0x43, 0x69, 0x64, 0x72, 0x12, 0x13, + 0x0a, 0x02, 0x69, 0x70, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x48, 0x00, 0x52, 0x02, 0x69, 0x70, + 0x88, 0x01, 0x01, 0x42, 0x05, 0x0a, 0x03, 0x5f, 0x69, 0x70, 0x22, 0x43, 0x0a, 0x10, 0x52, 0x65, + 0x6c, 0x65, 0x61, 0x73, 0x65, 0x49, 0x50, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x1f, + 0x0a, 0x0b, 0x70, 0x72, 0x65, 0x66, 0x69, 0x78, 0x5f, 0x63, 0x69, 0x64, 0x72, 0x18, 0x01, 0x20, + 0x01, 0x28, 0x09, 0x52, 0x0a, 0x70, 0x72, 0x65, 0x66, 0x69, 0x78, 0x43, 0x69, 0x64, 0x72, 0x12, + 0x0e, 0x0a, 0x02, 0x69, 0x70, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x02, 0x69, 0x70, 0x22, + 0x0d, 0x0a, 0x0b, 0x44, 0x75, 0x6d, 0x70, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x22, 0x22, + 0x0a, 0x0c, 0x44, 0x75, 0x6d, 0x70, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x12, + 0x0a, 0x04, 0x64, 0x75, 0x6d, 0x70, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x64, 0x75, + 0x6d, 0x70, 0x22, 0x21, 0x0a, 0x0b, 0x4c, 0x6f, 0x61, 0x64, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, + 0x74, 0x12, 0x12, 0x0a, 0x04, 0x64, 0x75, 0x6d, 0x70, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, + 0x04, 0x64, 0x75, 0x6d, 0x70, 0x22, 0x0e, 0x0a, 0x0c, 0x4c, 0x6f, 0x61, 0x64, 0x52, 0x65, 0x73, + 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x32, 0x9c, 0x06, 0x0a, 0x0b, 0x49, 0x70, 0x61, 0x6d, 0x53, 0x65, + 0x72, 0x76, 0x69, 0x63, 0x65, 0x12, 0x49, 0x0a, 0x0c, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x50, + 0x72, 0x65, 0x66, 0x69, 0x78, 0x12, 0x1b, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x31, 0x2e, 0x43, + 0x72, 0x65, 0x61, 0x74, 0x65, 0x50, 0x72, 0x65, 0x66, 0x69, 0x78, 0x52, 0x65, 0x71, 0x75, 0x65, + 0x73, 0x74, 0x1a, 0x1c, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x31, 0x2e, 0x43, 0x72, 0x65, 0x61, + 0x74, 0x65, 0x50, 0x72, 0x65, 0x66, 0x69, 0x78, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, + 0x12, 0x49, 0x0a, 0x0c, 0x44, 0x65, 0x6c, 0x65, 0x74, 0x65, 0x50, 0x72, 0x65, 0x66, 0x69, 0x78, + 0x12, 0x1b, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x31, 0x2e, 0x44, 0x65, 0x6c, 0x65, 0x74, 0x65, + 0x50, 0x72, 0x65, 0x66, 0x69, 0x78, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x1c, 0x2e, + 0x61, 0x70, 0x69, 0x2e, 0x76, 0x31, 0x2e, 0x44, 0x65, 0x6c, 0x65, 0x74, 0x65, 0x50, 0x72, 0x65, + 0x66, 0x69, 0x78, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x40, 0x0a, 0x09, 0x47, + 0x65, 0x74, 0x50, 0x72, 0x65, 0x66, 0x69, 0x78, 0x12, 0x18, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x76, + 0x31, 0x2e, 0x47, 0x65, 0x74, 0x50, 0x72, 0x65, 0x66, 0x69, 0x78, 0x52, 0x65, 0x71, 0x75, 0x65, + 0x73, 0x74, 0x1a, 0x19, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x31, 0x2e, 0x47, 0x65, 0x74, 0x50, + 0x72, 0x65, 0x66, 0x69, 0x78, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x49, 0x0a, + 0x0c, 0x4c, 0x69, 0x73, 0x74, 0x50, 0x72, 0x65, 0x66, 0x69, 0x78, 0x65, 0x73, 0x12, 0x1b, 0x2e, + 0x61, 0x70, 0x69, 0x2e, 0x76, 0x31, 0x2e, 0x4c, 0x69, 0x73, 0x74, 0x50, 0x72, 0x65, 0x66, 0x69, + 0x78, 0x65, 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x1c, 0x2e, 0x61, 0x70, 0x69, + 0x2e, 0x76, 0x31, 0x2e, 0x4c, 0x69, 0x73, 0x74, 0x50, 0x72, 0x65, 0x66, 0x69, 0x78, 0x65, 0x73, + 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x46, 0x0a, 0x0b, 0x50, 0x72, 0x65, 0x66, + 0x69, 0x78, 0x55, 0x73, 0x61, 0x67, 0x65, 0x12, 0x1a, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x31, + 0x2e, 0x50, 0x72, 0x65, 0x66, 0x69, 0x78, 0x55, 0x73, 0x61, 0x67, 0x65, 0x52, 0x65, 0x71, 0x75, + 0x65, 0x73, 0x74, 0x1a, 0x1b, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x31, 0x2e, 0x50, 0x72, 0x65, + 0x66, 0x69, 0x78, 0x55, 0x73, 0x61, 0x67, 0x65, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, + 0x12, 0x5b, 0x0a, 0x12, 0x41, 0x63, 0x71, 0x75, 0x69, 0x72, 0x65, 0x43, 0x68, 0x69, 0x6c, 0x64, + 0x50, 0x72, 0x65, 0x66, 0x69, 0x78, 0x12, 0x21, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x31, 0x2e, + 0x41, 0x63, 0x71, 0x75, 0x69, 0x72, 0x65, 0x43, 0x68, 0x69, 0x6c, 0x64, 0x50, 0x72, 0x65, 0x66, + 0x69, 0x78, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x22, 0x2e, 0x61, 0x70, 0x69, 0x2e, + 0x76, 0x31, 0x2e, 0x41, 0x63, 0x71, 0x75, 0x69, 0x72, 0x65, 0x43, 0x68, 0x69, 0x6c, 0x64, 0x50, + 0x72, 0x65, 0x66, 0x69, 0x78, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x5b, 0x0a, + 0x12, 0x52, 0x65, 0x6c, 0x65, 0x61, 0x73, 0x65, 0x43, 0x68, 0x69, 0x6c, 0x64, 0x50, 0x72, 0x65, + 0x66, 0x69, 0x78, 0x12, 0x21, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x31, 0x2e, 0x52, 0x65, 0x6c, + 0x65, 0x61, 0x73, 0x65, 0x43, 0x68, 0x69, 0x6c, 0x64, 0x50, 0x72, 0x65, 0x66, 0x69, 0x78, 0x52, + 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x22, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x31, 0x2e, + 0x52, 0x65, 0x6c, 0x65, 0x61, 0x73, 0x65, 0x43, 0x68, 0x69, 0x6c, 0x64, 0x50, 0x72, 0x65, 0x66, + 0x69, 0x78, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x40, 0x0a, 0x09, 0x41, 0x63, + 0x71, 0x75, 0x69, 0x72, 0x65, 0x49, 0x50, 0x12, 0x18, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x31, + 0x2e, 0x41, 0x63, 0x71, 0x75, 0x69, 0x72, 0x65, 0x49, 0x50, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, + 0x74, 0x1a, 0x19, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x31, 0x2e, 0x41, 0x63, 0x71, 0x75, 0x69, + 0x72, 0x65, 0x49, 0x50, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x40, 0x0a, 0x09, + 0x52, 0x65, 0x6c, 0x65, 0x61, 0x73, 0x65, 0x49, 0x50, 0x12, 0x18, 0x2e, 0x61, 0x70, 0x69, 0x2e, + 0x76, 0x31, 0x2e, 0x52, 0x65, 0x6c, 0x65, 0x61, 0x73, 0x65, 0x49, 0x50, 0x52, 0x65, 0x71, 0x75, + 0x65, 0x73, 0x74, 0x1a, 0x19, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x31, 0x2e, 0x52, 0x65, 0x6c, + 0x65, 0x61, 0x73, 0x65, 0x49, 0x50, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x31, + 0x0a, 0x04, 0x44, 0x75, 0x6d, 0x70, 0x12, 0x13, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x31, 0x2e, + 0x44, 0x75, 0x6d, 0x70, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x14, 0x2e, 0x61, 0x70, + 0x69, 0x2e, 0x76, 0x31, 0x2e, 0x44, 0x75, 0x6d, 0x70, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, + 0x65, 0x12, 0x31, 0x0a, 0x04, 0x4c, 0x6f, 0x61, 0x64, 0x12, 0x13, 0x2e, 0x61, 0x70, 0x69, 0x2e, + 0x76, 0x31, 0x2e, 0x4c, 0x6f, 0x61, 0x64, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x14, + 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x31, 0x2e, 0x4c, 0x6f, 0x61, 0x64, 0x52, 0x65, 0x73, 0x70, + 0x6f, 0x6e, 0x73, 0x65, 0x42, 0x7d, 0x0a, 0x0a, 0x63, 0x6f, 0x6d, 0x2e, 0x61, 0x70, 0x69, 0x2e, + 0x76, 0x31, 0x42, 0x09, 0x49, 0x70, 0x61, 0x6d, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x50, 0x01, 0x5a, + 0x2b, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x6d, 0x65, 0x74, 0x61, + 0x6c, 0x2d, 0x73, 0x74, 0x61, 0x63, 0x6b, 0x2f, 0x67, 0x6f, 0x2d, 0x69, 0x70, 0x61, 0x6d, 0x2f, + 0x61, 0x70, 0x69, 0x2f, 0x76, 0x31, 0x3b, 0x61, 0x70, 0x69, 0x76, 0x31, 0xa2, 0x02, 0x03, 0x41, + 0x58, 0x58, 0xaa, 0x02, 0x06, 0x41, 0x70, 0x69, 0x2e, 0x56, 0x31, 0xca, 0x02, 0x06, 0x41, 0x70, + 0x69, 0x5c, 0x56, 0x31, 0xe2, 0x02, 0x12, 0x41, 0x70, 0x69, 0x5c, 0x56, 0x31, 0x5c, 0x47, 0x50, + 0x42, 0x4d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0xea, 0x02, 0x07, 0x41, 0x70, 0x69, 0x3a, + 0x3a, 0x56, 0x31, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, } var ( @@ -1211,7 +1367,7 @@ func file_api_v1_ipam_proto_rawDescGZIP() []byte { return file_api_v1_ipam_proto_rawDescData } -var file_api_v1_ipam_proto_msgTypes = make([]protoimpl.MessageInfo, 22) +var file_api_v1_ipam_proto_msgTypes = make([]protoimpl.MessageInfo, 24) var file_api_v1_ipam_proto_goTypes = []interface{}{ (*Prefix)(nil), // 0: api.v1.Prefix (*CreatePrefixResponse)(nil), // 1: api.v1.CreatePrefixResponse @@ -1224,17 +1380,19 @@ var file_api_v1_ipam_proto_goTypes = []interface{}{ (*GetPrefixRequest)(nil), // 8: api.v1.GetPrefixRequest (*ListPrefixesRequest)(nil), // 9: api.v1.ListPrefixesRequest (*ListPrefixesResponse)(nil), // 10: api.v1.ListPrefixesResponse - (*AcquireChildPrefixRequest)(nil), // 11: api.v1.AcquireChildPrefixRequest - (*ReleaseChildPrefixRequest)(nil), // 12: api.v1.ReleaseChildPrefixRequest - (*IP)(nil), // 13: api.v1.IP - (*AcquireIPResponse)(nil), // 14: api.v1.AcquireIPResponse - (*ReleaseIPResponse)(nil), // 15: api.v1.ReleaseIPResponse - (*AcquireIPRequest)(nil), // 16: api.v1.AcquireIPRequest - (*ReleaseIPRequest)(nil), // 17: api.v1.ReleaseIPRequest - (*DumpRequest)(nil), // 18: api.v1.DumpRequest - (*DumpResponse)(nil), // 19: api.v1.DumpResponse - (*LoadRequest)(nil), // 20: api.v1.LoadRequest - (*LoadResponse)(nil), // 21: api.v1.LoadResponse + (*PrefixUsageRequest)(nil), // 11: api.v1.PrefixUsageRequest + (*PrefixUsageResponse)(nil), // 12: api.v1.PrefixUsageResponse + (*AcquireChildPrefixRequest)(nil), // 13: api.v1.AcquireChildPrefixRequest + (*ReleaseChildPrefixRequest)(nil), // 14: api.v1.ReleaseChildPrefixRequest + (*IP)(nil), // 15: api.v1.IP + (*AcquireIPResponse)(nil), // 16: api.v1.AcquireIPResponse + (*ReleaseIPResponse)(nil), // 17: api.v1.ReleaseIPResponse + (*AcquireIPRequest)(nil), // 18: api.v1.AcquireIPRequest + (*ReleaseIPRequest)(nil), // 19: api.v1.ReleaseIPRequest + (*DumpRequest)(nil), // 20: api.v1.DumpRequest + (*DumpResponse)(nil), // 21: api.v1.DumpResponse + (*LoadRequest)(nil), // 22: api.v1.LoadRequest + (*LoadResponse)(nil), // 23: api.v1.LoadResponse } var file_api_v1_ipam_proto_depIdxs = []int32{ 0, // 0: api.v1.CreatePrefixResponse.prefix:type_name -> api.v1.Prefix @@ -1243,30 +1401,32 @@ var file_api_v1_ipam_proto_depIdxs = []int32{ 0, // 3: api.v1.AcquireChildPrefixResponse.prefix:type_name -> api.v1.Prefix 0, // 4: api.v1.ReleaseChildPrefixResponse.prefix:type_name -> api.v1.Prefix 0, // 5: api.v1.ListPrefixesResponse.prefixes:type_name -> api.v1.Prefix - 13, // 6: api.v1.AcquireIPResponse.ip:type_name -> api.v1.IP - 13, // 7: api.v1.ReleaseIPResponse.ip:type_name -> api.v1.IP + 15, // 6: api.v1.AcquireIPResponse.ip:type_name -> api.v1.IP + 15, // 7: api.v1.ReleaseIPResponse.ip:type_name -> api.v1.IP 6, // 8: api.v1.IpamService.CreatePrefix:input_type -> api.v1.CreatePrefixRequest 7, // 9: api.v1.IpamService.DeletePrefix:input_type -> api.v1.DeletePrefixRequest 8, // 10: api.v1.IpamService.GetPrefix:input_type -> api.v1.GetPrefixRequest 9, // 11: api.v1.IpamService.ListPrefixes:input_type -> api.v1.ListPrefixesRequest - 11, // 12: api.v1.IpamService.AcquireChildPrefix:input_type -> api.v1.AcquireChildPrefixRequest - 12, // 13: api.v1.IpamService.ReleaseChildPrefix:input_type -> api.v1.ReleaseChildPrefixRequest - 16, // 14: api.v1.IpamService.AcquireIP:input_type -> api.v1.AcquireIPRequest - 17, // 15: api.v1.IpamService.ReleaseIP:input_type -> api.v1.ReleaseIPRequest - 18, // 16: api.v1.IpamService.Dump:input_type -> api.v1.DumpRequest - 20, // 17: api.v1.IpamService.Load:input_type -> api.v1.LoadRequest - 1, // 18: api.v1.IpamService.CreatePrefix:output_type -> api.v1.CreatePrefixResponse - 2, // 19: api.v1.IpamService.DeletePrefix:output_type -> api.v1.DeletePrefixResponse - 3, // 20: api.v1.IpamService.GetPrefix:output_type -> api.v1.GetPrefixResponse - 10, // 21: api.v1.IpamService.ListPrefixes:output_type -> api.v1.ListPrefixesResponse - 4, // 22: api.v1.IpamService.AcquireChildPrefix:output_type -> api.v1.AcquireChildPrefixResponse - 5, // 23: api.v1.IpamService.ReleaseChildPrefix:output_type -> api.v1.ReleaseChildPrefixResponse - 14, // 24: api.v1.IpamService.AcquireIP:output_type -> api.v1.AcquireIPResponse - 15, // 25: api.v1.IpamService.ReleaseIP:output_type -> api.v1.ReleaseIPResponse - 19, // 26: api.v1.IpamService.Dump:output_type -> api.v1.DumpResponse - 21, // 27: api.v1.IpamService.Load:output_type -> api.v1.LoadResponse - 18, // [18:28] is the sub-list for method output_type - 8, // [8:18] is the sub-list for method input_type + 11, // 12: api.v1.IpamService.PrefixUsage:input_type -> api.v1.PrefixUsageRequest + 13, // 13: api.v1.IpamService.AcquireChildPrefix:input_type -> api.v1.AcquireChildPrefixRequest + 14, // 14: api.v1.IpamService.ReleaseChildPrefix:input_type -> api.v1.ReleaseChildPrefixRequest + 18, // 15: api.v1.IpamService.AcquireIP:input_type -> api.v1.AcquireIPRequest + 19, // 16: api.v1.IpamService.ReleaseIP:input_type -> api.v1.ReleaseIPRequest + 20, // 17: api.v1.IpamService.Dump:input_type -> api.v1.DumpRequest + 22, // 18: api.v1.IpamService.Load:input_type -> api.v1.LoadRequest + 1, // 19: api.v1.IpamService.CreatePrefix:output_type -> api.v1.CreatePrefixResponse + 2, // 20: api.v1.IpamService.DeletePrefix:output_type -> api.v1.DeletePrefixResponse + 3, // 21: api.v1.IpamService.GetPrefix:output_type -> api.v1.GetPrefixResponse + 10, // 22: api.v1.IpamService.ListPrefixes:output_type -> api.v1.ListPrefixesResponse + 12, // 23: api.v1.IpamService.PrefixUsage:output_type -> api.v1.PrefixUsageResponse + 4, // 24: api.v1.IpamService.AcquireChildPrefix:output_type -> api.v1.AcquireChildPrefixResponse + 5, // 25: api.v1.IpamService.ReleaseChildPrefix:output_type -> api.v1.ReleaseChildPrefixResponse + 16, // 26: api.v1.IpamService.AcquireIP:output_type -> api.v1.AcquireIPResponse + 17, // 27: api.v1.IpamService.ReleaseIP:output_type -> api.v1.ReleaseIPResponse + 21, // 28: api.v1.IpamService.Dump:output_type -> api.v1.DumpResponse + 23, // 29: api.v1.IpamService.Load:output_type -> api.v1.LoadResponse + 19, // [19:30] is the sub-list for method output_type + 8, // [8:19] is the sub-list for method input_type 8, // [8:8] is the sub-list for extension type_name 8, // [8:8] is the sub-list for extension extendee 0, // [0:8] is the sub-list for field type_name @@ -1411,7 +1571,7 @@ func file_api_v1_ipam_proto_init() { } } file_api_v1_ipam_proto_msgTypes[11].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*AcquireChildPrefixRequest); i { + switch v := v.(*PrefixUsageRequest); i { case 0: return &v.state case 1: @@ -1423,7 +1583,7 @@ func file_api_v1_ipam_proto_init() { } } file_api_v1_ipam_proto_msgTypes[12].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*ReleaseChildPrefixRequest); i { + switch v := v.(*PrefixUsageResponse); i { case 0: return &v.state case 1: @@ -1435,7 +1595,7 @@ func file_api_v1_ipam_proto_init() { } } file_api_v1_ipam_proto_msgTypes[13].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*IP); i { + switch v := v.(*AcquireChildPrefixRequest); i { case 0: return &v.state case 1: @@ -1447,7 +1607,7 @@ func file_api_v1_ipam_proto_init() { } } file_api_v1_ipam_proto_msgTypes[14].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*AcquireIPResponse); i { + switch v := v.(*ReleaseChildPrefixRequest); i { case 0: return &v.state case 1: @@ -1459,7 +1619,7 @@ func file_api_v1_ipam_proto_init() { } } file_api_v1_ipam_proto_msgTypes[15].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*ReleaseIPResponse); i { + switch v := v.(*IP); i { case 0: return &v.state case 1: @@ -1471,7 +1631,7 @@ func file_api_v1_ipam_proto_init() { } } file_api_v1_ipam_proto_msgTypes[16].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*AcquireIPRequest); i { + switch v := v.(*AcquireIPResponse); i { case 0: return &v.state case 1: @@ -1483,7 +1643,7 @@ func file_api_v1_ipam_proto_init() { } } file_api_v1_ipam_proto_msgTypes[17].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*ReleaseIPRequest); i { + switch v := v.(*ReleaseIPResponse); i { case 0: return &v.state case 1: @@ -1495,7 +1655,7 @@ func file_api_v1_ipam_proto_init() { } } file_api_v1_ipam_proto_msgTypes[18].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*DumpRequest); i { + switch v := v.(*AcquireIPRequest); i { case 0: return &v.state case 1: @@ -1507,7 +1667,7 @@ func file_api_v1_ipam_proto_init() { } } file_api_v1_ipam_proto_msgTypes[19].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*DumpResponse); i { + switch v := v.(*ReleaseIPRequest); i { case 0: return &v.state case 1: @@ -1519,7 +1679,7 @@ func file_api_v1_ipam_proto_init() { } } file_api_v1_ipam_proto_msgTypes[20].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*LoadRequest); i { + switch v := v.(*DumpRequest); i { case 0: return &v.state case 1: @@ -1531,6 +1691,30 @@ func file_api_v1_ipam_proto_init() { } } file_api_v1_ipam_proto_msgTypes[21].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*DumpResponse); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_api_v1_ipam_proto_msgTypes[22].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*LoadRequest); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_api_v1_ipam_proto_msgTypes[23].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*LoadResponse); i { case 0: return &v.state @@ -1543,14 +1727,14 @@ func file_api_v1_ipam_proto_init() { } } } - file_api_v1_ipam_proto_msgTypes[16].OneofWrappers = []interface{}{} + file_api_v1_ipam_proto_msgTypes[18].OneofWrappers = []interface{}{} type x struct{} out := protoimpl.TypeBuilder{ File: protoimpl.DescBuilder{ GoPackagePath: reflect.TypeOf(x{}).PkgPath(), RawDescriptor: file_api_v1_ipam_proto_rawDesc, NumEnums: 0, - NumMessages: 22, + NumMessages: 24, NumExtensions: 0, NumServices: 1, }, diff --git a/go.mod b/go.mod index 51744b4..e3fd7a1 100644 --- a/go.mod +++ b/go.mod @@ -18,9 +18,9 @@ require ( go.etcd.io/etcd/client/v3 v3.5.4 go.mongodb.org/mongo-driver v1.10.0 go.uber.org/zap v1.21.0 - golang.org/x/net v0.0.0-20220725212005-46097bf591d3 + golang.org/x/net v0.0.0-20220728211354-c7608f3a8462 golang.org/x/sync v0.0.0-20220722155255-886fb9371eb4 - google.golang.org/protobuf v1.28.0 + google.golang.org/protobuf v1.28.1 inet.af/netaddr v0.0.0-20220617031823-097006376321 ) @@ -74,9 +74,9 @@ require ( go4.org/intern v0.0.0-20220617035311-6925f38cc365 // indirect go4.org/unsafe/assume-no-moving-gc v0.0.0-20220617031537-928513b29760 // indirect golang.org/x/crypto v0.0.0-20220722155217-630584e8d5aa // indirect - golang.org/x/sys v0.0.0-20220722155257-8c9f86f7a55f // indirect + golang.org/x/sys v0.0.0-20220728004956-3c1f35247d10 // indirect golang.org/x/text v0.3.7 // indirect - google.golang.org/genproto v0.0.0-20220725144611-272f38e5d71b // indirect + google.golang.org/genproto v0.0.0-20220728213248-dd149ef739b9 // indirect google.golang.org/grpc v1.48.0 // indirect gopkg.in/yaml.v3 v3.0.1 // indirect ) diff --git a/go.sum b/go.sum index a9f8305..b8c0bb5 100644 --- a/go.sum +++ b/go.sum @@ -899,8 +899,8 @@ golang.org/x/net v0.0.0-20210805182204-aaa1db679c0d/go.mod h1:9nx3DQGgdP8bBQD5qx golang.org/x/net v0.0.0-20210825183410-e898025ed96a/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y= golang.org/x/net v0.0.0-20211108170745-6635138e15ea/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y= golang.org/x/net v0.0.0-20211112202133-69e39bad7dc2/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y= -golang.org/x/net v0.0.0-20220725212005-46097bf591d3 h1:2yWTtPWWRcISTw3/o+s/Y4UOMnQL71DWyToOANFusCg= -golang.org/x/net v0.0.0-20220725212005-46097bf591d3/go.mod h1:AaygXjzTFtRAg2ttMY5RMuhpJ3cNnI0XpyFJD1iQRSM= +golang.org/x/net v0.0.0-20220728211354-c7608f3a8462 h1:UreQrH7DbFXSi9ZFox6FNT3WBooWmdANpU+IfkT1T4I= +golang.org/x/net v0.0.0-20220728211354-c7608f3a8462/go.mod h1:YDH+HFinaLZZlnHAfSS6ZXJJ9M9t4Dl22yv3iI2vPwk= golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U= golang.org/x/oauth2 v0.0.0-20190226205417-e64efc72b421/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw= golang.org/x/oauth2 v0.0.0-20190604053449-0f29369cfe45/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw= @@ -1001,8 +1001,8 @@ golang.org/x/sys v0.0.0-20211124211545-fe61309f8881/go.mod h1:oPkhp1MJrh7nUepCBc golang.org/x/sys v0.0.0-20211216021012-1d35b9e2eb4e/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20220520151302-bc2c85ada10a/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20220715151400-c0bba94af5f8/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.0.0-20220722155257-8c9f86f7a55f h1:v4INt8xihDGvnrfjMDVXGxw9wrfxYyCjk0KbXjhR55s= -golang.org/x/sys v0.0.0-20220722155257-8c9f86f7a55f/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.0.0-20220728004956-3c1f35247d10 h1:WIoqL4EROvwiPdUtaip4VcDdpZ4kha7wBWZrbVKCIZg= +golang.org/x/sys v0.0.0-20220728004956-3c1f35247d10/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo= golang.org/x/text v0.0.0-20170915032832-14c0d48ead0c/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= @@ -1118,8 +1118,8 @@ google.golang.org/genproto v0.0.0-20200526211855-cb27e3aa2013/go.mod h1:NbSheEEY google.golang.org/genproto v0.0.0-20200527145253-8367513e4ece/go.mod h1:jDfRM7FcilCzHH/e9qn6dsT145K34l5v+OpcnNgKAAA= google.golang.org/genproto v0.0.0-20201110150050-8816d57aaa9a/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no= google.golang.org/genproto v0.0.0-20210602131652-f16073e35f0c/go.mod h1:UODoCrxHCcBojKKwX1terBiRUaqAsFqJiF615XL43r0= -google.golang.org/genproto v0.0.0-20220725144611-272f38e5d71b h1:SfSkJugek6xm7lWywqth4r2iTrYLpD8lOj1nMIIhMNM= -google.golang.org/genproto v0.0.0-20220725144611-272f38e5d71b/go.mod h1:iHe1svFLAZg9VWz891+QbRMwUv9O/1Ww+/mngYeThbc= +google.golang.org/genproto v0.0.0-20220728213248-dd149ef739b9 h1:d3fKQZK+1rWQMg3xLKQbPMirUCo29I/NRdI2WarSzTg= +google.golang.org/genproto v0.0.0-20220728213248-dd149ef739b9/go.mod h1:iHe1svFLAZg9VWz891+QbRMwUv9O/1Ww+/mngYeThbc= google.golang.org/grpc v0.0.0-20160317175043-d3ddb4469d5a/go.mod h1:yo6s7OP7yaDglbqo1J04qKzAhqBH6lvTonzMVmEdcZw= google.golang.org/grpc v1.19.0/go.mod h1:mqu4LbDTu4XGKhr4mRzUsmM4RtVoemTSY81AxZiDr8c= google.golang.org/grpc v1.20.1/go.mod h1:10oTOabMzJvdu6/UiuZezV6QK5dSlG84ov/aaiqXj38= @@ -1154,8 +1154,8 @@ google.golang.org/protobuf v1.25.0/go.mod h1:9JNX74DMeImyA3h4bdi1ymwjUzf21/xIlba google.golang.org/protobuf v1.26.0-rc.1/go.mod h1:jlhhOSvTdKEhbULTjvd4ARK9grFBp09yW+WbY/TyQbw= google.golang.org/protobuf v1.26.0/go.mod h1:9q0QmTI4eRPtz6boOQmLYwt+qCgq0jsYwAQnmE0givc= google.golang.org/protobuf v1.27.1/go.mod h1:9q0QmTI4eRPtz6boOQmLYwt+qCgq0jsYwAQnmE0givc= -google.golang.org/protobuf v1.28.0 h1:w43yiav+6bVFTBQFZX0r7ipe9JQ1QsbMgHwbBziscLw= -google.golang.org/protobuf v1.28.0/go.mod h1:HV8QOd/L58Z+nl8r43ehVNZIU/HEI6OcFqwMG9pJV4I= +google.golang.org/protobuf v1.28.1 h1:d0NfwRgPtno5B1Wa6L2DAG+KivqkdutMf1UhdNx175w= +google.golang.org/protobuf v1.28.1/go.mod h1:HV8QOd/L58Z+nl8r43ehVNZIU/HEI6OcFqwMG9pJV4I= gopkg.in/airbrake/gobrake.v2 v2.0.9/go.mod h1:/h5ZAUhDkGaJfjzjKLSjv6zCL6O0LLBxU4K+aSYdM/U= gopkg.in/alecthomas/kingpin.v2 v2.2.6/go.mod h1:FMv+mEhP44yOT+4EoQTLFTRgOQ1FBLkstjWtayDeSgw= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= diff --git a/ipam.go b/ipam.go index a8e202d..4cce8d8 100644 --- a/ipam.go +++ b/ipam.go @@ -32,9 +32,6 @@ type Ipamer interface { // ReleaseIPFromPrefix will release the given IP for later usage. // If the Prefix or the IP is not found an NotFoundError is returned. ReleaseIPFromPrefix(ctx context.Context, prefixCidr, ip string) error - // PrefixesOverlapping will check if one ore more prefix of newPrefixes is overlapping - // with one of existingPrefixes - PrefixesOverlapping(existingPrefixes []string, newPrefixes []string) error // Dump all stored prefixes as json formatted string Dump(ctx context.Context) (string, error) // Load a previously created json formatted dump, deletes all prefixes before loading diff --git a/pkg/service/ipam-service.go b/pkg/service/ipam-service.go index fcdb9b7..947889b 100644 --- a/pkg/service/ipam-service.go +++ b/pkg/service/ipam-service.go @@ -197,8 +197,25 @@ func (i *IPAMService) Load(ctx context.Context, req *connect.Request[v1.LoadRequ i.log.Debugw("load", "req", req) err := i.ipamer.Load(ctx, req.Msg.Dump) if err != nil { - i.log.Errorw("dump", "error", err) + i.log.Errorw("load", "error", err) return nil, connect.NewError(connect.CodeInvalidArgument, err) } return &connect.Response[v1.LoadResponse]{}, nil } +func (i *IPAMService) PrefixUsage(ctx context.Context, req *connect.Request[v1.PrefixUsageRequest]) (*connect.Response[v1.PrefixUsageResponse], error) { + i.log.Debugw("prefixusage", "req", req) + p := i.ipamer.PrefixFrom(ctx, req.Msg.Cidr) + if p == nil { + return nil, connect.NewError(connect.CodeInvalidArgument, fmt.Errorf("prefix:%q not found", req.Msg.Cidr)) + } + u := p.Usage() + return &connect.Response[v1.PrefixUsageResponse]{ + Msg: &v1.PrefixUsageResponse{ + AvailableIps: u.AvailableIPs, + AcquiredIps: u.AcquiredIPs, + AvailableSmallestPrefixes: u.AvailableSmallestPrefixes, + AvailablePrefixes: u.AvailablePrefixes, + AcquiredPrefixes: u.AcquiredPrefixes, + }, + }, nil +} diff --git a/prefix.go b/prefix.go index 03e9bd1..89c4654 100644 --- a/prefix.go +++ b/prefix.go @@ -153,7 +153,7 @@ func (i *ipamer) NewPrefix(ctx context.Context, cidr string) (*Prefix, error) { if err != nil { return nil, err } - err = i.PrefixesOverlapping(existingPrefixes, []string{p.Cidr}) + err = PrefixesOverlapping(existingPrefixes, []string{p.Cidr}) if err != nil { return nil, err } @@ -435,7 +435,9 @@ func (i *ipamer) releaseIPFromPrefixInternal(ctx context.Context, prefixCidr, ip return nil } -func (i *ipamer) PrefixesOverlapping(existingPrefixes []string, newPrefixes []string) error { +// PrefixesOverlapping will check if one ore more prefix of newPrefixes is overlapping +// with one of existingPrefixes +func PrefixesOverlapping(existingPrefixes []string, newPrefixes []string) error { for _, ep := range existingPrefixes { eip, err := netaddr.ParseIPPrefix(ep) if err != nil { diff --git a/prefix_benchmark_test.go b/prefix_benchmark_test.go index f137c58..00572a5 100644 --- a/prefix_benchmark_test.go +++ b/prefix_benchmark_test.go @@ -91,11 +91,10 @@ func BenchmarkAcquireChildPrefix(b *testing.B) { } func BenchmarkPrefixOverlapping(b *testing.B) { - ipam := New() existingPrefixes := []string{"192.168.0.0/24", "10.0.0.0/8"} newPrefixes := []string{"192.168.1.0/24", "11.0.0.0/8"} for n := 0; n < b.N; n++ { - err := ipam.PrefixesOverlapping(existingPrefixes, newPrefixes) + err := PrefixesOverlapping(existingPrefixes, newPrefixes) if err != nil { b.Errorf("PrefixOverLapping error:%v", err) } diff --git a/prefix_test.go b/prefix_test.go index 337ae45..7507f49 100644 --- a/prefix_test.go +++ b/prefix_test.go @@ -1013,7 +1013,7 @@ func TestIpamer_PrefixesOverlapping(t *testing.T) { t.Errorf("Newprefix on ExistingPrefix returns nil") } } - err := ipam.PrefixesOverlapping(test.existingPrefixes, test.newPrefixes) + err := PrefixesOverlapping(test.existingPrefixes, test.newPrefixes) if test.wantErr && err == nil { t.Errorf("Ipamer.PrefixesOverlapping() expected error but err was nil") } diff --git a/proto/api/v1/ipam.proto b/proto/api/v1/ipam.proto index 22dca05..3663d2a 100644 --- a/proto/api/v1/ipam.proto +++ b/proto/api/v1/ipam.proto @@ -9,6 +9,7 @@ service IpamService { rpc DeletePrefix(DeletePrefixRequest) returns (DeletePrefixResponse); rpc GetPrefix(GetPrefixRequest) returns (GetPrefixResponse); rpc ListPrefixes(ListPrefixesRequest) returns (ListPrefixesResponse); + rpc PrefixUsage(PrefixUsageRequest) returns (PrefixUsageResponse); rpc AcquireChildPrefix(AcquireChildPrefixRequest) returns (AcquireChildPrefixResponse); rpc ReleaseChildPrefix(ReleaseChildPrefixRequest) returns (ReleaseChildPrefixResponse); rpc AcquireIP(AcquireIPRequest) returns (AcquireIPResponse); @@ -50,6 +51,25 @@ message ListPrefixesResponse { repeated Prefix prefixes = 1; } +message PrefixUsageRequest { + string cidr = 1; +} + +message PrefixUsageResponse { + // AvailableIPs the number of available IPs if this is not a parent prefix + // No more than 2^31 available IPs are reported + uint64 available_ips = 1; + // AcquiredIPs the number of acquired IPs if this is not a parent prefix + uint64 acquired_ips = 2; + // AvailableSmallestPrefixes is the count of available Prefixes with 2 countable Bits + // No more than 2^31 available Prefixes are reported + uint64 available_smallest_prefixes = 3; + // AvailablePrefixes is a list of prefixes which are available + repeated string available_prefixes = 4; + // AcquiredPrefixes the number of acquired prefixes if this is a parent prefix + uint64 acquired_prefixes = 5; +} + message AcquireChildPrefixRequest { string cidr = 1; uint32 length = 2;