From 0e768e9a11ed75010548a0cc93c0e5f5e5bfd1e7 Mon Sep 17 00:00:00 2001 From: Monty Taylor Date: Fri, 4 Nov 2016 07:20:18 -0500 Subject: [PATCH] Add Floating IP get/search Change-Id: I00b2f9d14bed83a53c31644ad6996136a900271a --- Makefile.am | 7 ++ oaktreemodel/floating_ip.pb.go | 137 +++++++++++++++++++++++++++++++++ oaktreemodel/floating_ip.proto | 41 ++++++++++ oaktreemodel/model.py | 1 + oaktreemodel/oaktree.pb.go | 43 ++++++----- oaktreemodel/oaktree.proto | 3 + 6 files changed, 212 insertions(+), 20 deletions(-) create mode 100644 oaktreemodel/floating_ip.pb.go create mode 100644 oaktreemodel/floating_ip.proto diff --git a/Makefile.am b/Makefile.am index 1634088..e764703 100644 --- a/Makefile.am +++ b/Makefile.am @@ -63,6 +63,7 @@ liboaktreemodel_la_CXXFLAGS = ${AM_CXXFLAGS} ${PROTOSKIP_WARNINGS} ${NO_WERROR} liboaktreemodel_la_SOURCES = \ oaktreemodel/common.pb.cc \ oaktreemodel/flavor.pb.cc \ + oaktreemodel/floating_ip.pb.cc \ oaktreemodel/image.pb.cc \ oaktreemodel/security_group.pb.cc \ oaktreemodel/oaktree.pb.cc \ @@ -71,6 +72,7 @@ liboaktreemodel_la_SOURCES = \ pkginclude_HEADERS = \ oaktreemodel/common.pb.h \ oaktreemodel/flavor.pb.h \ + oaktreemodel/floating_ip.pb.h \ oaktreemodel/image.pb.h \ oaktreemodel/security_group.pb.h \ oaktreemodel/oaktree.pb.h \ @@ -84,6 +86,9 @@ BUILT_SOURCES += \ oaktreemodel/flavor.pb.cc \ oaktreemodel/flavor.pb.h \ oaktreemodel/flavor_pb2.py \ + oaktreemodel/floating_ip.pb.cc \ + oaktreemodel/floating_ip.pb.h \ + oaktreemodel/floating_ip_pb2.py \ oaktreemodel/image.pb.cc \ oaktreemodel/image.pb.h \ oaktreemodel/image_pb2.py \ @@ -100,6 +105,7 @@ if HAVE_GO_PLUGIN BUILT_SOURCES += \ oaktreemodel/common.pb.go \ oaktreemodel/flavor.pb.go \ + oaktreemodel/floating_ip.pb.go \ oaktreemodel/image.pb.go \ oaktreemodel/oaktree.pb.go \ oaktreemodel/security_group.pb.go @@ -108,6 +114,7 @@ endif EXTRA_DIST += \ oaktreemodel/common.proto \ oaktreemodel/flavor.proto \ + oaktreemodel/floating_ip.proto \ oaktreemodel/image.proto \ oaktreemodel/security_group.proto \ oaktreemodel/oaktree.proto diff --git a/oaktreemodel/floating_ip.pb.go b/oaktreemodel/floating_ip.pb.go new file mode 100644 index 0000000..7bc6f1f --- /dev/null +++ b/oaktreemodel/floating_ip.pb.go @@ -0,0 +1,137 @@ +// Code generated by protoc-gen-go. +// source: floating_ip.proto +// DO NOT EDIT! + +/* +Package oaktree is a generated protocol buffer package. + +It is generated from these files: + floating_ip.proto + +It has these top-level messages: + FloatingIP + FloatingIPList +*/ +package oaktree + +import proto "github.com/golang/protobuf/proto" +import fmt "fmt" +import math "math" +import oaktree1 "." + +// Reference imports to suppress errors if they are not otherwise used. +var _ = proto.Marshal +var _ = fmt.Errorf +var _ = math.Inf + +// This is a compile-time assertion to ensure that this generated file +// is compatible with the proto package it is being compiled against. +// A compilation error at this line likely means your copy of the +// proto package needs to be updated. +const _ = proto.ProtoPackageIsVersion2 // please upgrade the proto package + +type FloatingIP_Status int32 + +const ( + FloatingIP_active FloatingIP_Status = 0 + FloatingIP_down FloatingIP_Status = 1 + FloatingIP_error FloatingIP_Status = 2 +) + +var FloatingIP_Status_name = map[int32]string{ + 0: "active", + 1: "down", + 2: "error", +} +var FloatingIP_Status_value = map[string]int32{ + "active": 0, + "down": 1, + "error": 2, +} + +func (x FloatingIP_Status) String() string { + return proto.EnumName(FloatingIP_Status_name, int32(x)) +} +func (FloatingIP_Status) EnumDescriptor() ([]byte, []int) { return fileDescriptor0, []int{0, 0} } + +type FloatingIP struct { + Location *oaktree1.Location `protobuf:"bytes,1,opt,name=location" json:"location,omitempty"` + Id string `protobuf:"bytes,2,opt,name=id" json:"id,omitempty"` + IsAttached bool `protobuf:"varint,3,opt,name=is_attached,json=isAttached" json:"is_attached,omitempty"` + FixedIpAddress string `protobuf:"bytes,4,opt,name=fixed_ip_address,json=fixedIpAddress" json:"fixed_ip_address,omitempty"` + FloatingIpAddress string `protobuf:"bytes,5,opt,name=floating_ip_address,json=floatingIpAddress" json:"floating_ip_address,omitempty"` + Network string `protobuf:"bytes,6,opt,name=network" json:"network,omitempty"` + Port string `protobuf:"bytes,7,opt,name=port" json:"port,omitempty"` + Status FloatingIP_Status `protobuf:"varint,8,opt,name=status,enum=oaktree.FloatingIP_Status" json:"status,omitempty"` + Properties map[string]string `protobuf:"bytes,99,rep,name=properties" json:"properties,omitempty" protobuf_key:"bytes,1,opt,name=key" protobuf_val:"bytes,2,opt,name=value"` +} + +func (m *FloatingIP) Reset() { *m = FloatingIP{} } +func (m *FloatingIP) String() string { return proto.CompactTextString(m) } +func (*FloatingIP) ProtoMessage() {} +func (*FloatingIP) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{0} } + +func (m *FloatingIP) GetLocation() *oaktree1.Location { + if m != nil { + return m.Location + } + return nil +} + +func (m *FloatingIP) GetProperties() map[string]string { + if m != nil { + return m.Properties + } + return nil +} + +type FloatingIPList struct { + FloatingIps []*FloatingIP `protobuf:"bytes,1,rep,name=floating_ips,json=floatingIps" json:"floating_ips,omitempty"` +} + +func (m *FloatingIPList) Reset() { *m = FloatingIPList{} } +func (m *FloatingIPList) String() string { return proto.CompactTextString(m) } +func (*FloatingIPList) ProtoMessage() {} +func (*FloatingIPList) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{1} } + +func (m *FloatingIPList) GetFloatingIps() []*FloatingIP { + if m != nil { + return m.FloatingIps + } + return nil +} + +func init() { + proto.RegisterType((*FloatingIP)(nil), "oaktree.FloatingIP") + proto.RegisterType((*FloatingIPList)(nil), "oaktree.FloatingIPList") + proto.RegisterEnum("oaktree.FloatingIP_Status", FloatingIP_Status_name, FloatingIP_Status_value) +} + +func init() { proto.RegisterFile("floating_ip.proto", fileDescriptor0) } + +var fileDescriptor0 = []byte{ + // 365 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x09, 0x6e, 0x88, 0x02, 0xff, 0x6c, 0x92, 0xc1, 0x8e, 0xda, 0x30, + 0x10, 0x86, 0x9b, 0x04, 0x42, 0x18, 0x50, 0x1a, 0x86, 0x1e, 0x2c, 0x2e, 0x45, 0xf4, 0x42, 0x0f, + 0xcd, 0x81, 0x4a, 0x55, 0x55, 0xa9, 0x07, 0x54, 0x75, 0xb5, 0x48, 0x1c, 0x50, 0xf6, 0x01, 0x90, + 0x37, 0x31, 0xbb, 0x16, 0x10, 0x47, 0xb6, 0x81, 0xe5, 0x49, 0xf7, 0x75, 0xd6, 0x38, 0xd9, 0x04, + 0xad, 0xb8, 0xcd, 0xfc, 0xf3, 0x8d, 0x3c, 0xff, 0x2f, 0xc3, 0x60, 0xb3, 0x13, 0x54, 0xf3, 0xfc, + 0x69, 0xcd, 0x8b, 0xb8, 0x90, 0x42, 0x0b, 0xec, 0x08, 0xba, 0xd5, 0x92, 0xb1, 0x51, 0x3f, 0x15, + 0xfb, 0xbd, 0xc8, 0x4b, 0x79, 0xf2, 0xea, 0x01, 0xdc, 0x55, 0xf0, 0x62, 0x85, 0x3f, 0x20, 0xd8, + 0x89, 0xd4, 0x74, 0x22, 0x27, 0xce, 0xd8, 0x99, 0xf6, 0x66, 0x83, 0xb8, 0x5a, 0x8c, 0x97, 0xd5, + 0x20, 0xa9, 0x11, 0x0c, 0xc1, 0xe5, 0x19, 0x71, 0x0d, 0xd8, 0x4d, 0x4c, 0x85, 0x5f, 0xa1, 0xc7, + 0xd5, 0x9a, 0x6a, 0x4d, 0xd3, 0x67, 0x96, 0x11, 0xcf, 0x0c, 0x82, 0x04, 0xb8, 0x9a, 0x57, 0x0a, + 0x4e, 0x21, 0xda, 0xf0, 0x17, 0x96, 0x99, 0xbb, 0xd6, 0x34, 0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0x00, 0x00, 0xff, 0xff, 0x1d, 0x8d, 0x18, 0x49, 0x56, 0x02, 0x00, 0x00, +} diff --git a/oaktreemodel/floating_ip.proto b/oaktreemodel/floating_ip.proto new file mode 100644 index 0000000..bca48ed --- /dev/null +++ b/oaktreemodel/floating_ip.proto @@ -0,0 +1,41 @@ +// Copyright (c) 2016 Red Hat, Inc +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or +// implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +syntax = "proto3"; + +import "common.proto"; + +package oaktree; + +message FloatingIP { + Location location = 1; + string id = 2; + bool is_attached = 3; + string fixed_ip_address = 4; + string floating_ip_address = 5; + string network = 6; + string port = 7; + enum Status { + active = 0; + down = 1; + error = 2; + } + Status status = 8; + map properties = 99; +} + +message FloatingIPList { + repeated FloatingIP floating_ips = 1; +} diff --git a/oaktreemodel/model.py b/oaktreemodel/model.py index 2908b21..7d25f65 100644 --- a/oaktreemodel/model.py +++ b/oaktreemodel/model.py @@ -16,6 +16,7 @@ from oaktreemodel.common_pb2 import Project, Location, Filter from oaktreemodel.flavor_pb2 import Flavor, FlavorList +from oaktreemodel.floating_ip_pb2 import FloatingIP, FloatingIPList from oaktreemodel.image_pb2 import Image, ImageList from oaktreemodel.security_group_pb2 import SecurityGroup, SecurityGroupList from oaktreemodel.security_group_pb2 import SecurityGroupRule diff --git a/oaktreemodel/oaktree.pb.go b/oaktreemodel/oaktree.pb.go index fb3a1b0..4187105 100644 --- a/oaktreemodel/oaktree.pb.go +++ b/oaktreemodel/oaktree.pb.go @@ -19,6 +19,7 @@ import _ "." import _ "." import _ "." import _ "." +import _ "." // Reference imports to suppress errors if they are not otherwise used. var _ = proto.Marshal @@ -34,24 +35,26 @@ const _ = proto.ProtoPackageIsVersion2 // please upgrade the proto package func init() { proto.RegisterFile("oaktree.proto", fileDescriptor0) } var fileDescriptor0 = []byte{ - // 291 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x09, 0x6e, 0x88, 0x02, 0xff, 0x8c, 0x92, 0xdf, 0x4a, 0xc3, 0x30, - 0x18, 0xc5, 0xd5, 0x81, 0xd3, 0xcf, 0x4e, 0x25, 0x0e, 0x91, 0x08, 0x5e, 0x78, 0x6f, 0x05, 0x87, - 0x78, 0xe5, 0x85, 0x03, 0x37, 0x44, 0x65, 0xc3, 0x3d, 0x80, 0xc4, 0x92, 0xd5, 0xb0, 0xb6, 0x29, - 0x5f, 0x53, 0xc1, 0xd7, 0xf1, 0x1d, 0xbd, 0x37, 0xff, 0x36, 0xec, 0x1a, 0xc1, 0xcb, 0x9c, 0x9c, - 0xdf, 0x39, 0x27, 0x10, 0xe8, 0x49, 0xb6, 0x50, 0xc8, 0x79, 0x5c, 0xa2, 0x54, 0x92, 0x74, 0xfd, - 0x91, 0x46, 0x89, 0xcc, 0x73, 0x59, 0x38, 0x99, 0x46, 0xf3, 0x8c, 0x7d, 0x48, 0xf4, 0xa7, 0x3d, - 0x91, 0xb3, 0xd4, 0x13, 0xb4, 0x5f, 0xf1, 0xa4, 0x46, 0xa1, 0x3e, 0x5f, 0x53, 0x94, 0x75, 0xe9, - 0xd4, 0xab, 0xef, 0x0e, 0x74, 0x27, 0x2e, 0x8a, 0x5c, 0xc2, 0xee, 0x98, 0xab, 0x91, 0x4d, 0x20, - 0x07, 0xf1, 0xb2, 0x70, 0x24, 0x32, 0xc5, 0x91, 0xfe, 0x12, 0xac, 0xe3, 0x7c, 0x83, 0xdc, 0x40, - 0x6f, 0xc6, 0x19, 0x26, 0xef, 0x4e, 0xa9, 0xda, 0xd0, 0xd1, 0x1a, 0xf4, 0x24, 0x2a, 0xa5, 0xc1, - 0x0b, 0xd8, 0xd1, 0x4d, 0x0f, 0x66, 0x5d, 0x9b, 0xd9, 0x5f, 0x09, 0xd6, 0xa0, 0xed, 0xd7, 0x10, - 0xb9, 0x1e, 0x2b, 0x04, 0x6a, 0x48, 0x13, 0xf1, 0x2d, 0xb7, 0x70, 0xa8, 0x5b, 0x66, 0xfe, 0xd9, - 0x63, 0xf3, 0xea, 0x36, 0x7a, 0xbc, 0x12, 0x1a, 0x46, 0x8d, 0xdf, 0x43, 0xdf, 0xb5, 0x36, 0x2e, - 0x02, 0xed, 0x34, 0x1c, 0xe1, 0x57, 0xe8, 0x98, 0xf5, 0x15, 0x2f, 0x75, 0xc6, 0xff, 0x1d, 0x63, - 0xcc, 0x3a, 0xe6, 0x19, 0x4e, 0x02, 0x6b, 0xcc, 0x65, 0x60, 0xd1, 0xd9, 0xdf, 0x51, 0x6e, 0xd5, - 0x70, 0x00, 0xa7, 0x12, 0xd3, 0x58, 0x96, 0xbc, 0xa8, 0x14, 0x4b, 0x16, 0xb1, 0x28, 0xe6, 0xc8, - 0x96, 0xd8, 0x30, 0xf2, 0x7f, 0x62, 0x6a, 0x3e, 0xc9, 0x74, 0xf3, 0x6b, 0xab, 0x33, 0xb9, 0x7b, - 0x7c, 0xdb, 0xb6, 0x7f, 0x66, 0xf0, 0x13, 0x00, 0x00, 0xff, 0xff, 0xf2, 0x6e, 0xbe, 0xa3, 0x8c, - 0x02, 0x00, 0x00, + // 327 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x09, 0x6e, 0x88, 0x02, 0xff, 0x8c, 0x92, 0xd1, 0x4a, 0xf3, 0x30, + 0x1c, 0xc5, 0xbf, 0x4f, 0xc5, 0xe9, 0xdf, 0x4e, 0x5d, 0x1d, 0x2a, 0x15, 0xbc, 0xf0, 0xde, 0x0a, + 0x0e, 0xf1, 0x4a, 0xc4, 0x81, 0x1b, 0x43, 0x65, 0xc5, 0x3d, 0xc0, 0x88, 0x25, 0xad, 0x61, 0x6d, + 0x53, 0xd2,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 0x52, 0x68, 0x18, 0x55, 0xfc, 0x1e, 0xfa, + 0x86, 0xda, 0xb8, 0xb0, 0xd0, 0x3d, 0x7b, 0x05, 0xae, 0x50, 0x35, 0xab, 0x2b, 0x9e, 0xcb, 0x84, + 0xfe, 0xb9, 0xa6, 0x32, 0xab, 0x9a, 0x27, 0x38, 0xb6, 0xac, 0xa9, 0x2e, 0x2d, 0x8b, 0x4e, 0x7f, + 0xae, 0x32, 0xab, 0x86, 0x03, 0x38, 0xe1, 0x22, 0xf6, 0x79, 0x4e, 0xb3, 0x42, 0x92, 0x70, 0xe1, + 0xb3, 0x2c, 0x12, 0xa4, 0x8e, 0x0d, 0x1d, 0xfc, 0x8d, 0x41, 0xf5, 0x3d, 0x83, 0xff, 0x1f, 0x6b, + 0xeb, 0xd3, 0xbb, 0x87, 0x97, 0x4d, 0xfd, 0x5b, 0x07, 0x5f, 0x01, 0x00, 0x00, 0xff, 0xff, 0x66, + 0xa3, 0x18, 0x3f, 0x19, 0x03, 0x00, 0x00, } diff --git a/oaktreemodel/oaktree.proto b/oaktreemodel/oaktree.proto index 33e1af3..da11770 100644 --- a/oaktreemodel/oaktree.proto +++ b/oaktreemodel/oaktree.proto @@ -22,6 +22,7 @@ option objc_class_prefix = "OAK"; import "common.proto"; import "flavor.proto"; +import "floating_ip.proto"; import "image.proto"; import "security_group.proto"; @@ -30,6 +31,8 @@ package oaktree; service Oaktree { rpc GetFlavor (Filter) returns (Flavor) {} rpc SearchFlavors (Filter) returns (FlavorList) {} + rpc GetFloatingIP (Filter) returns (FloatingIP) {} + rpc SearchFloatingIPs (Filter) returns (FloatingIPList) {} rpc GetImage (Filter) returns (Image) {} rpc SearchImages (Filter) returns (ImageList) {} rpc GetSecurityGroup (Filter) returns (SecurityGroup) {}