diff options
| author | Saumit <justsaumit@protonmail.com> | 2025-09-27 02:14:26 +0530 |
|---|---|---|
| committer | Saumit <justsaumit@protonmail.com> | 2025-09-27 02:14:26 +0530 |
| commit | 82e03978b89938219958032efb1448cc76baa181 (patch) | |
| tree | 626f3e54d52ecd49be0ed3bee30abacc0453d081 /src/checkout | |
Initial snapshot - OpenTelemetry demo 2.1.3 -f
Diffstat (limited to 'src/checkout')
| -rw-r--r-- | src/checkout/Dockerfile | 28 | ||||
| -rw-r--r-- | src/checkout/README.md | 36 | ||||
| -rw-r--r-- | src/checkout/genproto/Dockerfile | 13 | ||||
| -rw-r--r-- | src/checkout/genproto/oteldemo/demo.pb.go | 2544 | ||||
| -rw-r--r-- | src/checkout/genproto/oteldemo/demo_grpc.pb.go | 1433 | ||||
| -rw-r--r-- | src/checkout/go.mod | 87 | ||||
| -rw-r--r-- | src/checkout/go.sum | 225 | ||||
| -rw-r--r-- | src/checkout/kafka/producer.go | 61 | ||||
| -rw-r--r-- | src/checkout/main.go | 729 | ||||
| -rw-r--r-- | src/checkout/money/money.go | 120 | ||||
| -rw-r--r-- | src/checkout/money/money_test.go | 233 |
11 files changed, 5509 insertions, 0 deletions
diff --git a/src/checkout/Dockerfile b/src/checkout/Dockerfile new file mode 100644 index 0000000..9aa66af --- /dev/null +++ b/src/checkout/Dockerfile @@ -0,0 +1,28 @@ +# Copyright The OpenTelemetry Authors +# SPDX-License-Identifier: Apache-2.0 + + +FROM golang:1.24-bookworm AS builder + +WORKDIR /usr/src/app/ + +COPY ./src/checkout/go.mod go.mod +COPY ./src/checkout/go.sum go.sum + +RUN go mod download + +COPY ./src/checkout/genproto/oteldemo/ genproto/oteldemo/ +COPY ./src/checkout/kafka/ kafka/ +COPY ./src/checkout/money/ money/ +COPY ./src/checkout/main.go main.go + +RUN CGO_ENABLED=0 GOOS=linux go build -ldflags "-s -w" -o checkout main.go + +FROM gcr.io/distroless/static-debian12:nonroot + +WORKDIR /usr/src/app/ + +COPY --from=builder /usr/src/app/checkout/ ./ + +EXPOSE ${CHECKOUT_PORT} +ENTRYPOINT [ "./checkout" ] diff --git a/src/checkout/README.md b/src/checkout/README.md new file mode 100644 index 0000000..28064bd --- /dev/null +++ b/src/checkout/README.md @@ -0,0 +1,36 @@ +# Checkout Service + +This service provides checkout services for the application. + +## Local Build + +To build the service binary, run: + +```sh +go build -o /go/bin/checkout/ +``` + +## Docker Build + +From the root directory, run: + +```sh +docker compose build checkout +``` + +## Regenerate protos + +To build the protos, run from the root directory: + +```sh +make docker-generate-protobuf +``` + +## Bump dependencies + +To bump all dependencies run: + +```sh +go get -u -t ./... +go mod tidy +``` diff --git a/src/checkout/genproto/Dockerfile b/src/checkout/genproto/Dockerfile new file mode 100644 index 0000000..5bc391c --- /dev/null +++ b/src/checkout/genproto/Dockerfile @@ -0,0 +1,13 @@ +# Copyright The OpenTelemetry Authors +# SPDX-License-Identifier: Apache-2.0 + +FROM golang:1.24-alpine + +WORKDIR /build + +RUN apk add --no-cache protobuf-dev + +COPY ./src/checkout/go.mod go.mod +COPY ./src/checkout/go.sum go.sum + +RUN go install tool diff --git a/src/checkout/genproto/oteldemo/demo.pb.go b/src/checkout/genproto/oteldemo/demo.pb.go new file mode 100644 index 0000000..7094aa3 --- /dev/null +++ b/src/checkout/genproto/oteldemo/demo.pb.go @@ -0,0 +1,2544 @@ +// Copyright 2020 Google LLC +// +// 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. + +// Code generated by protoc-gen-go. DO NOT EDIT. +// versions: +// protoc-gen-go v1.36.9 +// protoc v5.29.4 +// source: demo.proto + +package oteldemo + +import ( + protoreflect "google.golang.org/protobuf/reflect/protoreflect" + protoimpl "google.golang.org/protobuf/runtime/protoimpl" + reflect "reflect" + sync "sync" + unsafe "unsafe" +) + +const ( + // Verify that this generated code is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion) + // Verify that runtime/protoimpl is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20) +) + +type CartItem struct { + state protoimpl.MessageState `protogen:"open.v1"` + ProductId string `protobuf:"bytes,1,opt,name=product_id,json=productId,proto3" json:"product_id,omitempty"` + Quantity int32 `protobuf:"varint,2,opt,name=quantity,proto3" json:"quantity,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *CartItem) Reset() { + *x = CartItem{} + mi := &file_demo_proto_msgTypes[0] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *CartItem) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*CartItem) ProtoMessage() {} + +func (x *CartItem) ProtoReflect() protoreflect.Message { + mi := &file_demo_proto_msgTypes[0] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use CartItem.ProtoReflect.Descriptor instead. +func (*CartItem) Descriptor() ([]byte, []int) { + return file_demo_proto_rawDescGZIP(), []int{0} +} + +func (x *CartItem) GetProductId() string { + if x != nil { + return x.ProductId + } + return "" +} + +func (x *CartItem) GetQuantity() int32 { + if x != nil { + return x.Quantity + } + return 0 +} + +type AddItemRequest struct { + state protoimpl.MessageState `protogen:"open.v1"` + UserId string `protobuf:"bytes,1,opt,name=user_id,json=userId,proto3" json:"user_id,omitempty"` + Item *CartItem `protobuf:"bytes,2,opt,name=item,proto3" json:"item,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *AddItemRequest) Reset() { + *x = AddItemRequest{} + mi := &file_demo_proto_msgTypes[1] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *AddItemRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*AddItemRequest) ProtoMessage() {} + +func (x *AddItemRequest) ProtoReflect() protoreflect.Message { + mi := &file_demo_proto_msgTypes[1] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use AddItemRequest.ProtoReflect.Descriptor instead. +func (*AddItemRequest) Descriptor() ([]byte, []int) { + return file_demo_proto_rawDescGZIP(), []int{1} +} + +func (x *AddItemRequest) GetUserId() string { + if x != nil { + return x.UserId + } + return "" +} + +func (x *AddItemRequest) GetItem() *CartItem { + if x != nil { + return x.Item + } + return nil +} + +type EmptyCartRequest struct { + state protoimpl.MessageState `protogen:"open.v1"` + UserId string `protobuf:"bytes,1,opt,name=user_id,json=userId,proto3" json:"user_id,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *EmptyCartRequest) Reset() { + *x = EmptyCartRequest{} + mi := &file_demo_proto_msgTypes[2] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *EmptyCartRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*EmptyCartRequest) ProtoMessage() {} + +func (x *EmptyCartRequest) ProtoReflect() protoreflect.Message { + mi := &file_demo_proto_msgTypes[2] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use EmptyCartRequest.ProtoReflect.Descriptor instead. +func (*EmptyCartRequest) Descriptor() ([]byte, []int) { + return file_demo_proto_rawDescGZIP(), []int{2} +} + +func (x *EmptyCartRequest) GetUserId() string { + if x != nil { + return x.UserId + } + return "" +} + +type GetCartRequest struct { + state protoimpl.MessageState `protogen:"open.v1"` + UserId string `protobuf:"bytes,1,opt,name=user_id,json=userId,proto3" json:"user_id,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *GetCartRequest) Reset() { + *x = GetCartRequest{} + mi := &file_demo_proto_msgTypes[3] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *GetCartRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*GetCartRequest) ProtoMessage() {} + +func (x *GetCartRequest) ProtoReflect() protoreflect.Message { + mi := &file_demo_proto_msgTypes[3] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use GetCartRequest.ProtoReflect.Descriptor instead. +func (*GetCartRequest) Descriptor() ([]byte, []int) { + return file_demo_proto_rawDescGZIP(), []int{3} +} + +func (x *GetCartRequest) GetUserId() string { + if x != nil { + return x.UserId + } + return "" +} + +type Cart struct { + state protoimpl.MessageState `protogen:"open.v1"` + UserId string `protobuf:"bytes,1,opt,name=user_id,json=userId,proto3" json:"user_id,omitempty"` + Items []*CartItem `protobuf:"bytes,2,rep,name=items,proto3" json:"items,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *Cart) Reset() { + *x = Cart{} + mi := &file_demo_proto_msgTypes[4] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *Cart) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*Cart) ProtoMessage() {} + +func (x *Cart) ProtoReflect() protoreflect.Message { + mi := &file_demo_proto_msgTypes[4] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use Cart.ProtoReflect.Descriptor instead. +func (*Cart) Descriptor() ([]byte, []int) { + return file_demo_proto_rawDescGZIP(), []int{4} +} + +func (x *Cart) GetUserId() string { + if x != nil { + return x.UserId + } + return "" +} + +func (x *Cart) GetItems() []*CartItem { + if x != nil { + return x.Items + } + return nil +} + +type Empty struct { + state protoimpl.MessageState `protogen:"open.v1"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *Empty) Reset() { + *x = Empty{} + mi := &file_demo_proto_msgTypes[5] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *Empty) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*Empty) ProtoMessage() {} + +func (x *Empty) ProtoReflect() protoreflect.Message { + mi := &file_demo_proto_msgTypes[5] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use Empty.ProtoReflect.Descriptor instead. +func (*Empty) Descriptor() ([]byte, []int) { + return file_demo_proto_rawDescGZIP(), []int{5} +} + +type ListRecommendationsRequest struct { + state protoimpl.MessageState `protogen:"open.v1"` + UserId string `protobuf:"bytes,1,opt,name=user_id,json=userId,proto3" json:"user_id,omitempty"` + ProductIds []string `protobuf:"bytes,2,rep,name=product_ids,json=productIds,proto3" json:"product_ids,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *ListRecommendationsRequest) Reset() { + *x = ListRecommendationsRequest{} + mi := &file_demo_proto_msgTypes[6] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *ListRecommendationsRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*ListRecommendationsRequest) ProtoMessage() {} + +func (x *ListRecommendationsRequest) ProtoReflect() protoreflect.Message { + mi := &file_demo_proto_msgTypes[6] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use ListRecommendationsRequest.ProtoReflect.Descriptor instead. +func (*ListRecommendationsRequest) Descriptor() ([]byte, []int) { + return file_demo_proto_rawDescGZIP(), []int{6} +} + +func (x *ListRecommendationsRequest) GetUserId() string { + if x != nil { + return x.UserId + } + return "" +} + +func (x *ListRecommendationsRequest) GetProductIds() []string { + if x != nil { + return x.ProductIds + } + return nil +} + +type ListRecommendationsResponse struct { + state protoimpl.MessageState `protogen:"open.v1"` + ProductIds []string `protobuf:"bytes,1,rep,name=product_ids,json=productIds,proto3" json:"product_ids,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *ListRecommendationsResponse) Reset() { + *x = ListRecommendationsResponse{} + mi := &file_demo_proto_msgTypes[7] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *ListRecommendationsResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*ListRecommendationsResponse) ProtoMessage() {} + +func (x *ListRecommendationsResponse) ProtoReflect() protoreflect.Message { + mi := &file_demo_proto_msgTypes[7] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use ListRecommendationsResponse.ProtoReflect.Descriptor instead. +func (*ListRecommendationsResponse) Descriptor() ([]byte, []int) { + return file_demo_proto_rawDescGZIP(), []int{7} +} + +func (x *ListRecommendationsResponse) GetProductIds() []string { + if x != nil { + return x.ProductIds + } + return nil +} + +type Product struct { + state protoimpl.MessageState `protogen:"open.v1"` + Id string `protobuf:"bytes,1,opt,name=id,proto3" json:"id,omitempty"` + Name string `protobuf:"bytes,2,opt,name=name,proto3" json:"name,omitempty"` + Description string `protobuf:"bytes,3,opt,name=description,proto3" json:"description,omitempty"` + Picture string `protobuf:"bytes,4,opt,name=picture,proto3" json:"picture,omitempty"` + PriceUsd *Money `protobuf:"bytes,5,opt,name=price_usd,json=priceUsd,proto3" json:"price_usd,omitempty"` + // Categories such as "clothing" or "kitchen" that can be used to look up + // other related products. + Categories []string `protobuf:"bytes,6,rep,name=categories,proto3" json:"categories,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *Product) Reset() { + *x = Product{} + mi := &file_demo_proto_msgTypes[8] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *Product) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*Product) ProtoMessage() {} + +func (x *Product) ProtoReflect() protoreflect.Message { + mi := &file_demo_proto_msgTypes[8] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use Product.ProtoReflect.Descriptor instead. +func (*Product) Descriptor() ([]byte, []int) { + return file_demo_proto_rawDescGZIP(), []int{8} +} + +func (x *Product) GetId() string { + if x != nil { + return x.Id + } + return "" +} + +func (x *Product) GetName() string { + if x != nil { + return x.Name + } + return "" +} + +func (x *Product) GetDescription() string { + if x != nil { + return x.Description + } + return "" +} + +func (x *Product) GetPicture() string { + if x != nil { + return x.Picture + } + return "" +} + +func (x *Product) GetPriceUsd() *Money { + if x != nil { + return x.PriceUsd + } + return nil +} + +func (x *Product) GetCategories() []string { + if x != nil { + return x.Categories + } + return nil +} + +type ListProductsResponse struct { + state protoimpl.MessageState `protogen:"open.v1"` + Products []*Product `protobuf:"bytes,1,rep,name=products,proto3" json:"products,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *ListProductsResponse) Reset() { + *x = ListProductsResponse{} + mi := &file_demo_proto_msgTypes[9] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *ListProductsResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*ListProductsResponse) ProtoMessage() {} + +func (x *ListProductsResponse) ProtoReflect() protoreflect.Message { + mi := &file_demo_proto_msgTypes[9] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use ListProductsResponse.ProtoReflect.Descriptor instead. +func (*ListProductsResponse) Descriptor() ([]byte, []int) { + return file_demo_proto_rawDescGZIP(), []int{9} +} + +func (x *ListProductsResponse) GetProducts() []*Product { + if x != nil { + return x.Products + } + return nil +} + +type GetProductRequest struct { + state protoimpl.MessageState `protogen:"open.v1"` + Id string `protobuf:"bytes,1,opt,name=id,proto3" json:"id,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *GetProductRequest) Reset() { + *x = GetProductRequest{} + mi := &file_demo_proto_msgTypes[10] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *GetProductRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*GetProductRequest) ProtoMessage() {} + +func (x *GetProductRequest) ProtoReflect() protoreflect.Message { + mi := &file_demo_proto_msgTypes[10] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use GetProductRequest.ProtoReflect.Descriptor instead. +func (*GetProductRequest) Descriptor() ([]byte, []int) { + return file_demo_proto_rawDescGZIP(), []int{10} +} + +func (x *GetProductRequest) GetId() string { + if x != nil { + return x.Id + } + return "" +} + +type SearchProductsRequest struct { + state protoimpl.MessageState `protogen:"open.v1"` + Query string `protobuf:"bytes,1,opt,name=query,proto3" json:"query,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *SearchProductsRequest) Reset() { + *x = SearchProductsRequest{} + mi := &file_demo_proto_msgTypes[11] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *SearchProductsRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*SearchProductsRequest) ProtoMessage() {} + +func (x *SearchProductsRequest) ProtoReflect() protoreflect.Message { + mi := &file_demo_proto_msgTypes[11] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use SearchProductsRequest.ProtoReflect.Descriptor instead. +func (*SearchProductsRequest) Descriptor() ([]byte, []int) { + return file_demo_proto_rawDescGZIP(), []int{11} +} + +func (x *SearchProductsRequest) GetQuery() string { + if x != nil { + return x.Query + } + return "" +} + +type SearchProductsResponse struct { + state protoimpl.MessageState `protogen:"open.v1"` + Results []*Product `protobuf:"bytes,1,rep,name=results,proto3" json:"results,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *SearchProductsResponse) Reset() { + *x = SearchProductsResponse{} + mi := &file_demo_proto_msgTypes[12] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *SearchProductsResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*SearchProductsResponse) ProtoMessage() {} + +func (x *SearchProductsResponse) ProtoReflect() protoreflect.Message { + mi := &file_demo_proto_msgTypes[12] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use SearchProductsResponse.ProtoReflect.Descriptor instead. +func (*SearchProductsResponse) Descriptor() ([]byte, []int) { + return file_demo_proto_rawDescGZIP(), []int{12} +} + +func (x *SearchProductsResponse) GetResults() []*Product { + if x != nil { + return x.Results + } + return nil +} + +type GetQuoteRequest struct { + state protoimpl.MessageState `protogen:"open.v1"` + Address *Address `protobuf:"bytes,1,opt,name=address,proto3" json:"address,omitempty"` + Items []*CartItem `protobuf:"bytes,2,rep,name=items,proto3" json:"items,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *GetQuoteRequest) Reset() { + *x = GetQuoteRequest{} + mi := &file_demo_proto_msgTypes[13] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *GetQuoteRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*GetQuoteRequest) ProtoMessage() {} + +func (x *GetQuoteRequest) ProtoReflect() protoreflect.Message { + mi := &file_demo_proto_msgTypes[13] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use GetQuoteRequest.ProtoReflect.Descriptor instead. +func (*GetQuoteRequest) Descriptor() ([]byte, []int) { + return file_demo_proto_rawDescGZIP(), []int{13} +} + +func (x *GetQuoteRequest) GetAddress() *Address { + if x != nil { + return x.Address + } + return nil +} + +func (x *GetQuoteRequest) GetItems() []*CartItem { + if x != nil { + return x.Items + } + return nil +} + +type GetQuoteResponse struct { + state protoimpl.MessageState `protogen:"open.v1"` + CostUsd *Money `protobuf:"bytes,1,opt,name=cost_usd,json=costUsd,proto3" json:"cost_usd,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *GetQuoteResponse) Reset() { + *x = GetQuoteResponse{} + mi := &file_demo_proto_msgTypes[14] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *GetQuoteResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*GetQuoteResponse) ProtoMessage() {} + +func (x *GetQuoteResponse) ProtoReflect() protoreflect.Message { + mi := &file_demo_proto_msgTypes[14] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use GetQuoteResponse.ProtoReflect.Descriptor instead. +func (*GetQuoteResponse) Descriptor() ([]byte, []int) { + return file_demo_proto_rawDescGZIP(), []int{14} +} + +func (x *GetQuoteResponse) GetCostUsd() *Money { + if x != nil { + return x.CostUsd + } + return nil +} + +type ShipOrderRequest struct { + state protoimpl.MessageState `protogen:"open.v1"` + Address *Address `protobuf:"bytes,1,opt,name=address,proto3" json:"address,omitempty"` + Items []*CartItem `protobuf:"bytes,2,rep,name=items,proto3" json:"items,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *ShipOrderRequest) Reset() { + *x = ShipOrderRequest{} + mi := &file_demo_proto_msgTypes[15] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *ShipOrderRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*ShipOrderRequest) ProtoMessage() {} + +func (x *ShipOrderRequest) ProtoReflect() protoreflect.Message { + mi := &file_demo_proto_msgTypes[15] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use ShipOrderRequest.ProtoReflect.Descriptor instead. +func (*ShipOrderRequest) Descriptor() ([]byte, []int) { + return file_demo_proto_rawDescGZIP(), []int{15} +} + +func (x *ShipOrderRequest) GetAddress() *Address { + if x != nil { + return x.Address + } + return nil +} + +func (x *ShipOrderRequest) GetItems() []*CartItem { + if x != nil { + return x.Items + } + return nil +} + +type ShipOrderResponse struct { + state protoimpl.MessageState `protogen:"open.v1"` + TrackingId string `protobuf:"bytes,1,opt,name=tracking_id,json=trackingId,proto3" json:"tracking_id,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *ShipOrderResponse) Reset() { + *x = ShipOrderResponse{} + mi := &file_demo_proto_msgTypes[16] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *ShipOrderResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*ShipOrderResponse) ProtoMessage() {} + +func (x *ShipOrderResponse) ProtoReflect() protoreflect.Message { + mi := &file_demo_proto_msgTypes[16] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use ShipOrderResponse.ProtoReflect.Descriptor instead. +func (*ShipOrderResponse) Descriptor() ([]byte, []int) { + return file_demo_proto_rawDescGZIP(), []int{16} +} + +func (x *ShipOrderResponse) GetTrackingId() string { + if x != nil { + return x.TrackingId + } + return "" +} + +type Address struct { + state protoimpl.MessageState `protogen:"open.v1"` + StreetAddress string `protobuf:"bytes,1,opt,name=street_address,json=streetAddress,proto3" json:"street_address,omitempty"` + City string `protobuf:"bytes,2,opt,name=city,proto3" json:"city,omitempty"` + State string `protobuf:"bytes,3,opt,name=state,proto3" json:"state,omitempty"` + Country string `protobuf:"bytes,4,opt,name=country,proto3" json:"country,omitempty"` + ZipCode string `protobuf:"bytes,5,opt,name=zip_code,json=zipCode,proto3" json:"zip_code,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *Address) Reset() { + *x = Address{} + mi := &file_demo_proto_msgTypes[17] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *Address) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*Address) ProtoMessage() {} + +func (x *Address) ProtoReflect() protoreflect.Message { + mi := &file_demo_proto_msgTypes[17] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use Address.ProtoReflect.Descriptor instead. +func (*Address) Descriptor() ([]byte, []int) { + return file_demo_proto_rawDescGZIP(), []int{17} +} + +func (x *Address) GetStreetAddress() string { + if x != nil { + return x.StreetAddress + } + return "" +} + +func (x *Address) GetCity() string { + if x != nil { + return x.City + } + return "" +} + +func (x *Address) GetState() string { + if x != nil { + return x.State + } + return "" +} + +func (x *Address) GetCountry() string { + if x != nil { + return x.Country + } + return "" +} + +func (x *Address) GetZipCode() string { + if x != nil { + return x.ZipCode + } + return "" +} + +// Represents an amount of money with its currency type. +type Money struct { + state protoimpl.MessageState `protogen:"open.v1"` + // The 3-letter currency code defined in ISO 4217. + CurrencyCode string `protobuf:"bytes,1,opt,name=currency_code,json=currencyCode,proto3" json:"currency_code,omitempty"` + // The whole units of the amount. + // For example if `currencyCode` is `"USD"`, then 1 unit is one US dollar. + Units int64 `protobuf:"varint,2,opt,name=units,proto3" json:"units,omitempty"` + // Number of nano (10^-9) units of the amount. + // The value must be between -999,999,999 and +999,999,999 inclusive. + // If `units` is positive, `nanos` must be positive or zero. + // If `units` is zero, `nanos` can be positive, zero, or negative. + // If `units` is negative, `nanos` must be negative or zero. + // For example $-1.75 is represented as `units`=-1 and `nanos`=-750,000,000. + Nanos int32 `protobuf:"varint,3,opt,name=nanos,proto3" json:"nanos,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *Money) Reset() { + *x = Money{} + mi := &file_demo_proto_msgTypes[18] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *Money) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*Money) ProtoMessage() {} + +func (x *Money) ProtoReflect() protoreflect.Message { + mi := &file_demo_proto_msgTypes[18] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use Money.ProtoReflect.Descriptor instead. +func (*Money) Descriptor() ([]byte, []int) { + return file_demo_proto_rawDescGZIP(), []int{18} +} + +func (x *Money) GetCurrencyCode() string { + if x != nil { + return x.CurrencyCode + } + return "" +} + +func (x *Money) GetUnits() int64 { + if x != nil { + return x.Units + } + return 0 +} + +func (x *Money) GetNanos() int32 { + if x != nil { + return x.Nanos + } + return 0 +} + +type GetSupportedCurrenciesResponse struct { + state protoimpl.MessageState `protogen:"open.v1"` + // The 3-letter currency code defined in ISO 4217. + CurrencyCodes []string `protobuf:"bytes,1,rep,name=currency_codes,json=currencyCodes,proto3" json:"currency_codes,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *GetSupportedCurrenciesResponse) Reset() { + *x = GetSupportedCurrenciesResponse{} + mi := &file_demo_proto_msgTypes[19] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *GetSupportedCurrenciesResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*GetSupportedCurrenciesResponse) ProtoMessage() {} + +func (x *GetSupportedCurrenciesResponse) ProtoReflect() protoreflect.Message { + mi := &file_demo_proto_msgTypes[19] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use GetSupportedCurrenciesResponse.ProtoReflect.Descriptor instead. +func (*GetSupportedCurrenciesResponse) Descriptor() ([]byte, []int) { + return file_demo_proto_rawDescGZIP(), []int{19} +} + +func (x *GetSupportedCurrenciesResponse) GetCurrencyCodes() []string { + if x != nil { + return x.CurrencyCodes + } + return nil +} + +type CurrencyConversionRequest struct { + state protoimpl.MessageState `protogen:"open.v1"` + From *Money `protobuf:"bytes,1,opt,name=from,proto3" json:"from,omitempty"` + // The 3-letter currency code defined in ISO 4217. + ToCode string `protobuf:"bytes,2,opt,name=to_code,json=toCode,proto3" json:"to_code,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *CurrencyConversionRequest) Reset() { + *x = CurrencyConversionRequest{} + mi := &file_demo_proto_msgTypes[20] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *CurrencyConversionRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*CurrencyConversionRequest) ProtoMessage() {} + +func (x *CurrencyConversionRequest) ProtoReflect() protoreflect.Message { + mi := &file_demo_proto_msgTypes[20] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use CurrencyConversionRequest.ProtoReflect.Descriptor instead. +func (*CurrencyConversionRequest) Descriptor() ([]byte, []int) { + return file_demo_proto_rawDescGZIP(), []int{20} +} + +func (x *CurrencyConversionRequest) GetFrom() *Money { + if x != nil { + return x.From + } + return nil +} + +func (x *CurrencyConversionRequest) GetToCode() string { + if x != nil { + return x.ToCode + } + return "" +} + +type CreditCardInfo struct { + state protoimpl.MessageState `protogen:"open.v1"` + CreditCardNumber string `protobuf:"bytes,1,opt,name=credit_card_number,json=creditCardNumber,proto3" json:"credit_card_number,omitempty"` + CreditCardCvv int32 `protobuf:"varint,2,opt,name=credit_card_cvv,json=creditCardCvv,proto3" json:"credit_card_cvv,omitempty"` + CreditCardExpirationYear int32 `protobuf:"varint,3,opt,name=credit_card_expiration_year,json=creditCardExpirationYear,proto3" json:"credit_card_expiration_year,omitempty"` + CreditCardExpirationMonth int32 `protobuf:"varint,4,opt,name=credit_card_expiration_month,json=creditCardExpirationMonth,proto3" json:"credit_card_expiration_month,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *CreditCardInfo) Reset() { + *x = CreditCardInfo{} + mi := &file_demo_proto_msgTypes[21] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *CreditCardInfo) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*CreditCardInfo) ProtoMessage() {} + +func (x *CreditCardInfo) ProtoReflect() protoreflect.Message { + mi := &file_demo_proto_msgTypes[21] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use CreditCardInfo.ProtoReflect.Descriptor instead. +func (*CreditCardInfo) Descriptor() ([]byte, []int) { + return file_demo_proto_rawDescGZIP(), []int{21} +} + +func (x *CreditCardInfo) GetCreditCardNumber() string { + if x != nil { + return x.CreditCardNumber + } + return "" +} + +func (x *CreditCardInfo) GetCreditCardCvv() int32 { + if x != nil { + return x.CreditCardCvv + } + return 0 +} + +func (x *CreditCardInfo) GetCreditCardExpirationYear() int32 { + if x != nil { + return x.CreditCardExpirationYear + } + return 0 +} + +func (x *CreditCardInfo) GetCreditCardExpirationMonth() int32 { + if x != nil { + return x.CreditCardExpirationMonth + } + return 0 +} + +type ChargeRequest struct { + state protoimpl.MessageState `protogen:"open.v1"` + Amount *Money `protobuf:"bytes,1,opt,name=amount,proto3" json:"amount,omitempty"` + CreditCard *CreditCardInfo `protobuf:"bytes,2,opt,name=credit_card,json=creditCard,proto3" json:"credit_card,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *ChargeRequest) Reset() { + *x = ChargeRequest{} + mi := &file_demo_proto_msgTypes[22] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *ChargeRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*ChargeRequest) ProtoMessage() {} + +func (x *ChargeRequest) ProtoReflect() protoreflect.Message { + mi := &file_demo_proto_msgTypes[22] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use ChargeRequest.ProtoReflect.Descriptor instead. +func (*ChargeRequest) Descriptor() ([]byte, []int) { + return file_demo_proto_rawDescGZIP(), []int{22} +} + +func (x *ChargeRequest) GetAmount() *Money { + if x != nil { + return x.Amount + } + return nil +} + +func (x *ChargeRequest) GetCreditCard() *CreditCardInfo { + if x != nil { + return x.CreditCard + } + return nil +} + +type ChargeResponse struct { + state protoimpl.MessageState `protogen:"open.v1"` + TransactionId string `protobuf:"bytes,1,opt,name=transaction_id,json=transactionId,proto3" json:"transaction_id,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *ChargeResponse) Reset() { + *x = ChargeResponse{} + mi := &file_demo_proto_msgTypes[23] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *ChargeResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*ChargeResponse) ProtoMessage() {} + +func (x *ChargeResponse) ProtoReflect() protoreflect.Message { + mi := &file_demo_proto_msgTypes[23] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use ChargeResponse.ProtoReflect.Descriptor instead. +func (*ChargeResponse) Descriptor() ([]byte, []int) { + return file_demo_proto_rawDescGZIP(), []int{23} +} + +func (x *ChargeResponse) GetTransactionId() string { + if x != nil { + return x.TransactionId + } + return "" +} + +type OrderItem struct { + state protoimpl.MessageState `protogen:"open.v1"` + Item *CartItem `protobuf:"bytes,1,opt,name=item,proto3" json:"item,omitempty"` + Cost *Money `protobuf:"bytes,2,opt,name=cost,proto3" json:"cost,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *OrderItem) Reset() { + *x = OrderItem{} + mi := &file_demo_proto_msgTypes[24] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *OrderItem) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*OrderItem) ProtoMessage() {} + +func (x *OrderItem) ProtoReflect() protoreflect.Message { + mi := &file_demo_proto_msgTypes[24] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use OrderItem.ProtoReflect.Descriptor instead. +func (*OrderItem) Descriptor() ([]byte, []int) { + return file_demo_proto_rawDescGZIP(), []int{24} +} + +func (x *OrderItem) GetItem() *CartItem { + if x != nil { + return x.Item + } + return nil +} + +func (x *OrderItem) GetCost() *Money { + if x != nil { + return x.Cost + } + return nil +} + +type OrderResult struct { + state protoimpl.MessageState `protogen:"open.v1"` + OrderId string `protobuf:"bytes,1,opt,name=order_id,json=orderId,proto3" json:"order_id,omitempty"` + ShippingTrackingId string `protobuf:"bytes,2,opt,name=shipping_tracking_id,json=shippingTrackingId,proto3" json:"shipping_tracking_id,omitempty"` + ShippingCost *Money `protobuf:"bytes,3,opt,name=shipping_cost,json=shippingCost,proto3" json:"shipping_cost,omitempty"` + ShippingAddress *Address `protobuf:"bytes,4,opt,name=shipping_address,json=shippingAddress,proto3" json:"shipping_address,omitempty"` + Items []*OrderItem `protobuf:"bytes,5,rep,name=items,proto3" json:"items,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *OrderResult) Reset() { + *x = OrderResult{} + mi := &file_demo_proto_msgTypes[25] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *OrderResult) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*OrderResult) ProtoMessage() {} + +func (x *OrderResult) ProtoReflect() protoreflect.Message { + mi := &file_demo_proto_msgTypes[25] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use OrderResult.ProtoReflect.Descriptor instead. +func (*OrderResult) Descriptor() ([]byte, []int) { + return file_demo_proto_rawDescGZIP(), []int{25} +} + +func (x *OrderResult) GetOrderId() string { + if x != nil { + return x.OrderId + } + return "" +} + +func (x *OrderResult) GetShippingTrackingId() string { + if x != nil { + return x.ShippingTrackingId + } + return "" +} + +func (x *OrderResult) GetShippingCost() *Money { + if x != nil { + return x.ShippingCost + } + return nil +} + +func (x *OrderResult) GetShippingAddress() *Address { + if x != nil { + return x.ShippingAddress + } + return nil +} + +func (x *OrderResult) GetItems() []*OrderItem { + if x != nil { + return x.Items + } + return nil +} + +type SendOrderConfirmationRequest struct { + state protoimpl.MessageState `protogen:"open.v1"` + Email string `protobuf:"bytes,1,opt,name=email,proto3" json:"email,omitempty"` + Order *OrderResult `protobuf:"bytes,2,opt,name=order,proto3" json:"order,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *SendOrderConfirmationRequest) Reset() { + *x = SendOrderConfirmationRequest{} + mi := &file_demo_proto_msgTypes[26] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *SendOrderConfirmationRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*SendOrderConfirmationRequest) ProtoMessage() {} + +func (x *SendOrderConfirmationRequest) ProtoReflect() protoreflect.Message { + mi := &file_demo_proto_msgTypes[26] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use SendOrderConfirmationRequest.ProtoReflect.Descriptor instead. +func (*SendOrderConfirmationRequest) Descriptor() ([]byte, []int) { + return file_demo_proto_rawDescGZIP(), []int{26} +} + +func (x *SendOrderConfirmationRequest) GetEmail() string { + if x != nil { + return x.Email + } + return "" +} + +func (x *SendOrderConfirmationRequest) GetOrder() *OrderResult { + if x != nil { + return x.Order + } + return nil +} + +type PlaceOrderRequest struct { + state protoimpl.MessageState `protogen:"open.v1"` + UserId string `protobuf:"bytes,1,opt,name=user_id,json=userId,proto3" json:"user_id,omitempty"` + UserCurrency string `protobuf:"bytes,2,opt,name=user_currency,json=userCurrency,proto3" json:"user_currency,omitempty"` + Address *Address `protobuf:"bytes,3,opt,name=address,proto3" json:"address,omitempty"` + Email string `protobuf:"bytes,5,opt,name=email,proto3" json:"email,omitempty"` + CreditCard *CreditCardInfo `protobuf:"bytes,6,opt,name=credit_card,json=creditCard,proto3" json:"credit_card,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *PlaceOrderRequest) Reset() { + *x = PlaceOrderRequest{} + mi := &file_demo_proto_msgTypes[27] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *PlaceOrderRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*PlaceOrderRequest) ProtoMessage() {} + +func (x *PlaceOrderRequest) ProtoReflect() protoreflect.Message { + mi := &file_demo_proto_msgTypes[27] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use PlaceOrderRequest.ProtoReflect.Descriptor instead. +func (*PlaceOrderRequest) Descriptor() ([]byte, []int) { + return file_demo_proto_rawDescGZIP(), []int{27} +} + +func (x *PlaceOrderRequest) GetUserId() string { + if x != nil { + return x.UserId + } + return "" +} + +func (x *PlaceOrderRequest) GetUserCurrency() string { + if x != nil { + return x.UserCurrency + } + return "" +} + +func (x *PlaceOrderRequest) GetAddress() *Address { + if x != nil { + return x.Address + } + return nil +} + +func (x *PlaceOrderRequest) GetEmail() string { + if x != nil { + return x.Email + } + return "" +} + +func (x *PlaceOrderRequest) GetCreditCard() *CreditCardInfo { + if x != nil { + return x.CreditCard + } + return nil +} + +type PlaceOrderResponse struct { + state protoimpl.MessageState `protogen:"open.v1"` + Order *OrderResult `protobuf:"bytes,1,opt,name=order,proto3" json:"order,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *PlaceOrderResponse) Reset() { + *x = PlaceOrderResponse{} + mi := &file_demo_proto_msgTypes[28] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *PlaceOrderResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*PlaceOrderResponse) ProtoMessage() {} + +func (x *PlaceOrderResponse) ProtoReflect() protoreflect.Message { + mi := &file_demo_proto_msgTypes[28] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use PlaceOrderResponse.ProtoReflect.Descriptor instead. +func (*PlaceOrderResponse) Descriptor() ([]byte, []int) { + return file_demo_proto_rawDescGZIP(), []int{28} +} + +func (x *PlaceOrderResponse) GetOrder() *OrderResult { + if x != nil { + return x.Order + } + return nil +} + +type AdRequest struct { + state protoimpl.MessageState `protogen:"open.v1"` + // List of important key words from the current page describing the context. + ContextKeys []string `protobuf:"bytes,1,rep,name=context_keys,json=contextKeys,proto3" json:"context_keys,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *AdRequest) Reset() { + *x = AdRequest{} + mi := &file_demo_proto_msgTypes[29] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *AdRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*AdRequest) ProtoMessage() {} + +func (x *AdRequest) ProtoReflect() protoreflect.Message { + mi := &file_demo_proto_msgTypes[29] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use AdRequest.ProtoReflect.Descriptor instead. +func (*AdRequest) Descriptor() ([]byte, []int) { + return file_demo_proto_rawDescGZIP(), []int{29} +} + +func (x *AdRequest) GetContextKeys() []string { + if x != nil { + return x.ContextKeys + } + return nil +} + +type AdResponse struct { + state protoimpl.MessageState `protogen:"open.v1"` + Ads []*Ad `protobuf:"bytes,1,rep,name=ads,proto3" json:"ads,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *AdResponse) Reset() { + *x = AdResponse{} + mi := &file_demo_proto_msgTypes[30] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *AdResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*AdResponse) ProtoMessage() {} + +func (x *AdResponse) ProtoReflect() protoreflect.Message { + mi := &file_demo_proto_msgTypes[30] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use AdResponse.ProtoReflect.Descriptor instead. +func (*AdResponse) Descriptor() ([]byte, []int) { + return file_demo_proto_rawDescGZIP(), []int{30} +} + +func (x *AdResponse) GetAds() []*Ad { + if x != nil { + return x.Ads + } + return nil +} + +type Ad struct { + state protoimpl.MessageState `protogen:"open.v1"` + // url to redirect to when an ad is clicked. + RedirectUrl string `protobuf:"bytes,1,opt,name=redirect_url,json=redirectUrl,proto3" json:"redirect_url,omitempty"` + // short advertisement text to display. + Text string `protobuf:"bytes,2,opt,name=text,proto3" json:"text,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *Ad) Reset() { + *x = Ad{} + mi := &file_demo_proto_msgTypes[31] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *Ad) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*Ad) ProtoMessage() {} + +func (x *Ad) ProtoReflect() protoreflect.Message { + mi := &file_demo_proto_msgTypes[31] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use Ad.ProtoReflect.Descriptor instead. +func (*Ad) Descriptor() ([]byte, []int) { + return file_demo_proto_rawDescGZIP(), []int{31} +} + +func (x *Ad) GetRedirectUrl() string { + if x != nil { + return x.RedirectUrl + } + return "" +} + +func (x *Ad) GetText() string { + if x != nil { + return x.Text + } + return "" +} + +type Flag struct { + state protoimpl.MessageState `protogen:"open.v1"` + Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"` + Description string `protobuf:"bytes,2,opt,name=description,proto3" json:"description,omitempty"` + Enabled bool `protobuf:"varint,3,opt,name=enabled,proto3" json:"enabled,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *Flag) Reset() { + *x = Flag{} + mi := &file_demo_proto_msgTypes[32] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *Flag) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*Flag) ProtoMessage() {} + +func (x *Flag) ProtoReflect() protoreflect.Message { + mi := &file_demo_proto_msgTypes[32] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use Flag.ProtoReflect.Descriptor instead. +func (*Flag) Descriptor() ([]byte, []int) { + return file_demo_proto_rawDescGZIP(), []int{32} +} + +func (x *Flag) GetName() string { + if x != nil { + return x.Name + } + return "" +} + +func (x *Flag) GetDescription() string { + if x != nil { + return x.Description + } + return "" +} + +func (x *Flag) GetEnabled() bool { + if x != nil { + return x.Enabled + } + return false +} + +type GetFlagRequest struct { + state protoimpl.MessageState `protogen:"open.v1"` + Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *GetFlagRequest) Reset() { + *x = GetFlagRequest{} + mi := &file_demo_proto_msgTypes[33] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *GetFlagRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*GetFlagRequest) ProtoMessage() {} + +func (x *GetFlagRequest) ProtoReflect() protoreflect.Message { + mi := &file_demo_proto_msgTypes[33] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use GetFlagRequest.ProtoReflect.Descriptor instead. +func (*GetFlagRequest) Descriptor() ([]byte, []int) { + return file_demo_proto_rawDescGZIP(), []int{33} +} + +func (x *GetFlagRequest) GetName() string { + if x != nil { + return x.Name + } + return "" +} + +type GetFlagResponse struct { + state protoimpl.MessageState `protogen:"open.v1"` + Flag *Flag `protobuf:"bytes,1,opt,name=flag,proto3" json:"flag,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *GetFlagResponse) Reset() { + *x = GetFlagResponse{} + mi := &file_demo_proto_msgTypes[34] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *GetFlagResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*GetFlagResponse) ProtoMessage() {} + +func (x *GetFlagResponse) ProtoReflect() protoreflect.Message { + mi := &file_demo_proto_msgTypes[34] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use GetFlagResponse.ProtoReflect.Descriptor instead. +func (*GetFlagResponse) Descriptor() ([]byte, []int) { + return file_demo_proto_rawDescGZIP(), []int{34} +} + +func (x *GetFlagResponse) GetFlag() *Flag { + if x != nil { + return x.Flag + } + return nil +} + +type CreateFlagRequest struct { + state protoimpl.MessageState `protogen:"open.v1"` + Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"` + Description string `protobuf:"bytes,2,opt,name=description,proto3" json:"description,omitempty"` + Enabled bool `protobuf:"varint,3,opt,name=enabled,proto3" json:"enabled,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *CreateFlagRequest) Reset() { + *x = CreateFlagRequest{} + mi := &file_demo_proto_msgTypes[35] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *CreateFlagRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*CreateFlagRequest) ProtoMessage() {} + +func (x *CreateFlagRequest) ProtoReflect() protoreflect.Message { + mi := &file_demo_proto_msgTypes[35] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use CreateFlagRequest.ProtoReflect.Descriptor instead. +func (*CreateFlagRequest) Descriptor() ([]byte, []int) { + return file_demo_proto_rawDescGZIP(), []int{35} +} + +func (x *CreateFlagRequest) GetName() string { + if x != nil { + return x.Name + } + return "" +} + +func (x *CreateFlagRequest) GetDescription() string { + if x != nil { + return x.Description + } + return "" +} + +func (x *CreateFlagRequest) GetEnabled() bool { + if x != nil { + return x.Enabled + } + return false +} + +type CreateFlagResponse struct { + state protoimpl.MessageState `protogen:"open.v1"` + Flag *Flag `protobuf:"bytes,1,opt,name=flag,proto3" json:"flag,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *CreateFlagResponse) Reset() { + *x = CreateFlagResponse{} + mi := &file_demo_proto_msgTypes[36] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *CreateFlagResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*CreateFlagResponse) ProtoMessage() {} + +func (x *CreateFlagResponse) ProtoReflect() protoreflect.Message { + mi := &file_demo_proto_msgTypes[36] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use CreateFlagResponse.ProtoReflect.Descriptor instead. +func (*CreateFlagResponse) Descriptor() ([]byte, []int) { + return file_demo_proto_rawDescGZIP(), []int{36} +} + +func (x *CreateFlagResponse) GetFlag() *Flag { + if x != nil { + return x.Flag + } + return nil +} + +type UpdateFlagRequest struct { + state protoimpl.MessageState `protogen:"open.v1"` + Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"` + Enabled bool `protobuf:"varint,2,opt,name=enabled,proto3" json:"enabled,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *UpdateFlagRequest) Reset() { + *x = UpdateFlagRequest{} + mi := &file_demo_proto_msgTypes[37] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *UpdateFlagRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*UpdateFlagRequest) ProtoMessage() {} + +func (x *UpdateFlagRequest) ProtoReflect() protoreflect.Message { + mi := &file_demo_proto_msgTypes[37] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use UpdateFlagRequest.ProtoReflect.Descriptor instead. +func (*UpdateFlagRequest) Descriptor() ([]byte, []int) { + return file_demo_proto_rawDescGZIP(), []int{37} +} + +func (x *UpdateFlagRequest) GetName() string { + if x != nil { + return x.Name + } + return "" +} + +func (x *UpdateFlagRequest) GetEnabled() bool { + if x != nil { + return x.Enabled + } + return false +} + +type UpdateFlagResponse struct { + state protoimpl.MessageState `protogen:"open.v1"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *UpdateFlagResponse) Reset() { + *x = UpdateFlagResponse{} + mi := &file_demo_proto_msgTypes[38] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *UpdateFlagResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*UpdateFlagResponse) ProtoMessage() {} + +func (x *UpdateFlagResponse) ProtoReflect() protoreflect.Message { + mi := &file_demo_proto_msgTypes[38] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use UpdateFlagResponse.ProtoReflect.Descriptor instead. +func (*UpdateFlagResponse) Descriptor() ([]byte, []int) { + return file_demo_proto_rawDescGZIP(), []int{38} +} + +type ListFlagsRequest struct { + state protoimpl.MessageState `protogen:"open.v1"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *ListFlagsRequest) Reset() { + *x = ListFlagsRequest{} + mi := &file_demo_proto_msgTypes[39] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *ListFlagsRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*ListFlagsRequest) ProtoMessage() {} + +func (x *ListFlagsRequest) ProtoReflect() protoreflect.Message { + mi := &file_demo_proto_msgTypes[39] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use ListFlagsRequest.ProtoReflect.Descriptor instead. +func (*ListFlagsRequest) Descriptor() ([]byte, []int) { + return file_demo_proto_rawDescGZIP(), []int{39} +} + +type ListFlagsResponse struct { + state protoimpl.MessageState `protogen:"open.v1"` + Flag []*Flag `protobuf:"bytes,1,rep,name=flag,proto3" json:"flag,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *ListFlagsResponse) Reset() { + *x = ListFlagsResponse{} + mi := &file_demo_proto_msgTypes[40] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *ListFlagsResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*ListFlagsResponse) ProtoMessage() {} + +func (x *ListFlagsResponse) ProtoReflect() protoreflect.Message { + mi := &file_demo_proto_msgTypes[40] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use ListFlagsResponse.ProtoReflect.Descriptor instead. +func (*ListFlagsResponse) Descriptor() ([]byte, []int) { + return file_demo_proto_rawDescGZIP(), []int{40} +} + +func (x *ListFlagsResponse) GetFlag() []*Flag { + if x != nil { + return x.Flag + } + return nil +} + +type DeleteFlagRequest struct { + state protoimpl.MessageState `protogen:"open.v1"` + Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *DeleteFlagRequest) Reset() { + *x = DeleteFlagRequest{} + mi := &file_demo_proto_msgTypes[41] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *DeleteFlagRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*DeleteFlagRequest) ProtoMessage() {} + +func (x *DeleteFlagRequest) ProtoReflect() protoreflect.Message { + mi := &file_demo_proto_msgTypes[41] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use DeleteFlagRequest.ProtoReflect.Descriptor instead. +func (*DeleteFlagRequest) Descriptor() ([]byte, []int) { + return file_demo_proto_rawDescGZIP(), []int{41} +} + +func (x *DeleteFlagRequest) GetName() string { + if x != nil { + return x.Name + } + return "" +} + +type DeleteFlagResponse struct { + state protoimpl.MessageState `protogen:"open.v1"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *DeleteFlagResponse) Reset() { + *x = DeleteFlagResponse{} + mi := &file_demo_proto_msgTypes[42] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *DeleteFlagResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*DeleteFlagResponse) ProtoMessage() {} + +func (x *DeleteFlagResponse) ProtoReflect() protoreflect.Message { + mi := &file_demo_proto_msgTypes[42] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use DeleteFlagResponse.ProtoReflect.Descriptor instead. +func (*DeleteFlagResponse) Descriptor() ([]byte, []int) { + return file_demo_proto_rawDescGZIP(), []int{42} +} + +var File_demo_proto protoreflect.FileDescriptor + +const file_demo_proto_rawDesc = "" + + "\n" + + "\n" + + "demo.proto\x12\boteldemo\"E\n" + + "\bCartItem\x12\x1d\n" + + "\n" + + "product_id\x18\x01 \x01(\tR\tproductId\x12\x1a\n" + + "\bquantity\x18\x02 \x01(\x05R\bquantity\"Q\n" + + "\x0eAddItemRequest\x12\x17\n" + + "\auser_id\x18\x01 \x01(\tR\x06userId\x12&\n" + + "\x04item\x18\x02 \x01(\v2\x12.oteldemo.CartItemR\x04item\"+\n" + + "\x10EmptyCartRequest\x12\x17\n" + + "\auser_id\x18\x01 \x01(\tR\x06userId\")\n" + + "\x0eGetCartRequest\x12\x17\n" + + "\auser_id\x18\x01 \x01(\tR\x06userId\"I\n" + + "\x04Cart\x12\x17\n" + + "\auser_id\x18\x01 \x01(\tR\x06userId\x12(\n" + + "\x05items\x18\x02 \x03(\v2\x12.oteldemo.CartItemR\x05items\"\a\n" + + "\x05Empty\"V\n" + + "\x1aListRecommendationsRequest\x12\x17\n" + + "\auser_id\x18\x01 \x01(\tR\x06userId\x12\x1f\n" + + "\vproduct_ids\x18\x02 \x03(\tR\n" + + "productIds\">\n" + + "\x1bListRecommendationsResponse\x12\x1f\n" + + "\vproduct_ids\x18\x01 \x03(\tR\n" + + "productIds\"\xb7\x01\n" + + "\aProduct\x12\x0e\n" + + "\x02id\x18\x01 \x01(\tR\x02id\x12\x12\n" + + "\x04name\x18\x02 \x01(\tR\x04name\x12 \n" + + "\vdescription\x18\x03 \x01(\tR\vdescription\x12\x18\n" + + "\apicture\x18\x04 \x01(\tR\apicture\x12,\n" + + "\tprice_usd\x18\x05 \x01(\v2\x0f.oteldemo.MoneyR\bpriceUsd\x12\x1e\n" + + "\n" + + "categories\x18\x06 \x03(\tR\n" + + "categories\"E\n" + + "\x14ListProductsResponse\x12-\n" + + "\bproducts\x18\x01 \x03(\v2\x11.oteldemo.ProductR\bproducts\"#\n" + + "\x11GetProductRequest\x12\x0e\n" + + "\x02id\x18\x01 \x01(\tR\x02id\"-\n" + + "\x15SearchProductsRequest\x12\x14\n" + + "\x05query\x18\x01 \x01(\tR\x05query\"E\n" + + "\x16SearchProductsResponse\x12+\n" + + "\aresults\x18\x01 \x03(\v2\x11.oteldemo.ProductR\aresults\"h\n" + + "\x0fGetQuoteRequest\x12+\n" + + "\aaddress\x18\x01 \x01(\v2\x11.oteldemo.AddressR\aaddress\x12(\n" + + "\x05items\x18\x02 \x03(\v2\x12.oteldemo.CartItemR\x05items\">\n" + + "\x10GetQuoteResponse\x12*\n" + + "\bcost_usd\x18\x01 \x01(\v2\x0f.oteldemo.MoneyR\acostUsd\"i\n" + + "\x10ShipOrderRequest\x12+\n" + + "\aaddress\x18\x01 \x01(\v2\x11.oteldemo.AddressR\aaddress\x12(\n" + + "\x05items\x18\x02 \x03(\v2\x12.oteldemo.CartItemR\x05items\"4\n" + + "\x11ShipOrderResponse\x12\x1f\n" + + "\vtracking_id\x18\x01 \x01(\tR\n" + + "trackingId\"\x8f\x01\n" + + "\aAddress\x12%\n" + + "\x0estreet_address\x18\x01 \x01(\tR\rstreetAddress\x12\x12\n" + + "\x04city\x18\x02 \x01(\tR\x04city\x12\x14\n" + + "\x05state\x18\x03 \x01(\tR\x05state\x12\x18\n" + + "\acountry\x18\x04 \x01(\tR\acountry\x12\x19\n" + + "\bzip_code\x18\x05 \x01(\tR\azipCode\"X\n" + + "\x05Money\x12#\n" + + "\rcurrency_code\x18\x01 \x01(\tR\fcurrencyCode\x12\x14\n" + + "\x05units\x18\x02 \x01(\x03R\x05units\x12\x14\n" + + "\x05nanos\x18\x03 \x01(\x05R\x05nanos\"G\n" + + "\x1eGetSupportedCurrenciesResponse\x12%\n" + + "\x0ecurrency_codes\x18\x01 \x03(\tR\rcurrencyCodes\"Y\n" + + "\x19CurrencyConversionRequest\x12#\n" + + "\x04from\x18\x01 \x01(\v2\x0f.oteldemo.MoneyR\x04from\x12\x17\n" + + "\ato_code\x18\x02 \x01(\tR\x06toCode\"\xe6\x01\n" + + "\x0eCreditCardInfo\x12,\n" + + "\x12credit_card_number\x18\x01 \x01(\tR\x10creditCardNumber\x12&\n" + + "\x0fcredit_card_cvv\x18\x02 \x01(\x05R\rcreditCardCvv\x12=\n" + + "\x1bcredit_card_expiration_year\x18\x03 \x01(\x05R\x18creditCardExpirationYear\x12?\n" + + "\x1ccredit_card_expiration_month\x18\x04 \x01(\x05R\x19creditCardExpirationMonth\"s\n" + + "\rChargeRequest\x12'\n" + + "\x06amount\x18\x01 \x01(\v2\x0f.oteldemo.MoneyR\x06amount\x129\n" + + "\vcredit_card\x18\x02 \x01(\v2\x18.oteldemo.CreditCardInfoR\n" + + "creditCard\"7\n" + + "\x0eChargeResponse\x12%\n" + + "\x0etransaction_id\x18\x01 \x01(\tR\rtransactionId\"X\n" + + "\tOrderItem\x12&\n" + + "\x04item\x18\x01 \x01(\v2\x12.oteldemo.CartItemR\x04item\x12#\n" + + "\x04cost\x18\x02 \x01(\v2\x0f.oteldemo.MoneyR\x04cost\"\xf9\x01\n" + + "\vOrderResult\x12\x19\n" + + "\border_id\x18\x01 \x01(\tR\aorderId\x120\n" + + "\x14shipping_tracking_id\x18\x02 \x01(\tR\x12shippingTrackingId\x124\n" + + "\rshipping_cost\x18\x03 \x01(\v2\x0f.oteldemo.MoneyR\fshippingCost\x12<\n" + + "\x10shipping_address\x18\x04 \x01(\v2\x11.oteldemo.AddressR\x0fshippingAddress\x12)\n" + + "\x05items\x18\x05 \x03(\v2\x13.oteldemo.OrderItemR\x05items\"a\n" + + "\x1cSendOrderConfirmationRequest\x12\x14\n" + + "\x05email\x18\x01 \x01(\tR\x05email\x12+\n" + + "\x05order\x18\x02 \x01(\v2\x15.oteldemo.OrderResultR\x05order\"\xcf\x01\n" + + "\x11PlaceOrderRequest\x12\x17\n" + + "\auser_id\x18\x01 \x01(\tR\x06userId\x12#\n" + + "\ruser_currency\x18\x02 \x01(\tR\fuserCurrency\x12+\n" + + "\aaddress\x18\x03 \x01(\v2\x11.oteldemo.AddressR\aaddress\x12\x14\n" + + "\x05email\x18\x05 \x01(\tR\x05email\x129\n" + + "\vcredit_card\x18\x06 \x01(\v2\x18.oteldemo.CreditCardInfoR\n" + + "creditCard\"A\n" + + "\x12PlaceOrderResponse\x12+\n" + + "\x05order\x18\x01 \x01(\v2\x15.oteldemo.OrderResultR\x05order\".\n" + + "\tAdRequest\x12!\n" + + "\fcontext_keys\x18\x01 \x03(\tR\vcontextKeys\",\n" + + "\n" + + "AdResponse\x12\x1e\n" + + "\x03ads\x18\x01 \x03(\v2\f.oteldemo.AdR\x03ads\";\n" + + "\x02Ad\x12!\n" + + "\fredirect_url\x18\x01 \x01(\tR\vredirectUrl\x12\x12\n" + + "\x04text\x18\x02 \x01(\tR\x04text\"V\n" + + "\x04Flag\x12\x12\n" + + "\x04name\x18\x01 \x01(\tR\x04name\x12 \n" + + "\vdescription\x18\x02 \x01(\tR\vdescription\x12\x18\n" + + "\aenabled\x18\x03 \x01(\bR\aenabled\"$\n" + + "\x0eGetFlagRequest\x12\x12\n" + + "\x04name\x18\x01 \x01(\tR\x04name\"5\n" + + "\x0fGetFlagResponse\x12\"\n" + + "\x04flag\x18\x01 \x01(\v2\x0e.oteldemo.FlagR\x04flag\"c\n" + + "\x11CreateFlagRequest\x12\x12\n" + + "\x04name\x18\x01 \x01(\tR\x04name\x12 \n" + + "\vdescription\x18\x02 \x01(\tR\vdescription\x12\x18\n" + + "\aenabled\x18\x03 \x01(\bR\aenabled\"8\n" + + "\x12CreateFlagResponse\x12\"\n" + + "\x04flag\x18\x01 \x01(\v2\x0e.oteldemo.FlagR\x04flag\"A\n" + + "\x11UpdateFlagRequest\x12\x12\n" + + "\x04name\x18\x01 \x01(\tR\x04name\x12\x18\n" + + "\aenabled\x18\x02 \x01(\bR\aenabled\"\x14\n" + + "\x12UpdateFlagResponse\"\x12\n" + + "\x10ListFlagsRequest\"7\n" + + "\x11ListFlagsResponse\x12\"\n" + + "\x04flag\x18\x01 \x03(\v2\x0e.oteldemo.FlagR\x04flag\"'\n" + + "\x11DeleteFlagRequest\x12\x12\n" + + "\x04name\x18\x01 \x01(\tR\x04name\"\x14\n" + + "\x12DeleteFlagResponse2\xb8\x01\n" + + "\vCartService\x126\n" + + "\aAddItem\x12\x18.oteldemo.AddItemRequest\x1a\x0f.oteldemo.Empty\"\x00\x125\n" + + "\aGetCart\x12\x18.oteldemo.GetCartRequest\x1a\x0e.oteldemo.Cart\"\x00\x12:\n" + + "\tEmptyCart\x12\x1a.oteldemo.EmptyCartRequest\x1a\x0f.oteldemo.Empty\"\x002}\n" + + "\x15RecommendationService\x12d\n" + + "\x13ListRecommendations\x12$.oteldemo.ListRecommendationsRequest\x1a%.oteldemo.ListRecommendationsResponse\"\x002\xf1\x01\n" + + "\x15ProductCatalogService\x12A\n" + + "\fListProducts\x12\x0f.oteldemo.Empty\x1a\x1e.oteldemo.ListProductsResponse\"\x00\x12>\n" + + "\n" + + "GetProduct\x12\x1b.oteldemo.GetProductRequest\x1a\x11.oteldemo.Product\"\x00\x12U\n" + + "\x0eSearchProducts\x12\x1f.oteldemo.SearchProductsRequest\x1a .oteldemo.SearchProductsResponse\"\x002\x9e\x01\n" + + "\x0fShippingService\x12C\n" + + "\bGetQuote\x12\x19.oteldemo.GetQuoteRequest\x1a\x1a.oteldemo.GetQuoteResponse\"\x00\x12F\n" + + "\tShipOrder\x12\x1a.oteldemo.ShipOrderRequest\x1a\x1b.oteldemo.ShipOrderResponse\"\x002\xab\x01\n" + + "\x0fCurrencyService\x12U\n" + + "\x16GetSupportedCurrencies\x12\x0f.oteldemo.Empty\x1a(.oteldemo.GetSupportedCurrenciesResponse\"\x00\x12A\n" + + "\aConvert\x12#.oteldemo.CurrencyConversionRequest\x1a\x0f.oteldemo.Money\"\x002O\n" + + "\x0ePaymentService\x12=\n" + + "\x06Charge\x12\x17.oteldemo.ChargeRequest\x1a\x18.oteldemo.ChargeResponse\"\x002b\n" + + "\fEmailService\x12R\n" + + "\x15SendOrderConfirmation\x12&.oteldemo.SendOrderConfirmationRequest\x1a\x0f.oteldemo.Empty\"\x002\\\n" + + "\x0fCheckoutService\x12I\n" + + "\n" + + "PlaceOrder\x12\x1b.oteldemo.PlaceOrderRequest\x1a\x1c.oteldemo.PlaceOrderResponse\"\x002B\n" + + "\tAdService\x125\n" + + "\x06GetAds\x12\x13.oteldemo.AdRequest\x1a\x14.oteldemo.AdResponse\"\x002\xff\x02\n" + + "\x12FeatureFlagService\x12@\n" + + "\aGetFlag\x12\x18.oteldemo.GetFlagRequest\x1a\x19.oteldemo.GetFlagResponse\"\x00\x12I\n" + + "\n" + + "CreateFlag\x12\x1b.oteldemo.CreateFlagRequest\x1a\x1c.oteldemo.CreateFlagResponse\"\x00\x12I\n" + + "\n" + + "UpdateFlag\x12\x1b.oteldemo.UpdateFlagRequest\x1a\x1c.oteldemo.UpdateFlagResponse\"\x00\x12F\n" + + "\tListFlags\x12\x1a.oteldemo.ListFlagsRequest\x1a\x1b.oteldemo.ListFlagsResponse\"\x00\x12I\n" + + "\n" + + "DeleteFlag\x12\x1b.oteldemo.DeleteFlagRequest\x1a\x1c.oteldemo.DeleteFlagResponse\"\x00B\x13Z\x11genproto/oteldemob\x06proto3" + +var ( + file_demo_proto_rawDescOnce sync.Once + file_demo_proto_rawDescData []byte +) + +func file_demo_proto_rawDescGZIP() []byte { + file_demo_proto_rawDescOnce.Do(func() { + file_demo_proto_rawDescData = protoimpl.X.CompressGZIP(unsafe.Slice(unsafe.StringData(file_demo_proto_rawDesc), len(file_demo_proto_rawDesc))) + }) + return file_demo_proto_rawDescData +} + +var file_demo_proto_msgTypes = make([]protoimpl.MessageInfo, 43) +var file_demo_proto_goTypes = []any{ + (*CartItem)(nil), // 0: oteldemo.CartItem + (*AddItemRequest)(nil), // 1: oteldemo.AddItemRequest + (*EmptyCartRequest)(nil), // 2: oteldemo.EmptyCartRequest + (*GetCartRequest)(nil), // 3: oteldemo.GetCartRequest + (*Cart)(nil), // 4: oteldemo.Cart + (*Empty)(nil), // 5: oteldemo.Empty + (*ListRecommendationsRequest)(nil), // 6: oteldemo.ListRecommendationsRequest + (*ListRecommendationsResponse)(nil), // 7: oteldemo.ListRecommendationsResponse + (*Product)(nil), // 8: oteldemo.Product + (*ListProductsResponse)(nil), // 9: oteldemo.ListProductsResponse + (*GetProductRequest)(nil), // 10: oteldemo.GetProductRequest + (*SearchProductsRequest)(nil), // 11: oteldemo.SearchProductsRequest + (*SearchProductsResponse)(nil), // 12: oteldemo.SearchProductsResponse + (*GetQuoteRequest)(nil), // 13: oteldemo.GetQuoteRequest + (*GetQuoteResponse)(nil), // 14: oteldemo.GetQuoteResponse + (*ShipOrderRequest)(nil), // 15: oteldemo.ShipOrderRequest + (*ShipOrderResponse)(nil), // 16: oteldemo.ShipOrderResponse + (*Address)(nil), // 17: oteldemo.Address + (*Money)(nil), // 18: oteldemo.Money + (*GetSupportedCurrenciesResponse)(nil), // 19: oteldemo.GetSupportedCurrenciesResponse + (*CurrencyConversionRequest)(nil), // 20: oteldemo.CurrencyConversionRequest + (*CreditCardInfo)(nil), // 21: oteldemo.CreditCardInfo + (*ChargeRequest)(nil), // 22: oteldemo.ChargeRequest + (*ChargeResponse)(nil), // 23: oteldemo.ChargeResponse + (*OrderItem)(nil), // 24: oteldemo.OrderItem + (*OrderResult)(nil), // 25: oteldemo.OrderResult + (*SendOrderConfirmationRequest)(nil), // 26: oteldemo.SendOrderConfirmationRequest + (*PlaceOrderRequest)(nil), // 27: oteldemo.PlaceOrderRequest + (*PlaceOrderResponse)(nil), // 28: oteldemo.PlaceOrderResponse + (*AdRequest)(nil), // 29: oteldemo.AdRequest + (*AdResponse)(nil), // 30: oteldemo.AdResponse + (*Ad)(nil), // 31: oteldemo.Ad + (*Flag)(nil), // 32: oteldemo.Flag + (*GetFlagRequest)(nil), // 33: oteldemo.GetFlagRequest + (*GetFlagResponse)(nil), // 34: oteldemo.GetFlagResponse + (*CreateFlagRequest)(nil), // 35: oteldemo.CreateFlagRequest + (*CreateFlagResponse)(nil), // 36: oteldemo.CreateFlagResponse + (*UpdateFlagRequest)(nil), // 37: oteldemo.UpdateFlagRequest + (*UpdateFlagResponse)(nil), // 38: oteldemo.UpdateFlagResponse + (*ListFlagsRequest)(nil), // 39: oteldemo.ListFlagsRequest + (*ListFlagsResponse)(nil), // 40: oteldemo.ListFlagsResponse + (*DeleteFlagRequest)(nil), // 41: oteldemo.DeleteFlagRequest + (*DeleteFlagResponse)(nil), // 42: oteldemo.DeleteFlagResponse +} +var file_demo_proto_depIdxs = []int32{ + 0, // 0: oteldemo.AddItemRequest.item:type_name -> oteldemo.CartItem + 0, // 1: oteldemo.Cart.items:type_name -> oteldemo.CartItem + 18, // 2: oteldemo.Product.price_usd:type_name -> oteldemo.Money + 8, // 3: oteldemo.ListProductsResponse.products:type_name -> oteldemo.Product + 8, // 4: oteldemo.SearchProductsResponse.results:type_name -> oteldemo.Product + 17, // 5: oteldemo.GetQuoteRequest.address:type_name -> oteldemo.Address + 0, // 6: oteldemo.GetQuoteRequest.items:type_name -> oteldemo.CartItem + 18, // 7: oteldemo.GetQuoteResponse.cost_usd:type_name -> oteldemo.Money + 17, // 8: oteldemo.ShipOrderRequest.address:type_name -> oteldemo.Address + 0, // 9: oteldemo.ShipOrderRequest.items:type_name -> oteldemo.CartItem + 18, // 10: oteldemo.CurrencyConversionRequest.from:type_name -> oteldemo.Money + 18, // 11: oteldemo.ChargeRequest.amount:type_name -> oteldemo.Money + 21, // 12: oteldemo.ChargeRequest.credit_card:type_name -> oteldemo.CreditCardInfo + 0, // 13: oteldemo.OrderItem.item:type_name -> oteldemo.CartItem + 18, // 14: oteldemo.OrderItem.cost:type_name -> oteldemo.Money + 18, // 15: oteldemo.OrderResult.shipping_cost:type_name -> oteldemo.Money + 17, // 16: oteldemo.OrderResult.shipping_address:type_name -> oteldemo.Address + 24, // 17: oteldemo.OrderResult.items:type_name -> oteldemo.OrderItem + 25, // 18: oteldemo.SendOrderConfirmationRequest.order:type_name -> oteldemo.OrderResult + 17, // 19: oteldemo.PlaceOrderRequest.address:type_name -> oteldemo.Address + 21, // 20: oteldemo.PlaceOrderRequest.credit_card:type_name -> oteldemo.CreditCardInfo + 25, // 21: oteldemo.PlaceOrderResponse.order:type_name -> oteldemo.OrderResult + 31, // 22: oteldemo.AdResponse.ads:type_name -> oteldemo.Ad + 32, // 23: oteldemo.GetFlagResponse.flag:type_name -> oteldemo.Flag + 32, // 24: oteldemo.CreateFlagResponse.flag:type_name -> oteldemo.Flag + 32, // 25: oteldemo.ListFlagsResponse.flag:type_name -> oteldemo.Flag + 1, // 26: oteldemo.CartService.AddItem:input_type -> oteldemo.AddItemRequest + 3, // 27: oteldemo.CartService.GetCart:input_type -> oteldemo.GetCartRequest + 2, // 28: oteldemo.CartService.EmptyCart:input_type -> oteldemo.EmptyCartRequest + 6, // 29: oteldemo.RecommendationService.ListRecommendations:input_type -> oteldemo.ListRecommendationsRequest + 5, // 30: oteldemo.ProductCatalogService.ListProducts:input_type -> oteldemo.Empty + 10, // 31: oteldemo.ProductCatalogService.GetProduct:input_type -> oteldemo.GetProductRequest + 11, // 32: oteldemo.ProductCatalogService.SearchProducts:input_type -> oteldemo.SearchProductsRequest + 13, // 33: oteldemo.ShippingService.GetQuote:input_type -> oteldemo.GetQuoteRequest + 15, // 34: oteldemo.ShippingService.ShipOrder:input_type -> oteldemo.ShipOrderRequest + 5, // 35: oteldemo.CurrencyService.GetSupportedCurrencies:input_type -> oteldemo.Empty + 20, // 36: oteldemo.CurrencyService.Convert:input_type -> oteldemo.CurrencyConversionRequest + 22, // 37: oteldemo.PaymentService.Charge:input_type -> oteldemo.ChargeRequest + 26, // 38: oteldemo.EmailService.SendOrderConfirmation:input_type -> oteldemo.SendOrderConfirmationRequest + 27, // 39: oteldemo.CheckoutService.PlaceOrder:input_type -> oteldemo.PlaceOrderRequest + 29, // 40: oteldemo.AdService.GetAds:input_type -> oteldemo.AdRequest + 33, // 41: oteldemo.FeatureFlagService.GetFlag:input_type -> oteldemo.GetFlagRequest + 35, // 42: oteldemo.FeatureFlagService.CreateFlag:input_type -> oteldemo.CreateFlagRequest + 37, // 43: oteldemo.FeatureFlagService.UpdateFlag:input_type -> oteldemo.UpdateFlagRequest + 39, // 44: oteldemo.FeatureFlagService.ListFlags:input_type -> oteldemo.ListFlagsRequest + 41, // 45: oteldemo.FeatureFlagService.DeleteFlag:input_type -> oteldemo.DeleteFlagRequest + 5, // 46: oteldemo.CartService.AddItem:output_type -> oteldemo.Empty + 4, // 47: oteldemo.CartService.GetCart:output_type -> oteldemo.Cart + 5, // 48: oteldemo.CartService.EmptyCart:output_type -> oteldemo.Empty + 7, // 49: oteldemo.RecommendationService.ListRecommendations:output_type -> oteldemo.ListRecommendationsResponse + 9, // 50: oteldemo.ProductCatalogService.ListProducts:output_type -> oteldemo.ListProductsResponse + 8, // 51: oteldemo.ProductCatalogService.GetProduct:output_type -> oteldemo.Product + 12, // 52: oteldemo.ProductCatalogService.SearchProducts:output_type -> oteldemo.SearchProductsResponse + 14, // 53: oteldemo.ShippingService.GetQuote:output_type -> oteldemo.GetQuoteResponse + 16, // 54: oteldemo.ShippingService.ShipOrder:output_type -> oteldemo.ShipOrderResponse + 19, // 55: oteldemo.CurrencyService.GetSupportedCurrencies:output_type -> oteldemo.GetSupportedCurrenciesResponse + 18, // 56: oteldemo.CurrencyService.Convert:output_type -> oteldemo.Money + 23, // 57: oteldemo.PaymentService.Charge:output_type -> oteldemo.ChargeResponse + 5, // 58: oteldemo.EmailService.SendOrderConfirmation:output_type -> oteldemo.Empty + 28, // 59: oteldemo.CheckoutService.PlaceOrder:output_type -> oteldemo.PlaceOrderResponse + 30, // 60: oteldemo.AdService.GetAds:output_type -> oteldemo.AdResponse + 34, // 61: oteldemo.FeatureFlagService.GetFlag:output_type -> oteldemo.GetFlagResponse + 36, // 62: oteldemo.FeatureFlagService.CreateFlag:output_type -> oteldemo.CreateFlagResponse + 38, // 63: oteldemo.FeatureFlagService.UpdateFlag:output_type -> oteldemo.UpdateFlagResponse + 40, // 64: oteldemo.FeatureFlagService.ListFlags:output_type -> oteldemo.ListFlagsResponse + 42, // 65: oteldemo.FeatureFlagService.DeleteFlag:output_type -> oteldemo.DeleteFlagResponse + 46, // [46:66] is the sub-list for method output_type + 26, // [26:46] is the sub-list for method input_type + 26, // [26:26] is the sub-list for extension type_name + 26, // [26:26] is the sub-list for extension extendee + 0, // [0:26] is the sub-list for field type_name +} + +func init() { file_demo_proto_init() } +func file_demo_proto_init() { + if File_demo_proto != nil { + return + } + type x struct{} + out := protoimpl.TypeBuilder{ + File: protoimpl.DescBuilder{ + GoPackagePath: reflect.TypeOf(x{}).PkgPath(), + RawDescriptor: unsafe.Slice(unsafe.StringData(file_demo_proto_rawDesc), len(file_demo_proto_rawDesc)), + NumEnums: 0, + NumMessages: 43, + NumExtensions: 0, + NumServices: 10, + }, + GoTypes: file_demo_proto_goTypes, + DependencyIndexes: file_demo_proto_depIdxs, + MessageInfos: file_demo_proto_msgTypes, + }.Build() + File_demo_proto = out.File + file_demo_proto_goTypes = nil + file_demo_proto_depIdxs = nil +} diff --git a/src/checkout/genproto/oteldemo/demo_grpc.pb.go b/src/checkout/genproto/oteldemo/demo_grpc.pb.go new file mode 100644 index 0000000..f04633a --- /dev/null +++ b/src/checkout/genproto/oteldemo/demo_grpc.pb.go @@ -0,0 +1,1433 @@ +// Copyright 2020 Google LLC +// +// 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. + +// Code generated by protoc-gen-go-grpc. DO NOT EDIT. +// versions: +// - protoc-gen-go-grpc v1.5.1 +// - protoc v5.29.4 +// source: demo.proto + +package oteldemo + +import ( + context "context" + grpc "google.golang.org/grpc" + codes "google.golang.org/grpc/codes" + status "google.golang.org/grpc/status" +) + +// This is a compile-time assertion to ensure that this generated file +// is compatible with the grpc package it is being compiled against. +// Requires gRPC-Go v1.64.0 or later. +const _ = grpc.SupportPackageIsVersion9 + +const ( + CartService_AddItem_FullMethodName = "/oteldemo.CartService/AddItem" + CartService_GetCart_FullMethodName = "/oteldemo.CartService/GetCart" + CartService_EmptyCart_FullMethodName = "/oteldemo.CartService/EmptyCart" +) + +// CartServiceClient is the client API for CartService service. +// +// For semantics around ctx use and closing/ending streaming RPCs, please refer to https://pkg.go.dev/google.golang.org/grpc/?tab=doc#ClientConn.NewStream. +type CartServiceClient interface { + AddItem(ctx context.Context, in *AddItemRequest, opts ...grpc.CallOption) (*Empty, error) + GetCart(ctx context.Context, in *GetCartRequest, opts ...grpc.CallOption) (*Cart, error) + EmptyCart(ctx context.Context, in *EmptyCartRequest, opts ...grpc.CallOption) (*Empty, error) +} + +type cartServiceClient struct { + cc grpc.ClientConnInterface +} + +func NewCartServiceClient(cc grpc.ClientConnInterface) CartServiceClient { + return &cartServiceClient{cc} +} + +func (c *cartServiceClient) AddItem(ctx context.Context, in *AddItemRequest, opts ...grpc.CallOption) (*Empty, error) { + cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) + out := new(Empty) + err := c.cc.Invoke(ctx, CartService_AddItem_FullMethodName, in, out, cOpts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *cartServiceClient) GetCart(ctx context.Context, in *GetCartRequest, opts ...grpc.CallOption) (*Cart, error) { + cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) + out := new(Cart) + err := c.cc.Invoke(ctx, CartService_GetCart_FullMethodName, in, out, cOpts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *cartServiceClient) EmptyCart(ctx context.Context, in *EmptyCartRequest, opts ...grpc.CallOption) (*Empty, error) { + cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) + out := new(Empty) + err := c.cc.Invoke(ctx, CartService_EmptyCart_FullMethodName, in, out, cOpts...) + if err != nil { + return nil, err + } + return out, nil +} + +// CartServiceServer is the server API for CartService service. +// All implementations must embed UnimplementedCartServiceServer +// for forward compatibility. +type CartServiceServer interface { + AddItem(context.Context, *AddItemRequest) (*Empty, error) + GetCart(context.Context, *GetCartRequest) (*Cart, error) + EmptyCart(context.Context, *EmptyCartRequest) (*Empty, error) + mustEmbedUnimplementedCartServiceServer() +} + +// UnimplementedCartServiceServer must be embedded to have +// forward compatible implementations. +// +// NOTE: this should be embedded by value instead of pointer to avoid a nil +// pointer dereference when methods are called. +type UnimplementedCartServiceServer struct{} + +func (UnimplementedCartServiceServer) AddItem(context.Context, *AddItemRequest) (*Empty, error) { + return nil, status.Errorf(codes.Unimplemented, "method AddItem not implemented") +} +func (UnimplementedCartServiceServer) GetCart(context.Context, *GetCartRequest) (*Cart, error) { + return nil, status.Errorf(codes.Unimplemented, "method GetCart not implemented") +} +func (UnimplementedCartServiceServer) EmptyCart(context.Context, *EmptyCartRequest) (*Empty, error) { + return nil, status.Errorf(codes.Unimplemented, "method EmptyCart not implemented") +} +func (UnimplementedCartServiceServer) mustEmbedUnimplementedCartServiceServer() {} +func (UnimplementedCartServiceServer) testEmbeddedByValue() {} + +// UnsafeCartServiceServer may be embedded to opt out of forward compatibility for this service. +// Use of this interface is not recommended, as added methods to CartServiceServer will +// result in compilation errors. +type UnsafeCartServiceServer interface { + mustEmbedUnimplementedCartServiceServer() +} + +func RegisterCartServiceServer(s grpc.ServiceRegistrar, srv CartServiceServer) { + // If the following call pancis, it indicates UnimplementedCartServiceServer was + // embedded by pointer and is nil. This will cause panics if an + // unimplemented method is ever invoked, so we test this at initialization + // time to prevent it from happening at runtime later due to I/O. + if t, ok := srv.(interface{ testEmbeddedByValue() }); ok { + t.testEmbeddedByValue() + } + s.RegisterService(&CartService_ServiceDesc, srv) +} + +func _CartService_AddItem_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(AddItemRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(CartServiceServer).AddItem(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: CartService_AddItem_FullMethodName, + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(CartServiceServer).AddItem(ctx, req.(*AddItemRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _CartService_GetCart_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(GetCartRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(CartServiceServer).GetCart(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: CartService_GetCart_FullMethodName, + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(CartServiceServer).GetCart(ctx, req.(*GetCartRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _CartService_EmptyCart_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(EmptyCartRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(CartServiceServer).EmptyCart(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: CartService_EmptyCart_FullMethodName, + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(CartServiceServer).EmptyCart(ctx, req.(*EmptyCartRequest)) + } + return interceptor(ctx, in, info, handler) +} + +// CartService_ServiceDesc is the grpc.ServiceDesc for CartService service. +// It's only intended for direct use with grpc.RegisterService, +// and not to be introspected or modified (even as a copy) +var CartService_ServiceDesc = grpc.ServiceDesc{ + ServiceName: "oteldemo.CartService", + HandlerType: (*CartServiceServer)(nil), + Methods: []grpc.MethodDesc{ + { + MethodName: "AddItem", + Handler: _CartService_AddItem_Handler, + }, + { + MethodName: "GetCart", + Handler: _CartService_GetCart_Handler, + }, + { + MethodName: "EmptyCart", + Handler: _CartService_EmptyCart_Handler, + }, + }, + Streams: []grpc.StreamDesc{}, + Metadata: "demo.proto", +} + +const ( + RecommendationService_ListRecommendations_FullMethodName = "/oteldemo.RecommendationService/ListRecommendations" +) + +// RecommendationServiceClient is the client API for RecommendationService service. +// +// For semantics around ctx use and closing/ending streaming RPCs, please refer to https://pkg.go.dev/google.golang.org/grpc/?tab=doc#ClientConn.NewStream. +type RecommendationServiceClient interface { + ListRecommendations(ctx context.Context, in *ListRecommendationsRequest, opts ...grpc.CallOption) (*ListRecommendationsResponse, error) +} + +type recommendationServiceClient struct { + cc grpc.ClientConnInterface +} + +func NewRecommendationServiceClient(cc grpc.ClientConnInterface) RecommendationServiceClient { + return &recommendationServiceClient{cc} +} + +func (c *recommendationServiceClient) ListRecommendations(ctx context.Context, in *ListRecommendationsRequest, opts ...grpc.CallOption) (*ListRecommendationsResponse, error) { + cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) + out := new(ListRecommendationsResponse) + err := c.cc.Invoke(ctx, RecommendationService_ListRecommendations_FullMethodName, in, out, cOpts...) + if err != nil { + return nil, err + } + return out, nil +} + +// RecommendationServiceServer is the server API for RecommendationService service. +// All implementations must embed UnimplementedRecommendationServiceServer +// for forward compatibility. +type RecommendationServiceServer interface { + ListRecommendations(context.Context, *ListRecommendationsRequest) (*ListRecommendationsResponse, error) + mustEmbedUnimplementedRecommendationServiceServer() +} + +// UnimplementedRecommendationServiceServer must be embedded to have +// forward compatible implementations. +// +// NOTE: this should be embedded by value instead of pointer to avoid a nil +// pointer dereference when methods are called. +type UnimplementedRecommendationServiceServer struct{} + +func (UnimplementedRecommendationServiceServer) ListRecommendations(context.Context, *ListRecommendationsRequest) (*ListRecommendationsResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method ListRecommendations not implemented") +} +func (UnimplementedRecommendationServiceServer) mustEmbedUnimplementedRecommendationServiceServer() {} +func (UnimplementedRecommendationServiceServer) testEmbeddedByValue() {} + +// UnsafeRecommendationServiceServer may be embedded to opt out of forward compatibility for this service. +// Use of this interface is not recommended, as added methods to RecommendationServiceServer will +// result in compilation errors. +type UnsafeRecommendationServiceServer interface { + mustEmbedUnimplementedRecommendationServiceServer() +} + +func RegisterRecommendationServiceServer(s grpc.ServiceRegistrar, srv RecommendationServiceServer) { + // If the following call pancis, it indicates UnimplementedRecommendationServiceServer was + // embedded by pointer and is nil. This will cause panics if an + // unimplemented method is ever invoked, so we test this at initialization + // time to prevent it from happening at runtime later due to I/O. + if t, ok := srv.(interface{ testEmbeddedByValue() }); ok { + t.testEmbeddedByValue() + } + s.RegisterService(&RecommendationService_ServiceDesc, srv) +} + +func _RecommendationService_ListRecommendations_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(ListRecommendationsRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(RecommendationServiceServer).ListRecommendations(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: RecommendationService_ListRecommendations_FullMethodName, + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(RecommendationServiceServer).ListRecommendations(ctx, req.(*ListRecommendationsRequest)) + } + return interceptor(ctx, in, info, handler) +} + +// RecommendationService_ServiceDesc is the grpc.ServiceDesc for RecommendationService service. +// It's only intended for direct use with grpc.RegisterService, +// and not to be introspected or modified (even as a copy) +var RecommendationService_ServiceDesc = grpc.ServiceDesc{ + ServiceName: "oteldemo.RecommendationService", + HandlerType: (*RecommendationServiceServer)(nil), + Methods: []grpc.MethodDesc{ + { + MethodName: "ListRecommendations", + Handler: _RecommendationService_ListRecommendations_Handler, + }, + }, + Streams: []grpc.StreamDesc{}, + Metadata: "demo.proto", +} + +const ( + ProductCatalogService_ListProducts_FullMethodName = "/oteldemo.ProductCatalogService/ListProducts" + ProductCatalogService_GetProduct_FullMethodName = "/oteldemo.ProductCatalogService/GetProduct" + ProductCatalogService_SearchProducts_FullMethodName = "/oteldemo.ProductCatalogService/SearchProducts" +) + +// ProductCatalogServiceClient is the client API for ProductCatalogService service. +// +// For semantics around ctx use and closing/ending streaming RPCs, please refer to https://pkg.go.dev/google.golang.org/grpc/?tab=doc#ClientConn.NewStream. +type ProductCatalogServiceClient interface { + ListProducts(ctx context.Context, in *Empty, opts ...grpc.CallOption) (*ListProductsResponse, error) + GetProduct(ctx context.Context, in *GetProductRequest, opts ...grpc.CallOption) (*Product, error) + SearchProducts(ctx context.Context, in *SearchProductsRequest, opts ...grpc.CallOption) (*SearchProductsResponse, error) +} + +type productCatalogServiceClient struct { + cc grpc.ClientConnInterface +} + +func NewProductCatalogServiceClient(cc grpc.ClientConnInterface) ProductCatalogServiceClient { + return &productCatalogServiceClient{cc} +} + +func (c *productCatalogServiceClient) ListProducts(ctx context.Context, in *Empty, opts ...grpc.CallOption) (*ListProductsResponse, error) { + cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) + out := new(ListProductsResponse) + err := c.cc.Invoke(ctx, ProductCatalogService_ListProducts_FullMethodName, in, out, cOpts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *productCatalogServiceClient) GetProduct(ctx context.Context, in *GetProductRequest, opts ...grpc.CallOption) (*Product, error) { + cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) + out := new(Product) + err := c.cc.Invoke(ctx, ProductCatalogService_GetProduct_FullMethodName, in, out, cOpts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *productCatalogServiceClient) SearchProducts(ctx context.Context, in *SearchProductsRequest, opts ...grpc.CallOption) (*SearchProductsResponse, error) { + cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) + out := new(SearchProductsResponse) + err := c.cc.Invoke(ctx, ProductCatalogService_SearchProducts_FullMethodName, in, out, cOpts...) + if err != nil { + return nil, err + } + return out, nil +} + +// ProductCatalogServiceServer is the server API for ProductCatalogService service. +// All implementations must embed UnimplementedProductCatalogServiceServer +// for forward compatibility. +type ProductCatalogServiceServer interface { + ListProducts(context.Context, *Empty) (*ListProductsResponse, error) + GetProduct(context.Context, *GetProductRequest) (*Product, error) + SearchProducts(context.Context, *SearchProductsRequest) (*SearchProductsResponse, error) + mustEmbedUnimplementedProductCatalogServiceServer() +} + +// UnimplementedProductCatalogServiceServer must be embedded to have +// forward compatible implementations. +// +// NOTE: this should be embedded by value instead of pointer to avoid a nil +// pointer dereference when methods are called. +type UnimplementedProductCatalogServiceServer struct{} + +func (UnimplementedProductCatalogServiceServer) ListProducts(context.Context, *Empty) (*ListProductsResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method ListProducts not implemented") +} +func (UnimplementedProductCatalogServiceServer) GetProduct(context.Context, *GetProductRequest) (*Product, error) { + return nil, status.Errorf(codes.Unimplemented, "method GetProduct not implemented") +} +func (UnimplementedProductCatalogServiceServer) SearchProducts(context.Context, *SearchProductsRequest) (*SearchProductsResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method SearchProducts not implemented") +} +func (UnimplementedProductCatalogServiceServer) mustEmbedUnimplementedProductCatalogServiceServer() {} +func (UnimplementedProductCatalogServiceServer) testEmbeddedByValue() {} + +// UnsafeProductCatalogServiceServer may be embedded to opt out of forward compatibility for this service. +// Use of this interface is not recommended, as added methods to ProductCatalogServiceServer will +// result in compilation errors. +type UnsafeProductCatalogServiceServer interface { + mustEmbedUnimplementedProductCatalogServiceServer() +} + +func RegisterProductCatalogServiceServer(s grpc.ServiceRegistrar, srv ProductCatalogServiceServer) { + // If the following call pancis, it indicates UnimplementedProductCatalogServiceServer was + // embedded by pointer and is nil. This will cause panics if an + // unimplemented method is ever invoked, so we test this at initialization + // time to prevent it from happening at runtime later due to I/O. + if t, ok := srv.(interface{ testEmbeddedByValue() }); ok { + t.testEmbeddedByValue() + } + s.RegisterService(&ProductCatalogService_ServiceDesc, srv) +} + +func _ProductCatalogService_ListProducts_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.(ProductCatalogServiceServer).ListProducts(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: ProductCatalogService_ListProducts_FullMethodName, + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(ProductCatalogServiceServer).ListProducts(ctx, req.(*Empty)) + } + return interceptor(ctx, in, info, handler) +} + +func _ProductCatalogService_GetProduct_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(GetProductRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(ProductCatalogServiceServer).GetProduct(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: ProductCatalogService_GetProduct_FullMethodName, + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(ProductCatalogServiceServer).GetProduct(ctx, req.(*GetProductRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _ProductCatalogService_SearchProducts_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(SearchProductsRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(ProductCatalogServiceServer).SearchProducts(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: ProductCatalogService_SearchProducts_FullMethodName, + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(ProductCatalogServiceServer).SearchProducts(ctx, req.(*SearchProductsRequest)) + } + return interceptor(ctx, in, info, handler) +} + +// ProductCatalogService_ServiceDesc is the grpc.ServiceDesc for ProductCatalogService service. +// It's only intended for direct use with grpc.RegisterService, +// and not to be introspected or modified (even as a copy) +var ProductCatalogService_ServiceDesc = grpc.ServiceDesc{ + ServiceName: "oteldemo.ProductCatalogService", + HandlerType: (*ProductCatalogServiceServer)(nil), + Methods: []grpc.MethodDesc{ + { + MethodName: "ListProducts", + Handler: _ProductCatalogService_ListProducts_Handler, + }, + { + MethodName: "GetProduct", + Handler: _ProductCatalogService_GetProduct_Handler, + }, + { + MethodName: "SearchProducts", + Handler: _ProductCatalogService_SearchProducts_Handler, + }, + }, + Streams: []grpc.StreamDesc{}, + Metadata: "demo.proto", +} + +const ( + ShippingService_GetQuote_FullMethodName = "/oteldemo.ShippingService/GetQuote" + ShippingService_ShipOrder_FullMethodName = "/oteldemo.ShippingService/ShipOrder" +) + +// ShippingServiceClient is the client API for ShippingService service. +// +// For semantics around ctx use and closing/ending streaming RPCs, please refer to https://pkg.go.dev/google.golang.org/grpc/?tab=doc#ClientConn.NewStream. +type ShippingServiceClient interface { + GetQuote(ctx context.Context, in *GetQuoteRequest, opts ...grpc.CallOption) (*GetQuoteResponse, error) + ShipOrder(ctx context.Context, in *ShipOrderRequest, opts ...grpc.CallOption) (*ShipOrderResponse, error) +} + +type shippingServiceClient struct { + cc grpc.ClientConnInterface +} + +func NewShippingServiceClient(cc grpc.ClientConnInterface) ShippingServiceClient { + return &shippingServiceClient{cc} +} + +func (c *shippingServiceClient) GetQuote(ctx context.Context, in *GetQuoteRequest, opts ...grpc.CallOption) (*GetQuoteResponse, error) { + cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) + out := new(GetQuoteResponse) + err := c.cc.Invoke(ctx, ShippingService_GetQuote_FullMethodName, in, out, cOpts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *shippingServiceClient) ShipOrder(ctx context.Context, in *ShipOrderRequest, opts ...grpc.CallOption) (*ShipOrderResponse, error) { + cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) + out := new(ShipOrderResponse) + err := c.cc.Invoke(ctx, ShippingService_ShipOrder_FullMethodName, in, out, cOpts...) + if err != nil { + return nil, err + } + return out, nil +} + +// ShippingServiceServer is the server API for ShippingService service. +// All implementations must embed UnimplementedShippingServiceServer +// for forward compatibility. +type ShippingServiceServer interface { + GetQuote(context.Context, *GetQuoteRequest) (*GetQuoteResponse, error) + ShipOrder(context.Context, *ShipOrderRequest) (*ShipOrderResponse, error) + mustEmbedUnimplementedShippingServiceServer() +} + +// UnimplementedShippingServiceServer must be embedded to have +// forward compatible implementations. +// +// NOTE: this should be embedded by value instead of pointer to avoid a nil +// pointer dereference when methods are called. +type UnimplementedShippingServiceServer struct{} + +func (UnimplementedShippingServiceServer) GetQuote(context.Context, *GetQuoteRequest) (*GetQuoteResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method GetQuote not implemented") +} +func (UnimplementedShippingServiceServer) ShipOrder(context.Context, *ShipOrderRequest) (*ShipOrderResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method ShipOrder not implemented") +} +func (UnimplementedShippingServiceServer) mustEmbedUnimplementedShippingServiceServer() {} +func (UnimplementedShippingServiceServer) testEmbeddedByValue() {} + +// UnsafeShippingServiceServer may be embedded to opt out of forward compatibility for this service. +// Use of this interface is not recommended, as added methods to ShippingServiceServer will +// result in compilation errors. +type UnsafeShippingServiceServer interface { + mustEmbedUnimplementedShippingServiceServer() +} + +func RegisterShippingServiceServer(s grpc.ServiceRegistrar, srv ShippingServiceServer) { + // If the following call pancis, it indicates UnimplementedShippingServiceServer was + // embedded by pointer and is nil. This will cause panics if an + // unimplemented method is ever invoked, so we test this at initialization + // time to prevent it from happening at runtime later due to I/O. + if t, ok := srv.(interface{ testEmbeddedByValue() }); ok { + t.testEmbeddedByValue() + } + s.RegisterService(&ShippingService_ServiceDesc, srv) +} + +func _ShippingService_GetQuote_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(GetQuoteRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(ShippingServiceServer).GetQuote(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: ShippingService_GetQuote_FullMethodName, + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(ShippingServiceServer).GetQuote(ctx, req.(*GetQuoteRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _ShippingService_ShipOrder_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(ShipOrderRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(ShippingServiceServer).ShipOrder(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: ShippingService_ShipOrder_FullMethodName, + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(ShippingServiceServer).ShipOrder(ctx, req.(*ShipOrderRequest)) + } + return interceptor(ctx, in, info, handler) +} + +// ShippingService_ServiceDesc is the grpc.ServiceDesc for ShippingService service. +// It's only intended for direct use with grpc.RegisterService, +// and not to be introspected or modified (even as a copy) +var ShippingService_ServiceDesc = grpc.ServiceDesc{ + ServiceName: "oteldemo.ShippingService", + HandlerType: (*ShippingServiceServer)(nil), + Methods: []grpc.MethodDesc{ + { + MethodName: "GetQuote", + Handler: _ShippingService_GetQuote_Handler, + }, + { + MethodName: "ShipOrder", + Handler: _ShippingService_ShipOrder_Handler, + }, + }, + Streams: []grpc.StreamDesc{}, + Metadata: "demo.proto", +} + +const ( + CurrencyService_GetSupportedCurrencies_FullMethodName = "/oteldemo.CurrencyService/GetSupportedCurrencies" + CurrencyService_Convert_FullMethodName = "/oteldemo.CurrencyService/Convert" +) + +// CurrencyServiceClient is the client API for CurrencyService service. +// +// For semantics around ctx use and closing/ending streaming RPCs, please refer to https://pkg.go.dev/google.golang.org/grpc/?tab=doc#ClientConn.NewStream. +type CurrencyServiceClient interface { + GetSupportedCurrencies(ctx context.Context, in *Empty, opts ...grpc.CallOption) (*GetSupportedCurrenciesResponse, error) + Convert(ctx context.Context, in *CurrencyConversionRequest, opts ...grpc.CallOption) (*Money, error) +} + +type currencyServiceClient struct { + cc grpc.ClientConnInterface +} + +func NewCurrencyServiceClient(cc grpc.ClientConnInterface) CurrencyServiceClient { + return ¤cyServiceClient{cc} +} + +func (c *currencyServiceClient) GetSupportedCurrencies(ctx context.Context, in *Empty, opts ...grpc.CallOption) (*GetSupportedCurrenciesResponse, error) { + cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) + out := new(GetSupportedCurrenciesResponse) + err := c.cc.Invoke(ctx, CurrencyService_GetSupportedCurrencies_FullMethodName, in, out, cOpts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *currencyServiceClient) Convert(ctx context.Context, in *CurrencyConversionRequest, opts ...grpc.CallOption) (*Money, error) { + cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) + out := new(Money) + err := c.cc.Invoke(ctx, CurrencyService_Convert_FullMethodName, in, out, cOpts...) + if err != nil { + return nil, err + } + return out, nil +} + +// CurrencyServiceServer is the server API for CurrencyService service. +// All implementations must embed UnimplementedCurrencyServiceServer +// for forward compatibility. +type CurrencyServiceServer interface { + GetSupportedCurrencies(context.Context, *Empty) (*GetSupportedCurrenciesResponse, error) + Convert(context.Context, *CurrencyConversionRequest) (*Money, error) + mustEmbedUnimplementedCurrencyServiceServer() +} + +// UnimplementedCurrencyServiceServer must be embedded to have +// forward compatible implementations. +// +// NOTE: this should be embedded by value instead of pointer to avoid a nil +// pointer dereference when methods are called. +type UnimplementedCurrencyServiceServer struct{} + +func (UnimplementedCurrencyServiceServer) GetSupportedCurrencies(context.Context, *Empty) (*GetSupportedCurrenciesResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method GetSupportedCurrencies not implemented") +} +func (UnimplementedCurrencyServiceServer) Convert(context.Context, *CurrencyConversionRequest) (*Money, error) { + return nil, status.Errorf(codes.Unimplemented, "method Convert not implemented") +} +func (UnimplementedCurrencyServiceServer) mustEmbedUnimplementedCurrencyServiceServer() {} +func (UnimplementedCurrencyServiceServer) testEmbeddedByValue() {} + +// UnsafeCurrencyServiceServer may be embedded to opt out of forward compatibility for this service. +// Use of this interface is not recommended, as added methods to CurrencyServiceServer will +// result in compilation errors. +type UnsafeCurrencyServiceServer interface { + mustEmbedUnimplementedCurrencyServiceServer() +} + +func RegisterCurrencyServiceServer(s grpc.ServiceRegistrar, srv CurrencyServiceServer) { + // If the following call pancis, it indicates UnimplementedCurrencyServiceServer was + // embedded by pointer and is nil. This will cause panics if an + // unimplemented method is ever invoked, so we test this at initialization + // time to prevent it from happening at runtime later due to I/O. + if t, ok := srv.(interface{ testEmbeddedByValue() }); ok { + t.testEmbeddedByValue() + } + s.RegisterService(&CurrencyService_ServiceDesc, srv) +} + +func _CurrencyService_GetSupportedCurrencies_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.(CurrencyServiceServer).GetSupportedCurrencies(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: CurrencyService_GetSupportedCurrencies_FullMethodName, + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(CurrencyServiceServer).GetSupportedCurrencies(ctx, req.(*Empty)) + } + return interceptor(ctx, in, info, handler) +} + +func _CurrencyService_Convert_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(CurrencyConversionRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(CurrencyServiceServer).Convert(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: CurrencyService_Convert_FullMethodName, + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(CurrencyServiceServer).Convert(ctx, req.(*CurrencyConversionRequest)) + } + return interceptor(ctx, in, info, handler) +} + +// CurrencyService_ServiceDesc is the grpc.ServiceDesc for CurrencyService service. +// It's only intended for direct use with grpc.RegisterService, +// and not to be introspected or modified (even as a copy) +var CurrencyService_ServiceDesc = grpc.ServiceDesc{ + ServiceName: "oteldemo.CurrencyService", + HandlerType: (*CurrencyServiceServer)(nil), + Methods: []grpc.MethodDesc{ + { + MethodName: "GetSupportedCurrencies", + Handler: _CurrencyService_GetSupportedCurrencies_Handler, + }, + { + MethodName: "Convert", + Handler: _CurrencyService_Convert_Handler, + }, + }, + Streams: []grpc.StreamDesc{}, + Metadata: "demo.proto", +} + +const ( + PaymentService_Charge_FullMethodName = "/oteldemo.PaymentService/Charge" +) + +// PaymentServiceClient is the client API for PaymentService service. +// +// For semantics around ctx use and closing/ending streaming RPCs, please refer to https://pkg.go.dev/google.golang.org/grpc/?tab=doc#ClientConn.NewStream. +type PaymentServiceClient interface { + Charge(ctx context.Context, in *ChargeRequest, opts ...grpc.CallOption) (*ChargeResponse, error) +} + +type paymentServiceClient struct { + cc grpc.ClientConnInterface +} + +func NewPaymentServiceClient(cc grpc.ClientConnInterface) PaymentServiceClient { + return &paymentServiceClient{cc} +} + +func (c *paymentServiceClient) Charge(ctx context.Context, in *ChargeRequest, opts ...grpc.CallOption) (*ChargeResponse, error) { + cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) + out := new(ChargeResponse) + err := c.cc.Invoke(ctx, PaymentService_Charge_FullMethodName, in, out, cOpts...) + if err != nil { + return nil, err + } + return out, nil +} + +// PaymentServiceServer is the server API for PaymentService service. +// All implementations must embed UnimplementedPaymentServiceServer +// for forward compatibility. +type PaymentServiceServer interface { + Charge(context.Context, *ChargeRequest) (*ChargeResponse, error) + mustEmbedUnimplementedPaymentServiceServer() +} + +// UnimplementedPaymentServiceServer must be embedded to have +// forward compatible implementations. +// +// NOTE: this should be embedded by value instead of pointer to avoid a nil +// pointer dereference when methods are called. +type UnimplementedPaymentServiceServer struct{} + +func (UnimplementedPaymentServiceServer) Charge(context.Context, *ChargeRequest) (*ChargeResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method Charge not implemented") +} +func (UnimplementedPaymentServiceServer) mustEmbedUnimplementedPaymentServiceServer() {} +func (UnimplementedPaymentServiceServer) testEmbeddedByValue() {} + +// UnsafePaymentServiceServer may be embedded to opt out of forward compatibility for this service. +// Use of this interface is not recommended, as added methods to PaymentServiceServer will +// result in compilation errors. +type UnsafePaymentServiceServer interface { + mustEmbedUnimplementedPaymentServiceServer() +} + +func RegisterPaymentServiceServer(s grpc.ServiceRegistrar, srv PaymentServiceServer) { + // If the following call pancis, it indicates UnimplementedPaymentServiceServer was + // embedded by pointer and is nil. This will cause panics if an + // unimplemented method is ever invoked, so we test this at initialization + // time to prevent it from happening at runtime later due to I/O. + if t, ok := srv.(interface{ testEmbeddedByValue() }); ok { + t.testEmbeddedByValue() + } + s.RegisterService(&PaymentService_ServiceDesc, srv) +} + +func _PaymentService_Charge_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(ChargeRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(PaymentServiceServer).Charge(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: PaymentService_Charge_FullMethodName, + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(PaymentServiceServer).Charge(ctx, req.(*ChargeRequest)) + } + return interceptor(ctx, in, info, handler) +} + +// PaymentService_ServiceDesc is the grpc.ServiceDesc for PaymentService service. +// It's only intended for direct use with grpc.RegisterService, +// and not to be introspected or modified (even as a copy) +var PaymentService_ServiceDesc = grpc.ServiceDesc{ + ServiceName: "oteldemo.PaymentService", + HandlerType: (*PaymentServiceServer)(nil), + Methods: []grpc.MethodDesc{ + { + MethodName: "Charge", + Handler: _PaymentService_Charge_Handler, + }, + }, + Streams: []grpc.StreamDesc{}, + Metadata: "demo.proto", +} + +const ( + EmailService_SendOrderConfirmation_FullMethodName = "/oteldemo.EmailService/SendOrderConfirmation" +) + +// EmailServiceClient is the client API for EmailService service. +// +// For semantics around ctx use and closing/ending streaming RPCs, please refer to https://pkg.go.dev/google.golang.org/grpc/?tab=doc#ClientConn.NewStream. +type EmailServiceClient interface { + SendOrderConfirmation(ctx context.Context, in *SendOrderConfirmationRequest, opts ...grpc.CallOption) (*Empty, error) +} + +type emailServiceClient struct { + cc grpc.ClientConnInterface +} + +func NewEmailServiceClient(cc grpc.ClientConnInterface) EmailServiceClient { + return &emailServiceClient{cc} +} + +func (c *emailServiceClient) SendOrderConfirmation(ctx context.Context, in *SendOrderConfirmationRequest, opts ...grpc.CallOption) (*Empty, error) { + cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) + out := new(Empty) + err := c.cc.Invoke(ctx, EmailService_SendOrderConfirmation_FullMethodName, in, out, cOpts...) + if err != nil { + return nil, err + } + return out, nil +} + +// EmailServiceServer is the server API for EmailService service. +// All implementations must embed UnimplementedEmailServiceServer +// for forward compatibility. +type EmailServiceServer interface { + SendOrderConfirmation(context.Context, *SendOrderConfirmationRequest) (*Empty, error) + mustEmbedUnimplementedEmailServiceServer() +} + +// UnimplementedEmailServiceServer must be embedded to have +// forward compatible implementations. +// +// NOTE: this should be embedded by value instead of pointer to avoid a nil +// pointer dereference when methods are called. +type UnimplementedEmailServiceServer struct{} + +func (UnimplementedEmailServiceServer) SendOrderConfirmation(context.Context, *SendOrderConfirmationRequest) (*Empty, error) { + return nil, status.Errorf(codes.Unimplemented, "method SendOrderConfirmation not implemented") +} +func (UnimplementedEmailServiceServer) mustEmbedUnimplementedEmailServiceServer() {} +func (UnimplementedEmailServiceServer) testEmbeddedByValue() {} + +// UnsafeEmailServiceServer may be embedded to opt out of forward compatibility for this service. +// Use of this interface is not recommended, as added methods to EmailServiceServer will +// result in compilation errors. +type UnsafeEmailServiceServer interface { + mustEmbedUnimplementedEmailServiceServer() +} + +func RegisterEmailServiceServer(s grpc.ServiceRegistrar, srv EmailServiceServer) { + // If the following call pancis, it indicates UnimplementedEmailServiceServer was + // embedded by pointer and is nil. This will cause panics if an + // unimplemented method is ever invoked, so we test this at initialization + // time to prevent it from happening at runtime later due to I/O. + if t, ok := srv.(interface{ testEmbeddedByValue() }); ok { + t.testEmbeddedByValue() + } + s.RegisterService(&EmailService_ServiceDesc, srv) +} + +func _EmailService_SendOrderConfirmation_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(SendOrderConfirmationRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(EmailServiceServer).SendOrderConfirmation(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: EmailService_SendOrderConfirmation_FullMethodName, + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(EmailServiceServer).SendOrderConfirmation(ctx, req.(*SendOrderConfirmationRequest)) + } + return interceptor(ctx, in, info, handler) +} + +// EmailService_ServiceDesc is the grpc.ServiceDesc for EmailService service. +// It's only intended for direct use with grpc.RegisterService, +// and not to be introspected or modified (even as a copy) +var EmailService_ServiceDesc = grpc.ServiceDesc{ + ServiceName: "oteldemo.EmailService", + HandlerType: (*EmailServiceServer)(nil), + Methods: []grpc.MethodDesc{ + { + MethodName: "SendOrderConfirmation", + Handler: _EmailService_SendOrderConfirmation_Handler, + }, + }, + Streams: []grpc.StreamDesc{}, + Metadata: "demo.proto", +} + +const ( + CheckoutService_PlaceOrder_FullMethodName = "/oteldemo.CheckoutService/PlaceOrder" +) + +// CheckoutServiceClient is the client API for CheckoutService service. +// +// For semantics around ctx use and closing/ending streaming RPCs, please refer to https://pkg.go.dev/google.golang.org/grpc/?tab=doc#ClientConn.NewStream. +type CheckoutServiceClient interface { + PlaceOrder(ctx context.Context, in *PlaceOrderRequest, opts ...grpc.CallOption) (*PlaceOrderResponse, error) +} + +type checkoutServiceClient struct { + cc grpc.ClientConnInterface +} + +func NewCheckoutServiceClient(cc grpc.ClientConnInterface) CheckoutServiceClient { + return &checkoutServiceClient{cc} +} + +func (c *checkoutServiceClient) PlaceOrder(ctx context.Context, in *PlaceOrderRequest, opts ...grpc.CallOption) (*PlaceOrderResponse, error) { + cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) + out := new(PlaceOrderResponse) + err := c.cc.Invoke(ctx, CheckoutService_PlaceOrder_FullMethodName, in, out, cOpts...) + if err != nil { + return nil, err + } + return out, nil +} + +// CheckoutServiceServer is the server API for CheckoutService service. +// All implementations must embed UnimplementedCheckoutServiceServer +// for forward compatibility. +type CheckoutServiceServer interface { + PlaceOrder(context.Context, *PlaceOrderRequest) (*PlaceOrderResponse, error) + mustEmbedUnimplementedCheckoutServiceServer() +} + +// UnimplementedCheckoutServiceServer must be embedded to have +// forward compatible implementations. +// +// NOTE: this should be embedded by value instead of pointer to avoid a nil +// pointer dereference when methods are called. +type UnimplementedCheckoutServiceServer struct{} + +func (UnimplementedCheckoutServiceServer) PlaceOrder(context.Context, *PlaceOrderRequest) (*PlaceOrderResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method PlaceOrder not implemented") +} +func (UnimplementedCheckoutServiceServer) mustEmbedUnimplementedCheckoutServiceServer() {} +func (UnimplementedCheckoutServiceServer) testEmbeddedByValue() {} + +// UnsafeCheckoutServiceServer may be embedded to opt out of forward compatibility for this service. +// Use of this interface is not recommended, as added methods to CheckoutServiceServer will +// result in compilation errors. +type UnsafeCheckoutServiceServer interface { + mustEmbedUnimplementedCheckoutServiceServer() +} + +func RegisterCheckoutServiceServer(s grpc.ServiceRegistrar, srv CheckoutServiceServer) { + // If the following call pancis, it indicates UnimplementedCheckoutServiceServer was + // embedded by pointer and is nil. This will cause panics if an + // unimplemented method is ever invoked, so we test this at initialization + // time to prevent it from happening at runtime later due to I/O. + if t, ok := srv.(interface{ testEmbeddedByValue() }); ok { + t.testEmbeddedByValue() + } + s.RegisterService(&CheckoutService_ServiceDesc, srv) +} + +func _CheckoutService_PlaceOrder_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(PlaceOrderRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(CheckoutServiceServer).PlaceOrder(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: CheckoutService_PlaceOrder_FullMethodName, + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(CheckoutServiceServer).PlaceOrder(ctx, req.(*PlaceOrderRequest)) + } + return interceptor(ctx, in, info, handler) +} + +// CheckoutService_ServiceDesc is the grpc.ServiceDesc for CheckoutService service. +// It's only intended for direct use with grpc.RegisterService, +// and not to be introspected or modified (even as a copy) +var CheckoutService_ServiceDesc = grpc.ServiceDesc{ + ServiceName: "oteldemo.CheckoutService", + HandlerType: (*CheckoutServiceServer)(nil), + Methods: []grpc.MethodDesc{ + { + MethodName: "PlaceOrder", + Handler: _CheckoutService_PlaceOrder_Handler, + }, + }, + Streams: []grpc.StreamDesc{}, + Metadata: "demo.proto", +} + +const ( + AdService_GetAds_FullMethodName = "/oteldemo.AdService/GetAds" +) + +// AdServiceClient is the client API for AdService service. +// +// For semantics around ctx use and closing/ending streaming RPCs, please refer to https://pkg.go.dev/google.golang.org/grpc/?tab=doc#ClientConn.NewStream. +type AdServiceClient interface { + GetAds(ctx context.Context, in *AdRequest, opts ...grpc.CallOption) (*AdResponse, error) +} + +type adServiceClient struct { + cc grpc.ClientConnInterface +} + +func NewAdServiceClient(cc grpc.ClientConnInterface) AdServiceClient { + return &adServiceClient{cc} +} + +func (c *adServiceClient) GetAds(ctx context.Context, in *AdRequest, opts ...grpc.CallOption) (*AdResponse, error) { + cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) + out := new(AdResponse) + err := c.cc.Invoke(ctx, AdService_GetAds_FullMethodName, in, out, cOpts...) + if err != nil { + return nil, err + } + return out, nil +} + +// AdServiceServer is the server API for AdService service. +// All implementations must embed UnimplementedAdServiceServer +// for forward compatibility. +type AdServiceServer interface { + GetAds(context.Context, *AdRequest) (*AdResponse, error) + mustEmbedUnimplementedAdServiceServer() +} + +// UnimplementedAdServiceServer must be embedded to have +// forward compatible implementations. +// +// NOTE: this should be embedded by value instead of pointer to avoid a nil +// pointer dereference when methods are called. +type UnimplementedAdServiceServer struct{} + +func (UnimplementedAdServiceServer) GetAds(context.Context, *AdRequest) (*AdResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method GetAds not implemented") +} +func (UnimplementedAdServiceServer) mustEmbedUnimplementedAdServiceServer() {} +func (UnimplementedAdServiceServer) testEmbeddedByValue() {} + +// UnsafeAdServiceServer may be embedded to opt out of forward compatibility for this service. +// Use of this interface is not recommended, as added methods to AdServiceServer will +// result in compilation errors. +type UnsafeAdServiceServer interface { + mustEmbedUnimplementedAdServiceServer() +} + +func RegisterAdServiceServer(s grpc.ServiceRegistrar, srv AdServiceServer) { + // If the following call pancis, it indicates UnimplementedAdServiceServer was + // embedded by pointer and is nil. This will cause panics if an + // unimplemented method is ever invoked, so we test this at initialization + // time to prevent it from happening at runtime later due to I/O. + if t, ok := srv.(interface{ testEmbeddedByValue() }); ok { + t.testEmbeddedByValue() + } + s.RegisterService(&AdService_ServiceDesc, srv) +} + +func _AdService_GetAds_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(AdRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(AdServiceServer).GetAds(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: AdService_GetAds_FullMethodName, + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(AdServiceServer).GetAds(ctx, req.(*AdRequest)) + } + return interceptor(ctx, in, info, handler) +} + +// AdService_ServiceDesc is the grpc.ServiceDesc for AdService service. +// It's only intended for direct use with grpc.RegisterService, +// and not to be introspected or modified (even as a copy) +var AdService_ServiceDesc = grpc.ServiceDesc{ + ServiceName: "oteldemo.AdService", + HandlerType: (*AdServiceServer)(nil), + Methods: []grpc.MethodDesc{ + { + MethodName: "GetAds", + Handler: _AdService_GetAds_Handler, + }, + }, + Streams: []grpc.StreamDesc{}, + Metadata: "demo.proto", +} + +const ( + FeatureFlagService_GetFlag_FullMethodName = "/oteldemo.FeatureFlagService/GetFlag" + FeatureFlagService_CreateFlag_FullMethodName = "/oteldemo.FeatureFlagService/CreateFlag" + FeatureFlagService_UpdateFlag_FullMethodName = "/oteldemo.FeatureFlagService/UpdateFlag" + FeatureFlagService_ListFlags_FullMethodName = "/oteldemo.FeatureFlagService/ListFlags" + FeatureFlagService_DeleteFlag_FullMethodName = "/oteldemo.FeatureFlagService/DeleteFlag" +) + +// FeatureFlagServiceClient is the client API for FeatureFlagService service. +// +// For semantics around ctx use and closing/ending streaming RPCs, please refer to https://pkg.go.dev/google.golang.org/grpc/?tab=doc#ClientConn.NewStream. +type FeatureFlagServiceClient interface { + GetFlag(ctx context.Context, in *GetFlagRequest, opts ...grpc.CallOption) (*GetFlagResponse, error) + CreateFlag(ctx context.Context, in *CreateFlagRequest, opts ...grpc.CallOption) (*CreateFlagResponse, error) + UpdateFlag(ctx context.Context, in *UpdateFlagRequest, opts ...grpc.CallOption) (*UpdateFlagResponse, error) + ListFlags(ctx context.Context, in *ListFlagsRequest, opts ...grpc.CallOption) (*ListFlagsResponse, error) + DeleteFlag(ctx context.Context, in *DeleteFlagRequest, opts ...grpc.CallOption) (*DeleteFlagResponse, error) +} + +type featureFlagServiceClient struct { + cc grpc.ClientConnInterface +} + +func NewFeatureFlagServiceClient(cc grpc.ClientConnInterface) FeatureFlagServiceClient { + return &featureFlagServiceClient{cc} +} + +func (c *featureFlagServiceClient) GetFlag(ctx context.Context, in *GetFlagRequest, opts ...grpc.CallOption) (*GetFlagResponse, error) { + cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) + out := new(GetFlagResponse) + err := c.cc.Invoke(ctx, FeatureFlagService_GetFlag_FullMethodName, in, out, cOpts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *featureFlagServiceClient) CreateFlag(ctx context.Context, in *CreateFlagRequest, opts ...grpc.CallOption) (*CreateFlagResponse, error) { + cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) + out := new(CreateFlagResponse) + err := c.cc.Invoke(ctx, FeatureFlagService_CreateFlag_FullMethodName, in, out, cOpts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *featureFlagServiceClient) UpdateFlag(ctx context.Context, in *UpdateFlagRequest, opts ...grpc.CallOption) (*UpdateFlagResponse, error) { + cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) + out := new(UpdateFlagResponse) + err := c.cc.Invoke(ctx, FeatureFlagService_UpdateFlag_FullMethodName, in, out, cOpts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *featureFlagServiceClient) ListFlags(ctx context.Context, in *ListFlagsRequest, opts ...grpc.CallOption) (*ListFlagsResponse, error) { + cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) + out := new(ListFlagsResponse) + err := c.cc.Invoke(ctx, FeatureFlagService_ListFlags_FullMethodName, in, out, cOpts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *featureFlagServiceClient) DeleteFlag(ctx context.Context, in *DeleteFlagRequest, opts ...grpc.CallOption) (*DeleteFlagResponse, error) { + cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) + out := new(DeleteFlagResponse) + err := c.cc.Invoke(ctx, FeatureFlagService_DeleteFlag_FullMethodName, in, out, cOpts...) + if err != nil { + return nil, err + } + return out, nil +} + +// FeatureFlagServiceServer is the server API for FeatureFlagService service. +// All implementations must embed UnimplementedFeatureFlagServiceServer +// for forward compatibility. +type FeatureFlagServiceServer interface { + GetFlag(context.Context, *GetFlagRequest) (*GetFlagResponse, error) + CreateFlag(context.Context, *CreateFlagRequest) (*CreateFlagResponse, error) + UpdateFlag(context.Context, *UpdateFlagRequest) (*UpdateFlagResponse, error) + ListFlags(context.Context, *ListFlagsRequest) (*ListFlagsResponse, error) + DeleteFlag(context.Context, *DeleteFlagRequest) (*DeleteFlagResponse, error) + mustEmbedUnimplementedFeatureFlagServiceServer() +} + +// UnimplementedFeatureFlagServiceServer must be embedded to have +// forward compatible implementations. +// +// NOTE: this should be embedded by value instead of pointer to avoid a nil +// pointer dereference when methods are called. +type UnimplementedFeatureFlagServiceServer struct{} + +func (UnimplementedFeatureFlagServiceServer) GetFlag(context.Context, *GetFlagRequest) (*GetFlagResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method GetFlag not implemented") +} +func (UnimplementedFeatureFlagServiceServer) CreateFlag(context.Context, *CreateFlagRequest) (*CreateFlagResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method CreateFlag not implemented") +} +func (UnimplementedFeatureFlagServiceServer) UpdateFlag(context.Context, *UpdateFlagRequest) (*UpdateFlagResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method UpdateFlag not implemented") +} +func (UnimplementedFeatureFlagServiceServer) ListFlags(context.Context, *ListFlagsRequest) (*ListFlagsResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method ListFlags not implemented") +} +func (UnimplementedFeatureFlagServiceServer) DeleteFlag(context.Context, *DeleteFlagRequest) (*DeleteFlagResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method DeleteFlag not implemented") +} +func (UnimplementedFeatureFlagServiceServer) mustEmbedUnimplementedFeatureFlagServiceServer() {} +func (UnimplementedFeatureFlagServiceServer) testEmbeddedByValue() {} + +// UnsafeFeatureFlagServiceServer may be embedded to opt out of forward compatibility for this service. +// Use of this interface is not recommended, as added methods to FeatureFlagServiceServer will +// result in compilation errors. +type UnsafeFeatureFlagServiceServer interface { + mustEmbedUnimplementedFeatureFlagServiceServer() +} + +func RegisterFeatureFlagServiceServer(s grpc.ServiceRegistrar, srv FeatureFlagServiceServer) { + // If the following call pancis, it indicates UnimplementedFeatureFlagServiceServer was + // embedded by pointer and is nil. This will cause panics if an + // unimplemented method is ever invoked, so we test this at initialization + // time to prevent it from happening at runtime later due to I/O. + if t, ok := srv.(interface{ testEmbeddedByValue() }); ok { + t.testEmbeddedByValue() + } + s.RegisterService(&FeatureFlagService_ServiceDesc, srv) +} + +func _FeatureFlagService_GetFlag_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(GetFlagRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(FeatureFlagServiceServer).GetFlag(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: FeatureFlagService_GetFlag_FullMethodName, + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(FeatureFlagServiceServer).GetFlag(ctx, req.(*GetFlagRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _FeatureFlagService_CreateFlag_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(CreateFlagRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(FeatureFlagServiceServer).CreateFlag(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: FeatureFlagService_CreateFlag_FullMethodName, + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(FeatureFlagServiceServer).CreateFlag(ctx, req.(*CreateFlagRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _FeatureFlagService_UpdateFlag_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(UpdateFlagRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(FeatureFlagServiceServer).UpdateFlag(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: FeatureFlagService_UpdateFlag_FullMethodName, + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(FeatureFlagServiceServer).UpdateFlag(ctx, req.(*UpdateFlagRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _FeatureFlagService_ListFlags_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(ListFlagsRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(FeatureFlagServiceServer).ListFlags(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: FeatureFlagService_ListFlags_FullMethodName, + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(FeatureFlagServiceServer).ListFlags(ctx, req.(*ListFlagsRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _FeatureFlagService_DeleteFlag_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(DeleteFlagRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(FeatureFlagServiceServer).DeleteFlag(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: FeatureFlagService_DeleteFlag_FullMethodName, + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(FeatureFlagServiceServer).DeleteFlag(ctx, req.(*DeleteFlagRequest)) + } + return interceptor(ctx, in, info, handler) +} + +// FeatureFlagService_ServiceDesc is the grpc.ServiceDesc for FeatureFlagService service. +// It's only intended for direct use with grpc.RegisterService, +// and not to be introspected or modified (even as a copy) +var FeatureFlagService_ServiceDesc = grpc.ServiceDesc{ + ServiceName: "oteldemo.FeatureFlagService", + HandlerType: (*FeatureFlagServiceServer)(nil), + Methods: []grpc.MethodDesc{ + { + MethodName: "GetFlag", + Handler: _FeatureFlagService_GetFlag_Handler, + }, + { + MethodName: "CreateFlag", + Handler: _FeatureFlagService_CreateFlag_Handler, + }, + { + MethodName: "UpdateFlag", + Handler: _FeatureFlagService_UpdateFlag_Handler, + }, + { + MethodName: "ListFlags", + Handler: _FeatureFlagService_ListFlags_Handler, + }, + { + MethodName: "DeleteFlag", + Handler: _FeatureFlagService_DeleteFlag_Handler, + }, + }, + Streams: []grpc.StreamDesc{}, + Metadata: "demo.proto", +} diff --git a/src/checkout/go.mod b/src/checkout/go.mod new file mode 100644 index 0000000..7f0d505 --- /dev/null +++ b/src/checkout/go.mod @@ -0,0 +1,87 @@ +module github.com/open-telemetry/opentelemetry-demo/src/checkout + +go 1.24.2 + +require ( + github.com/IBM/sarama v1.46.1 + github.com/google/uuid v1.6.0 + github.com/open-feature/go-sdk v1.15.1 + github.com/open-feature/go-sdk-contrib/hooks/open-telemetry v0.3.6 + github.com/open-feature/go-sdk-contrib/providers/flagd v0.3.0 + go.opentelemetry.io/contrib/bridges/otelslog v0.13.0 + go.opentelemetry.io/contrib/instrumentation/google.golang.org/grpc/otelgrpc v0.63.0 + go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.63.0 + go.opentelemetry.io/contrib/instrumentation/runtime v0.63.0 + go.opentelemetry.io/otel v1.38.0 + go.opentelemetry.io/otel/exporters/otlp/otlplog/otlploggrpc v0.14.0 + go.opentelemetry.io/otel/exporters/otlp/otlpmetric/otlpmetricgrpc v1.38.0 + go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc v1.38.0 + go.opentelemetry.io/otel/log v0.14.0 + go.opentelemetry.io/otel/sdk v1.38.0 + go.opentelemetry.io/otel/sdk/log v0.14.0 + go.opentelemetry.io/otel/sdk/metric v1.38.0 + go.opentelemetry.io/otel/trace v1.38.0 + google.golang.org/grpc v1.75.1 + google.golang.org/protobuf v1.36.9 +) + +require ( + buf.build/gen/go/open-feature/flagd/connectrpc/go v1.18.1-20250127221518-be6d1143b690.1 // indirect + buf.build/gen/go/open-feature/flagd/grpc/go v1.5.1-20250127221518-be6d1143b690.2 // indirect + buf.build/gen/go/open-feature/flagd/protocolbuffers/go v1.36.6-20250127221518-be6d1143b690.1 // indirect + connectrpc.com/connect v1.18.1 // indirect + connectrpc.com/otelconnect v0.7.2 // indirect + github.com/barkimedes/go-deepcopy v0.0.0-20220514131651-17c30cfc62df // indirect + github.com/cenkalti/backoff/v5 v5.0.3 // indirect + github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc // indirect + github.com/diegoholiveira/jsonlogic/v3 v3.7.4 // indirect + github.com/eapache/go-resiliency v1.7.0 // indirect + github.com/eapache/go-xerial-snappy v0.0.0-20230731223053-c322873962e3 // indirect + github.com/eapache/queue v1.1.0 // indirect + github.com/felixge/httpsnoop v1.0.4 // indirect + github.com/fsnotify/fsnotify v1.8.0 // indirect + github.com/go-logr/logr v1.4.3 // indirect + github.com/go-logr/stdr v1.2.2 // indirect + github.com/golang/snappy v0.0.4 // indirect + github.com/grpc-ecosystem/grpc-gateway/v2 v2.27.2 // indirect + github.com/hashicorp/go-uuid v1.0.3 // indirect + github.com/hashicorp/golang-lru/v2 v2.0.7 // indirect + github.com/jcmturner/aescts/v2 v2.0.0 // indirect + github.com/jcmturner/dnsutils/v2 v2.0.0 // indirect + github.com/jcmturner/gofork v1.7.6 // indirect + github.com/jcmturner/gokrb5/v8 v8.4.4 // indirect + github.com/jcmturner/rpc/v2 v2.0.3 // indirect + github.com/klauspost/compress v1.18.0 // indirect + github.com/klauspost/cpuid/v2 v2.2.7 // indirect + github.com/open-feature/flagd-schemas v0.2.9-0.20250127221449-bb763438abc5 // indirect + github.com/open-feature/flagd/core v0.11.2 // indirect + github.com/pierrec/lz4/v4 v4.1.22 // indirect + github.com/rcrowley/go-metrics v0.0.0-20250401214520-65e299d6c5c9 // indirect + github.com/twmb/murmur3 v1.1.8 // indirect + github.com/xeipuuv/gojsonpointer v0.0.0-20190905194746-02993c407bfb // indirect + github.com/xeipuuv/gojsonreference v0.0.0-20180127040603-bd5ef7bd5415 // indirect + github.com/xeipuuv/gojsonschema v1.2.0 // indirect + github.com/zeebo/xxh3 v1.0.2 // indirect + go.opentelemetry.io/auto/sdk v1.1.0 // indirect + go.opentelemetry.io/otel/exporters/otlp/otlptrace v1.38.0 // indirect + go.opentelemetry.io/otel/metric v1.38.0 // indirect + go.opentelemetry.io/proto/otlp v1.7.1 // indirect + go.uber.org/mock v0.5.2 // indirect + go.uber.org/multierr v1.11.0 // indirect + go.uber.org/zap v1.27.0 // indirect + golang.org/x/crypto v0.42.0 // indirect + golang.org/x/exp v0.0.0-20250408133849-7e4ce0ab07d0 // indirect + golang.org/x/mod v0.27.0 // indirect + golang.org/x/net v0.44.0 // indirect + golang.org/x/sys v0.36.0 // indirect + golang.org/x/text v0.29.0 // indirect + google.golang.org/genproto/googleapis/api v0.0.0-20250825161204-c5933d9347a5 // indirect + google.golang.org/genproto/googleapis/rpc v0.0.0-20250825161204-c5933d9347a5 // indirect + google.golang.org/grpc/cmd/protoc-gen-go-grpc v1.5.1 // indirect + gopkg.in/yaml.v3 v3.0.1 // indirect +) + +tool ( + google.golang.org/grpc/cmd/protoc-gen-go-grpc + google.golang.org/protobuf/cmd/protoc-gen-go +) diff --git a/src/checkout/go.sum b/src/checkout/go.sum new file mode 100644 index 0000000..fe48a39 --- /dev/null +++ b/src/checkout/go.sum @@ -0,0 +1,225 @@ +buf.build/gen/go/open-feature/flagd/connectrpc/go v1.18.1-20250127221518-be6d1143b690.1 h1:BIA4nkcwwyl0zPZ4vutd5Mn+VeLOV756RmvbQbfnb9g= +buf.build/gen/go/open-feature/flagd/connectrpc/go v1.18.1-20250127221518-be6d1143b690.1/go.mod h1:BSerK2QrH0wQdgiFP6fKevMB4QXotvyXUfmE6mExwHY= +buf.build/gen/go/open-feature/flagd/grpc/go v1.5.1-20250127221518-be6d1143b690.2 h1:D3HI5RQbqgffyf+Z77+hReDx5kigFVAKGvttULD9/ms= +buf.build/gen/go/open-feature/flagd/grpc/go v1.5.1-20250127221518-be6d1143b690.2/go.mod h1:b9rfG6rbGXZAlLwQwedvZ0kI0nUcR+aLaYF70pj920E= +buf.build/gen/go/open-feature/flagd/protocolbuffers/go v1.36.6-20250127221518-be6d1143b690.1 h1:vxTpPJylwPBezTghhBEHOsdptq8+tb/PtSkGw3rhPQc= +buf.build/gen/go/open-feature/flagd/protocolbuffers/go v1.36.6-20250127221518-be6d1143b690.1/go.mod h1:cCQ49+ttXE2MZ/ciRNb0tCG+F3kj2ZVbP+0/psbhrLY= +connectrpc.com/connect v1.18.1 h1:PAg7CjSAGvscaf6YZKUefjoih5Z/qYkyaTrBW8xvYPw= +connectrpc.com/connect v1.18.1/go.mod h1:0292hj1rnx8oFrStN7cB4jjVBeqs+Yx5yDIC2prWDO8= +connectrpc.com/otelconnect v0.7.2 h1:WlnwFzaW64dN06JXU+hREPUGeEzpz3Acz2ACOmN8cMI= +connectrpc.com/otelconnect v0.7.2/go.mod h1:JS7XUKfuJs2adhCnXhNHPHLz6oAaZniCJdSF00OZSew= +github.com/IBM/sarama v1.46.1 h1:AlDkvyQm4LKktoQZxv0sbTfH3xukeH7r/UFBbUmFV9M= +github.com/IBM/sarama v1.46.1/go.mod h1:ipyOREIx+o9rMSrrPGLZHGuT0mzecNzKd19Quq+Q8AA= +github.com/barkimedes/go-deepcopy v0.0.0-20220514131651-17c30cfc62df h1:GSoSVRLoBaFpOOds6QyY1L8AX7uoY+Ln3BHc22W40X0= +github.com/barkimedes/go-deepcopy v0.0.0-20220514131651-17c30cfc62df/go.mod h1:hiVxq5OP2bUGBRNS3Z/bt/reCLFNbdcST6gISi1fiOM= +github.com/cenkalti/backoff/v5 v5.0.3 h1:ZN+IMa753KfX5hd8vVaMixjnqRZ3y8CuJKRKj1xcsSM= +github.com/cenkalti/backoff/v5 v5.0.3/go.mod h1:rkhZdG3JZukswDf7f0cwqPNk4K0sa+F97BxZthm/crw= +github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= +github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= +github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc h1:U9qPSI2PIWSS1VwoXQT9A3Wy9MM3WgvqSxFWenqJduM= +github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= +github.com/diegoholiveira/jsonlogic/v3 v3.7.4 h1:92HSmB9bwM/o0ZvrCpcvTP2EsPXSkKtAniIr2W/dcIM= +github.com/diegoholiveira/jsonlogic/v3 v3.7.4/go.mod h1:OYRb6FSTVmMM+MNQ7ElmMsczyNSepw+OU4Z8emDSi4w= +github.com/eapache/go-resiliency v1.7.0 h1:n3NRTnBn5N0Cbi/IeOHuQn9s2UwVUH7Ga0ZWcP+9JTA= +github.com/eapache/go-resiliency v1.7.0/go.mod h1:5yPzW0MIvSe0JDsv0v+DvcjEv2FyD6iZYSs1ZI+iQho= +github.com/eapache/go-xerial-snappy v0.0.0-20230731223053-c322873962e3 h1:Oy0F4ALJ04o5Qqpdz8XLIpNA3WM/iSIXqxtqo7UGVws= +github.com/eapache/go-xerial-snappy v0.0.0-20230731223053-c322873962e3/go.mod h1:YvSRo5mw33fLEx1+DlK6L2VV43tJt5Eyel9n9XBcR+0= +github.com/eapache/queue v1.1.0 h1:YOEu7KNc61ntiQlcEeUIoDTJ2o8mQznoNvUhiigpIqc= +github.com/eapache/queue v1.1.0/go.mod h1:6eCeP0CKFpHLu8blIFXhExK/dRa7WDZfr6jVFPTqq+I= +github.com/felixge/httpsnoop v1.0.4 h1:NFTV2Zj1bL4mc9sqWACXbQFVBBg2W3GPvqp8/ESS2Wg= +github.com/felixge/httpsnoop v1.0.4/go.mod h1:m8KPJKqk1gH5J9DgRY2ASl2lWCfGKXixSwevea8zH2U= +github.com/fortytw2/leaktest v1.3.0 h1:u8491cBMTQ8ft8aeV+adlcytMZylmA5nnwwkRZjI8vw= +github.com/fortytw2/leaktest v1.3.0/go.mod h1:jDsjWgpAGjm2CA7WthBh/CdZYEPF31XHquHwclZch5g= +github.com/fsnotify/fsnotify v1.8.0 h1:dAwr6QBTBZIkG8roQaJjGof0pp0EeF+tNV7YBP3F/8M= +github.com/fsnotify/fsnotify v1.8.0/go.mod h1:8jBTzvmWwFyi3Pb8djgCCO5IBqzKJ/Jwo8TRcHyHii0= +github.com/go-logr/logr v1.2.2/go.mod h1:jdQByPbusPIv2/zmleS9BjJVeZ6kBagPoEUsqbVz/1A= +github.com/go-logr/logr v1.4.3 h1:CjnDlHq8ikf6E492q6eKboGOC0T8CDaOvkHCIg8idEI= +github.com/go-logr/logr v1.4.3/go.mod h1:9T104GzyrTigFIr8wt5mBrctHMim0Nb2HLGrmQ40KvY= +github.com/go-logr/stdr v1.2.2 h1:hSWxHoqTgW2S2qGc0LTAI563KZ5YKYRhT3MFKZMbjag= +github.com/go-logr/stdr v1.2.2/go.mod h1:mMo/vtBO5dYbehREoey6XUKy/eSumjCCveDpRre4VKE= +github.com/golang/protobuf v1.5.4 h1:i7eJL8qZTpSEXOPTxNKhASYpMn+8e5Q6AdndVa1dWek= +github.com/golang/protobuf v1.5.4/go.mod h1:lnTiLA8Wa4RWRcIUkrtSVa5nRhsEGBg48fD6rSs7xps= +github.com/golang/snappy v0.0.4 h1:yAGX7huGHXlcLOEtBnF4w7FQwA26wojNCwOYAEhLjQM= +github.com/golang/snappy v0.0.4/go.mod h1:/XxbfmMg8lxefKM7IXC3fBNl/7bRcc72aCRzEWrmP2Q= +github.com/google/go-cmp v0.7.0 h1:wk8382ETsv4JYUZwIsn6YpYiWiBsYLSJiTsyBybVuN8= +github.com/google/go-cmp v0.7.0/go.mod h1:pXiqmnSA92OHEEa9HXL2W4E7lf9JzCmGVUdgjX3N/iU= +github.com/google/uuid v1.6.0 h1:NIvaJDMOsjHA8n1jAhLSgzrAzy1Hgr+hNrb57e+94F0= +github.com/google/uuid v1.6.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= +github.com/gorilla/securecookie v1.1.1/go.mod h1:ra0sb63/xPlUeL+yeDciTfxMRAA+MP+HVt/4epWDjd4= +github.com/gorilla/sessions v1.2.1/go.mod h1:dk2InVEVJ0sfLlnXv9EAgkf6ecYs/i80K/zI+bUmuGM= +github.com/grpc-ecosystem/grpc-gateway/v2 v2.27.2 h1:8Tjv8EJ+pM1xP8mK6egEbD1OgnVTyacbefKhmbLhIhU= +github.com/grpc-ecosystem/grpc-gateway/v2 v2.27.2/go.mod h1:pkJQ2tZHJ0aFOVEEot6oZmaVEZcRme73eIFmhiVuRWs= +github.com/hashicorp/go-uuid v1.0.2/go.mod h1:6SBZvOh/SIDV7/2o3Jml5SYk/TvGqwFJ/bN7x4byOro= +github.com/hashicorp/go-uuid v1.0.3 h1:2gKiV6YVmrJ1i2CKKa9obLvRieoRGviZFL26PcT/Co8= +github.com/hashicorp/go-uuid v1.0.3/go.mod h1:6SBZvOh/SIDV7/2o3Jml5SYk/TvGqwFJ/bN7x4byOro= +github.com/hashicorp/golang-lru/v2 v2.0.7 h1:a+bsQ5rvGLjzHuww6tVxozPZFVghXaHOwFs4luLUK2k= +github.com/hashicorp/golang-lru/v2 v2.0.7/go.mod h1:QeFd9opnmA6QUJc5vARoKUSoFhyfM2/ZepoAG6RGpeM= +github.com/jcmturner/aescts/v2 v2.0.0 h1:9YKLH6ey7H4eDBXW8khjYslgyqG2xZikXP0EQFKrle8= +github.com/jcmturner/aescts/v2 v2.0.0/go.mod h1:AiaICIRyfYg35RUkr8yESTqvSy7csK90qZ5xfvvsoNs= +github.com/jcmturner/dnsutils/v2 v2.0.0 h1:lltnkeZGL0wILNvrNiVCR6Ro5PGU/SeBvVO/8c/iPbo= +github.com/jcmturner/dnsutils/v2 v2.0.0/go.mod h1:b0TnjGOvI/n42bZa+hmXL+kFJZsFT7G4t3HTlQ184QM= +github.com/jcmturner/gofork v1.7.6 h1:QH0l3hzAU1tfT3rZCnW5zXl+orbkNMMRGJfdJjHVETg= +github.com/jcmturner/gofork v1.7.6/go.mod h1:1622LH6i/EZqLloHfE7IeZ0uEJwMSUyQ/nDd82IeqRo= +github.com/jcmturner/goidentity/v6 v6.0.1 h1:VKnZd2oEIMorCTsFBnJWbExfNN7yZr3EhJAxwOkZg6o= +github.com/jcmturner/goidentity/v6 v6.0.1/go.mod h1:X1YW3bgtvwAXju7V3LCIMpY0Gbxyjn/mY9zx4tFonSg= +github.com/jcmturner/gokrb5/v8 v8.4.4 h1:x1Sv4HaTpepFkXbt2IkL29DXRf8sOfZXo8eRKh687T8= +github.com/jcmturner/gokrb5/v8 v8.4.4/go.mod h1:1btQEpgT6k+unzCwX1KdWMEwPPkkgBtP+F6aCACiMrs= +github.com/jcmturner/rpc/v2 v2.0.3 h1:7FXXj8Ti1IaVFpSAziCZWNzbNuZmnvw/i6CqLNdWfZY= +github.com/jcmturner/rpc/v2 v2.0.3/go.mod h1:VUJYCIDm3PVOEHw8sgt091/20OJjskO/YJki3ELg/Hc= +github.com/klauspost/compress v1.18.0 h1:c/Cqfb0r+Yi+JtIEq73FWXVkRonBlf0CRNYc8Zttxdo= +github.com/klauspost/compress v1.18.0/go.mod h1:2Pp+KzxcywXVXMr50+X0Q/Lsb43OQHYWRCY2AiWywWQ= +github.com/klauspost/cpuid/v2 v2.2.7 h1:ZWSB3igEs+d0qvnxR/ZBzXVmxkgt8DdzP6m9pfuVLDM= +github.com/klauspost/cpuid/v2 v2.2.7/go.mod h1:Lcz8mBdAVJIBVzewtcLocK12l3Y+JytZYpaMropDUws= +github.com/kr/pretty v0.3.1 h1:flRD4NNwYAUpkphVc1HcthR4KEIFJ65n8Mw5qdRn3LE= +github.com/kr/pretty v0.3.1/go.mod h1:hoEshYVHaxMs3cyo3Yncou5ZscifuDolrwPKZanG3xk= +github.com/kr/text v0.2.0 h1:5Nx0Ya0ZqY2ygV366QzturHI13Jq95ApcVaJBhpS+AY= +github.com/kr/text v0.2.0/go.mod h1:eLer722TekiGuMkidMxC/pM04lWEeraHUUmBw8l2grE= +github.com/open-feature/flagd-schemas v0.2.9-0.20250127221449-bb763438abc5 h1:0RKCLYeQpvSsKR95kc894tm8GAZmq7bcG48v0KJ0HCs= +github.com/open-feature/flagd-schemas v0.2.9-0.20250127221449-bb763438abc5/go.mod h1:WKtwo1eW9/K6D+4HfgTXWBqCDzpvMhDa5eRxW7R5B2U= +github.com/open-feature/flagd/core v0.11.2 h1:3LAuLR2vXpBF80RwwCAu9JX898JasfPH7ErJEf5C5YA= +github.com/open-feature/flagd/core v0.11.2/go.mod h1:rTdYFyLGP1tGwxo0X26ygIrC31nINCv8hcCq+vhFD0E= +github.com/open-feature/go-sdk v1.15.1 h1:TC3FtHtOKlGlIbSf3SEpxXVhgTd/bCbuc39XHIyltkw= +github.com/open-feature/go-sdk v1.15.1/go.mod h1:2WAFYzt8rLYavcubpCoiym3iSCXiHdPB6DxtMkv2wyo= +github.com/open-feature/go-sdk-contrib/hooks/open-telemetry v0.3.6 h1:4UX24wgUa+zZkGeecn+884c3VHrXt9oca/krSFAjXNY= +github.com/open-feature/go-sdk-contrib/hooks/open-telemetry v0.3.6/go.mod h1:TftRJnT+7hyYDLBhuDUjDjabmBgOZYspYU9HUM9K3D0= +github.com/open-feature/go-sdk-contrib/providers/flagd v0.3.0 h1:WWOe6ym+lPWcc32FHyXCSEeSl/ghkl6mnOh+J9lwbo8= +github.com/open-feature/go-sdk-contrib/providers/flagd v0.3.0/go.mod h1:7qNKNDUWPtghLf8DguzobRL8D8pMsjnp657+/NTql9U= +github.com/pierrec/lz4/v4 v4.1.22 h1:cKFw6uJDK+/gfw5BcDL0JL5aBsAFdsIT18eRtLj7VIU= +github.com/pierrec/lz4/v4 v4.1.22/go.mod h1:gZWDp/Ze/IJXGXf23ltt2EXimqmTUXEy0GFuRQyBid4= +github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= +github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2 h1:Jamvg5psRIccs7FGNTlIRMkT8wgtp5eCXdBlqhYGL6U= +github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= +github.com/rcrowley/go-metrics v0.0.0-20250401214520-65e299d6c5c9 h1:bsUq1dX0N8AOIL7EB/X911+m4EHsnWEHeJ0c+3TTBrg= +github.com/rcrowley/go-metrics v0.0.0-20250401214520-65e299d6c5c9/go.mod h1:bCqnVzQkZxMG4s8nGwiZ5l3QUCyqpo9Y+/ZMZ9VjZe4= +github.com/rogpeppe/go-internal v1.13.1 h1:KvO1DLK/DRN07sQ1LQKScxyZJuNnedQ5/wKSR38lUII= +github.com/rogpeppe/go-internal v1.13.1/go.mod h1:uMEvuHeurkdAXX61udpOXGD/AzZDWNMNyH2VO9fmH0o= +github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= +github.com/stretchr/objx v0.4.0/go.mod h1:YvHI0jy2hoMjB+UWwv71VJQ9isScKT/TqJzVSSt89Yw= +github.com/stretchr/objx v0.5.0/go.mod h1:Yh+to48EsGEfYuaHDzXPcE3xhTkx73EhmCGUpEOglKo= +github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UVUgZn+9EI= +github.com/stretchr/testify v1.4.0/go.mod h1:j7eGeouHqKxXV5pUuKE4zz7dFj8WfuZ+81PSLYec5m4= +github.com/stretchr/testify v1.7.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= +github.com/stretchr/testify v1.8.0/go.mod h1:yNjHg4UonilssWZ8iaSj1OCr/vHnekPRkoO+kdMU+MU= +github.com/stretchr/testify v1.8.1/go.mod h1:w2LPCIKwWwSfY2zedu0+kehJoqGctiVI29o6fzry7u4= +github.com/stretchr/testify v1.11.1 h1:7s2iGBzp5EwR7/aIZr8ao5+dra3wiQyKjjFuvgVKu7U= +github.com/stretchr/testify v1.11.1/go.mod h1:wZwfW3scLgRK+23gO65QZefKpKQRnfz6sD981Nm4B6U= +github.com/twmb/murmur3 v1.1.8 h1:8Yt9taO/WN3l08xErzjeschgZU2QSrwm1kclYq+0aRg= +github.com/twmb/murmur3 v1.1.8/go.mod h1:Qq/R7NUyOfr65zD+6Q5IHKsJLwP7exErjN6lyyq3OSQ= +github.com/xeipuuv/gojsonpointer v0.0.0-20180127040702-4e3ac2762d5f/go.mod h1:N2zxlSyiKSe5eX1tZViRH5QA0qijqEDrYZiPEAiq3wU= +github.com/xeipuuv/gojsonpointer v0.0.0-20190905194746-02993c407bfb h1:zGWFAtiMcyryUHoUjUJX0/lt1H2+i2Ka2n+D3DImSNo= +github.com/xeipuuv/gojsonpointer v0.0.0-20190905194746-02993c407bfb/go.mod h1:N2zxlSyiKSe5eX1tZViRH5QA0qijqEDrYZiPEAiq3wU= +github.com/xeipuuv/gojsonreference v0.0.0-20180127040603-bd5ef7bd5415 h1:EzJWgHovont7NscjpAxXsDA8S8BMYve8Y5+7cuRE7R0= +github.com/xeipuuv/gojsonreference v0.0.0-20180127040603-bd5ef7bd5415/go.mod h1:GwrjFmJcFw6At/Gs6z4yjiIwzuJ1/+UwLxMQDVQXShQ= +github.com/xeipuuv/gojsonschema v1.2.0 h1:LhYJRs+L4fBtjZUfuSZIKGeVu0QRy8e5Xi7D17UxZ74= +github.com/xeipuuv/gojsonschema v1.2.0/go.mod h1:anYRn/JVcOK2ZgGU+IjEV4nwlhoK5sQluxsYJ78Id3Y= +github.com/yuin/goldmark v1.4.13/go.mod h1:6yULJ656Px+3vBD8DxQVa3kxgyrAnzto9xy5taEt/CY= +github.com/zeebo/assert v1.3.0 h1:g7C04CbJuIDKNPFHmsk4hwZDO5O+kntRxzaUoNXj+IQ= +github.com/zeebo/assert v1.3.0/go.mod h1:Pq9JiuJQpG8JLJdtkwrJESF0Foym2/D9XMU5ciN/wJ0= +github.com/zeebo/xxh3 v1.0.2 h1:xZmwmqxHZA8AI603jOQ0tMqmBr9lPeFwGg6d+xy9DC0= +github.com/zeebo/xxh3 v1.0.2/go.mod h1:5NWz9Sef7zIDm2JHfFlcQvNekmcEl9ekUZQQKCYaDcA= +go.opentelemetry.io/auto/sdk v1.1.0 h1:cH53jehLUN6UFLY71z+NDOiNJqDdPRaXzTel0sJySYA= +go.opentelemetry.io/auto/sdk v1.1.0/go.mod h1:3wSPjt5PWp2RhlCcmmOial7AvC4DQqZb7a7wCow3W8A= +go.opentelemetry.io/contrib/bridges/otelslog v0.13.0 h1:bwnLpizECbPr1RrQ27waeY2SPIPeccCx/xLuoYADZ9s= +go.opentelemetry.io/contrib/bridges/otelslog v0.13.0/go.mod h1:3nWlOiiqA9UtUnrcNk82mYasNxD8ehOspL0gOfEo6Y4= +go.opentelemetry.io/contrib/instrumentation/google.golang.org/grpc/otelgrpc v0.63.0 h1:YH4g8lQroajqUwWbq/tr2QX1JFmEXaDLgG+ew9bLMWo= +go.opentelemetry.io/contrib/instrumentation/google.golang.org/grpc/otelgrpc v0.63.0/go.mod h1:fvPi2qXDqFs8M4B4fmJhE92TyQs9Ydjlg3RvfUp+NbQ= +go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.63.0 h1:RbKq8BG0FI8OiXhBfcRtqqHcZcka+gU3cskNuf05R18= +go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.63.0/go.mod h1:h06DGIukJOevXaj/xrNjhi/2098RZzcLTbc0jDAUbsg= +go.opentelemetry.io/contrib/instrumentation/runtime v0.63.0 h1:PeBoRj6af6xMI7qCupwFvTbbnd49V7n5YpG6pg8iDYQ= +go.opentelemetry.io/contrib/instrumentation/runtime v0.63.0/go.mod h1:ingqBCtMCe8I4vpz/UVzCW6sxoqgZB37nao91mLQ3Bw= +go.opentelemetry.io/otel v1.38.0 h1:RkfdswUDRimDg0m2Az18RKOsnI8UDzppJAtj01/Ymk8= +go.opentelemetry.io/otel v1.38.0/go.mod h1:zcmtmQ1+YmQM9wrNsTGV/q/uyusom3P8RxwExxkZhjM= +go.opentelemetry.io/otel/exporters/otlp/otlplog/otlploggrpc v0.14.0 h1:OMqPldHt79PqWKOMYIAQs3CxAi7RLgPxwfFSwr4ZxtM= +go.opentelemetry.io/otel/exporters/otlp/otlplog/otlploggrpc v0.14.0/go.mod h1:1biG4qiqTxKiUCtoWDPpL3fB3KxVwCiGw81j3nKMuHE= +go.opentelemetry.io/otel/exporters/otlp/otlpmetric/otlpmetricgrpc v1.38.0 h1:vl9obrcoWVKp/lwl8tRE33853I8Xru9HFbw/skNeLs8= +go.opentelemetry.io/otel/exporters/otlp/otlpmetric/otlpmetricgrpc v1.38.0/go.mod h1:GAXRxmLJcVM3u22IjTg74zWBrRCKq8BnOqUVLodpcpw= +go.opentelemetry.io/otel/exporters/otlp/otlptrace v1.38.0 h1:GqRJVj7UmLjCVyVJ3ZFLdPRmhDUp2zFmQe3RHIOsw24= +go.opentelemetry.io/otel/exporters/otlp/otlptrace v1.38.0/go.mod h1:ri3aaHSmCTVYu2AWv44YMauwAQc0aqI9gHKIcSbI1pU= +go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc v1.38.0 h1:lwI4Dc5leUqENgGuQImwLo4WnuXFPetmPpkLi2IrX54= +go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc v1.38.0/go.mod h1:Kz/oCE7z5wuyhPxsXDuaPteSWqjSBD5YaSdbxZYGbGk= +go.opentelemetry.io/otel/log v0.14.0 h1:2rzJ+pOAZ8qmZ3DDHg73NEKzSZkhkGIua9gXtxNGgrM= +go.opentelemetry.io/otel/log v0.14.0/go.mod h1:5jRG92fEAgx0SU/vFPxmJvhIuDU9E1SUnEQrMlJpOno= +go.opentelemetry.io/otel/metric v1.38.0 h1:Kl6lzIYGAh5M159u9NgiRkmoMKjvbsKtYRwgfrA6WpA= +go.opentelemetry.io/otel/metric v1.38.0/go.mod h1:kB5n/QoRM8YwmUahxvI3bO34eVtQf2i4utNVLr9gEmI= +go.opentelemetry.io/otel/sdk v1.38.0 h1:l48sr5YbNf2hpCUj/FoGhW9yDkl+Ma+LrVl8qaM5b+E= +go.opentelemetry.io/otel/sdk v1.38.0/go.mod h1:ghmNdGlVemJI3+ZB5iDEuk4bWA3GkTpW+DOoZMYBVVg= +go.opentelemetry.io/otel/sdk/log v0.14.0 h1:JU/U3O7N6fsAXj0+CXz21Czg532dW2V4gG1HE/e8Zrg= +go.opentelemetry.io/otel/sdk/log v0.14.0/go.mod h1:imQvII+0ZylXfKU7/wtOND8Hn4OpT3YUoIgqJVksUkM= +go.opentelemetry.io/otel/sdk/log/logtest v0.14.0 h1:Ijbtz+JKXl8T2MngiwqBlPaHqc4YCaP/i13Qrow6gAM= +go.opentelemetry.io/otel/sdk/log/logtest v0.14.0/go.mod h1:dCU8aEL6q+L9cYTqcVOk8rM9Tp8WdnHOPLiBgp0SGOA= +go.opentelemetry.io/otel/sdk/metric v1.38.0 h1:aSH66iL0aZqo//xXzQLYozmWrXxyFkBJ6qT5wthqPoM= +go.opentelemetry.io/otel/sdk/metric v1.38.0/go.mod h1:dg9PBnW9XdQ1Hd6ZnRz689CbtrUp0wMMs9iPcgT9EZA= +go.opentelemetry.io/otel/trace v1.38.0 h1:Fxk5bKrDZJUH+AMyyIXGcFAPah0oRcT+LuNtJrmcNLE= +go.opentelemetry.io/otel/trace v1.38.0/go.mod h1:j1P9ivuFsTceSWe1oY+EeW3sc+Pp42sO++GHkg4wwhs= +go.opentelemetry.io/proto/otlp v1.7.1 h1:gTOMpGDb0WTBOP8JaO72iL3auEZhVmAQg4ipjOVAtj4= +go.opentelemetry.io/proto/otlp v1.7.1/go.mod h1:b2rVh6rfI/s2pHWNlB7ILJcRALpcNDzKhACevjI+ZnE= +go.uber.org/goleak v1.3.0 h1:2K3zAYmnTNqV73imy9J1T3WC+gmCePx2hEGkimedGto= +go.uber.org/goleak v1.3.0/go.mod h1:CoHD4mav9JJNrW/WLlf7HGZPjdw8EucARQHekz1X6bE= +go.uber.org/mock v0.5.2 h1:LbtPTcP8A5k9WPXj54PPPbjcI4Y6lhyOZXn+VS7wNko= +go.uber.org/mock v0.5.2/go.mod h1:wLlUxC2vVTPTaE3UD51E0BGOAElKrILxhVSDYQLld5o= +go.uber.org/multierr v1.11.0 h1:blXXJkSxSSfBVBlC76pxqeO+LN3aDfLQo+309xJstO0= +go.uber.org/multierr v1.11.0/go.mod h1:20+QtiLqy0Nd6FdQB9TLXag12DsQkrbs3htMFfDN80Y= +go.uber.org/zap v1.27.0 h1:aJMhYGrd5QSmlpLMr2MftRKl7t8J8PTZPA732ud/XR8= +go.uber.org/zap v1.27.0/go.mod h1:GB2qFLM7cTU87MWRP2mPIjqfIDnGu+VIO4V/SdhGo2E= +golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= +golang.org/x/crypto v0.0.0-20210921155107-089bfa567519/go.mod h1:GvvjBRRGRdwPK5ydBHafDWAxML/pGHZbMvKqRZ5+Abc= +golang.org/x/crypto v0.6.0/go.mod h1:OFC/31mSvZgRz0V1QTNCzfAI1aIRzbiufJtkMIlEp58= +golang.org/x/crypto v0.42.0 h1:chiH31gIWm57EkTXpwnqf8qeuMUi0yekh6mT2AvFlqI= +golang.org/x/crypto v0.42.0/go.mod h1:4+rDnOTJhQCx2q7/j6rAN5XDw8kPjeaXEUR2eL94ix8= +golang.org/x/exp v0.0.0-20250408133849-7e4ce0ab07d0 h1:R84qjqJb5nVJMxqWYb3np9L5ZsaDtB+a39EqjV0JSUM= +golang.org/x/exp v0.0.0-20250408133849-7e4ce0ab07d0/go.mod h1:S9Xr4PYopiDyqSyp5NjCrhFrqg6A5zA2E/iPHPhqnS8= +golang.org/x/mod v0.6.0-dev.0.20220419223038-86c51ed26bb4/go.mod h1:jJ57K6gSWd91VN4djpZkiMVwK6gcyfeH4XE8wZrZaV4= +golang.org/x/mod v0.27.0 h1:kb+q2PyFnEADO2IEF935ehFUXlWiNjJWtRNgBLSfbxQ= +golang.org/x/mod v0.27.0/go.mod h1:rWI627Fq0DEoudcK+MBkNkCe0EetEaDSwJJkCcjpazc= +golang.org/x/net v0.0.0-20190620200207-3b0461eec859/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= +golang.org/x/net v0.0.0-20200114155413-6afb5195e5aa/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= +golang.org/x/net v0.0.0-20210226172049-e18ecbb05110/go.mod h1:m0MpNAwzfU5UDzcl9v0D8zg8gWTRqZa9RBIspLL5mdg= +golang.org/x/net v0.0.0-20220722155237-a158d28d115b/go.mod h1:XRhObCWvk6IyKnWLug+ECip1KBveYUHfp+8e9klMJ9c= +golang.org/x/net v0.6.0/go.mod h1:2Tu9+aMcznHK/AK1HMvgo6xiTLG5rD5rZLDS+rp2Bjs= +golang.org/x/net v0.7.0/go.mod h1:2Tu9+aMcznHK/AK1HMvgo6xiTLG5rD5rZLDS+rp2Bjs= +golang.org/x/net v0.44.0 h1:evd8IRDyfNBMBTTY5XRF1vaZlD+EmWx6x8PkhR04H/I= +golang.org/x/net v0.44.0/go.mod h1:ECOoLqd5U3Lhyeyo/QDCEVQ4sNgYsqvCZ722XogGieY= +golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= +golang.org/x/sync v0.0.0-20220722155255-886fb9371eb4/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= +golang.org/x/sync v0.17.0 h1:l60nONMj9l5drqw6jlhIELNv9I0A4OFgRsG9k2oT9Ug= +golang.org/x/sync v0.17.0/go.mod h1:9KTHXmSnoGruLpwFjVSX0lNNA75CykiMECbovNTZqGI= +golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= +golang.org/x/sys v0.0.0-20201119102817-f84b799fce68/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20210615035016-665e8c7367d1/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-20220722155257-8c9f86f7a55f/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.5.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.36.0 h1:KVRy2GtZBrk1cBYA7MKu5bEZFxQk4NIDV6RLVcC8o0k= +golang.org/x/sys v0.36.0/go.mod h1:OgkHotnGiDImocRcuBABYBEXf8A9a87e/uXjp9XT3ks= +golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo= +golang.org/x/term v0.0.0-20210927222741-03fcf44c2211/go.mod h1:jbD1KX2456YbFQfuXm/mYQcufACuNUgVhRMnK/tPxf8= +golang.org/x/term v0.5.0/go.mod h1:jMB1sMXY+tzblOD4FWmEbocvup2/aLOaQEp7JmGp78k= +golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= +golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= +golang.org/x/text v0.3.7/go.mod h1:u+2+/6zg+i71rQMx5EYifcz6MCKuco9NR6JIITiCfzQ= +golang.org/x/text v0.7.0/go.mod h1:mrYo+phRRbMaCq/xk9113O4dZlRixOauAjOtrjsXDZ8= +golang.org/x/text v0.29.0 h1:1neNs90w9YzJ9BocxfsQNHKuAT4pkghyXc4nhZ6sJvk= +golang.org/x/text v0.29.0/go.mod h1:7MhJOA9CD2qZyOKYazxdYMF85OwPdEr9jTtBpO7ydH4= +golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= +golang.org/x/tools v0.0.0-20191119224855-298f0cb1881e/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= +golang.org/x/tools v0.1.12/go.mod h1:hNGJHUnrk76NpqgfD5Aqm5Crs+Hm0VOH/i9J2+nxYbc= +golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= +gonum.org/v1/gonum v0.16.0 h1:5+ul4Swaf3ESvrOnidPp4GZbzf0mxVQpDCYUQE7OJfk= +gonum.org/v1/gonum v0.16.0/go.mod h1:fef3am4MQ93R2HHpKnLk4/Tbh/s0+wqD5nfa6Pnwy4E= +google.golang.org/genproto/googleapis/api v0.0.0-20250825161204-c5933d9347a5 h1:BIRfGDEjiHRrk0QKZe3Xv2ieMhtgRGeLcZQ0mIVn4EY= +google.golang.org/genproto/googleapis/api v0.0.0-20250825161204-c5933d9347a5/go.mod h1:j3QtIyytwqGr1JUDtYXwtMXWPKsEa5LtzIFN1Wn5WvE= +google.golang.org/genproto/googleapis/rpc v0.0.0-20250825161204-c5933d9347a5 h1:eaY8u2EuxbRv7c3NiGK0/NedzVsCcV6hDuU5qPX5EGE= +google.golang.org/genproto/googleapis/rpc v0.0.0-20250825161204-c5933d9347a5/go.mod h1:M4/wBTSeyLxupu3W3tJtOgB14jILAS/XWPSSa3TAlJc= +google.golang.org/grpc v1.75.1 h1:/ODCNEuf9VghjgO3rqLcfg8fiOP0nSluljWFlDxELLI= +google.golang.org/grpc v1.75.1/go.mod h1:JtPAzKiq4v1xcAB2hydNlWI2RnF85XXcV0mhKXr2ecQ= +google.golang.org/grpc/cmd/protoc-gen-go-grpc v1.5.1 h1:F29+wU6Ee6qgu9TddPgooOdaqsxTMunOoj8KA5yuS5A= +google.golang.org/grpc/cmd/protoc-gen-go-grpc v1.5.1/go.mod h1:5KF+wpkbTSbGcR9zteSqZV6fqFOWBl4Yde8En8MryZA= +google.golang.org/protobuf v1.36.9 h1:w2gp2mA27hUeUzj9Ex9FBjsBm40zfaDtEWow293U7Iw= +google.golang.org/protobuf v1.36.9/go.mod h1:fuxRtAxBytpl4zzqUh6/eyUujkJdNiuEkXntxiD/uRU= +gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= +gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c h1:Hei/4ADfdWqJk1ZMxUNpqntNwaWcugrBjAiHlqqRiVk= +gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c/go.mod h1:JHkPIbrfpd72SG/EVd6muEfDQjcINNoR0C8j2r3qZ4Q= +gopkg.in/yaml.v2 v2.2.2/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= +gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= +gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA= +gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= diff --git a/src/checkout/kafka/producer.go b/src/checkout/kafka/producer.go new file mode 100644 index 0000000..3bd9cc6 --- /dev/null +++ b/src/checkout/kafka/producer.go @@ -0,0 +1,61 @@ +// Copyright The OpenTelemetry Authors +// SPDX-License-Identifier: Apache-2.0 +package kafka + +import ( + "fmt" + "log/slog" + + "github.com/IBM/sarama" +) + +var ( + Topic = "orders" + ProtocolVersion = sarama.V3_0_0_0 +) + +type saramaLogger struct { + logger *slog.Logger +} + +func (l *saramaLogger) Printf(format string, v ...interface{}) { + l.logger.Info(fmt.Sprintf(format, v...)) +} +func (l *saramaLogger) Println(v ...interface{}) { + l.logger.Info(fmt.Sprint(v...)) +} +func (l *saramaLogger) Print(v ...interface{}) { + l.logger.Info(fmt.Sprint(v...)) +} + +func CreateKafkaProducer(brokers []string, logger *slog.Logger) (sarama.AsyncProducer, error) { + // Set the logger for sarama to use. + sarama.Logger = &saramaLogger{logger: logger} + + saramaConfig := sarama.NewConfig() + saramaConfig.Producer.Return.Successes = true + saramaConfig.Producer.Return.Errors = true + + // Sarama has an issue in a single broker kafka if the kafka broker is restarted. + // This setting is to prevent that issue from manifesting itself, but may swallow failed messages. + saramaConfig.Producer.RequiredAcks = sarama.NoResponse + + saramaConfig.Version = ProtocolVersion + + // So we can know the partition and offset of messages. + saramaConfig.Producer.Return.Successes = true + + producer, err := sarama.NewAsyncProducer(brokers, saramaConfig) + if err != nil { + return nil, err + } + + // We will log to STDOUT if we're not able to produce messages. + go func() { + for err := range producer.Errors() { + logger.Error(fmt.Sprintf("Failed to write message: %+v", err)) + + } + }() + return producer, nil +} diff --git a/src/checkout/main.go b/src/checkout/main.go new file mode 100644 index 0000000..f200865 --- /dev/null +++ b/src/checkout/main.go @@ -0,0 +1,729 @@ +// Copyright The OpenTelemetry Authors +// SPDX-License-Identifier: Apache-2.0 +package main + +import ( + "bytes" + "context" + "encoding/json" + "fmt" + "io" + "log/slog" + "net" + "net/http" + "os" + "os/signal" + "strconv" + "sync" + "syscall" + "time" + + "go.opentelemetry.io/otel/attribute" + "go.opentelemetry.io/otel/log/global" + semconv "go.opentelemetry.io/otel/semconv/v1.24.0" + "go.opentelemetry.io/otel/trace" + + "github.com/IBM/sarama" + "github.com/google/uuid" + otelhooks "github.com/open-feature/go-sdk-contrib/hooks/open-telemetry/pkg" + flagd "github.com/open-feature/go-sdk-contrib/providers/flagd/pkg" + "github.com/open-feature/go-sdk/openfeature" + + "go.opentelemetry.io/contrib/bridges/otelslog" + "go.opentelemetry.io/contrib/instrumentation/google.golang.org/grpc/otelgrpc" + "go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp" + "go.opentelemetry.io/contrib/instrumentation/runtime" + "go.opentelemetry.io/otel" + otelcodes "go.opentelemetry.io/otel/codes" + "go.opentelemetry.io/otel/exporters/otlp/otlplog/otlploggrpc" + "go.opentelemetry.io/otel/exporters/otlp/otlpmetric/otlpmetricgrpc" + "go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc" + "go.opentelemetry.io/otel/propagation" + + sdklog "go.opentelemetry.io/otel/sdk/log" + sdkmetric "go.opentelemetry.io/otel/sdk/metric" + sdkresource "go.opentelemetry.io/otel/sdk/resource" + sdktrace "go.opentelemetry.io/otel/sdk/trace" + + "google.golang.org/grpc" + "google.golang.org/grpc/codes" + "google.golang.org/grpc/credentials/insecure" + "google.golang.org/grpc/health" + healthpb "google.golang.org/grpc/health/grpc_health_v1" + "google.golang.org/grpc/status" + "google.golang.org/protobuf/proto" + + pb "github.com/open-telemetry/opentelemetry-demo/src/checkout/genproto/oteldemo" + "github.com/open-telemetry/opentelemetry-demo/src/checkout/kafka" + "github.com/open-telemetry/opentelemetry-demo/src/checkout/money" +) + +//go:generate go install google.golang.org/protobuf/cmd/protoc-gen-go +//go:generate go install google.golang.org/grpc/cmd/protoc-gen-go-grpc +//go:generate protoc --go_out=./ --go-grpc_out=./ --proto_path=../../pb ../../pb/demo.proto + +var logger *slog.Logger +var tracer trace.Tracer +var resource *sdkresource.Resource +var initResourcesOnce sync.Once + +func initResource() *sdkresource.Resource { + initResourcesOnce.Do(func() { + extraResources, _ := sdkresource.New( + context.Background(), + sdkresource.WithOS(), + sdkresource.WithProcess(), + sdkresource.WithContainer(), + sdkresource.WithHost(), + ) + resource, _ = sdkresource.Merge( + sdkresource.Default(), + extraResources, + ) + }) + return resource +} + +func initTracerProvider() *sdktrace.TracerProvider { + ctx := context.Background() + + exporter, err := otlptracegrpc.New(ctx) + if err != nil { + logger.Error(fmt.Sprintf("new otlp trace grpc exporter failed: %v", err)) + } + tp := sdktrace.NewTracerProvider( + sdktrace.WithBatcher(exporter), + sdktrace.WithResource(initResource()), + ) + otel.SetTracerProvider(tp) + otel.SetTextMapPropagator(propagation.NewCompositeTextMapPropagator(propagation.TraceContext{}, propagation.Baggage{})) + return tp +} + +func initMeterProvider() *sdkmetric.MeterProvider { + ctx := context.Background() + + exporter, err := otlpmetricgrpc.New(ctx) + if err != nil { + logger.Error(fmt.Sprintf("new otlp metric grpc exporter failed: %v", err)) + } + + mp := sdkmetric.NewMeterProvider( + sdkmetric.WithReader(sdkmetric.NewPeriodicReader(exporter)), + sdkmetric.WithResource(initResource()), + ) + otel.SetMeterProvider(mp) + return mp +} + +func initLoggerProvider() *sdklog.LoggerProvider { + ctx := context.Background() + + logExporter, err := otlploggrpc.New(ctx) + if err != nil { + return nil + } + + loggerProvider := sdklog.NewLoggerProvider( + sdklog.WithProcessor(sdklog.NewBatchProcessor(logExporter)), + ) + global.SetLoggerProvider(loggerProvider) + + return loggerProvider +} + +type checkout struct { + productCatalogSvcAddr string + cartSvcAddr string + currencySvcAddr string + shippingSvcAddr string + emailSvcAddr string + paymentSvcAddr string + kafkaBrokerSvcAddr string + pb.UnimplementedCheckoutServiceServer + KafkaProducerClient sarama.AsyncProducer + shippingSvcClient pb.ShippingServiceClient + productCatalogSvcClient pb.ProductCatalogServiceClient + cartSvcClient pb.CartServiceClient + currencySvcClient pb.CurrencyServiceClient + emailSvcClient pb.EmailServiceClient + paymentSvcClient pb.PaymentServiceClient +} + +func main() { + var port string + mustMapEnv(&port, "CHECKOUT_PORT") + + tp := initTracerProvider() + defer func() { + if err := tp.Shutdown(context.Background()); err != nil { + logger.Error(fmt.Sprintf("Error shutting down tracer provider: %v", err)) + } + }() + + mp := initMeterProvider() + defer func() { + if err := mp.Shutdown(context.Background()); err != nil { + logger.Error(fmt.Sprintf("Error shutting down meter provider: %v", err)) + } + }() + + lp := initLoggerProvider() + defer func() { + if err := lp.Shutdown(context.Background()); err != nil { + logger.Error(fmt.Sprintf("Error shutting down logger provider: %v", err)) + } + }() + + // this *must* be called after the logger provider is initialized + // otherwise the Sarama producer in kafka/producer.go will not be + // able to log properly + logger = otelslog.NewLogger("checkout") + slog.SetDefault(logger) + + err := runtime.Start(runtime.WithMinimumReadMemStatsInterval(time.Second)) + if err != nil { + logger.Error((err.Error())) + } + + provider, err := flagd.NewProvider() + if err != nil { + logger.Error(fmt.Sprintf("Error creating flagd provider: %v", err)) + } + + openfeature.SetProvider(provider) + openfeature.AddHooks(otelhooks.NewTracesHook()) + + tracer = tp.Tracer("checkout") + + svc := new(checkout) + + mustMapEnv(&svc.shippingSvcAddr, "SHIPPING_ADDR") + c := mustCreateClient(svc.shippingSvcAddr) + svc.shippingSvcClient = pb.NewShippingServiceClient(c) + defer c.Close() + + mustMapEnv(&svc.productCatalogSvcAddr, "PRODUCT_CATALOG_ADDR") + c = mustCreateClient(svc.productCatalogSvcAddr) + svc.productCatalogSvcClient = pb.NewProductCatalogServiceClient(c) + defer c.Close() + + mustMapEnv(&svc.cartSvcAddr, "CART_ADDR") + c = mustCreateClient(svc.cartSvcAddr) + svc.cartSvcClient = pb.NewCartServiceClient(c) + defer c.Close() + + mustMapEnv(&svc.currencySvcAddr, "CURRENCY_ADDR") + c = mustCreateClient(svc.currencySvcAddr) + svc.currencySvcClient = pb.NewCurrencyServiceClient(c) + defer c.Close() + + mustMapEnv(&svc.emailSvcAddr, "EMAIL_ADDR") + c = mustCreateClient(svc.emailSvcAddr) + svc.emailSvcClient = pb.NewEmailServiceClient(c) + defer c.Close() + + mustMapEnv(&svc.paymentSvcAddr, "PAYMENT_ADDR") + c = mustCreateClient(svc.paymentSvcAddr) + svc.paymentSvcClient = pb.NewPaymentServiceClient(c) + defer c.Close() + + svc.kafkaBrokerSvcAddr = os.Getenv("KAFKA_ADDR") + + if svc.kafkaBrokerSvcAddr != "" { + svc.KafkaProducerClient, err = kafka.CreateKafkaProducer([]string{svc.kafkaBrokerSvcAddr}, logger) + if err != nil { + logger.Error(err.Error()) + } + } + + logger.Info(fmt.Sprintf("service config: %+v", svc)) + + lis, err := net.Listen("tcp", fmt.Sprintf(":%s", port)) + if err != nil { + logger.Error(err.Error()) + } + + var srv = grpc.NewServer( + grpc.StatsHandler(otelgrpc.NewServerHandler()), + ) + pb.RegisterCheckoutServiceServer(srv, svc) + + healthcheck := health.NewServer() + healthpb.RegisterHealthServer(srv, healthcheck) + logger.Info(fmt.Sprintf("starting to listen on tcp: %q", lis.Addr().String())) + err = srv.Serve(lis) + logger.Error(err.Error()) + + ctx, cancel := signal.NotifyContext(context.Background(), os.Interrupt, syscall.SIGTERM, syscall.SIGKILL) + defer cancel() + + go func() { + if err := srv.Serve(lis); err != nil { + logger.Error(err.Error()) + } + }() + + <-ctx.Done() + + srv.GracefulStop() + logger.Info("Checkout gRPC server stopped") +} + +func mustMapEnv(target *string, envKey string) { + v := os.Getenv(envKey) + if v == "" { + panic(fmt.Sprintf("environment variable %q not set", envKey)) + } + *target = v +} + +func (cs *checkout) Check(ctx context.Context, req *healthpb.HealthCheckRequest) (*healthpb.HealthCheckResponse, error) { + return &healthpb.HealthCheckResponse{Status: healthpb.HealthCheckResponse_SERVING}, nil +} + +func (cs *checkout) Watch(req *healthpb.HealthCheckRequest, ws healthpb.Health_WatchServer) error { + return status.Errorf(codes.Unimplemented, "health check via Watch not implemented") +} + +func (cs *checkout) PlaceOrder(ctx context.Context, req *pb.PlaceOrderRequest) (*pb.PlaceOrderResponse, error) { + span := trace.SpanFromContext(ctx) + span.SetAttributes( + attribute.String("app.user.id", req.UserId), + attribute.String("app.user.currency", req.UserCurrency), + ) + logger.LogAttrs( + ctx, + slog.LevelInfo, "[PlaceOrder]", + slog.String("user_id", req.UserId), + slog.String("user_currency", req.UserCurrency), + ) + + var err error + defer func() { + if err != nil { + span.AddEvent("error", trace.WithAttributes(semconv.ExceptionMessageKey.String(err.Error()))) + } + }() + + orderID, err := uuid.NewUUID() + if err != nil { + return nil, status.Errorf(codes.Internal, "failed to generate order uuid") + } + + prep, err := cs.prepareOrderItemsAndShippingQuoteFromCart(ctx, req.UserId, req.UserCurrency, req.Address) + if err != nil { + return nil, status.Errorf(codes.Internal, err.Error()) + } + span.AddEvent("prepared") + + total := &pb.Money{CurrencyCode: req.UserCurrency, + Units: 0, + Nanos: 0} + total = money.Must(money.Sum(total, prep.shippingCostLocalized)) + for _, it := range prep.orderItems { + multPrice := money.MultiplySlow(it.Cost, uint32(it.GetItem().GetQuantity())) + total = money.Must(money.Sum(total, multPrice)) + } + + txID, err := cs.chargeCard(ctx, total, req.CreditCard) + if err != nil { + return nil, status.Errorf(codes.Internal, "failed to charge card: %+v", err) + } + + span.AddEvent("charged", + trace.WithAttributes(attribute.String("app.payment.transaction.id", txID))) + logger.LogAttrs( + ctx, + slog.LevelInfo, "payment went through", + slog.String("transaction_id", txID), + ) + + shippingTrackingID, err := cs.shipOrder(ctx, req.Address, prep.cartItems) + if err != nil { + return nil, status.Errorf(codes.Unavailable, "shipping error: %+v", err) + } + shippingTrackingAttribute := attribute.String("app.shipping.tracking.id", shippingTrackingID) + span.AddEvent("shipped", trace.WithAttributes(shippingTrackingAttribute)) + + _ = cs.emptyUserCart(ctx, req.UserId) + + orderResult := &pb.OrderResult{ + OrderId: orderID.String(), + ShippingTrackingId: shippingTrackingID, + ShippingCost: prep.shippingCostLocalized, + ShippingAddress: req.Address, + Items: prep.orderItems, + } + + shippingCostFloat, _ := strconv.ParseFloat(fmt.Sprintf("%d.%02d", prep.shippingCostLocalized.GetUnits(), prep.shippingCostLocalized.GetNanos()/1000000000), 64) + totalPriceFloat, _ := strconv.ParseFloat(fmt.Sprintf("%d.%02d", total.GetUnits(), total.GetNanos()/1000000000), 64) + + span.SetAttributes( + attribute.String("app.order.id", orderID.String()), + attribute.Float64("app.shipping.amount", shippingCostFloat), + attribute.Float64("app.order.amount", totalPriceFloat), + attribute.Int("app.order.items.count", len(prep.orderItems)), + shippingTrackingAttribute, + ) + logger.LogAttrs( + ctx, + slog.LevelInfo, "order placed", + slog.String("app.order.id", orderID.String()), + slog.Float64("app.shipping.amount", shippingCostFloat), + slog.Float64("app.order.amount", totalPriceFloat), + slog.Int("app.order.items.count", len(prep.orderItems)), + slog.String("app.shipping.tracking.id", shippingTrackingID), + ) + + if err := cs.sendOrderConfirmation(ctx, req.Email, orderResult); err != nil { + logger.Warn(fmt.Sprintf("failed to send order confirmation to %q: %+v", req.Email, err)) + } else { + logger.Info(fmt.Sprintf("order confirmation email sent to %q", req.Email)) + } + + // send to kafka only if kafka broker address is set + if cs.kafkaBrokerSvcAddr != "" { + logger.Info("sending to postProcessor") + cs.sendToPostProcessor(ctx, orderResult) + } + + resp := &pb.PlaceOrderResponse{Order: orderResult} + return resp, nil +} + +type orderPrep struct { + orderItems []*pb.OrderItem + cartItems []*pb.CartItem + shippingCostLocalized *pb.Money +} + +func (cs *checkout) prepareOrderItemsAndShippingQuoteFromCart(ctx context.Context, userID, userCurrency string, address *pb.Address) (orderPrep, error) { + + ctx, span := tracer.Start(ctx, "prepareOrderItemsAndShippingQuoteFromCart") + defer span.End() + + var out orderPrep + cartItems, err := cs.getUserCart(ctx, userID) + if err != nil { + return out, fmt.Errorf("cart failure: %+v", err) + } + orderItems, err := cs.prepOrderItems(ctx, cartItems, userCurrency) + if err != nil { + return out, fmt.Errorf("failed to prepare order: %+v", err) + } + shippingUSD, err := cs.quoteShipping(ctx, address, cartItems) + if err != nil { + return out, fmt.Errorf("shipping quote failure: %+v", err) + } + shippingPrice, err := cs.convertCurrency(ctx, shippingUSD, userCurrency) + if err != nil { + return out, fmt.Errorf("failed to convert shipping cost to currency: %+v", err) + } + + out.shippingCostLocalized = shippingPrice + out.cartItems = cartItems + out.orderItems = orderItems + + var totalCart int32 + for _, ci := range cartItems { + totalCart += ci.Quantity + } + shippingCostFloat, _ := strconv.ParseFloat(fmt.Sprintf("%d.%02d", shippingPrice.GetUnits(), shippingPrice.GetNanos()/1000000000), 64) + + span.SetAttributes( + attribute.Float64("app.shipping.amount", shippingCostFloat), + attribute.Int("app.cart.items.count", int(totalCart)), + attribute.Int("app.order.items.count", len(orderItems)), + ) + return out, nil +} + +func mustCreateClient(svcAddr string) *grpc.ClientConn { + c, err := grpc.NewClient(svcAddr, + grpc.WithTransportCredentials(insecure.NewCredentials()), + grpc.WithStatsHandler(otelgrpc.NewClientHandler()), + ) + if err != nil { + logger.Error(fmt.Sprintf("could not connect to %s service, err: %+v", svcAddr, err)) + } + + return c +} + +func (cs *checkout) quoteShipping(ctx context.Context, address *pb.Address, items []*pb.CartItem) (*pb.Money, error) { + quotePayload, err := json.Marshal(map[string]interface{}{ + "address": address, + "items": items, + }) + if err != nil { + return nil, fmt.Errorf("failed to marshal ship order request: %+v", err) + } + + resp, err := otelhttp.Post(ctx, cs.shippingSvcAddr+"/get-quote", "application/json", bytes.NewBuffer(quotePayload)) + if err != nil { + return nil, fmt.Errorf("failed POST to shipping service: %+v", err) + } + defer resp.Body.Close() + + if resp.StatusCode != http.StatusOK { + return nil, fmt.Errorf("failed POST to email service: expected 200, got %d", resp.StatusCode) + } + + shippingQuoteBytes, err := io.ReadAll(resp.Body) + if err != nil { + return nil, fmt.Errorf("failed to read shipping quote response: %+v", err) + } + + var quoteResp struct { + CostUsd *pb.Money `json:"cost_usd"` + } + if err := json.Unmarshal(shippingQuoteBytes, "eResp); err != nil { + return nil, fmt.Errorf("failed to unmarshal shipping quote: %+v", err) + } + if quoteResp.CostUsd == nil { + return nil, fmt.Errorf("shipping quote missing cost_usd field") + } + + return quoteResp.CostUsd, nil +} + +func (cs *checkout) getUserCart(ctx context.Context, userID string) ([]*pb.CartItem, error) { + cart, err := cs.cartSvcClient.GetCart(ctx, &pb.GetCartRequest{UserId: userID}) + if err != nil { + return nil, fmt.Errorf("failed to get user cart during checkout: %+v", err) + } + return cart.GetItems(), nil +} + +func (cs *checkout) emptyUserCart(ctx context.Context, userID string) error { + if _, err := cs.cartSvcClient.EmptyCart(ctx, &pb.EmptyCartRequest{UserId: userID}); err != nil { + return fmt.Errorf("failed to empty user cart during checkout: %+v", err) + } + return nil +} + +func (cs *checkout) prepOrderItems(ctx context.Context, items []*pb.CartItem, userCurrency string) ([]*pb.OrderItem, error) { + out := make([]*pb.OrderItem, len(items)) + + for i, item := range items { + product, err := cs.productCatalogSvcClient.GetProduct(ctx, &pb.GetProductRequest{Id: item.GetProductId()}) + if err != nil { + return nil, fmt.Errorf("failed to get product #%q", item.GetProductId()) + } + price, err := cs.convertCurrency(ctx, product.GetPriceUsd(), userCurrency) + if err != nil { + return nil, fmt.Errorf("failed to convert price of %q to %s", item.GetProductId(), userCurrency) + } + out[i] = &pb.OrderItem{ + Item: item, + Cost: price} + } + return out, nil +} + +func (cs *checkout) convertCurrency(ctx context.Context, from *pb.Money, toCurrency string) (*pb.Money, error) { + result, err := cs.currencySvcClient.Convert(ctx, &pb.CurrencyConversionRequest{ + From: from, + ToCode: toCurrency}) + if err != nil { + return nil, fmt.Errorf("failed to convert currency: %+v", err) + } + return result, err +} + +func (cs *checkout) chargeCard(ctx context.Context, amount *pb.Money, paymentInfo *pb.CreditCardInfo) (string, error) { + paymentService := cs.paymentSvcClient + if cs.isFeatureFlagEnabled(ctx, "paymentUnreachable") { + badAddress := "badAddress:50051" + c := mustCreateClient(badAddress) + paymentService = pb.NewPaymentServiceClient(c) + } + + paymentResp, err := paymentService.Charge(ctx, &pb.ChargeRequest{ + Amount: amount, + CreditCard: paymentInfo}) + if err != nil { + return "", fmt.Errorf("could not charge the card: %+v", err) + } + return paymentResp.GetTransactionId(), nil +} + +func (cs *checkout) sendOrderConfirmation(ctx context.Context, email string, order *pb.OrderResult) error { + emailPayload, err := json.Marshal(map[string]interface{}{ + "email": email, + "order": order, + }) + if err != nil { + return fmt.Errorf("failed to marshal order to JSON: %+v", err) + } + + resp, err := otelhttp.Post(ctx, cs.emailSvcAddr+"/send_order_confirmation", "application/json", bytes.NewBuffer(emailPayload)) + if err != nil { + return fmt.Errorf("failed POST to email service: %+v", err) + } + defer resp.Body.Close() + + if resp.StatusCode != http.StatusOK { + return fmt.Errorf("failed POST to email service: expected 200, got %d", resp.StatusCode) + } + + return err +} + +func (cs *checkout) shipOrder(ctx context.Context, address *pb.Address, items []*pb.CartItem) (string, error) { + shipPayload, err := json.Marshal(map[string]interface{}{ + "address": address, + "items": items, + }) + if err != nil { + return "", fmt.Errorf("failed to marshal ship order request: %+v", err) + } + + resp, err := otelhttp.Post(ctx, cs.shippingSvcAddr+"/ship-order", "application/json", bytes.NewBuffer(shipPayload)) + if err != nil { + return "", fmt.Errorf("failed POST to shipping service: %+v", err) + } + defer resp.Body.Close() + + if resp.StatusCode != http.StatusOK { + return "", fmt.Errorf("failed POST to email service: expected 200, got %d", resp.StatusCode) + } + + trackingRespBytes, err := io.ReadAll(resp.Body) + if err != nil { + return "", fmt.Errorf("failed to read ship order response: %+v", err) + } + + var shipResp struct { + TrackingID string `json:"tracking_id"` + } + if err := json.Unmarshal(trackingRespBytes, &shipResp); err != nil { + return "", fmt.Errorf("failed to unmarshal ship order response: %+v", err) + } + if shipResp.TrackingID == "" { + return "", fmt.Errorf("ship order response missing tracking_id field") + } + + return shipResp.TrackingID, nil +} + +func (cs *checkout) sendToPostProcessor(ctx context.Context, result *pb.OrderResult) { + message, err := proto.Marshal(result) + if err != nil { + logger.Error(fmt.Sprintf("Failed to marshal message to protobuf: %+v", err)) + return + } + + msg := sarama.ProducerMessage{ + Topic: kafka.Topic, + Value: sarama.ByteEncoder(message), + } + + // Inject tracing info into message + span := createProducerSpan(ctx, &msg) + defer span.End() + + // Send message and handle response + startTime := time.Now() + select { + case cs.KafkaProducerClient.Input() <- &msg: + select { + case successMsg := <-cs.KafkaProducerClient.Successes(): + span.SetAttributes( + attribute.Bool("messaging.kafka.producer.success", true), + attribute.Int("messaging.kafka.producer.duration_ms", int(time.Since(startTime).Milliseconds())), + attribute.KeyValue(semconv.MessagingKafkaMessageOffset(int(successMsg.Offset))), + ) + logger.Info(fmt.Sprintf("Successful to write message. offset: %v, duration: %v", successMsg.Offset, time.Since(startTime))) + case errMsg := <-cs.KafkaProducerClient.Errors(): + span.SetAttributes( + attribute.Bool("messaging.kafka.producer.success", false), + attribute.Int("messaging.kafka.producer.duration_ms", int(time.Since(startTime).Milliseconds())), + ) + span.SetStatus(otelcodes.Error, errMsg.Err.Error()) + logger.Error(fmt.Sprintf("Failed to write message: %v", errMsg.Err)) + case <-ctx.Done(): + span.SetAttributes( + attribute.Bool("messaging.kafka.producer.success", false), + attribute.Int("messaging.kafka.producer.duration_ms", int(time.Since(startTime).Milliseconds())), + ) + span.SetStatus(otelcodes.Error, "Context cancelled: "+ctx.Err().Error()) + logger.Warn(fmt.Sprintf("Context canceled before success message received: %v", ctx.Err())) + } + case <-ctx.Done(): + span.SetAttributes( + attribute.Bool("messaging.kafka.producer.success", false), + attribute.Int("messaging.kafka.producer.duration_ms", int(time.Since(startTime).Milliseconds())), + ) + span.SetStatus(otelcodes.Error, "Failed to send: "+ctx.Err().Error()) + logger.Error(fmt.Sprintf("Failed to send message to Kafka within context deadline: %v", ctx.Err())) + return + } + + ffValue := cs.getIntFeatureFlag(ctx, "kafkaQueueProblems") + if ffValue > 0 { + logger.Info("Warning: FeatureFlag 'kafkaQueueProblems' is activated, overloading queue now.") + for i := 0; i < ffValue; i++ { + go func(i int) { + cs.KafkaProducerClient.Input() <- &msg + _ = <-cs.KafkaProducerClient.Successes() + }(i) + } + logger.Info(fmt.Sprintf("Done with #%d messages for overload simulation.", ffValue)) + } +} + +func createProducerSpan(ctx context.Context, msg *sarama.ProducerMessage) trace.Span { + spanContext, span := tracer.Start( + ctx, + fmt.Sprintf("%s publish", msg.Topic), + trace.WithSpanKind(trace.SpanKindProducer), + trace.WithAttributes( + semconv.PeerService("kafka"), + semconv.NetworkTransportTCP, + semconv.MessagingSystemKafka, + semconv.MessagingDestinationName(msg.Topic), + semconv.MessagingOperationPublish, + semconv.MessagingKafkaDestinationPartition(int(msg.Partition)), + ), + ) + + carrier := propagation.MapCarrier{} + propagator := otel.GetTextMapPropagator() + propagator.Inject(spanContext, carrier) + + for key, value := range carrier { + msg.Headers = append(msg.Headers, sarama.RecordHeader{Key: []byte(key), Value: []byte(value)}) + } + + return span +} + +func (cs *checkout) isFeatureFlagEnabled(ctx context.Context, featureFlagName string) bool { + client := openfeature.NewClient("checkout") + + // Default value is set to false, but you could also make this a parameter. + featureEnabled, _ := client.BooleanValue( + ctx, + featureFlagName, + false, + openfeature.EvaluationContext{}, + ) + + return featureEnabled +} + +func (cs *checkout) getIntFeatureFlag(ctx context.Context, featureFlagName string) int { + client := openfeature.NewClient("checkout") + + // Default value is set to 0, but you could also make this a parameter. + featureFlagValue, _ := client.IntValue( + ctx, + featureFlagName, + 0, + openfeature.EvaluationContext{}, + ) + + return int(featureFlagValue) +} diff --git a/src/checkout/money/money.go b/src/checkout/money/money.go new file mode 100644 index 0000000..ba21cd8 --- /dev/null +++ b/src/checkout/money/money.go @@ -0,0 +1,120 @@ +// Copyright The OpenTelemetry Authors +// SPDX-License-Identifier: Apache-2.0 +package money + +import ( + "errors" + + pb "github.com/open-telemetry/opentelemetry-demo/src/checkout/genproto/oteldemo" +) + +const ( + nanosMin = -999999999 + nanosMax = +999999999 + nanosMod = 1000000000 +) + +var ( + ErrInvalidValue = errors.New("one of the specified money values is invalid") + ErrMismatchingCurrency = errors.New("mismatching currency codes") +) + +// IsValid checks if specified value has a valid units/nanos signs and ranges. +func IsValid(m *pb.Money) bool { + return signMatches(m) && validNanos(m.GetNanos()) +} + +func signMatches(m *pb.Money) bool { + return m.GetNanos() == 0 || m.GetUnits() == 0 || (m.GetNanos() < 0) == (m.GetUnits() < 0) +} + +func validNanos(nanos int32) bool { return nanosMin <= nanos && nanos <= nanosMax } + +// IsZero returns true if the specified money value is equal to zero. +func IsZero(m *pb.Money) bool { return m.GetUnits() == 0 && m.GetNanos() == 0 } + +// IsPositive returns true if the specified money value is valid and is +// positive. +func IsPositive(m *pb.Money) bool { + return IsValid(m) && m.GetUnits() > 0 || (m.GetUnits() == 0 && m.GetNanos() > 0) +} + +// IsNegative returns true if the specified money value is valid and is +// negative. +func IsNegative(m *pb.Money) bool { + return IsValid(m) && m.GetUnits() < 0 || (m.GetUnits() == 0 && m.GetNanos() < 0) +} + +// AreSameCurrency returns true if values l and r have a currency code and +// they are the same values. +func AreSameCurrency(l, r *pb.Money) bool { + return l.GetCurrencyCode() == r.GetCurrencyCode() && l.GetCurrencyCode() != "" +} + +// AreEquals returns true if values l and r are the equal, including the +// currency. This does not check validity of the provided values. +func AreEquals(l, r *pb.Money) bool { + return l.GetCurrencyCode() == r.GetCurrencyCode() && + l.GetUnits() == r.GetUnits() && l.GetNanos() == r.GetNanos() +} + +// Negate returns the same amount with the sign negated. +func Negate(m *pb.Money) *pb.Money { + return &pb.Money{ + Units: -m.GetUnits(), + Nanos: -m.GetNanos(), + CurrencyCode: m.GetCurrencyCode()} +} + +// Must panics if the given error is not nil. This can be used with other +// functions like: "m := Must(Sum(a,b))". +func Must(v *pb.Money, err error) *pb.Money { + if err != nil { + panic(err) + } + return v +} + +// Sum adds two values. Returns an error if one of the values are invalid or +// currency codes are not matching (unless currency code is unspecified for +// both). +func Sum(l, r *pb.Money) (*pb.Money, error) { + if !IsValid(l) || !IsValid(r) { + return &pb.Money{}, ErrInvalidValue + } else if l.GetCurrencyCode() != r.GetCurrencyCode() { + return &pb.Money{}, ErrMismatchingCurrency + } + units := l.GetUnits() + r.GetUnits() + nanos := l.GetNanos() + r.GetNanos() + + if (units == 0 && nanos == 0) || (units > 0 && nanos >= 0) || (units < 0 && nanos <= 0) { + // same sign <units, nanos> + units += int64(nanos / nanosMod) + nanos = nanos % nanosMod + } else { + // different sign. nanos guaranteed to not to go over the limit + if units > 0 { + units-- + nanos += nanosMod + } else { + units++ + nanos -= nanosMod + } + } + + return &pb.Money{ + Units: units, + Nanos: nanos, + CurrencyCode: l.GetCurrencyCode()}, nil +} + +// MultiplySlow is a slow multiplication operation done through adding the value +// to itself n-1 times. +func MultiplySlow(m *pb.Money, n uint32) *pb.Money { + out := m + for n > 1 { + out = Must(Sum(out, m)) + n-- + } + return out +} diff --git a/src/checkout/money/money_test.go b/src/checkout/money/money_test.go new file mode 100644 index 0000000..8c2c3d7 --- /dev/null +++ b/src/checkout/money/money_test.go @@ -0,0 +1,233 @@ +// Copyright The OpenTelemetry Authors +// SPDX-License-Identifier: Apache-2.0 +package money + +import ( + "fmt" + "reflect" + "testing" + + pb "github.com/open-telemetry/opentelemetry-demo/src/checkout/genproto/oteldemo" +) + +func mmc(u int64, n int32, c string) *pb.Money { return &pb.Money{Units: u, Nanos: n, CurrencyCode: c} } +func mm(u int64, n int32) *pb.Money { return mmc(u, n, "") } + +func TestIsValid(t *testing.T) { + tests := []struct { + name string + in *pb.Money + want bool + }{ + {"valid -/-", mm(-981273891273, -999999999), true}, + {"invalid -/+", mm(-981273891273, +999999999), false}, + {"valid +/+", mm(981273891273, 999999999), true}, + {"invalid +/-", mm(981273891273, -999999999), false}, + {"invalid +/+overflow", mm(3, 1000000000), false}, + {"invalid +/-overflow", mm(3, -1000000000), false}, + {"invalid -/+overflow", mm(-3, 1000000000), false}, + {"invalid -/-overflow", mm(-3, -1000000000), false}, + } + for _, tt := range tests { + t.Run(tt.name, func(t *testing.T) { + if got := IsValid(tt.in); got != tt.want { + t.Errorf("IsValid(%v) = %v, want %v", tt.in, got, tt.want) + } + }) + } +} + +func TestIsZero(t *testing.T) { + tests := []struct { + name string + in *pb.Money + want bool + }{ + {"zero", mm(0, 0), true}, + {"not-zero (-/+)", mm(-1, +1), false}, + {"not-zero (-/-)", mm(-1, -1), false}, + {"not-zero (+/+)", mm(+1, +1), false}, + {"not-zero (+/-)", mm(+1, -1), false}, + } + for _, tt := range tests { + t.Run(tt.name, func(t *testing.T) { + if got := IsZero(tt.in); got != tt.want { + t.Errorf("IsZero(%v) = %v, want %v", tt.in, got, tt.want) + } + }) + } +} + +func TestIsPositive(t *testing.T) { + tests := []struct { + name string + in *pb.Money + want bool + }{ + {"zero", mm(0, 0), false}, + {"positive (+/+)", mm(+1, +1), true}, + {"invalid (-/+)", mm(-1, +1), false}, + {"negative (-/-)", mm(-1, -1), false}, + {"invalid (+/-)", mm(+1, -1), false}, + } + for _, tt := range tests { + t.Run(tt.name, func(t *testing.T) { + if got := IsPositive(tt.in); got != tt.want { + t.Errorf("IsPositive(%v) = %v, want %v", tt.in, got, tt.want) + } + }) + } +} + +func TestIsNegative(t *testing.T) { + tests := []struct { + name string + in *pb.Money + want bool + }{ + {"zero", mm(0, 0), false}, + {"positive (+/+)", mm(+1, +1), false}, + {"invalid (-/+)", mm(-1, +1), false}, + {"negative (-/-)", mm(-1, -1), true}, + {"invalid (+/-)", mm(+1, -1), false}, + } + for _, tt := range tests { + t.Run(tt.name, func(t *testing.T) { + if got := IsNegative(tt.in); got != tt.want { + t.Errorf("IsNegative(%v) = %v, want %v", tt.in, got, tt.want) + } + }) + } +} + +func TestAreSameCurrency(t *testing.T) { + type args struct { + l *pb.Money + r *pb.Money + } + tests := []struct { + name string + args args + want bool + }{ + {"both empty currency", args{mmc(1, 0, ""), mmc(2, 0, "")}, false}, + {"left empty currency", args{mmc(1, 0, ""), mmc(2, 0, "USD")}, false}, + {"right empty currency", args{mmc(1, 0, "USD"), mmc(2, 0, "")}, false}, + {"mismatching", args{mmc(1, 0, "USD"), mmc(2, 0, "CAD")}, false}, + {"matching", args{mmc(1, 0, "USD"), mmc(2, 0, "USD")}, true}, + } + for _, tt := range tests { + t.Run(tt.name, func(t *testing.T) { + if got := AreSameCurrency(tt.args.l, tt.args.r); got != tt.want { + t.Errorf("AreSameCurrency([%v],[%v]) = %v, want %v", tt.args.l, tt.args.r, got, tt.want) + } + }) + } +} + +func TestAreEquals(t *testing.T) { + type args struct { + l *pb.Money + r *pb.Money + } + tests := []struct { + name string + args args + want bool + }{ + {"equals", args{mmc(1, 2, "USD"), mmc(1, 2, "USD")}, true}, + {"mismatching currency", args{mmc(1, 2, "USD"), mmc(1, 2, "CAD")}, false}, + {"mismatching units", args{mmc(10, 20, "USD"), mmc(1, 20, "USD")}, false}, + {"mismatching nanos", args{mmc(1, 2, "USD"), mmc(1, 20, "USD")}, false}, + {"negated", args{mmc(1, 2, "USD"), mmc(-1, -2, "USD")}, false}, + } + for _, tt := range tests { + t.Run(tt.name, func(t *testing.T) { + if got := AreEquals(tt.args.l, tt.args.r); got != tt.want { + t.Errorf("AreEquals([%v],[%v]) = %v, want %v", tt.args.l, tt.args.r, got, tt.want) + } + }) + } +} + +func TestNegate(t *testing.T) { + tests := []struct { + name string + in *pb.Money + want *pb.Money + }{ + {"zero", mm(0, 0), mm(0, 0)}, + {"negative", mm(-1, -200), mm(1, 200)}, + {"positive", mm(1, 200), mm(-1, -200)}, + {"carries currency code", mmc(0, 0, "XXX"), mmc(0, 0, "XXX")}, + } + for _, tt := range tests { + t.Run(tt.name, func(t *testing.T) { + if got := Negate(tt.in); !AreEquals(got, tt.want) { + t.Errorf("Negate([%v]) = %v, want %v", tt.in, got, tt.want) + } + }) + } +} + +func TestMust_pass(t *testing.T) { + v := Must(mm(2, 3), nil) + if !AreEquals(v, mm(2, 3)) { + t.Errorf("returned the wrong value: %v", v) + } +} + +func TestMust_panic(t *testing.T) { + defer func() { + if r := recover(); r != nil { + t.Logf("panic captured: %v", r) + } + }() + Must(mm(2, 3), fmt.Errorf("some error")) + t.Fatal("this should not have executed due to the panic above") +} + +func TestSum(t *testing.T) { + type args struct { + l *pb.Money + r *pb.Money + } + tests := []struct { + name string + args args + want *pb.Money + wantErr error + }{ + {"0+0=0", args{mm(0, 0), mm(0, 0)}, mm(0, 0), nil}, + {"Error: currency code on left", args{mmc(0, 0, "XXX"), mm(0, 0)}, mm(0, 0), ErrMismatchingCurrency}, + {"Error: currency code on right", args{mm(0, 0), mmc(0, 0, "YYY")}, mm(0, 0), ErrMismatchingCurrency}, + {"Error: currency code mismatch", args{mmc(0, 0, "AAA"), mmc(0, 0, "BBB")}, mm(0, 0), ErrMismatchingCurrency}, + {"Error: invalid +/-", args{mm(+1, -1), mm(0, 0)}, mm(0, 0), ErrInvalidValue}, + {"Error: invalid -/+", args{mm(0, 0), mm(-1, +2)}, mm(0, 0), ErrInvalidValue}, + {"Error: invalid nanos", args{mm(0, 1000000000), mm(1, 0)}, mm(0, 0), ErrInvalidValue}, + {"both positive (no carry)", args{mm(2, 200000000), mm(2, 200000000)}, mm(4, 400000000), nil}, + {"both positive (nanos=max)", args{mm(2, 111111111), mm(2, 888888888)}, mm(4, 999999999), nil}, + {"both positive (carry)", args{mm(2, 200000000), mm(2, 900000000)}, mm(5, 100000000), nil}, + {"both negative (no carry)", args{mm(-2, -200000000), mm(-2, -200000000)}, mm(-4, -400000000), nil}, + {"both negative (carry)", args{mm(-2, -200000000), mm(-2, -900000000)}, mm(-5, -100000000), nil}, + {"mixed (larger positive, just decimals)", args{mm(11, 0), mm(-2, 0)}, mm(9, 0), nil}, + {"mixed (larger negative, just decimals)", args{mm(-11, 0), mm(2, 0)}, mm(-9, 0), nil}, + {"mixed (larger positive, no borrow)", args{mm(11, 100000000), mm(-2, -100000000)}, mm(9, 0), nil}, + {"mixed (larger positive, with borrow)", args{mm(11, 100000000), mm(-2, -9000000 /*.09*/)}, mm(9, 91000000 /*.091*/), nil}, + {"mixed (larger negative, no borrow)", args{mm(-11, -100000000), mm(2, 100000000)}, mm(-9, 0), nil}, + {"mixed (larger negative, with borrow)", args{mm(-11, -100000000), mm(2, 9000000 /*.09*/)}, mm(-9, -91000000 /*.091*/), nil}, + {"0+negative", args{mm(0, 0), mm(-2, -100000000)}, mm(-2, -100000000), nil}, + {"negative+0", args{mm(-2, -100000000), mm(0, 0)}, mm(-2, -100000000), nil}, + } + for _, tt := range tests { + t.Run(tt.name, func(t *testing.T) { + got, err := Sum(tt.args.l, tt.args.r) + if err != tt.wantErr { + t.Errorf("Sum([%v],[%v]): expected err=\"%v\" got=\"%v\"", tt.args.l, tt.args.r, tt.wantErr, err) + } + if !reflect.DeepEqual(got, tt.want) { + t.Errorf("Sum([%v],[%v]) = %v, want %v", tt.args.l, tt.args.r, got, tt.want) + } + }) + } +} |
