Merge pull request #34 from spotify/scaffolder

Add scaffolder service
This commit is contained in:
Patrik Oldsberg
2020-02-04 15:38:18 +01:00
committed by GitHub
11 changed files with 453 additions and 12 deletions
+17 -4
View File
@@ -8,6 +8,8 @@ import (
fmt "fmt"
proto "github.com/golang/protobuf/proto"
grpc "google.golang.org/grpc"
codes "google.golang.org/grpc/codes"
status "google.golang.org/grpc/status"
math "math"
)
@@ -324,11 +326,11 @@ var fileDescriptor_2343b5ee8923b571 = []byte{
// Reference imports to suppress errors if they are not otherwise used.
var _ context.Context
var _ grpc.ClientConn
var _ grpc.ClientConnInterface
// This is a compile-time assertion to ensure that this generated file
// is compatible with the grpc package it is being compiled against.
const _ = grpc.SupportPackageIsVersion4
const _ = grpc.SupportPackageIsVersion6
// IdentityClient is the client API for Identity service.
//
@@ -342,10 +344,10 @@ type IdentityClient interface {
}
type identityClient struct {
cc *grpc.ClientConn
cc grpc.ClientConnInterface
}
func NewIdentityClient(cc *grpc.ClientConn) IdentityClient {
func NewIdentityClient(cc grpc.ClientConnInterface) IdentityClient {
return &identityClient{cc}
}
@@ -376,6 +378,17 @@ type IdentityServer interface {
GetGroup(context.Context, *GetGroupRequest) (*GetGroupReply, error)
}
// UnimplementedIdentityServer can be embedded to have forward compatible implementations.
type UnimplementedIdentityServer struct {
}
func (*UnimplementedIdentityServer) GetUser(ctx context.Context, req *GetUserRequest) (*GetUserReply, error) {
return nil, status.Errorf(codes.Unimplemented, "method GetUser not implemented")
}
func (*UnimplementedIdentityServer) GetGroup(ctx context.Context, req *GetGroupRequest) (*GetGroupReply, error) {
return nil, status.Errorf(codes.Unimplemented, "method GetGroup not implemented")
}
func RegisterIdentityServer(s *grpc.Server, srv IdentityServer) {
s.RegisterService(&_Identity_serviceDesc, srv)
}
@@ -0,0 +1,259 @@
// Code generated by protoc-gen-go. DO NOT EDIT.
// source: scaffolder/v1/scaffolder.proto
package scaffolderv1
import (
context "context"
fmt "fmt"
proto "github.com/golang/protobuf/proto"
v1 "github.com/spotify/backstage/backend/proto/identity/v1"
grpc "google.golang.org/grpc"
codes "google.golang.org/grpc/codes"
status "google.golang.org/grpc/status"
math "math"
)
// 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.ProtoPackageIsVersion3 // please upgrade the proto package
type Empty struct {
XXX_NoUnkeyedLiteral struct{} `json:"-"`
XXX_unrecognized []byte `json:"-"`
XXX_sizecache int32 `json:"-"`
}
func (m *Empty) Reset() { *m = Empty{} }
func (m *Empty) String() string { return proto.CompactTextString(m) }
func (*Empty) ProtoMessage() {}
func (*Empty) Descriptor() ([]byte, []int) {
return fileDescriptor_6737326b433dc57d, []int{0}
}
func (m *Empty) XXX_Unmarshal(b []byte) error {
return xxx_messageInfo_Empty.Unmarshal(m, b)
}
func (m *Empty) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
return xxx_messageInfo_Empty.Marshal(b, m, deterministic)
}
func (m *Empty) XXX_Merge(src proto.Message) {
xxx_messageInfo_Empty.Merge(m, src)
}
func (m *Empty) XXX_Size() int {
return xxx_messageInfo_Empty.Size(m)
}
func (m *Empty) XXX_DiscardUnknown() {
xxx_messageInfo_Empty.DiscardUnknown(m)
}
var xxx_messageInfo_Empty proto.InternalMessageInfo
type GetAllTemplatesResponse struct {
Templates []*Template `protobuf:"bytes,1,rep,name=templates,proto3" json:"templates,omitempty"`
XXX_NoUnkeyedLiteral struct{} `json:"-"`
XXX_unrecognized []byte `json:"-"`
XXX_sizecache int32 `json:"-"`
}
func (m *GetAllTemplatesResponse) Reset() { *m = GetAllTemplatesResponse{} }
func (m *GetAllTemplatesResponse) String() string { return proto.CompactTextString(m) }
func (*GetAllTemplatesResponse) ProtoMessage() {}
func (*GetAllTemplatesResponse) Descriptor() ([]byte, []int) {
return fileDescriptor_6737326b433dc57d, []int{1}
}
func (m *GetAllTemplatesResponse) XXX_Unmarshal(b []byte) error {
return xxx_messageInfo_GetAllTemplatesResponse.Unmarshal(m, b)
}
func (m *GetAllTemplatesResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
return xxx_messageInfo_GetAllTemplatesResponse.Marshal(b, m, deterministic)
}
func (m *GetAllTemplatesResponse) XXX_Merge(src proto.Message) {
xxx_messageInfo_GetAllTemplatesResponse.Merge(m, src)
}
func (m *GetAllTemplatesResponse) XXX_Size() int {
return xxx_messageInfo_GetAllTemplatesResponse.Size(m)
}
func (m *GetAllTemplatesResponse) XXX_DiscardUnknown() {
xxx_messageInfo_GetAllTemplatesResponse.DiscardUnknown(m)
}
var xxx_messageInfo_GetAllTemplatesResponse proto.InternalMessageInfo
func (m *GetAllTemplatesResponse) GetTemplates() []*Template {
if m != nil {
return m.Templates
}
return nil
}
type Template struct {
Id string `protobuf:"bytes,1,opt,name=id,proto3" json:"id,omitempty"`
Name string `protobuf:"bytes,2,opt,name=name,proto3" json:"name,omitempty"`
User *v1.User `protobuf:"bytes,3,opt,name=user,proto3" json:"user,omitempty"`
XXX_NoUnkeyedLiteral struct{} `json:"-"`
XXX_unrecognized []byte `json:"-"`
XXX_sizecache int32 `json:"-"`
}
func (m *Template) Reset() { *m = Template{} }
func (m *Template) String() string { return proto.CompactTextString(m) }
func (*Template) ProtoMessage() {}
func (*Template) Descriptor() ([]byte, []int) {
return fileDescriptor_6737326b433dc57d, []int{2}
}
func (m *Template) XXX_Unmarshal(b []byte) error {
return xxx_messageInfo_Template.Unmarshal(m, b)
}
func (m *Template) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
return xxx_messageInfo_Template.Marshal(b, m, deterministic)
}
func (m *Template) XXX_Merge(src proto.Message) {
xxx_messageInfo_Template.Merge(m, src)
}
func (m *Template) XXX_Size() int {
return xxx_messageInfo_Template.Size(m)
}
func (m *Template) XXX_DiscardUnknown() {
xxx_messageInfo_Template.DiscardUnknown(m)
}
var xxx_messageInfo_Template proto.InternalMessageInfo
func (m *Template) GetId() string {
if m != nil {
return m.Id
}
return ""
}
func (m *Template) GetName() string {
if m != nil {
return m.Name
}
return ""
}
func (m *Template) GetUser() *v1.User {
if m != nil {
return m.User
}
return nil
}
func init() {
proto.RegisterType((*Empty)(nil), "spotify.backstage.scaffolder.v1.Empty")
proto.RegisterType((*GetAllTemplatesResponse)(nil), "spotify.backstage.scaffolder.v1.GetAllTemplatesResponse")
proto.RegisterType((*Template)(nil), "spotify.backstage.scaffolder.v1.Template")
}
func init() { proto.RegisterFile("scaffolder/v1/scaffolder.proto", fileDescriptor_6737326b433dc57d) }
var fileDescriptor_6737326b433dc57d = []byte{
// 254 bytes of a gzipped FileDescriptorProto
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x84, 0x90, 0x4f, 0x4b, 0xc4, 0x30,
0x10, 0xc5, 0x49, 0x77, 0xfd, 0xb3, 0xb3, 0xb2, 0x42, 0x2e, 0x96, 0x1e, 0xb4, 0x54, 0x90, 0x7a,
0xc9, 0xd2, 0x7a, 0xd0, 0xab, 0x82, 0xec, 0xbd, 0xea, 0xc5, 0x5b, 0xba, 0x9d, 0x2e, 0xc1, 0xb6,
0x09, 0xcd, 0x58, 0xe8, 0xd1, 0x6f, 0x2e, 0x46, 0xba, 0x15, 0x51, 0x7a, 0x9b, 0x3c, 0xde, 0x2f,
0x33, 0xef, 0xc1, 0xb9, 0xdd, 0xca, 0xb2, 0xd4, 0x55, 0x81, 0xed, 0xba, 0x4b, 0xd6, 0xe3, 0x4b,
0x98, 0x56, 0x93, 0xe6, 0x17, 0xd6, 0x68, 0x52, 0x65, 0x2f, 0x72, 0xb9, 0x7d, 0xb3, 0x24, 0x77,
0x28, 0x7e, 0x78, 0xba, 0x24, 0x08, 0x54, 0x81, 0x0d, 0x29, 0xea, 0xbf, 0xf0, 0x61, 0xfe, 0x86,
0xa3, 0x23, 0x38, 0x78, 0xac, 0x0d, 0xf5, 0x51, 0x0e, 0x67, 0x1b, 0xa4, 0xfb, 0xaa, 0x7a, 0xc6,
0xda, 0x54, 0x92, 0xd0, 0x66, 0x68, 0x8d, 0x6e, 0x2c, 0xf2, 0x0d, 0x2c, 0x68, 0x10, 0x7d, 0x16,
0xce, 0xe2, 0x65, 0x7a, 0x2d, 0x26, 0x96, 0x8a, 0xe1, 0x9b, 0x6c, 0x64, 0xa3, 0x1d, 0x1c, 0x0f,
0x32, 0x5f, 0x81, 0xa7, 0x0a, 0x9f, 0x85, 0x2c, 0x5e, 0x64, 0x9e, 0x2a, 0x38, 0x87, 0x79, 0x23,
0x6b, 0xf4, 0x3d, 0xa7, 0xb8, 0x99, 0xdf, 0xc2, 0xfc, 0xdd, 0x62, 0xeb, 0xcf, 0x42, 0x16, 0x2f,
0xd3, 0xcb, 0x3f, 0x76, 0xee, 0xd3, 0x74, 0x89, 0x78, 0xb1, 0xd8, 0x66, 0x0e, 0x48, 0x3f, 0x18,
0xc0, 0xd3, 0xfe, 0x1c, 0x6e, 0xe1, 0xf4, 0x57, 0x36, 0x7e, 0x35, 0x19, 0xc0, 0xd5, 0x12, 0xdc,
0x4d, 0xfa, 0xfe, 0x69, 0xed, 0x61, 0xf5, 0x7a, 0x32, 0x1a, 0xbb, 0x24, 0x3f, 0x74, 0x85, 0xdf,
0x7c, 0x06, 0x00, 0x00, 0xff, 0xff, 0x6c, 0x28, 0xe6, 0x58, 0xcf, 0x01, 0x00, 0x00,
}
// Reference imports to suppress errors if they are not otherwise used.
var _ context.Context
var _ grpc.ClientConnInterface
// This is a compile-time assertion to ensure that this generated file
// is compatible with the grpc package it is being compiled against.
const _ = grpc.SupportPackageIsVersion6
// ScaffolderClient is the client API for Scaffolder service.
//
// For semantics around ctx use and closing/ending streaming RPCs, please refer to https://godoc.org/google.golang.org/grpc#ClientConn.NewStream.
type ScaffolderClient interface {
GetAllTemplates(ctx context.Context, in *Empty, opts ...grpc.CallOption) (*GetAllTemplatesResponse, error)
}
type scaffolderClient struct {
cc grpc.ClientConnInterface
}
func NewScaffolderClient(cc grpc.ClientConnInterface) ScaffolderClient {
return &scaffolderClient{cc}
}
func (c *scaffolderClient) GetAllTemplates(ctx context.Context, in *Empty, opts ...grpc.CallOption) (*GetAllTemplatesResponse, error) {
out := new(GetAllTemplatesResponse)
err := c.cc.Invoke(ctx, "/spotify.backstage.scaffolder.v1.Scaffolder/GetAllTemplates", in, out, opts...)
if err != nil {
return nil, err
}
return out, nil
}
// ScaffolderServer is the server API for Scaffolder service.
type ScaffolderServer interface {
GetAllTemplates(context.Context, *Empty) (*GetAllTemplatesResponse, error)
}
// UnimplementedScaffolderServer can be embedded to have forward compatible implementations.
type UnimplementedScaffolderServer struct {
}
func (*UnimplementedScaffolderServer) GetAllTemplates(ctx context.Context, req *Empty) (*GetAllTemplatesResponse, error) {
return nil, status.Errorf(codes.Unimplemented, "method GetAllTemplates not implemented")
}
func RegisterScaffolderServer(s *grpc.Server, srv ScaffolderServer) {
s.RegisterService(&_Scaffolder_serviceDesc, srv)
}
func _Scaffolder_GetAllTemplates_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
in := new(Empty)
if err := dec(in); err != nil {
return nil, err
}
if interceptor == nil {
return srv.(ScaffolderServer).GetAllTemplates(ctx, in)
}
info := &grpc.UnaryServerInfo{
Server: srv,
FullMethod: "/spotify.backstage.scaffolder.v1.Scaffolder/GetAllTemplates",
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(ScaffolderServer).GetAllTemplates(ctx, req.(*Empty))
}
return interceptor(ctx, in, info, handler)
}
var _Scaffolder_serviceDesc = grpc.ServiceDesc{
ServiceName: "spotify.backstage.scaffolder.v1.Scaffolder",
HandlerType: (*ScaffolderServer)(nil),
Methods: []grpc.MethodDesc{
{
MethodName: "GetAllTemplates",
Handler: _Scaffolder_GetAllTemplates_Handler,
},
},
Streams: []grpc.StreamDesc{},
Metadata: "scaffolder/v1/scaffolder.proto",
}
+30 -4
View File
@@ -24,9 +24,17 @@ static_resources:
- name: local_service
domains: ['*']
routes:
- match: { prefix: '/' }
- match: { prefix: '/identity' }
route:
cluster: hello_service
cluster: identity_service
max_grpc_timeout: 0s
- match: { prefix: '/inventory' }
route:
cluster: inventory_service
max_grpc_timeout: 0s
- match: { prefix: '/spotify.backstage.scaffolder.v1.Scaffolder' }
route:
cluster: scaffolder_service
max_grpc_timeout: 0s
cors:
allow_origin_string_match:
@@ -41,12 +49,30 @@ static_resources:
- name: envoy.router
clusters:
- name: hello_service
- name: identity_service
connect_timeout: 0.25s
type: logical_dns
http2_protocol_options: {}
lb_policy: round_robin
hosts:
- socket_address:
address: hello
address: identity
port_value: 80
- name: inventory_service
connect_timeout: 0.25s
type: logical_dns
http2_protocol_options: {}
lb_policy: round_robin
hosts:
- socket_address:
address: inventory
port_value: 80
- name: scaffolder_service
connect_timeout: 0.25s
type: logical_dns
http2_protocol_options: {}
lb_policy: round_robin
hosts:
- socket_address:
address: scaffolder
port_value: 80
View File
+10
View File
@@ -0,0 +1,10 @@
module github.com/spotify/backstage/scaffolder
go 1.13
replace github.com/spotify/backstage/backend/proto => ../proto
require (
github.com/spotify/backstage/backend/proto v0.0.0-00010101000000-000000000000 // indirect
google.golang.org/grpc v1.27.0
)
+51
View File
@@ -0,0 +1,51 @@
cloud.google.com/go v0.26.0/go.mod h1:aQUYkXzVsufM+DwF1aE+0xfcU+56JwCaLick0ClmMTw=
github.com/BurntSushi/toml v0.3.1/go.mod h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03qcyfWMU=
github.com/census-instrumentation/opencensus-proto v0.2.1/go.mod h1:f6KPmirojxKA12rnyqOA5BBL4O983OfeGPqjHWSTneU=
github.com/client9/misspell v0.3.4/go.mod h1:qj6jICC3Q7zFZvVWo7KLAzC3yx5G7kyvSDkc90ppPyw=
github.com/envoyproxy/go-control-plane v0.9.1-0.20191026205805-5f8ba28d4473/go.mod h1:YTl/9mNaCwkRvm6d1a2C3ymFceY/DCBVvsKhRF0iEA4=
github.com/envoyproxy/protoc-gen-validate v0.1.0/go.mod h1:iSmxcyjqTsJpI2R4NaDN7+kN2VEUnK/pcBlmesArF7c=
github.com/golang/glog v0.0.0-20160126235308-23def4e6c14b h1:VKtxabqXZkF25pY9ekfRL6a582T4P37/31XEstQ5p58=
github.com/golang/glog v0.0.0-20160126235308-23def4e6c14b/go.mod h1:SBH7ygxi8pfUlaOkMMuAQtPIUF8ecWP5IEl/CR7VP2Q=
github.com/golang/mock v1.1.1/go.mod h1:oTYuIxOrZwtPieC+H1uAHpcLFnEyAGVDL/k47Jfbm0A=
github.com/golang/protobuf v1.2.0/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U=
github.com/golang/protobuf v1.3.2 h1:6nsPYzhq5kReh6QImI3k5qWzO4PEbvbIW2cwSfR/6xs=
github.com/golang/protobuf v1.3.2/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U=
github.com/golang/protobuf v1.3.3 h1:gyjaxf+svBWX08ZjK86iN9geUJF0H6gp2IRKX6Nf6/I=
github.com/golang/protobuf v1.3.3/go.mod h1:vzj43D7+SQXF/4pzW/hwtAqwc6iTitCiVSaWz5lYuqw=
github.com/google/go-cmp v0.2.0 h1:+dTQ8DZQJz0Mb/HjFlkptS1FeQ4cWSnN941F8aEG4SQ=
github.com/google/go-cmp v0.2.0/go.mod h1:oXzfMopK8JAjlY9xF4vHSVASa0yLyX7SntLO5aqRK0M=
github.com/prometheus/client_model v0.0.0-20190812154241-14fe0d1b01d4/go.mod h1:xMI15A0UPsDsEKsMN9yxemIoYk6Tm2C1GtYGdfGttqA=
golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w=
golang.org/x/exp v0.0.0-20190121172915-509febef88a4/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA=
golang.org/x/lint v0.0.0-20181026193005-c67002cb31c3/go.mod h1:UVdnD1Gm6xHRNCYTkRU2/jEulfH38KcIWyp/GAMgvoE=
golang.org/x/lint v0.0.0-20190227174305-5b3e6a55c961/go.mod h1:wehouNa3lNwaWXcvxsM5YxQ5yQlVC4a0KAMCusXpPoU=
golang.org/x/lint v0.0.0-20190313153728-d0100b6bd8b3/go.mod h1:6SW0HCj/g11FgYtHlgUYUwCkIfeOF89ocIRzGO/8vkc=
golang.org/x/net v0.0.0-20180724234803-3673e40ba225/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4=
golang.org/x/net v0.0.0-20180826012351-8a410e7b638d/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4=
golang.org/x/net v0.0.0-20190213061140-3a22650c66bd/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4=
golang.org/x/net v0.0.0-20190311183353-d8887717615a h1:oWX7TPOiFAMXLq8o0ikBYfCJVlRHBcsciT5bXOrH628=
golang.org/x/net v0.0.0-20190311183353-d8887717615a/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg=
golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U=
golang.org/x/sync v0.0.0-20180314180146-1d60e4601c6f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
golang.org/x/sync v0.0.0-20181108010431-42b317875d0f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
golang.org/x/sys v0.0.0-20180830151530-49385e6e1522/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a h1:1BGLXjeY4akVXGgbC9HugT3Jv3hCI0z56oJR5vAMgBU=
golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
golang.org/x/text v0.3.0 h1:g61tztE5qeGQ89tm6NTjjM9VPIm088od1l6aSorWRWg=
golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
golang.org/x/tools v0.0.0-20190114222345-bf090417da8b/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ=
golang.org/x/tools v0.0.0-20190226205152-f727befe758c/go.mod h1:9Yl7xja0Znq3iFh3HoIrodX9oNMXvdceNzlUR8zjMvY=
golang.org/x/tools v0.0.0-20190311212946-11955173bddd/go.mod h1:LCzVGOaR6xXOjkQ3onu1FJEFr0SW1gC7cKk1uF8kGRs=
golang.org/x/tools v0.0.0-20190524140312-2c0ae7006135/go.mod h1:RgjU9mgBXZiqYHBnxXauZ1Gv1EHHAz9KjViQ78xBX0Q=
google.golang.org/appengine v1.1.0/go.mod h1:EbEs0AVv82hx2wNQdGPgUI5lhzA/G0D9YwlJXL52JkM=
google.golang.org/appengine v1.4.0/go.mod h1:xpcJRLb0r/rnEns0DIKYYv+WjYCduHsrkT7/EB5XEv4=
google.golang.org/genproto v0.0.0-20180817151627-c66870c02cf8/go.mod h1:JiN7NxoALGmiZfu7CAH4rXhgtRTLTxftemlI0sWmxmc=
google.golang.org/genproto v0.0.0-20190819201941-24fa4b261c55 h1:gSJIx1SDwno+2ElGhA4+qG2zF97qiUzTM+rQ0klBOcE=
google.golang.org/genproto v0.0.0-20190819201941-24fa4b261c55/go.mod h1:DMBHOl98Agz4BDEuKkezgsaosCRResVns1a3J2ZsMNc=
google.golang.org/grpc v1.19.0/go.mod h1:mqu4LbDTu4XGKhr4mRzUsmM4RtVoemTSY81AxZiDr8c=
google.golang.org/grpc v1.23.0/go.mod h1:Y5yQAOtifL1yxbo5wqy6BxZv8vAUGQwXBOALyacEbxg=
google.golang.org/grpc v1.27.0 h1:rRYRFMVgRv6E0D70Skyfsr28tDXIuuPZyWGMPdMcnXg=
google.golang.org/grpc v1.27.0/go.mod h1:qbnxyOmOxrQa7FizSgH+ReBfzJrCY1pSN7KXBS8abTk=
honnef.co/go/tools v0.0.0-20190102054323-c2f93a96b099/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4=
honnef.co/go/tools v0.0.0-20190523083050-ea95bdfd59fc/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4=
+34
View File
@@ -0,0 +1,34 @@
package main
import (
"context"
"log"
"net"
pb "github.com/spotify/backstage/backend/proto/scaffolder/v1"
"google.golang.org/grpc"
)
const (
port = ":50051"
)
func main() {
lis, err := net.Listen("tcp", port)
if err != nil {
log.Fatalf("failed to listen: %v", err)
}
grpcServer := grpc.NewServer()
pb.RegisterScaffolderServer(grpcServer, &server{})
log.Println("Serving Scaffolder Service")
grpcServer.Serve(lis)
}
type server struct {
}
func (s *server) GetAllTemplates(ctx context.Context, req *pb.Empty) (*pb.GetAllTemplatesResponse, error) {
return &pb.GetAllTemplatesResponse{}, nil
}
+17 -3
View File
@@ -11,8 +11,22 @@ services:
ports:
- "8080:80"
hello:
container_name: boss-hello
# identity:
# container_name: boss-identity
# build:
# context: backend/identity
# restart: unless-stopped
# inventory:
# container_name: boss-inventory
# build:
# context: backend/inventory
# restart: unless-stopped
scaffolder:
container_name: boss-scaffolder
build:
context: backend/hello
context: backend/scaffolder
restart: unless-stopped
+11
View File
@@ -6,6 +6,17 @@ Collection of all Backstage protobuf definitions.
Managed with prototool, install instructions at https://github.com/uber/prototool/blob/dev/docs/install.md
## Install Depenedencies
You will need to have `protoc-gen-go` available in your path. You can find out more information here: https://github.com/golang/protobuf
```sh
$ go get -u github.com/golang/protobuf/protoc-gen-go
$ protoc-gen-go # should now be available in your path providing you GOPATH + GOBIN paths are setup correctly.
```
### Generate code
Run to generate code to `backend/proto/`:
+1 -1
View File
@@ -10,7 +10,7 @@ lint:
path: ../LICENSE
generate:
go_options:
import_path: github.com/spotify/backstage
import_path: github.com/spotify/backstage/backend
plugins:
- name: go
type: go
+23
View File
@@ -0,0 +1,23 @@
syntax = "proto3";
package spotify.backstage.scaffolder.v1;
import "identity/v1/identity.proto";
option go_package = "scaffolderv1";
service Scaffolder {
rpc GetAllTemplates(Empty) returns (GetAllTemplatesResponse);
}
message Empty {}
message GetAllTemplatesResponse {
repeated Template templates = 1;
}
message Template {
string id = 1;
string name = 2;
spotify.backstage.identity.v1.User user = 3;
}