From 8457143f012e44ee5b97b8b6e0f48e53323dbaf8 Mon Sep 17 00:00:00 2001 From: Andrew Hayworth Date: Sat, 4 Jun 2022 00:27:45 -0500 Subject: [PATCH 1/6] feat: rewrite emailservice in ruby Rather than use GRPC, we reimplement the emailservice as a simple HTTP application, using Sinatra and OpenTelemetry auto-instrumentation. We can do this because our use of GRPC in this instance is not very complicated - we can just serialize the protobuf request to JSON and send it over HTTP instead, and it's pretty straightforward. Probably the most interesting part here is that we're rendering the email text right into the logfile, which might be noisy. We can revisit that decision if needed. --- src/emailservice/.ruby-version | 1 + src/emailservice/Dockerfile | 22 +- src/emailservice/Gemfile | 10 + src/emailservice/Gemfile.lock | 74 + src/emailservice/README.md | 23 +- src/emailservice/demo_pb2.py | 1851 ----------------- src/emailservice/demo_pb2_grpc.py | 806 ------- src/emailservice/email_client.py | 41 - src/emailservice/email_server.py | 142 -- src/emailservice/email_server.rb | 22 + src/emailservice/logger.py | 39 - src/emailservice/requirements.in | 12 - src/emailservice/requirements.txt | 105 - .../confirmation.erb} | 24 +- 14 files changed, 144 insertions(+), 3028 deletions(-) create mode 100644 src/emailservice/.ruby-version create mode 100644 src/emailservice/Gemfile create mode 100644 src/emailservice/Gemfile.lock delete mode 100644 src/emailservice/demo_pb2.py delete mode 100644 src/emailservice/demo_pb2_grpc.py delete mode 100644 src/emailservice/email_client.py delete mode 100644 src/emailservice/email_server.py create mode 100644 src/emailservice/email_server.rb delete mode 100644 src/emailservice/logger.py delete mode 100644 src/emailservice/requirements.in delete mode 100644 src/emailservice/requirements.txt rename src/emailservice/{templates/confirmation.html => views/confirmation.erb} (60%) diff --git a/src/emailservice/.ruby-version b/src/emailservice/.ruby-version new file mode 100644 index 0000000000..ef538c2810 --- /dev/null +++ b/src/emailservice/.ruby-version @@ -0,0 +1 @@ +3.1.2 diff --git a/src/emailservice/Dockerfile b/src/emailservice/Dockerfile index 4f201c544a..572f4aaf81 100644 --- a/src/emailservice/Dockerfile +++ b/src/emailservice/Dockerfile @@ -12,28 +12,14 @@ # See the License for the specific language governing permissions and # limitations under the License. -FROM python:3.10-slim +FROM ruby:3.1.2 -# get packages -COPY requirements.txt . -RUN pip install -r requirements.txt - -# Enable unbuffered logging -ENV PYTHONUNBUFFERED=1 - -RUN apt-get -qq update \ - && apt-get install -y --no-install-recommends \ - wget - -# Download the grpc health probe -RUN GRPC_HEALTH_PROBE_VERSION=v0.4.7 && \ - wget -qO/bin/grpc_health_probe https://github.com/grpc-ecosystem/grpc-health-probe/releases/download/${GRPC_HEALTH_PROBE_VERSION}/grpc_health_probe-linux-amd64 && \ - chmod +x /bin/grpc_health_probe +COPY Gemfile* . +RUN bundle install WORKDIR /email_server -# Add the application COPY . . EXPOSE 8080 -ENTRYPOINT [ "opentelemetry-instrument", "python", "email_server.py" ] +ENTRYPOINT ["bundle", "exec", "ruby", "email_server.rb"] diff --git a/src/emailservice/Gemfile b/src/emailservice/Gemfile new file mode 100644 index 0000000000..971b0d036b --- /dev/null +++ b/src/emailservice/Gemfile @@ -0,0 +1,10 @@ +source "https://rubygems.org" + +gem "net-smtp", "~> 0.3" +gem "pony", "~> 1.13" +gem "puma", "~> 5.6" +gem "sinatra", "~> 2.2" + +gem "opentelemetry-sdk", "~> 1.1" +gem "opentelemetry-exporter-otlp", "~> 0.21" +gem "opentelemetry-instrumentation-sinatra", "~> 0.19" diff --git a/src/emailservice/Gemfile.lock b/src/emailservice/Gemfile.lock new file mode 100644 index 0000000000..1242d3e71d --- /dev/null +++ b/src/emailservice/Gemfile.lock @@ -0,0 +1,74 @@ +GEM + remote: https://rubygems.org/ + specs: + digest (3.1.0) + google-protobuf (3.21.1) + googleapis-common-protos-types (1.3.1) + google-protobuf (~> 3.14) + mail (2.7.1) + mini_mime (>= 0.1.1) + mini_mime (1.1.2) + mustermann (1.1.1) + ruby2_keywords (~> 0.0.1) + net-protocol (0.1.3) + timeout + net-smtp (0.3.1) + digest + net-protocol + timeout + nio4r (2.5.8) + opentelemetry-api (1.0.2) + opentelemetry-common (0.19.6) + opentelemetry-api (~> 1.0) + opentelemetry-exporter-otlp (0.21.3) + google-protobuf (~> 3.19) + googleapis-common-protos-types (~> 1.3) + opentelemetry-api (~> 1.0) + opentelemetry-common (~> 0.19.3) + opentelemetry-sdk (~> 1.0) + opentelemetry-semantic_conventions + opentelemetry-instrumentation-base (0.20.0) + opentelemetry-api (~> 1.0) + opentelemetry-instrumentation-sinatra (0.19.4) + opentelemetry-api (~> 1.0) + opentelemetry-common (~> 0.19.3) + opentelemetry-instrumentation-base (~> 0.20.0) + opentelemetry-registry (0.1.0) + opentelemetry-api (~> 1.0.1) + opentelemetry-sdk (1.1.0) + opentelemetry-api (~> 1.0) + opentelemetry-common (~> 0.19.3) + opentelemetry-registry (~> 0.1) + opentelemetry-semantic_conventions + opentelemetry-semantic_conventions (1.8.0) + opentelemetry-api (~> 1.0) + pony (1.13.1) + mail (>= 2.0) + puma (5.6.4) + nio4r (~> 2.0) + rack (2.2.3.1) + rack-protection (2.2.0) + rack + ruby2_keywords (0.0.5) + sinatra (2.2.0) + mustermann (~> 1.0) + rack (~> 2.2) + rack-protection (= 2.2.0) + tilt (~> 2.0) + tilt (2.0.10) + timeout (0.3.0) + +PLATFORMS + arm64-darwin-21 + +DEPENDENCIES + net-smtp (~> 0.3) + opentelemetry-exporter-otlp (~> 0.21) + opentelemetry-instrumentation-sinatra (~> 0.19) + opentelemetry-sdk (~> 1.1) + pony (~> 1.13) + puma (~> 5.6) + sinatra (~> 2.2) + +BUNDLED WITH + 2.3.7 diff --git a/src/emailservice/README.md b/src/emailservice/README.md index 1cb920bac8..b61acc7956 100644 --- a/src/emailservice/README.md +++ b/src/emailservice/README.md @@ -1,3 +1,22 @@ -# Read Me +# Email Service -This is a placeholder +The Email service "sends" an email to the customer with their order details by rendering it as a log message. It expects a JSON payload like: + +```json +{ + "email": "some.address@website.com", + "order": "" +} +``` + +## Building locally + +We use `bundler` to manage dependencies. To get started, simply `bundle install`. + +## Running locally + +You may run this service locally with `bundle exec ruby email_server.rb`. + +## Building docker image + +From `src/emailservice`, run `docker build .` diff --git a/src/emailservice/demo_pb2.py b/src/emailservice/demo_pb2.py deleted file mode 100644 index 2306c91d98..0000000000 --- a/src/emailservice/demo_pb2.py +++ /dev/null @@ -1,1851 +0,0 @@ -# -*- coding: utf-8 -*- -# Generated by the protocol buffer compiler. DO NOT EDIT! -# source: demo.proto -"""Generated protocol buffer code.""" -from google.protobuf import descriptor as _descriptor -from google.protobuf import message as _message -from google.protobuf import reflection as _reflection -from google.protobuf import symbol_database as _symbol_database -# @@protoc_insertion_point(imports) - -_sym_db = _symbol_database.Default() - - - - -DESCRIPTOR = _descriptor.FileDescriptor( - name='demo.proto', - package='hipstershop', - syntax='proto3', - serialized_options=None, - create_key=_descriptor._internal_create_key, - serialized_pb=b'\n\ndemo.proto\x12\x0bhipstershop\"0\n\x08\x43\x61rtItem\x12\x12\n\nproduct_id\x18\x01 \x01(\t\x12\x10\n\x08quantity\x18\x02 \x01(\x05\"F\n\x0e\x41\x64\x64ItemRequest\x12\x0f\n\x07user_id\x18\x01 \x01(\t\x12#\n\x04item\x18\x02 \x01(\x0b\x32\x15.hipstershop.CartItem\"#\n\x10\x45mptyCartRequest\x12\x0f\n\x07user_id\x18\x01 \x01(\t\"!\n\x0eGetCartRequest\x12\x0f\n\x07user_id\x18\x01 \x01(\t\"=\n\x04\x43\x61rt\x12\x0f\n\x07user_id\x18\x01 \x01(\t\x12$\n\x05items\x18\x02 \x03(\x0b\x32\x15.hipstershop.CartItem\"\x07\n\x05\x45mpty\"B\n\x1aListRecommendationsRequest\x12\x0f\n\x07user_id\x18\x01 \x01(\t\x12\x13\n\x0bproduct_ids\x18\x02 \x03(\t\"2\n\x1bListRecommendationsResponse\x12\x13\n\x0bproduct_ids\x18\x01 \x03(\t\"\x84\x01\n\x07Product\x12\n\n\x02id\x18\x01 \x01(\t\x12\x0c\n\x04name\x18\x02 \x01(\t\x12\x13\n\x0b\x64\x65scription\x18\x03 \x01(\t\x12\x0f\n\x07picture\x18\x04 \x01(\t\x12%\n\tprice_usd\x18\x05 \x01(\x0b\x32\x12.hipstershop.Money\x12\x12\n\ncategories\x18\x06 \x03(\t\">\n\x14ListProductsResponse\x12&\n\x08products\x18\x01 \x03(\x0b\x32\x14.hipstershop.Product\"\x1f\n\x11GetProductRequest\x12\n\n\x02id\x18\x01 \x01(\t\"&\n\x15SearchProductsRequest\x12\r\n\x05query\x18\x01 \x01(\t\"?\n\x16SearchProductsResponse\x12%\n\x07results\x18\x01 \x03(\x0b\x32\x14.hipstershop.Product\"^\n\x0fGetQuoteRequest\x12%\n\x07\x61\x64\x64ress\x18\x01 \x01(\x0b\x32\x14.hipstershop.Address\x12$\n\x05items\x18\x02 \x03(\x0b\x32\x15.hipstershop.CartItem\"8\n\x10GetQuoteResponse\x12$\n\x08\x63ost_usd\x18\x01 \x01(\x0b\x32\x12.hipstershop.Money\"_\n\x10ShipOrderRequest\x12%\n\x07\x61\x64\x64ress\x18\x01 \x01(\x0b\x32\x14.hipstershop.Address\x12$\n\x05items\x18\x02 \x03(\x0b\x32\x15.hipstershop.CartItem\"(\n\x11ShipOrderResponse\x12\x13\n\x0btracking_id\x18\x01 \x01(\t\"a\n\x07\x41\x64\x64ress\x12\x16\n\x0estreet_address\x18\x01 \x01(\t\x12\x0c\n\x04\x63ity\x18\x02 \x01(\t\x12\r\n\x05state\x18\x03 \x01(\t\x12\x0f\n\x07\x63ountry\x18\x04 \x01(\t\x12\x10\n\x08zip_code\x18\x05 \x01(\x05\"<\n\x05Money\x12\x15\n\rcurrency_code\x18\x01 \x01(\t\x12\r\n\x05units\x18\x02 \x01(\x03\x12\r\n\x05nanos\x18\x03 \x01(\x05\"8\n\x1eGetSupportedCurrenciesResponse\x12\x16\n\x0e\x63urrency_codes\x18\x01 \x03(\t\"N\n\x19\x43urrencyConversionRequest\x12 \n\x04\x66rom\x18\x01 \x01(\x0b\x32\x12.hipstershop.Money\x12\x0f\n\x07to_code\x18\x02 \x01(\t\"\x90\x01\n\x0e\x43reditCardInfo\x12\x1a\n\x12\x63redit_card_number\x18\x01 \x01(\t\x12\x17\n\x0f\x63redit_card_cvv\x18\x02 \x01(\x05\x12#\n\x1b\x63redit_card_expiration_year\x18\x03 \x01(\x05\x12$\n\x1c\x63redit_card_expiration_month\x18\x04 \x01(\x05\"e\n\rChargeRequest\x12\"\n\x06\x61mount\x18\x01 \x01(\x0b\x32\x12.hipstershop.Money\x12\x30\n\x0b\x63redit_card\x18\x02 \x01(\x0b\x32\x1b.hipstershop.CreditCardInfo\"(\n\x0e\x43hargeResponse\x12\x16\n\x0etransaction_id\x18\x01 \x01(\t\"R\n\tOrderItem\x12#\n\x04item\x18\x01 \x01(\x0b\x32\x15.hipstershop.CartItem\x12 \n\x04\x63ost\x18\x02 \x01(\x0b\x32\x12.hipstershop.Money\"\xbf\x01\n\x0bOrderResult\x12\x10\n\x08order_id\x18\x01 \x01(\t\x12\x1c\n\x14shipping_tracking_id\x18\x02 \x01(\t\x12)\n\rshipping_cost\x18\x03 \x01(\x0b\x32\x12.hipstershop.Money\x12.\n\x10shipping_address\x18\x04 \x01(\x0b\x32\x14.hipstershop.Address\x12%\n\x05items\x18\x05 \x03(\x0b\x32\x16.hipstershop.OrderItem\"V\n\x1cSendOrderConfirmationRequest\x12\r\n\x05\x65mail\x18\x01 \x01(\t\x12\'\n\x05order\x18\x02 \x01(\x0b\x32\x18.hipstershop.OrderResult\"\xa3\x01\n\x11PlaceOrderRequest\x12\x0f\n\x07user_id\x18\x01 \x01(\t\x12\x15\n\ruser_currency\x18\x02 \x01(\t\x12%\n\x07\x61\x64\x64ress\x18\x03 \x01(\x0b\x32\x14.hipstershop.Address\x12\r\n\x05\x65mail\x18\x05 \x01(\t\x12\x30\n\x0b\x63redit_card\x18\x06 \x01(\x0b\x32\x1b.hipstershop.CreditCardInfo\"=\n\x12PlaceOrderResponse\x12\'\n\x05order\x18\x01 \x01(\x0b\x32\x18.hipstershop.OrderResult\"!\n\tAdRequest\x12\x14\n\x0c\x63ontext_keys\x18\x01 \x03(\t\"*\n\nAdResponse\x12\x1c\n\x03\x61\x64s\x18\x01 \x03(\x0b\x32\x0f.hipstershop.Ad\"(\n\x02\x41\x64\x12\x14\n\x0credirect_url\x18\x01 \x01(\t\x12\x0c\n\x04text\x18\x02 \x01(\t2\xca\x01\n\x0b\x43\x61rtService\x12<\n\x07\x41\x64\x64Item\x12\x1b.hipstershop.AddItemRequest\x1a\x12.hipstershop.Empty\"\x00\x12;\n\x07GetCart\x12\x1b.hipstershop.GetCartRequest\x1a\x11.hipstershop.Cart\"\x00\x12@\n\tEmptyCart\x12\x1d.hipstershop.EmptyCartRequest\x1a\x12.hipstershop.Empty\"\x00\x32\x83\x01\n\x15RecommendationService\x12j\n\x13ListRecommendations\x12\'.hipstershop.ListRecommendationsRequest\x1a(.hipstershop.ListRecommendationsResponse\"\x00\x32\x83\x02\n\x15ProductCatalogService\x12G\n\x0cListProducts\x12\x12.hipstershop.Empty\x1a!.hipstershop.ListProductsResponse\"\x00\x12\x44\n\nGetProduct\x12\x1e.hipstershop.GetProductRequest\x1a\x14.hipstershop.Product\"\x00\x12[\n\x0eSearchProducts\x12\".hipstershop.SearchProductsRequest\x1a#.hipstershop.SearchProductsResponse\"\x00\x32\xaa\x01\n\x0fShippingService\x12I\n\x08GetQuote\x12\x1c.hipstershop.GetQuoteRequest\x1a\x1d.hipstershop.GetQuoteResponse\"\x00\x12L\n\tShipOrder\x12\x1d.hipstershop.ShipOrderRequest\x1a\x1e.hipstershop.ShipOrderResponse\"\x00\x32\xb7\x01\n\x0f\x43urrencyService\x12[\n\x16GetSupportedCurrencies\x12\x12.hipstershop.Empty\x1a+.hipstershop.GetSupportedCurrenciesResponse\"\x00\x12G\n\x07\x43onvert\x12&.hipstershop.CurrencyConversionRequest\x1a\x12.hipstershop.Money\"\x00\x32U\n\x0ePaymentService\x12\x43\n\x06\x43harge\x12\x1a.hipstershop.ChargeRequest\x1a\x1b.hipstershop.ChargeResponse\"\x00\x32h\n\x0c\x45mailService\x12X\n\x15SendOrderConfirmation\x12).hipstershop.SendOrderConfirmationRequest\x1a\x12.hipstershop.Empty\"\x00\x32\x62\n\x0f\x43heckoutService\x12O\n\nPlaceOrder\x12\x1e.hipstershop.PlaceOrderRequest\x1a\x1f.hipstershop.PlaceOrderResponse\"\x00\x32H\n\tAdService\x12;\n\x06GetAds\x12\x16.hipstershop.AdRequest\x1a\x17.hipstershop.AdResponse\"\x00\x62\x06proto3' -) - - - - -_CARTITEM = _descriptor.Descriptor( - name='CartItem', - full_name='hipstershop.CartItem', - filename=None, - file=DESCRIPTOR, - containing_type=None, - create_key=_descriptor._internal_create_key, - fields=[ - _descriptor.FieldDescriptor( - name='product_id', full_name='hipstershop.CartItem.product_id', index=0, - number=1, type=9, cpp_type=9, label=1, - has_default_value=False, default_value=b"".decode('utf-8'), - message_type=None, enum_type=None, containing_type=None, - is_extension=False, extension_scope=None, - serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), - _descriptor.FieldDescriptor( - name='quantity', full_name='hipstershop.CartItem.quantity', index=1, - number=2, type=5, cpp_type=1, label=1, - has_default_value=False, default_value=0, - message_type=None, enum_type=None, containing_type=None, - is_extension=False, extension_scope=None, - serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), - ], - extensions=[ - ], - nested_types=[], - enum_types=[ - ], - serialized_options=None, - is_extendable=False, - syntax='proto3', - extension_ranges=[], - oneofs=[ - ], - serialized_start=27, - serialized_end=75, -) - - -_ADDITEMREQUEST = _descriptor.Descriptor( - name='AddItemRequest', - full_name='hipstershop.AddItemRequest', - filename=None, - file=DESCRIPTOR, - containing_type=None, - create_key=_descriptor._internal_create_key, - fields=[ - _descriptor.FieldDescriptor( - name='user_id', full_name='hipstershop.AddItemRequest.user_id', index=0, - number=1, type=9, cpp_type=9, label=1, - has_default_value=False, default_value=b"".decode('utf-8'), - message_type=None, enum_type=None, containing_type=None, - is_extension=False, extension_scope=None, - serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), - _descriptor.FieldDescriptor( - name='item', full_name='hipstershop.AddItemRequest.item', index=1, - number=2, type=11, cpp_type=10, label=1, - has_default_value=False, default_value=None, - message_type=None, enum_type=None, containing_type=None, - is_extension=False, extension_scope=None, - serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), - ], - extensions=[ - ], - nested_types=[], - enum_types=[ - ], - serialized_options=None, - is_extendable=False, - syntax='proto3', - extension_ranges=[], - oneofs=[ - ], - serialized_start=77, - serialized_end=147, -) - - -_EMPTYCARTREQUEST = _descriptor.Descriptor( - name='EmptyCartRequest', - full_name='hipstershop.EmptyCartRequest', - filename=None, - file=DESCRIPTOR, - containing_type=None, - create_key=_descriptor._internal_create_key, - fields=[ - _descriptor.FieldDescriptor( - name='user_id', full_name='hipstershop.EmptyCartRequest.user_id', index=0, - number=1, type=9, cpp_type=9, label=1, - has_default_value=False, default_value=b"".decode('utf-8'), - message_type=None, enum_type=None, containing_type=None, - is_extension=False, extension_scope=None, - serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), - ], - extensions=[ - ], - nested_types=[], - enum_types=[ - ], - serialized_options=None, - is_extendable=False, - syntax='proto3', - extension_ranges=[], - oneofs=[ - ], - serialized_start=149, - serialized_end=184, -) - - -_GETCARTREQUEST = _descriptor.Descriptor( - name='GetCartRequest', - full_name='hipstershop.GetCartRequest', - filename=None, - file=DESCRIPTOR, - containing_type=None, - create_key=_descriptor._internal_create_key, - fields=[ - _descriptor.FieldDescriptor( - name='user_id', full_name='hipstershop.GetCartRequest.user_id', index=0, - number=1, type=9, cpp_type=9, label=1, - has_default_value=False, default_value=b"".decode('utf-8'), - message_type=None, enum_type=None, containing_type=None, - is_extension=False, extension_scope=None, - serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), - ], - extensions=[ - ], - nested_types=[], - enum_types=[ - ], - serialized_options=None, - is_extendable=False, - syntax='proto3', - extension_ranges=[], - oneofs=[ - ], - serialized_start=186, - serialized_end=219, -) - - -_CART = _descriptor.Descriptor( - name='Cart', - full_name='hipstershop.Cart', - filename=None, - file=DESCRIPTOR, - containing_type=None, - create_key=_descriptor._internal_create_key, - fields=[ - _descriptor.FieldDescriptor( - name='user_id', full_name='hipstershop.Cart.user_id', index=0, - number=1, type=9, cpp_type=9, label=1, - has_default_value=False, default_value=b"".decode('utf-8'), - message_type=None, enum_type=None, containing_type=None, - is_extension=False, extension_scope=None, - serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), - _descriptor.FieldDescriptor( - name='items', full_name='hipstershop.Cart.items', index=1, - number=2, type=11, cpp_type=10, label=3, - has_default_value=False, default_value=[], - message_type=None, enum_type=None, containing_type=None, - is_extension=False, extension_scope=None, - serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), - ], - extensions=[ - ], - nested_types=[], - enum_types=[ - ], - serialized_options=None, - is_extendable=False, - syntax='proto3', - extension_ranges=[], - oneofs=[ - ], - serialized_start=221, - serialized_end=282, -) - - -_EMPTY = _descriptor.Descriptor( - name='Empty', - full_name='hipstershop.Empty', - filename=None, - file=DESCRIPTOR, - containing_type=None, - create_key=_descriptor._internal_create_key, - fields=[ - ], - extensions=[ - ], - nested_types=[], - enum_types=[ - ], - serialized_options=None, - is_extendable=False, - syntax='proto3', - extension_ranges=[], - oneofs=[ - ], - serialized_start=284, - serialized_end=291, -) - - -_LISTRECOMMENDATIONSREQUEST = _descriptor.Descriptor( - name='ListRecommendationsRequest', - full_name='hipstershop.ListRecommendationsRequest', - filename=None, - file=DESCRIPTOR, - containing_type=None, - create_key=_descriptor._internal_create_key, - fields=[ - _descriptor.FieldDescriptor( - name='user_id', full_name='hipstershop.ListRecommendationsRequest.user_id', index=0, - number=1, type=9, cpp_type=9, label=1, - has_default_value=False, default_value=b"".decode('utf-8'), - message_type=None, enum_type=None, containing_type=None, - is_extension=False, extension_scope=None, - serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), - _descriptor.FieldDescriptor( - name='product_ids', full_name='hipstershop.ListRecommendationsRequest.product_ids', index=1, - number=2, type=9, cpp_type=9, label=3, - has_default_value=False, default_value=[], - message_type=None, enum_type=None, containing_type=None, - is_extension=False, extension_scope=None, - serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), - ], - extensions=[ - ], - nested_types=[], - enum_types=[ - ], - serialized_options=None, - is_extendable=False, - syntax='proto3', - extension_ranges=[], - oneofs=[ - ], - serialized_start=293, - serialized_end=359, -) - - -_LISTRECOMMENDATIONSRESPONSE = _descriptor.Descriptor( - name='ListRecommendationsResponse', - full_name='hipstershop.ListRecommendationsResponse', - filename=None, - file=DESCRIPTOR, - containing_type=None, - create_key=_descriptor._internal_create_key, - fields=[ - _descriptor.FieldDescriptor( - name='product_ids', full_name='hipstershop.ListRecommendationsResponse.product_ids', index=0, - number=1, type=9, cpp_type=9, label=3, - has_default_value=False, default_value=[], - message_type=None, enum_type=None, containing_type=None, - is_extension=False, extension_scope=None, - serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), - ], - extensions=[ - ], - nested_types=[], - enum_types=[ - ], - serialized_options=None, - is_extendable=False, - syntax='proto3', - extension_ranges=[], - oneofs=[ - ], - serialized_start=361, - serialized_end=411, -) - - -_PRODUCT = _descriptor.Descriptor( - name='Product', - full_name='hipstershop.Product', - filename=None, - file=DESCRIPTOR, - containing_type=None, - create_key=_descriptor._internal_create_key, - fields=[ - _descriptor.FieldDescriptor( - name='id', full_name='hipstershop.Product.id', index=0, - number=1, type=9, cpp_type=9, label=1, - has_default_value=False, default_value=b"".decode('utf-8'), - message_type=None, enum_type=None, containing_type=None, - is_extension=False, extension_scope=None, - serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), - _descriptor.FieldDescriptor( - name='name', full_name='hipstershop.Product.name', index=1, - number=2, type=9, cpp_type=9, label=1, - has_default_value=False, default_value=b"".decode('utf-8'), - message_type=None, enum_type=None, containing_type=None, - is_extension=False, extension_scope=None, - serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), - _descriptor.FieldDescriptor( - name='description', full_name='hipstershop.Product.description', index=2, - number=3, type=9, cpp_type=9, label=1, - has_default_value=False, default_value=b"".decode('utf-8'), - message_type=None, enum_type=None, containing_type=None, - is_extension=False, extension_scope=None, - serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), - _descriptor.FieldDescriptor( - name='picture', full_name='hipstershop.Product.picture', index=3, - number=4, type=9, cpp_type=9, label=1, - has_default_value=False, default_value=b"".decode('utf-8'), - message_type=None, enum_type=None, containing_type=None, - is_extension=False, extension_scope=None, - serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), - _descriptor.FieldDescriptor( - name='price_usd', full_name='hipstershop.Product.price_usd', index=4, - number=5, type=11, cpp_type=10, label=1, - has_default_value=False, default_value=None, - message_type=None, enum_type=None, containing_type=None, - is_extension=False, extension_scope=None, - serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), - _descriptor.FieldDescriptor( - name='categories', full_name='hipstershop.Product.categories', index=5, - number=6, type=9, cpp_type=9, label=3, - has_default_value=False, default_value=[], - message_type=None, enum_type=None, containing_type=None, - is_extension=False, extension_scope=None, - serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), - ], - extensions=[ - ], - nested_types=[], - enum_types=[ - ], - serialized_options=None, - is_extendable=False, - syntax='proto3', - extension_ranges=[], - oneofs=[ - ], - serialized_start=414, - serialized_end=546, -) - - -_LISTPRODUCTSRESPONSE = _descriptor.Descriptor( - name='ListProductsResponse', - full_name='hipstershop.ListProductsResponse', - filename=None, - file=DESCRIPTOR, - containing_type=None, - create_key=_descriptor._internal_create_key, - fields=[ - _descriptor.FieldDescriptor( - name='products', full_name='hipstershop.ListProductsResponse.products', index=0, - number=1, type=11, cpp_type=10, label=3, - has_default_value=False, default_value=[], - message_type=None, enum_type=None, containing_type=None, - is_extension=False, extension_scope=None, - serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), - ], - extensions=[ - ], - nested_types=[], - enum_types=[ - ], - serialized_options=None, - is_extendable=False, - syntax='proto3', - extension_ranges=[], - oneofs=[ - ], - serialized_start=548, - serialized_end=610, -) - - -_GETPRODUCTREQUEST = _descriptor.Descriptor( - name='GetProductRequest', - full_name='hipstershop.GetProductRequest', - filename=None, - file=DESCRIPTOR, - containing_type=None, - create_key=_descriptor._internal_create_key, - fields=[ - _descriptor.FieldDescriptor( - name='id', full_name='hipstershop.GetProductRequest.id', index=0, - number=1, type=9, cpp_type=9, label=1, - has_default_value=False, default_value=b"".decode('utf-8'), - message_type=None, enum_type=None, containing_type=None, - is_extension=False, extension_scope=None, - serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), - ], - extensions=[ - ], - nested_types=[], - enum_types=[ - ], - serialized_options=None, - is_extendable=False, - syntax='proto3', - extension_ranges=[], - oneofs=[ - ], - serialized_start=612, - serialized_end=643, -) - - -_SEARCHPRODUCTSREQUEST = _descriptor.Descriptor( - name='SearchProductsRequest', - full_name='hipstershop.SearchProductsRequest', - filename=None, - file=DESCRIPTOR, - containing_type=None, - create_key=_descriptor._internal_create_key, - fields=[ - _descriptor.FieldDescriptor( - name='query', full_name='hipstershop.SearchProductsRequest.query', index=0, - number=1, type=9, cpp_type=9, label=1, - has_default_value=False, default_value=b"".decode('utf-8'), - message_type=None, enum_type=None, containing_type=None, - is_extension=False, extension_scope=None, - serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), - ], - extensions=[ - ], - nested_types=[], - enum_types=[ - ], - serialized_options=None, - is_extendable=False, - syntax='proto3', - extension_ranges=[], - oneofs=[ - ], - serialized_start=645, - serialized_end=683, -) - - -_SEARCHPRODUCTSRESPONSE = _descriptor.Descriptor( - name='SearchProductsResponse', - full_name='hipstershop.SearchProductsResponse', - filename=None, - file=DESCRIPTOR, - containing_type=None, - create_key=_descriptor._internal_create_key, - fields=[ - _descriptor.FieldDescriptor( - name='results', full_name='hipstershop.SearchProductsResponse.results', index=0, - number=1, type=11, cpp_type=10, label=3, - has_default_value=False, default_value=[], - message_type=None, enum_type=None, containing_type=None, - is_extension=False, extension_scope=None, - serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), - ], - extensions=[ - ], - nested_types=[], - enum_types=[ - ], - serialized_options=None, - is_extendable=False, - syntax='proto3', - extension_ranges=[], - oneofs=[ - ], - serialized_start=685, - serialized_end=748, -) - - -_GETQUOTEREQUEST = _descriptor.Descriptor( - name='GetQuoteRequest', - full_name='hipstershop.GetQuoteRequest', - filename=None, - file=DESCRIPTOR, - containing_type=None, - create_key=_descriptor._internal_create_key, - fields=[ - _descriptor.FieldDescriptor( - name='address', full_name='hipstershop.GetQuoteRequest.address', index=0, - number=1, type=11, cpp_type=10, label=1, - has_default_value=False, default_value=None, - message_type=None, enum_type=None, containing_type=None, - is_extension=False, extension_scope=None, - serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), - _descriptor.FieldDescriptor( - name='items', full_name='hipstershop.GetQuoteRequest.items', index=1, - number=2, type=11, cpp_type=10, label=3, - has_default_value=False, default_value=[], - message_type=None, enum_type=None, containing_type=None, - is_extension=False, extension_scope=None, - serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), - ], - extensions=[ - ], - nested_types=[], - enum_types=[ - ], - serialized_options=None, - is_extendable=False, - syntax='proto3', - extension_ranges=[], - oneofs=[ - ], - serialized_start=750, - serialized_end=844, -) - - -_GETQUOTERESPONSE = _descriptor.Descriptor( - name='GetQuoteResponse', - full_name='hipstershop.GetQuoteResponse', - filename=None, - file=DESCRIPTOR, - containing_type=None, - create_key=_descriptor._internal_create_key, - fields=[ - _descriptor.FieldDescriptor( - name='cost_usd', full_name='hipstershop.GetQuoteResponse.cost_usd', index=0, - number=1, type=11, cpp_type=10, label=1, - has_default_value=False, default_value=None, - message_type=None, enum_type=None, containing_type=None, - is_extension=False, extension_scope=None, - serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), - ], - extensions=[ - ], - nested_types=[], - enum_types=[ - ], - serialized_options=None, - is_extendable=False, - syntax='proto3', - extension_ranges=[], - oneofs=[ - ], - serialized_start=846, - serialized_end=902, -) - - -_SHIPORDERREQUEST = _descriptor.Descriptor( - name='ShipOrderRequest', - full_name='hipstershop.ShipOrderRequest', - filename=None, - file=DESCRIPTOR, - containing_type=None, - create_key=_descriptor._internal_create_key, - fields=[ - _descriptor.FieldDescriptor( - name='address', full_name='hipstershop.ShipOrderRequest.address', index=0, - number=1, type=11, cpp_type=10, label=1, - has_default_value=False, default_value=None, - message_type=None, enum_type=None, containing_type=None, - is_extension=False, extension_scope=None, - serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), - _descriptor.FieldDescriptor( - name='items', full_name='hipstershop.ShipOrderRequest.items', index=1, - number=2, type=11, cpp_type=10, label=3, - has_default_value=False, default_value=[], - message_type=None, enum_type=None, containing_type=None, - is_extension=False, extension_scope=None, - serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), - ], - extensions=[ - ], - nested_types=[], - enum_types=[ - ], - serialized_options=None, - is_extendable=False, - syntax='proto3', - extension_ranges=[], - oneofs=[ - ], - serialized_start=904, - serialized_end=999, -) - - -_SHIPORDERRESPONSE = _descriptor.Descriptor( - name='ShipOrderResponse', - full_name='hipstershop.ShipOrderResponse', - filename=None, - file=DESCRIPTOR, - containing_type=None, - create_key=_descriptor._internal_create_key, - fields=[ - _descriptor.FieldDescriptor( - name='tracking_id', full_name='hipstershop.ShipOrderResponse.tracking_id', index=0, - number=1, type=9, cpp_type=9, label=1, - has_default_value=False, default_value=b"".decode('utf-8'), - message_type=None, enum_type=None, containing_type=None, - is_extension=False, extension_scope=None, - serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), - ], - extensions=[ - ], - nested_types=[], - enum_types=[ - ], - serialized_options=None, - is_extendable=False, - syntax='proto3', - extension_ranges=[], - oneofs=[ - ], - serialized_start=1001, - serialized_end=1041, -) - - -_ADDRESS = _descriptor.Descriptor( - name='Address', - full_name='hipstershop.Address', - filename=None, - file=DESCRIPTOR, - containing_type=None, - create_key=_descriptor._internal_create_key, - fields=[ - _descriptor.FieldDescriptor( - name='street_address', full_name='hipstershop.Address.street_address', index=0, - number=1, type=9, cpp_type=9, label=1, - has_default_value=False, default_value=b"".decode('utf-8'), - message_type=None, enum_type=None, containing_type=None, - is_extension=False, extension_scope=None, - serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), - _descriptor.FieldDescriptor( - name='city', full_name='hipstershop.Address.city', index=1, - number=2, type=9, cpp_type=9, label=1, - has_default_value=False, default_value=b"".decode('utf-8'), - message_type=None, enum_type=None, containing_type=None, - is_extension=False, extension_scope=None, - serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), - _descriptor.FieldDescriptor( - name='state', full_name='hipstershop.Address.state', index=2, - number=3, type=9, cpp_type=9, label=1, - has_default_value=False, default_value=b"".decode('utf-8'), - message_type=None, enum_type=None, containing_type=None, - is_extension=False, extension_scope=None, - serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), - _descriptor.FieldDescriptor( - name='country', full_name='hipstershop.Address.country', index=3, - number=4, type=9, cpp_type=9, label=1, - has_default_value=False, default_value=b"".decode('utf-8'), - message_type=None, enum_type=None, containing_type=None, - is_extension=False, extension_scope=None, - serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), - _descriptor.FieldDescriptor( - name='zip_code', full_name='hipstershop.Address.zip_code', index=4, - number=5, type=5, cpp_type=1, label=1, - has_default_value=False, default_value=0, - message_type=None, enum_type=None, containing_type=None, - is_extension=False, extension_scope=None, - serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), - ], - extensions=[ - ], - nested_types=[], - enum_types=[ - ], - serialized_options=None, - is_extendable=False, - syntax='proto3', - extension_ranges=[], - oneofs=[ - ], - serialized_start=1043, - serialized_end=1140, -) - - -_MONEY = _descriptor.Descriptor( - name='Money', - full_name='hipstershop.Money', - filename=None, - file=DESCRIPTOR, - containing_type=None, - create_key=_descriptor._internal_create_key, - fields=[ - _descriptor.FieldDescriptor( - name='currency_code', full_name='hipstershop.Money.currency_code', index=0, - number=1, type=9, cpp_type=9, label=1, - has_default_value=False, default_value=b"".decode('utf-8'), - message_type=None, enum_type=None, containing_type=None, - is_extension=False, extension_scope=None, - serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), - _descriptor.FieldDescriptor( - name='units', full_name='hipstershop.Money.units', index=1, - number=2, type=3, cpp_type=2, label=1, - has_default_value=False, default_value=0, - message_type=None, enum_type=None, containing_type=None, - is_extension=False, extension_scope=None, - serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), - _descriptor.FieldDescriptor( - name='nanos', full_name='hipstershop.Money.nanos', index=2, - number=3, type=5, cpp_type=1, label=1, - has_default_value=False, default_value=0, - message_type=None, enum_type=None, containing_type=None, - is_extension=False, extension_scope=None, - serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), - ], - extensions=[ - ], - nested_types=[], - enum_types=[ - ], - serialized_options=None, - is_extendable=False, - syntax='proto3', - extension_ranges=[], - oneofs=[ - ], - serialized_start=1142, - serialized_end=1202, -) - - -_GETSUPPORTEDCURRENCIESRESPONSE = _descriptor.Descriptor( - name='GetSupportedCurrenciesResponse', - full_name='hipstershop.GetSupportedCurrenciesResponse', - filename=None, - file=DESCRIPTOR, - containing_type=None, - create_key=_descriptor._internal_create_key, - fields=[ - _descriptor.FieldDescriptor( - name='currency_codes', full_name='hipstershop.GetSupportedCurrenciesResponse.currency_codes', index=0, - number=1, type=9, cpp_type=9, label=3, - has_default_value=False, default_value=[], - message_type=None, enum_type=None, containing_type=None, - is_extension=False, extension_scope=None, - serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), - ], - extensions=[ - ], - nested_types=[], - enum_types=[ - ], - serialized_options=None, - is_extendable=False, - syntax='proto3', - extension_ranges=[], - oneofs=[ - ], - serialized_start=1204, - serialized_end=1260, -) - - -_CURRENCYCONVERSIONREQUEST = _descriptor.Descriptor( - name='CurrencyConversionRequest', - full_name='hipstershop.CurrencyConversionRequest', - filename=None, - file=DESCRIPTOR, - containing_type=None, - create_key=_descriptor._internal_create_key, - fields=[ - _descriptor.FieldDescriptor( - name='from', full_name='hipstershop.CurrencyConversionRequest.from', index=0, - number=1, type=11, cpp_type=10, label=1, - has_default_value=False, default_value=None, - message_type=None, enum_type=None, containing_type=None, - is_extension=False, extension_scope=None, - serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), - _descriptor.FieldDescriptor( - name='to_code', full_name='hipstershop.CurrencyConversionRequest.to_code', index=1, - number=2, type=9, cpp_type=9, label=1, - has_default_value=False, default_value=b"".decode('utf-8'), - message_type=None, enum_type=None, containing_type=None, - is_extension=False, extension_scope=None, - serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), - ], - extensions=[ - ], - nested_types=[], - enum_types=[ - ], - serialized_options=None, - is_extendable=False, - syntax='proto3', - extension_ranges=[], - oneofs=[ - ], - serialized_start=1262, - serialized_end=1340, -) - - -_CREDITCARDINFO = _descriptor.Descriptor( - name='CreditCardInfo', - full_name='hipstershop.CreditCardInfo', - filename=None, - file=DESCRIPTOR, - containing_type=None, - create_key=_descriptor._internal_create_key, - fields=[ - _descriptor.FieldDescriptor( - name='credit_card_number', full_name='hipstershop.CreditCardInfo.credit_card_number', index=0, - number=1, type=9, cpp_type=9, label=1, - has_default_value=False, default_value=b"".decode('utf-8'), - message_type=None, enum_type=None, containing_type=None, - is_extension=False, extension_scope=None, - serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), - _descriptor.FieldDescriptor( - name='credit_card_cvv', full_name='hipstershop.CreditCardInfo.credit_card_cvv', index=1, - number=2, type=5, cpp_type=1, label=1, - has_default_value=False, default_value=0, - message_type=None, enum_type=None, containing_type=None, - is_extension=False, extension_scope=None, - serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), - _descriptor.FieldDescriptor( - name='credit_card_expiration_year', full_name='hipstershop.CreditCardInfo.credit_card_expiration_year', index=2, - number=3, type=5, cpp_type=1, label=1, - has_default_value=False, default_value=0, - message_type=None, enum_type=None, containing_type=None, - is_extension=False, extension_scope=None, - serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), - _descriptor.FieldDescriptor( - name='credit_card_expiration_month', full_name='hipstershop.CreditCardInfo.credit_card_expiration_month', index=3, - number=4, type=5, cpp_type=1, label=1, - has_default_value=False, default_value=0, - message_type=None, enum_type=None, containing_type=None, - is_extension=False, extension_scope=None, - serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), - ], - extensions=[ - ], - nested_types=[], - enum_types=[ - ], - serialized_options=None, - is_extendable=False, - syntax='proto3', - extension_ranges=[], - oneofs=[ - ], - serialized_start=1343, - serialized_end=1487, -) - - -_CHARGEREQUEST = _descriptor.Descriptor( - name='ChargeRequest', - full_name='hipstershop.ChargeRequest', - filename=None, - file=DESCRIPTOR, - containing_type=None, - create_key=_descriptor._internal_create_key, - fields=[ - _descriptor.FieldDescriptor( - name='amount', full_name='hipstershop.ChargeRequest.amount', index=0, - number=1, type=11, cpp_type=10, label=1, - has_default_value=False, default_value=None, - message_type=None, enum_type=None, containing_type=None, - is_extension=False, extension_scope=None, - serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), - _descriptor.FieldDescriptor( - name='credit_card', full_name='hipstershop.ChargeRequest.credit_card', index=1, - number=2, type=11, cpp_type=10, label=1, - has_default_value=False, default_value=None, - message_type=None, enum_type=None, containing_type=None, - is_extension=False, extension_scope=None, - serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), - ], - extensions=[ - ], - nested_types=[], - enum_types=[ - ], - serialized_options=None, - is_extendable=False, - syntax='proto3', - extension_ranges=[], - oneofs=[ - ], - serialized_start=1489, - serialized_end=1590, -) - - -_CHARGERESPONSE = _descriptor.Descriptor( - name='ChargeResponse', - full_name='hipstershop.ChargeResponse', - filename=None, - file=DESCRIPTOR, - containing_type=None, - create_key=_descriptor._internal_create_key, - fields=[ - _descriptor.FieldDescriptor( - name='transaction_id', full_name='hipstershop.ChargeResponse.transaction_id', index=0, - number=1, type=9, cpp_type=9, label=1, - has_default_value=False, default_value=b"".decode('utf-8'), - message_type=None, enum_type=None, containing_type=None, - is_extension=False, extension_scope=None, - serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), - ], - extensions=[ - ], - nested_types=[], - enum_types=[ - ], - serialized_options=None, - is_extendable=False, - syntax='proto3', - extension_ranges=[], - oneofs=[ - ], - serialized_start=1592, - serialized_end=1632, -) - - -_ORDERITEM = _descriptor.Descriptor( - name='OrderItem', - full_name='hipstershop.OrderItem', - filename=None, - file=DESCRIPTOR, - containing_type=None, - create_key=_descriptor._internal_create_key, - fields=[ - _descriptor.FieldDescriptor( - name='item', full_name='hipstershop.OrderItem.item', index=0, - number=1, type=11, cpp_type=10, label=1, - has_default_value=False, default_value=None, - message_type=None, enum_type=None, containing_type=None, - is_extension=False, extension_scope=None, - serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), - _descriptor.FieldDescriptor( - name='cost', full_name='hipstershop.OrderItem.cost', index=1, - number=2, type=11, cpp_type=10, label=1, - has_default_value=False, default_value=None, - message_type=None, enum_type=None, containing_type=None, - is_extension=False, extension_scope=None, - serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), - ], - extensions=[ - ], - nested_types=[], - enum_types=[ - ], - serialized_options=None, - is_extendable=False, - syntax='proto3', - extension_ranges=[], - oneofs=[ - ], - serialized_start=1634, - serialized_end=1716, -) - - -_ORDERRESULT = _descriptor.Descriptor( - name='OrderResult', - full_name='hipstershop.OrderResult', - filename=None, - file=DESCRIPTOR, - containing_type=None, - create_key=_descriptor._internal_create_key, - fields=[ - _descriptor.FieldDescriptor( - name='order_id', full_name='hipstershop.OrderResult.order_id', index=0, - number=1, type=9, cpp_type=9, label=1, - has_default_value=False, default_value=b"".decode('utf-8'), - message_type=None, enum_type=None, containing_type=None, - is_extension=False, extension_scope=None, - serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), - _descriptor.FieldDescriptor( - name='shipping_tracking_id', full_name='hipstershop.OrderResult.shipping_tracking_id', index=1, - number=2, type=9, cpp_type=9, label=1, - has_default_value=False, default_value=b"".decode('utf-8'), - message_type=None, enum_type=None, containing_type=None, - is_extension=False, extension_scope=None, - serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), - _descriptor.FieldDescriptor( - name='shipping_cost', full_name='hipstershop.OrderResult.shipping_cost', index=2, - number=3, type=11, cpp_type=10, label=1, - has_default_value=False, default_value=None, - message_type=None, enum_type=None, containing_type=None, - is_extension=False, extension_scope=None, - serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), - _descriptor.FieldDescriptor( - name='shipping_address', full_name='hipstershop.OrderResult.shipping_address', index=3, - number=4, type=11, cpp_type=10, label=1, - has_default_value=False, default_value=None, - message_type=None, enum_type=None, containing_type=None, - is_extension=False, extension_scope=None, - serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), - _descriptor.FieldDescriptor( - name='items', full_name='hipstershop.OrderResult.items', index=4, - number=5, type=11, cpp_type=10, label=3, - has_default_value=False, default_value=[], - message_type=None, enum_type=None, containing_type=None, - is_extension=False, extension_scope=None, - serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), - ], - extensions=[ - ], - nested_types=[], - enum_types=[ - ], - serialized_options=None, - is_extendable=False, - syntax='proto3', - extension_ranges=[], - oneofs=[ - ], - serialized_start=1719, - serialized_end=1910, -) - - -_SENDORDERCONFIRMATIONREQUEST = _descriptor.Descriptor( - name='SendOrderConfirmationRequest', - full_name='hipstershop.SendOrderConfirmationRequest', - filename=None, - file=DESCRIPTOR, - containing_type=None, - create_key=_descriptor._internal_create_key, - fields=[ - _descriptor.FieldDescriptor( - name='email', full_name='hipstershop.SendOrderConfirmationRequest.email', index=0, - number=1, type=9, cpp_type=9, label=1, - has_default_value=False, default_value=b"".decode('utf-8'), - message_type=None, enum_type=None, containing_type=None, - is_extension=False, extension_scope=None, - serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), - _descriptor.FieldDescriptor( - name='order', full_name='hipstershop.SendOrderConfirmationRequest.order', index=1, - number=2, type=11, cpp_type=10, label=1, - has_default_value=False, default_value=None, - message_type=None, enum_type=None, containing_type=None, - is_extension=False, extension_scope=None, - serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), - ], - extensions=[ - ], - nested_types=[], - enum_types=[ - ], - serialized_options=None, - is_extendable=False, - syntax='proto3', - extension_ranges=[], - oneofs=[ - ], - serialized_start=1912, - serialized_end=1998, -) - - -_PLACEORDERREQUEST = _descriptor.Descriptor( - name='PlaceOrderRequest', - full_name='hipstershop.PlaceOrderRequest', - filename=None, - file=DESCRIPTOR, - containing_type=None, - create_key=_descriptor._internal_create_key, - fields=[ - _descriptor.FieldDescriptor( - name='user_id', full_name='hipstershop.PlaceOrderRequest.user_id', index=0, - number=1, type=9, cpp_type=9, label=1, - has_default_value=False, default_value=b"".decode('utf-8'), - message_type=None, enum_type=None, containing_type=None, - is_extension=False, extension_scope=None, - serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), - _descriptor.FieldDescriptor( - name='user_currency', full_name='hipstershop.PlaceOrderRequest.user_currency', index=1, - number=2, type=9, cpp_type=9, label=1, - has_default_value=False, default_value=b"".decode('utf-8'), - message_type=None, enum_type=None, containing_type=None, - is_extension=False, extension_scope=None, - serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), - _descriptor.FieldDescriptor( - name='address', full_name='hipstershop.PlaceOrderRequest.address', index=2, - number=3, type=11, cpp_type=10, label=1, - has_default_value=False, default_value=None, - message_type=None, enum_type=None, containing_type=None, - is_extension=False, extension_scope=None, - serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), - _descriptor.FieldDescriptor( - name='email', full_name='hipstershop.PlaceOrderRequest.email', index=3, - number=5, type=9, cpp_type=9, label=1, - has_default_value=False, default_value=b"".decode('utf-8'), - message_type=None, enum_type=None, containing_type=None, - is_extension=False, extension_scope=None, - serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), - _descriptor.FieldDescriptor( - name='credit_card', full_name='hipstershop.PlaceOrderRequest.credit_card', index=4, - number=6, type=11, cpp_type=10, label=1, - has_default_value=False, default_value=None, - message_type=None, enum_type=None, containing_type=None, - is_extension=False, extension_scope=None, - serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), - ], - extensions=[ - ], - nested_types=[], - enum_types=[ - ], - serialized_options=None, - is_extendable=False, - syntax='proto3', - extension_ranges=[], - oneofs=[ - ], - serialized_start=2001, - serialized_end=2164, -) - - -_PLACEORDERRESPONSE = _descriptor.Descriptor( - name='PlaceOrderResponse', - full_name='hipstershop.PlaceOrderResponse', - filename=None, - file=DESCRIPTOR, - containing_type=None, - create_key=_descriptor._internal_create_key, - fields=[ - _descriptor.FieldDescriptor( - name='order', full_name='hipstershop.PlaceOrderResponse.order', index=0, - number=1, type=11, cpp_type=10, label=1, - has_default_value=False, default_value=None, - message_type=None, enum_type=None, containing_type=None, - is_extension=False, extension_scope=None, - serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), - ], - extensions=[ - ], - nested_types=[], - enum_types=[ - ], - serialized_options=None, - is_extendable=False, - syntax='proto3', - extension_ranges=[], - oneofs=[ - ], - serialized_start=2166, - serialized_end=2227, -) - - -_ADREQUEST = _descriptor.Descriptor( - name='AdRequest', - full_name='hipstershop.AdRequest', - filename=None, - file=DESCRIPTOR, - containing_type=None, - create_key=_descriptor._internal_create_key, - fields=[ - _descriptor.FieldDescriptor( - name='context_keys', full_name='hipstershop.AdRequest.context_keys', index=0, - number=1, type=9, cpp_type=9, label=3, - has_default_value=False, default_value=[], - message_type=None, enum_type=None, containing_type=None, - is_extension=False, extension_scope=None, - serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), - ], - extensions=[ - ], - nested_types=[], - enum_types=[ - ], - serialized_options=None, - is_extendable=False, - syntax='proto3', - extension_ranges=[], - oneofs=[ - ], - serialized_start=2229, - serialized_end=2262, -) - - -_ADRESPONSE = _descriptor.Descriptor( - name='AdResponse', - full_name='hipstershop.AdResponse', - filename=None, - file=DESCRIPTOR, - containing_type=None, - create_key=_descriptor._internal_create_key, - fields=[ - _descriptor.FieldDescriptor( - name='ads', full_name='hipstershop.AdResponse.ads', index=0, - number=1, type=11, cpp_type=10, label=3, - has_default_value=False, default_value=[], - message_type=None, enum_type=None, containing_type=None, - is_extension=False, extension_scope=None, - serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), - ], - extensions=[ - ], - nested_types=[], - enum_types=[ - ], - serialized_options=None, - is_extendable=False, - syntax='proto3', - extension_ranges=[], - oneofs=[ - ], - serialized_start=2264, - serialized_end=2306, -) - - -_AD = _descriptor.Descriptor( - name='Ad', - full_name='hipstershop.Ad', - filename=None, - file=DESCRIPTOR, - containing_type=None, - create_key=_descriptor._internal_create_key, - fields=[ - _descriptor.FieldDescriptor( - name='redirect_url', full_name='hipstershop.Ad.redirect_url', index=0, - number=1, type=9, cpp_type=9, label=1, - has_default_value=False, default_value=b"".decode('utf-8'), - message_type=None, enum_type=None, containing_type=None, - is_extension=False, extension_scope=None, - serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), - _descriptor.FieldDescriptor( - name='text', full_name='hipstershop.Ad.text', index=1, - number=2, type=9, cpp_type=9, label=1, - has_default_value=False, default_value=b"".decode('utf-8'), - message_type=None, enum_type=None, containing_type=None, - is_extension=False, extension_scope=None, - serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), - ], - extensions=[ - ], - nested_types=[], - enum_types=[ - ], - serialized_options=None, - is_extendable=False, - syntax='proto3', - extension_ranges=[], - oneofs=[ - ], - serialized_start=2308, - serialized_end=2348, -) - -_ADDITEMREQUEST.fields_by_name['item'].message_type = _CARTITEM -_CART.fields_by_name['items'].message_type = _CARTITEM -_PRODUCT.fields_by_name['price_usd'].message_type = _MONEY -_LISTPRODUCTSRESPONSE.fields_by_name['products'].message_type = _PRODUCT -_SEARCHPRODUCTSRESPONSE.fields_by_name['results'].message_type = _PRODUCT -_GETQUOTEREQUEST.fields_by_name['address'].message_type = _ADDRESS -_GETQUOTEREQUEST.fields_by_name['items'].message_type = _CARTITEM -_GETQUOTERESPONSE.fields_by_name['cost_usd'].message_type = _MONEY -_SHIPORDERREQUEST.fields_by_name['address'].message_type = _ADDRESS -_SHIPORDERREQUEST.fields_by_name['items'].message_type = _CARTITEM -_CURRENCYCONVERSIONREQUEST.fields_by_name['from'].message_type = _MONEY -_CHARGEREQUEST.fields_by_name['amount'].message_type = _MONEY -_CHARGEREQUEST.fields_by_name['credit_card'].message_type = _CREDITCARDINFO -_ORDERITEM.fields_by_name['item'].message_type = _CARTITEM -_ORDERITEM.fields_by_name['cost'].message_type = _MONEY -_ORDERRESULT.fields_by_name['shipping_cost'].message_type = _MONEY -_ORDERRESULT.fields_by_name['shipping_address'].message_type = _ADDRESS -_ORDERRESULT.fields_by_name['items'].message_type = _ORDERITEM -_SENDORDERCONFIRMATIONREQUEST.fields_by_name['order'].message_type = _ORDERRESULT -_PLACEORDERREQUEST.fields_by_name['address'].message_type = _ADDRESS -_PLACEORDERREQUEST.fields_by_name['credit_card'].message_type = _CREDITCARDINFO -_PLACEORDERRESPONSE.fields_by_name['order'].message_type = _ORDERRESULT -_ADRESPONSE.fields_by_name['ads'].message_type = _AD -DESCRIPTOR.message_types_by_name['CartItem'] = _CARTITEM -DESCRIPTOR.message_types_by_name['AddItemRequest'] = _ADDITEMREQUEST -DESCRIPTOR.message_types_by_name['EmptyCartRequest'] = _EMPTYCARTREQUEST -DESCRIPTOR.message_types_by_name['GetCartRequest'] = _GETCARTREQUEST -DESCRIPTOR.message_types_by_name['Cart'] = _CART -DESCRIPTOR.message_types_by_name['Empty'] = _EMPTY -DESCRIPTOR.message_types_by_name['ListRecommendationsRequest'] = _LISTRECOMMENDATIONSREQUEST -DESCRIPTOR.message_types_by_name['ListRecommendationsResponse'] = _LISTRECOMMENDATIONSRESPONSE -DESCRIPTOR.message_types_by_name['Product'] = _PRODUCT -DESCRIPTOR.message_types_by_name['ListProductsResponse'] = _LISTPRODUCTSRESPONSE -DESCRIPTOR.message_types_by_name['GetProductRequest'] = _GETPRODUCTREQUEST -DESCRIPTOR.message_types_by_name['SearchProductsRequest'] = _SEARCHPRODUCTSREQUEST -DESCRIPTOR.message_types_by_name['SearchProductsResponse'] = _SEARCHPRODUCTSRESPONSE -DESCRIPTOR.message_types_by_name['GetQuoteRequest'] = _GETQUOTEREQUEST -DESCRIPTOR.message_types_by_name['GetQuoteResponse'] = _GETQUOTERESPONSE -DESCRIPTOR.message_types_by_name['ShipOrderRequest'] = _SHIPORDERREQUEST -DESCRIPTOR.message_types_by_name['ShipOrderResponse'] = _SHIPORDERRESPONSE -DESCRIPTOR.message_types_by_name['Address'] = _ADDRESS -DESCRIPTOR.message_types_by_name['Money'] = _MONEY -DESCRIPTOR.message_types_by_name['GetSupportedCurrenciesResponse'] = _GETSUPPORTEDCURRENCIESRESPONSE -DESCRIPTOR.message_types_by_name['CurrencyConversionRequest'] = _CURRENCYCONVERSIONREQUEST -DESCRIPTOR.message_types_by_name['CreditCardInfo'] = _CREDITCARDINFO -DESCRIPTOR.message_types_by_name['ChargeRequest'] = _CHARGEREQUEST -DESCRIPTOR.message_types_by_name['ChargeResponse'] = _CHARGERESPONSE -DESCRIPTOR.message_types_by_name['OrderItem'] = _ORDERITEM -DESCRIPTOR.message_types_by_name['OrderResult'] = _ORDERRESULT -DESCRIPTOR.message_types_by_name['SendOrderConfirmationRequest'] = _SENDORDERCONFIRMATIONREQUEST -DESCRIPTOR.message_types_by_name['PlaceOrderRequest'] = _PLACEORDERREQUEST -DESCRIPTOR.message_types_by_name['PlaceOrderResponse'] = _PLACEORDERRESPONSE -DESCRIPTOR.message_types_by_name['AdRequest'] = _ADREQUEST -DESCRIPTOR.message_types_by_name['AdResponse'] = _ADRESPONSE -DESCRIPTOR.message_types_by_name['Ad'] = _AD -_sym_db.RegisterFileDescriptor(DESCRIPTOR) - -CartItem = _reflection.GeneratedProtocolMessageType('CartItem', (_message.Message,), { - 'DESCRIPTOR' : _CARTITEM, - '__module__' : 'demo_pb2' - # @@protoc_insertion_point(class_scope:hipstershop.CartItem) - }) -_sym_db.RegisterMessage(CartItem) - -AddItemRequest = _reflection.GeneratedProtocolMessageType('AddItemRequest', (_message.Message,), { - 'DESCRIPTOR' : _ADDITEMREQUEST, - '__module__' : 'demo_pb2' - # @@protoc_insertion_point(class_scope:hipstershop.AddItemRequest) - }) -_sym_db.RegisterMessage(AddItemRequest) - -EmptyCartRequest = _reflection.GeneratedProtocolMessageType('EmptyCartRequest', (_message.Message,), { - 'DESCRIPTOR' : _EMPTYCARTREQUEST, - '__module__' : 'demo_pb2' - # @@protoc_insertion_point(class_scope:hipstershop.EmptyCartRequest) - }) -_sym_db.RegisterMessage(EmptyCartRequest) - -GetCartRequest = _reflection.GeneratedProtocolMessageType('GetCartRequest', (_message.Message,), { - 'DESCRIPTOR' : _GETCARTREQUEST, - '__module__' : 'demo_pb2' - # @@protoc_insertion_point(class_scope:hipstershop.GetCartRequest) - }) -_sym_db.RegisterMessage(GetCartRequest) - -Cart = _reflection.GeneratedProtocolMessageType('Cart', (_message.Message,), { - 'DESCRIPTOR' : _CART, - '__module__' : 'demo_pb2' - # @@protoc_insertion_point(class_scope:hipstershop.Cart) - }) -_sym_db.RegisterMessage(Cart) - -Empty = _reflection.GeneratedProtocolMessageType('Empty', (_message.Message,), { - 'DESCRIPTOR' : _EMPTY, - '__module__' : 'demo_pb2' - # @@protoc_insertion_point(class_scope:hipstershop.Empty) - }) -_sym_db.RegisterMessage(Empty) - -ListRecommendationsRequest = _reflection.GeneratedProtocolMessageType('ListRecommendationsRequest', (_message.Message,), { - 'DESCRIPTOR' : _LISTRECOMMENDATIONSREQUEST, - '__module__' : 'demo_pb2' - # @@protoc_insertion_point(class_scope:hipstershop.ListRecommendationsRequest) - }) -_sym_db.RegisterMessage(ListRecommendationsRequest) - -ListRecommendationsResponse = _reflection.GeneratedProtocolMessageType('ListRecommendationsResponse', (_message.Message,), { - 'DESCRIPTOR' : _LISTRECOMMENDATIONSRESPONSE, - '__module__' : 'demo_pb2' - # @@protoc_insertion_point(class_scope:hipstershop.ListRecommendationsResponse) - }) -_sym_db.RegisterMessage(ListRecommendationsResponse) - -Product = _reflection.GeneratedProtocolMessageType('Product', (_message.Message,), { - 'DESCRIPTOR' : _PRODUCT, - '__module__' : 'demo_pb2' - # @@protoc_insertion_point(class_scope:hipstershop.Product) - }) -_sym_db.RegisterMessage(Product) - -ListProductsResponse = _reflection.GeneratedProtocolMessageType('ListProductsResponse', (_message.Message,), { - 'DESCRIPTOR' : _LISTPRODUCTSRESPONSE, - '__module__' : 'demo_pb2' - # @@protoc_insertion_point(class_scope:hipstershop.ListProductsResponse) - }) -_sym_db.RegisterMessage(ListProductsResponse) - -GetProductRequest = _reflection.GeneratedProtocolMessageType('GetProductRequest', (_message.Message,), { - 'DESCRIPTOR' : _GETPRODUCTREQUEST, - '__module__' : 'demo_pb2' - # @@protoc_insertion_point(class_scope:hipstershop.GetProductRequest) - }) -_sym_db.RegisterMessage(GetProductRequest) - -SearchProductsRequest = _reflection.GeneratedProtocolMessageType('SearchProductsRequest', (_message.Message,), { - 'DESCRIPTOR' : _SEARCHPRODUCTSREQUEST, - '__module__' : 'demo_pb2' - # @@protoc_insertion_point(class_scope:hipstershop.SearchProductsRequest) - }) -_sym_db.RegisterMessage(SearchProductsRequest) - -SearchProductsResponse = _reflection.GeneratedProtocolMessageType('SearchProductsResponse', (_message.Message,), { - 'DESCRIPTOR' : _SEARCHPRODUCTSRESPONSE, - '__module__' : 'demo_pb2' - # @@protoc_insertion_point(class_scope:hipstershop.SearchProductsResponse) - }) -_sym_db.RegisterMessage(SearchProductsResponse) - -GetQuoteRequest = _reflection.GeneratedProtocolMessageType('GetQuoteRequest', (_message.Message,), { - 'DESCRIPTOR' : _GETQUOTEREQUEST, - '__module__' : 'demo_pb2' - # @@protoc_insertion_point(class_scope:hipstershop.GetQuoteRequest) - }) -_sym_db.RegisterMessage(GetQuoteRequest) - -GetQuoteResponse = _reflection.GeneratedProtocolMessageType('GetQuoteResponse', (_message.Message,), { - 'DESCRIPTOR' : _GETQUOTERESPONSE, - '__module__' : 'demo_pb2' - # @@protoc_insertion_point(class_scope:hipstershop.GetQuoteResponse) - }) -_sym_db.RegisterMessage(GetQuoteResponse) - -ShipOrderRequest = _reflection.GeneratedProtocolMessageType('ShipOrderRequest', (_message.Message,), { - 'DESCRIPTOR' : _SHIPORDERREQUEST, - '__module__' : 'demo_pb2' - # @@protoc_insertion_point(class_scope:hipstershop.ShipOrderRequest) - }) -_sym_db.RegisterMessage(ShipOrderRequest) - -ShipOrderResponse = _reflection.GeneratedProtocolMessageType('ShipOrderResponse', (_message.Message,), { - 'DESCRIPTOR' : _SHIPORDERRESPONSE, - '__module__' : 'demo_pb2' - # @@protoc_insertion_point(class_scope:hipstershop.ShipOrderResponse) - }) -_sym_db.RegisterMessage(ShipOrderResponse) - -Address = _reflection.GeneratedProtocolMessageType('Address', (_message.Message,), { - 'DESCRIPTOR' : _ADDRESS, - '__module__' : 'demo_pb2' - # @@protoc_insertion_point(class_scope:hipstershop.Address) - }) -_sym_db.RegisterMessage(Address) - -Money = _reflection.GeneratedProtocolMessageType('Money', (_message.Message,), { - 'DESCRIPTOR' : _MONEY, - '__module__' : 'demo_pb2' - # @@protoc_insertion_point(class_scope:hipstershop.Money) - }) -_sym_db.RegisterMessage(Money) - -GetSupportedCurrenciesResponse = _reflection.GeneratedProtocolMessageType('GetSupportedCurrenciesResponse', (_message.Message,), { - 'DESCRIPTOR' : _GETSUPPORTEDCURRENCIESRESPONSE, - '__module__' : 'demo_pb2' - # @@protoc_insertion_point(class_scope:hipstershop.GetSupportedCurrenciesResponse) - }) -_sym_db.RegisterMessage(GetSupportedCurrenciesResponse) - -CurrencyConversionRequest = _reflection.GeneratedProtocolMessageType('CurrencyConversionRequest', (_message.Message,), { - 'DESCRIPTOR' : _CURRENCYCONVERSIONREQUEST, - '__module__' : 'demo_pb2' - # @@protoc_insertion_point(class_scope:hipstershop.CurrencyConversionRequest) - }) -_sym_db.RegisterMessage(CurrencyConversionRequest) - -CreditCardInfo = _reflection.GeneratedProtocolMessageType('CreditCardInfo', (_message.Message,), { - 'DESCRIPTOR' : _CREDITCARDINFO, - '__module__' : 'demo_pb2' - # @@protoc_insertion_point(class_scope:hipstershop.CreditCardInfo) - }) -_sym_db.RegisterMessage(CreditCardInfo) - -ChargeRequest = _reflection.GeneratedProtocolMessageType('ChargeRequest', (_message.Message,), { - 'DESCRIPTOR' : _CHARGEREQUEST, - '__module__' : 'demo_pb2' - # @@protoc_insertion_point(class_scope:hipstershop.ChargeRequest) - }) -_sym_db.RegisterMessage(ChargeRequest) - -ChargeResponse = _reflection.GeneratedProtocolMessageType('ChargeResponse', (_message.Message,), { - 'DESCRIPTOR' : _CHARGERESPONSE, - '__module__' : 'demo_pb2' - # @@protoc_insertion_point(class_scope:hipstershop.ChargeResponse) - }) -_sym_db.RegisterMessage(ChargeResponse) - -OrderItem = _reflection.GeneratedProtocolMessageType('OrderItem', (_message.Message,), { - 'DESCRIPTOR' : _ORDERITEM, - '__module__' : 'demo_pb2' - # @@protoc_insertion_point(class_scope:hipstershop.OrderItem) - }) -_sym_db.RegisterMessage(OrderItem) - -OrderResult = _reflection.GeneratedProtocolMessageType('OrderResult', (_message.Message,), { - 'DESCRIPTOR' : _ORDERRESULT, - '__module__' : 'demo_pb2' - # @@protoc_insertion_point(class_scope:hipstershop.OrderResult) - }) -_sym_db.RegisterMessage(OrderResult) - -SendOrderConfirmationRequest = _reflection.GeneratedProtocolMessageType('SendOrderConfirmationRequest', (_message.Message,), { - 'DESCRIPTOR' : _SENDORDERCONFIRMATIONREQUEST, - '__module__' : 'demo_pb2' - # @@protoc_insertion_point(class_scope:hipstershop.SendOrderConfirmationRequest) - }) -_sym_db.RegisterMessage(SendOrderConfirmationRequest) - -PlaceOrderRequest = _reflection.GeneratedProtocolMessageType('PlaceOrderRequest', (_message.Message,), { - 'DESCRIPTOR' : _PLACEORDERREQUEST, - '__module__' : 'demo_pb2' - # @@protoc_insertion_point(class_scope:hipstershop.PlaceOrderRequest) - }) -_sym_db.RegisterMessage(PlaceOrderRequest) - -PlaceOrderResponse = _reflection.GeneratedProtocolMessageType('PlaceOrderResponse', (_message.Message,), { - 'DESCRIPTOR' : _PLACEORDERRESPONSE, - '__module__' : 'demo_pb2' - # @@protoc_insertion_point(class_scope:hipstershop.PlaceOrderResponse) - }) -_sym_db.RegisterMessage(PlaceOrderResponse) - -AdRequest = _reflection.GeneratedProtocolMessageType('AdRequest', (_message.Message,), { - 'DESCRIPTOR' : _ADREQUEST, - '__module__' : 'demo_pb2' - # @@protoc_insertion_point(class_scope:hipstershop.AdRequest) - }) -_sym_db.RegisterMessage(AdRequest) - -AdResponse = _reflection.GeneratedProtocolMessageType('AdResponse', (_message.Message,), { - 'DESCRIPTOR' : _ADRESPONSE, - '__module__' : 'demo_pb2' - # @@protoc_insertion_point(class_scope:hipstershop.AdResponse) - }) -_sym_db.RegisterMessage(AdResponse) - -Ad = _reflection.GeneratedProtocolMessageType('Ad', (_message.Message,), { - 'DESCRIPTOR' : _AD, - '__module__' : 'demo_pb2' - # @@protoc_insertion_point(class_scope:hipstershop.Ad) - }) -_sym_db.RegisterMessage(Ad) - - - -_CARTSERVICE = _descriptor.ServiceDescriptor( - name='CartService', - full_name='hipstershop.CartService', - file=DESCRIPTOR, - index=0, - serialized_options=None, - create_key=_descriptor._internal_create_key, - serialized_start=2351, - serialized_end=2553, - methods=[ - _descriptor.MethodDescriptor( - name='AddItem', - full_name='hipstershop.CartService.AddItem', - index=0, - containing_service=None, - input_type=_ADDITEMREQUEST, - output_type=_EMPTY, - serialized_options=None, - create_key=_descriptor._internal_create_key, - ), - _descriptor.MethodDescriptor( - name='GetCart', - full_name='hipstershop.CartService.GetCart', - index=1, - containing_service=None, - input_type=_GETCARTREQUEST, - output_type=_CART, - serialized_options=None, - create_key=_descriptor._internal_create_key, - ), - _descriptor.MethodDescriptor( - name='EmptyCart', - full_name='hipstershop.CartService.EmptyCart', - index=2, - containing_service=None, - input_type=_EMPTYCARTREQUEST, - output_type=_EMPTY, - serialized_options=None, - create_key=_descriptor._internal_create_key, - ), -]) -_sym_db.RegisterServiceDescriptor(_CARTSERVICE) - -DESCRIPTOR.services_by_name['CartService'] = _CARTSERVICE - - -_RECOMMENDATIONSERVICE = _descriptor.ServiceDescriptor( - name='RecommendationService', - full_name='hipstershop.RecommendationService', - file=DESCRIPTOR, - index=1, - serialized_options=None, - create_key=_descriptor._internal_create_key, - serialized_start=2556, - serialized_end=2687, - methods=[ - _descriptor.MethodDescriptor( - name='ListRecommendations', - full_name='hipstershop.RecommendationService.ListRecommendations', - index=0, - containing_service=None, - input_type=_LISTRECOMMENDATIONSREQUEST, - output_type=_LISTRECOMMENDATIONSRESPONSE, - serialized_options=None, - create_key=_descriptor._internal_create_key, - ), -]) -_sym_db.RegisterServiceDescriptor(_RECOMMENDATIONSERVICE) - -DESCRIPTOR.services_by_name['RecommendationService'] = _RECOMMENDATIONSERVICE - - -_PRODUCTCATALOGSERVICE = _descriptor.ServiceDescriptor( - name='ProductCatalogService', - full_name='hipstershop.ProductCatalogService', - file=DESCRIPTOR, - index=2, - serialized_options=None, - create_key=_descriptor._internal_create_key, - serialized_start=2690, - serialized_end=2949, - methods=[ - _descriptor.MethodDescriptor( - name='ListProducts', - full_name='hipstershop.ProductCatalogService.ListProducts', - index=0, - containing_service=None, - input_type=_EMPTY, - output_type=_LISTPRODUCTSRESPONSE, - serialized_options=None, - create_key=_descriptor._internal_create_key, - ), - _descriptor.MethodDescriptor( - name='GetProduct', - full_name='hipstershop.ProductCatalogService.GetProduct', - index=1, - containing_service=None, - input_type=_GETPRODUCTREQUEST, - output_type=_PRODUCT, - serialized_options=None, - create_key=_descriptor._internal_create_key, - ), - _descriptor.MethodDescriptor( - name='SearchProducts', - full_name='hipstershop.ProductCatalogService.SearchProducts', - index=2, - containing_service=None, - input_type=_SEARCHPRODUCTSREQUEST, - output_type=_SEARCHPRODUCTSRESPONSE, - serialized_options=None, - create_key=_descriptor._internal_create_key, - ), -]) -_sym_db.RegisterServiceDescriptor(_PRODUCTCATALOGSERVICE) - -DESCRIPTOR.services_by_name['ProductCatalogService'] = _PRODUCTCATALOGSERVICE - - -_SHIPPINGSERVICE = _descriptor.ServiceDescriptor( - name='ShippingService', - full_name='hipstershop.ShippingService', - file=DESCRIPTOR, - index=3, - serialized_options=None, - create_key=_descriptor._internal_create_key, - serialized_start=2952, - serialized_end=3122, - methods=[ - _descriptor.MethodDescriptor( - name='GetQuote', - full_name='hipstershop.ShippingService.GetQuote', - index=0, - containing_service=None, - input_type=_GETQUOTEREQUEST, - output_type=_GETQUOTERESPONSE, - serialized_options=None, - create_key=_descriptor._internal_create_key, - ), - _descriptor.MethodDescriptor( - name='ShipOrder', - full_name='hipstershop.ShippingService.ShipOrder', - index=1, - containing_service=None, - input_type=_SHIPORDERREQUEST, - output_type=_SHIPORDERRESPONSE, - serialized_options=None, - create_key=_descriptor._internal_create_key, - ), -]) -_sym_db.RegisterServiceDescriptor(_SHIPPINGSERVICE) - -DESCRIPTOR.services_by_name['ShippingService'] = _SHIPPINGSERVICE - - -_CURRENCYSERVICE = _descriptor.ServiceDescriptor( - name='CurrencyService', - full_name='hipstershop.CurrencyService', - file=DESCRIPTOR, - index=4, - serialized_options=None, - create_key=_descriptor._internal_create_key, - serialized_start=3125, - serialized_end=3308, - methods=[ - _descriptor.MethodDescriptor( - name='GetSupportedCurrencies', - full_name='hipstershop.CurrencyService.GetSupportedCurrencies', - index=0, - containing_service=None, - input_type=_EMPTY, - output_type=_GETSUPPORTEDCURRENCIESRESPONSE, - serialized_options=None, - create_key=_descriptor._internal_create_key, - ), - _descriptor.MethodDescriptor( - name='Convert', - full_name='hipstershop.CurrencyService.Convert', - index=1, - containing_service=None, - input_type=_CURRENCYCONVERSIONREQUEST, - output_type=_MONEY, - serialized_options=None, - create_key=_descriptor._internal_create_key, - ), -]) -_sym_db.RegisterServiceDescriptor(_CURRENCYSERVICE) - -DESCRIPTOR.services_by_name['CurrencyService'] = _CURRENCYSERVICE - - -_PAYMENTSERVICE = _descriptor.ServiceDescriptor( - name='PaymentService', - full_name='hipstershop.PaymentService', - file=DESCRIPTOR, - index=5, - serialized_options=None, - create_key=_descriptor._internal_create_key, - serialized_start=3310, - serialized_end=3395, - methods=[ - _descriptor.MethodDescriptor( - name='Charge', - full_name='hipstershop.PaymentService.Charge', - index=0, - containing_service=None, - input_type=_CHARGEREQUEST, - output_type=_CHARGERESPONSE, - serialized_options=None, - create_key=_descriptor._internal_create_key, - ), -]) -_sym_db.RegisterServiceDescriptor(_PAYMENTSERVICE) - -DESCRIPTOR.services_by_name['PaymentService'] = _PAYMENTSERVICE - - -_EMAILSERVICE = _descriptor.ServiceDescriptor( - name='EmailService', - full_name='hipstershop.EmailService', - file=DESCRIPTOR, - index=6, - serialized_options=None, - create_key=_descriptor._internal_create_key, - serialized_start=3397, - serialized_end=3501, - methods=[ - _descriptor.MethodDescriptor( - name='SendOrderConfirmation', - full_name='hipstershop.EmailService.SendOrderConfirmation', - index=0, - containing_service=None, - input_type=_SENDORDERCONFIRMATIONREQUEST, - output_type=_EMPTY, - serialized_options=None, - create_key=_descriptor._internal_create_key, - ), -]) -_sym_db.RegisterServiceDescriptor(_EMAILSERVICE) - -DESCRIPTOR.services_by_name['EmailService'] = _EMAILSERVICE - - -_CHECKOUTSERVICE = _descriptor.ServiceDescriptor( - name='CheckoutService', - full_name='hipstershop.CheckoutService', - file=DESCRIPTOR, - index=7, - serialized_options=None, - create_key=_descriptor._internal_create_key, - serialized_start=3503, - serialized_end=3601, - methods=[ - _descriptor.MethodDescriptor( - name='PlaceOrder', - full_name='hipstershop.CheckoutService.PlaceOrder', - index=0, - containing_service=None, - input_type=_PLACEORDERREQUEST, - output_type=_PLACEORDERRESPONSE, - serialized_options=None, - create_key=_descriptor._internal_create_key, - ), -]) -_sym_db.RegisterServiceDescriptor(_CHECKOUTSERVICE) - -DESCRIPTOR.services_by_name['CheckoutService'] = _CHECKOUTSERVICE - - -_ADSERVICE = _descriptor.ServiceDescriptor( - name='AdService', - full_name='hipstershop.AdService', - file=DESCRIPTOR, - index=8, - serialized_options=None, - create_key=_descriptor._internal_create_key, - serialized_start=3603, - serialized_end=3675, - methods=[ - _descriptor.MethodDescriptor( - name='GetAds', - full_name='hipstershop.AdService.GetAds', - index=0, - containing_service=None, - input_type=_ADREQUEST, - output_type=_ADRESPONSE, - serialized_options=None, - create_key=_descriptor._internal_create_key, - ), -]) -_sym_db.RegisterServiceDescriptor(_ADSERVICE) - -DESCRIPTOR.services_by_name['AdService'] = _ADSERVICE - -# @@protoc_insertion_point(module_scope) diff --git a/src/emailservice/demo_pb2_grpc.py b/src/emailservice/demo_pb2_grpc.py deleted file mode 100644 index c172b0ac10..0000000000 --- a/src/emailservice/demo_pb2_grpc.py +++ /dev/null @@ -1,806 +0,0 @@ -# Generated by the gRPC Python protocol compiler plugin. DO NOT EDIT! -"""Client and server classes corresponding to protobuf-defined services.""" -import grpc - -import demo_pb2 as demo__pb2 - - -class CartServiceStub(object): - """-----------------Cart service----------------- - - """ - - def __init__(self, channel): - """Constructor. - - Args: - channel: A grpc.Channel. - """ - self.AddItem = channel.unary_unary( - '/hipstershop.CartService/AddItem', - request_serializer=demo__pb2.AddItemRequest.SerializeToString, - response_deserializer=demo__pb2.Empty.FromString, - ) - self.GetCart = channel.unary_unary( - '/hipstershop.CartService/GetCart', - request_serializer=demo__pb2.GetCartRequest.SerializeToString, - response_deserializer=demo__pb2.Cart.FromString, - ) - self.EmptyCart = channel.unary_unary( - '/hipstershop.CartService/EmptyCart', - request_serializer=demo__pb2.EmptyCartRequest.SerializeToString, - response_deserializer=demo__pb2.Empty.FromString, - ) - - -class CartServiceServicer(object): - """-----------------Cart service----------------- - - """ - - def AddItem(self, request, context): - """Missing associated documentation comment in .proto file.""" - context.set_code(grpc.StatusCode.UNIMPLEMENTED) - context.set_details('Method not implemented!') - raise NotImplementedError('Method not implemented!') - - def GetCart(self, request, context): - """Missing associated documentation comment in .proto file.""" - context.set_code(grpc.StatusCode.UNIMPLEMENTED) - context.set_details('Method not implemented!') - raise NotImplementedError('Method not implemented!') - - def EmptyCart(self, request, context): - """Missing associated documentation comment in .proto file.""" - context.set_code(grpc.StatusCode.UNIMPLEMENTED) - context.set_details('Method not implemented!') - raise NotImplementedError('Method not implemented!') - - -def add_CartServiceServicer_to_server(servicer, server): - rpc_method_handlers = { - 'AddItem': grpc.unary_unary_rpc_method_handler( - servicer.AddItem, - request_deserializer=demo__pb2.AddItemRequest.FromString, - response_serializer=demo__pb2.Empty.SerializeToString, - ), - 'GetCart': grpc.unary_unary_rpc_method_handler( - servicer.GetCart, - request_deserializer=demo__pb2.GetCartRequest.FromString, - response_serializer=demo__pb2.Cart.SerializeToString, - ), - 'EmptyCart': grpc.unary_unary_rpc_method_handler( - servicer.EmptyCart, - request_deserializer=demo__pb2.EmptyCartRequest.FromString, - response_serializer=demo__pb2.Empty.SerializeToString, - ), - } - generic_handler = grpc.method_handlers_generic_handler( - 'hipstershop.CartService', rpc_method_handlers) - server.add_generic_rpc_handlers((generic_handler,)) - - - # This class is part of an EXPERIMENTAL API. -class CartService(object): - """-----------------Cart service----------------- - - """ - - @staticmethod - def AddItem(request, - target, - options=(), - channel_credentials=None, - call_credentials=None, - insecure=False, - compression=None, - wait_for_ready=None, - timeout=None, - metadata=None): - return grpc.experimental.unary_unary(request, target, '/hipstershop.CartService/AddItem', - demo__pb2.AddItemRequest.SerializeToString, - demo__pb2.Empty.FromString, - options, channel_credentials, - insecure, call_credentials, compression, wait_for_ready, timeout, metadata) - - @staticmethod - def GetCart(request, - target, - options=(), - channel_credentials=None, - call_credentials=None, - insecure=False, - compression=None, - wait_for_ready=None, - timeout=None, - metadata=None): - return grpc.experimental.unary_unary(request, target, '/hipstershop.CartService/GetCart', - demo__pb2.GetCartRequest.SerializeToString, - demo__pb2.Cart.FromString, - options, channel_credentials, - insecure, call_credentials, compression, wait_for_ready, timeout, metadata) - - @staticmethod - def EmptyCart(request, - target, - options=(), - channel_credentials=None, - call_credentials=None, - insecure=False, - compression=None, - wait_for_ready=None, - timeout=None, - metadata=None): - return grpc.experimental.unary_unary(request, target, '/hipstershop.CartService/EmptyCart', - demo__pb2.EmptyCartRequest.SerializeToString, - demo__pb2.Empty.FromString, - options, channel_credentials, - insecure, call_credentials, compression, wait_for_ready, timeout, metadata) - - -class RecommendationServiceStub(object): - """---------------Recommendation service---------- - - """ - - def __init__(self, channel): - """Constructor. - - Args: - channel: A grpc.Channel. - """ - self.ListRecommendations = channel.unary_unary( - '/hipstershop.RecommendationService/ListRecommendations', - request_serializer=demo__pb2.ListRecommendationsRequest.SerializeToString, - response_deserializer=demo__pb2.ListRecommendationsResponse.FromString, - ) - - -class RecommendationServiceServicer(object): - """---------------Recommendation service---------- - - """ - - def ListRecommendations(self, request, context): - """Missing associated documentation comment in .proto file.""" - context.set_code(grpc.StatusCode.UNIMPLEMENTED) - context.set_details('Method not implemented!') - raise NotImplementedError('Method not implemented!') - - -def add_RecommendationServiceServicer_to_server(servicer, server): - rpc_method_handlers = { - 'ListRecommendations': grpc.unary_unary_rpc_method_handler( - servicer.ListRecommendations, - request_deserializer=demo__pb2.ListRecommendationsRequest.FromString, - response_serializer=demo__pb2.ListRecommendationsResponse.SerializeToString, - ), - } - generic_handler = grpc.method_handlers_generic_handler( - 'hipstershop.RecommendationService', rpc_method_handlers) - server.add_generic_rpc_handlers((generic_handler,)) - - - # This class is part of an EXPERIMENTAL API. -class RecommendationService(object): - """---------------Recommendation service---------- - - """ - - @staticmethod - def ListRecommendations(request, - target, - options=(), - channel_credentials=None, - call_credentials=None, - insecure=False, - compression=None, - wait_for_ready=None, - timeout=None, - metadata=None): - return grpc.experimental.unary_unary(request, target, '/hipstershop.RecommendationService/ListRecommendations', - demo__pb2.ListRecommendationsRequest.SerializeToString, - demo__pb2.ListRecommendationsResponse.FromString, - options, channel_credentials, - insecure, call_credentials, compression, wait_for_ready, timeout, metadata) - - -class ProductCatalogServiceStub(object): - """---------------Product Catalog---------------- - - """ - - def __init__(self, channel): - """Constructor. - - Args: - channel: A grpc.Channel. - """ - self.ListProducts = channel.unary_unary( - '/hipstershop.ProductCatalogService/ListProducts', - request_serializer=demo__pb2.Empty.SerializeToString, - response_deserializer=demo__pb2.ListProductsResponse.FromString, - ) - self.GetProduct = channel.unary_unary( - '/hipstershop.ProductCatalogService/GetProduct', - request_serializer=demo__pb2.GetProductRequest.SerializeToString, - response_deserializer=demo__pb2.Product.FromString, - ) - self.SearchProducts = channel.unary_unary( - '/hipstershop.ProductCatalogService/SearchProducts', - request_serializer=demo__pb2.SearchProductsRequest.SerializeToString, - response_deserializer=demo__pb2.SearchProductsResponse.FromString, - ) - - -class ProductCatalogServiceServicer(object): - """---------------Product Catalog---------------- - - """ - - def ListProducts(self, request, context): - """Missing associated documentation comment in .proto file.""" - context.set_code(grpc.StatusCode.UNIMPLEMENTED) - context.set_details('Method not implemented!') - raise NotImplementedError('Method not implemented!') - - def GetProduct(self, request, context): - """Missing associated documentation comment in .proto file.""" - context.set_code(grpc.StatusCode.UNIMPLEMENTED) - context.set_details('Method not implemented!') - raise NotImplementedError('Method not implemented!') - - def SearchProducts(self, request, context): - """Missing associated documentation comment in .proto file.""" - context.set_code(grpc.StatusCode.UNIMPLEMENTED) - context.set_details('Method not implemented!') - raise NotImplementedError('Method not implemented!') - - -def add_ProductCatalogServiceServicer_to_server(servicer, server): - rpc_method_handlers = { - 'ListProducts': grpc.unary_unary_rpc_method_handler( - servicer.ListProducts, - request_deserializer=demo__pb2.Empty.FromString, - response_serializer=demo__pb2.ListProductsResponse.SerializeToString, - ), - 'GetProduct': grpc.unary_unary_rpc_method_handler( - servicer.GetProduct, - request_deserializer=demo__pb2.GetProductRequest.FromString, - response_serializer=demo__pb2.Product.SerializeToString, - ), - 'SearchProducts': grpc.unary_unary_rpc_method_handler( - servicer.SearchProducts, - request_deserializer=demo__pb2.SearchProductsRequest.FromString, - response_serializer=demo__pb2.SearchProductsResponse.SerializeToString, - ), - } - generic_handler = grpc.method_handlers_generic_handler( - 'hipstershop.ProductCatalogService', rpc_method_handlers) - server.add_generic_rpc_handlers((generic_handler,)) - - - # This class is part of an EXPERIMENTAL API. -class ProductCatalogService(object): - """---------------Product Catalog---------------- - - """ - - @staticmethod - def ListProducts(request, - target, - options=(), - channel_credentials=None, - call_credentials=None, - insecure=False, - compression=None, - wait_for_ready=None, - timeout=None, - metadata=None): - return grpc.experimental.unary_unary(request, target, '/hipstershop.ProductCatalogService/ListProducts', - demo__pb2.Empty.SerializeToString, - demo__pb2.ListProductsResponse.FromString, - options, channel_credentials, - insecure, call_credentials, compression, wait_for_ready, timeout, metadata) - - @staticmethod - def GetProduct(request, - target, - options=(), - channel_credentials=None, - call_credentials=None, - insecure=False, - compression=None, - wait_for_ready=None, - timeout=None, - metadata=None): - return grpc.experimental.unary_unary(request, target, '/hipstershop.ProductCatalogService/GetProduct', - demo__pb2.GetProductRequest.SerializeToString, - demo__pb2.Product.FromString, - options, channel_credentials, - insecure, call_credentials, compression, wait_for_ready, timeout, metadata) - - @staticmethod - def SearchProducts(request, - target, - options=(), - channel_credentials=None, - call_credentials=None, - insecure=False, - compression=None, - wait_for_ready=None, - timeout=None, - metadata=None): - return grpc.experimental.unary_unary(request, target, '/hipstershop.ProductCatalogService/SearchProducts', - demo__pb2.SearchProductsRequest.SerializeToString, - demo__pb2.SearchProductsResponse.FromString, - options, channel_credentials, - insecure, call_credentials, compression, wait_for_ready, timeout, metadata) - - -class ShippingServiceStub(object): - """---------------Shipping Service---------- - - """ - - def __init__(self, channel): - """Constructor. - - Args: - channel: A grpc.Channel. - """ - self.GetQuote = channel.unary_unary( - '/hipstershop.ShippingService/GetQuote', - request_serializer=demo__pb2.GetQuoteRequest.SerializeToString, - response_deserializer=demo__pb2.GetQuoteResponse.FromString, - ) - self.ShipOrder = channel.unary_unary( - '/hipstershop.ShippingService/ShipOrder', - request_serializer=demo__pb2.ShipOrderRequest.SerializeToString, - response_deserializer=demo__pb2.ShipOrderResponse.FromString, - ) - - -class ShippingServiceServicer(object): - """---------------Shipping Service---------- - - """ - - def GetQuote(self, request, context): - """Missing associated documentation comment in .proto file.""" - context.set_code(grpc.StatusCode.UNIMPLEMENTED) - context.set_details('Method not implemented!') - raise NotImplementedError('Method not implemented!') - - def ShipOrder(self, request, context): - """Missing associated documentation comment in .proto file.""" - context.set_code(grpc.StatusCode.UNIMPLEMENTED) - context.set_details('Method not implemented!') - raise NotImplementedError('Method not implemented!') - - -def add_ShippingServiceServicer_to_server(servicer, server): - rpc_method_handlers = { - 'GetQuote': grpc.unary_unary_rpc_method_handler( - servicer.GetQuote, - request_deserializer=demo__pb2.GetQuoteRequest.FromString, - response_serializer=demo__pb2.GetQuoteResponse.SerializeToString, - ), - 'ShipOrder': grpc.unary_unary_rpc_method_handler( - servicer.ShipOrder, - request_deserializer=demo__pb2.ShipOrderRequest.FromString, - response_serializer=demo__pb2.ShipOrderResponse.SerializeToString, - ), - } - generic_handler = grpc.method_handlers_generic_handler( - 'hipstershop.ShippingService', rpc_method_handlers) - server.add_generic_rpc_handlers((generic_handler,)) - - - # This class is part of an EXPERIMENTAL API. -class ShippingService(object): - """---------------Shipping Service---------- - - """ - - @staticmethod - def GetQuote(request, - target, - options=(), - channel_credentials=None, - call_credentials=None, - insecure=False, - compression=None, - wait_for_ready=None, - timeout=None, - metadata=None): - return grpc.experimental.unary_unary(request, target, '/hipstershop.ShippingService/GetQuote', - demo__pb2.GetQuoteRequest.SerializeToString, - demo__pb2.GetQuoteResponse.FromString, - options, channel_credentials, - insecure, call_credentials, compression, wait_for_ready, timeout, metadata) - - @staticmethod - def ShipOrder(request, - target, - options=(), - channel_credentials=None, - call_credentials=None, - insecure=False, - compression=None, - wait_for_ready=None, - timeout=None, - metadata=None): - return grpc.experimental.unary_unary(request, target, '/hipstershop.ShippingService/ShipOrder', - demo__pb2.ShipOrderRequest.SerializeToString, - demo__pb2.ShipOrderResponse.FromString, - options, channel_credentials, - insecure, call_credentials, compression, wait_for_ready, timeout, metadata) - - -class CurrencyServiceStub(object): - """-----------------Currency service----------------- - - """ - - def __init__(self, channel): - """Constructor. - - Args: - channel: A grpc.Channel. - """ - self.GetSupportedCurrencies = channel.unary_unary( - '/hipstershop.CurrencyService/GetSupportedCurrencies', - request_serializer=demo__pb2.Empty.SerializeToString, - response_deserializer=demo__pb2.GetSupportedCurrenciesResponse.FromString, - ) - self.Convert = channel.unary_unary( - '/hipstershop.CurrencyService/Convert', - request_serializer=demo__pb2.CurrencyConversionRequest.SerializeToString, - response_deserializer=demo__pb2.Money.FromString, - ) - - -class CurrencyServiceServicer(object): - """-----------------Currency service----------------- - - """ - - def GetSupportedCurrencies(self, request, context): - """Missing associated documentation comment in .proto file.""" - context.set_code(grpc.StatusCode.UNIMPLEMENTED) - context.set_details('Method not implemented!') - raise NotImplementedError('Method not implemented!') - - def Convert(self, request, context): - """Missing associated documentation comment in .proto file.""" - context.set_code(grpc.StatusCode.UNIMPLEMENTED) - context.set_details('Method not implemented!') - raise NotImplementedError('Method not implemented!') - - -def add_CurrencyServiceServicer_to_server(servicer, server): - rpc_method_handlers = { - 'GetSupportedCurrencies': grpc.unary_unary_rpc_method_handler( - servicer.GetSupportedCurrencies, - request_deserializer=demo__pb2.Empty.FromString, - response_serializer=demo__pb2.GetSupportedCurrenciesResponse.SerializeToString, - ), - 'Convert': grpc.unary_unary_rpc_method_handler( - servicer.Convert, - request_deserializer=demo__pb2.CurrencyConversionRequest.FromString, - response_serializer=demo__pb2.Money.SerializeToString, - ), - } - generic_handler = grpc.method_handlers_generic_handler( - 'hipstershop.CurrencyService', rpc_method_handlers) - server.add_generic_rpc_handlers((generic_handler,)) - - - # This class is part of an EXPERIMENTAL API. -class CurrencyService(object): - """-----------------Currency service----------------- - - """ - - @staticmethod - def GetSupportedCurrencies(request, - target, - options=(), - channel_credentials=None, - call_credentials=None, - insecure=False, - compression=None, - wait_for_ready=None, - timeout=None, - metadata=None): - return grpc.experimental.unary_unary(request, target, '/hipstershop.CurrencyService/GetSupportedCurrencies', - demo__pb2.Empty.SerializeToString, - demo__pb2.GetSupportedCurrenciesResponse.FromString, - options, channel_credentials, - insecure, call_credentials, compression, wait_for_ready, timeout, metadata) - - @staticmethod - def Convert(request, - target, - options=(), - channel_credentials=None, - call_credentials=None, - insecure=False, - compression=None, - wait_for_ready=None, - timeout=None, - metadata=None): - return grpc.experimental.unary_unary(request, target, '/hipstershop.CurrencyService/Convert', - demo__pb2.CurrencyConversionRequest.SerializeToString, - demo__pb2.Money.FromString, - options, channel_credentials, - insecure, call_credentials, compression, wait_for_ready, timeout, metadata) - - -class PaymentServiceStub(object): - """-------------Payment service----------------- - - """ - - def __init__(self, channel): - """Constructor. - - Args: - channel: A grpc.Channel. - """ - self.Charge = channel.unary_unary( - '/hipstershop.PaymentService/Charge', - request_serializer=demo__pb2.ChargeRequest.SerializeToString, - response_deserializer=demo__pb2.ChargeResponse.FromString, - ) - - -class PaymentServiceServicer(object): - """-------------Payment service----------------- - - """ - - def Charge(self, request, context): - """Missing associated documentation comment in .proto file.""" - context.set_code(grpc.StatusCode.UNIMPLEMENTED) - context.set_details('Method not implemented!') - raise NotImplementedError('Method not implemented!') - - -def add_PaymentServiceServicer_to_server(servicer, server): - rpc_method_handlers = { - 'Charge': grpc.unary_unary_rpc_method_handler( - servicer.Charge, - request_deserializer=demo__pb2.ChargeRequest.FromString, - response_serializer=demo__pb2.ChargeResponse.SerializeToString, - ), - } - generic_handler = grpc.method_handlers_generic_handler( - 'hipstershop.PaymentService', rpc_method_handlers) - server.add_generic_rpc_handlers((generic_handler,)) - - - # This class is part of an EXPERIMENTAL API. -class PaymentService(object): - """-------------Payment service----------------- - - """ - - @staticmethod - def Charge(request, - target, - options=(), - channel_credentials=None, - call_credentials=None, - insecure=False, - compression=None, - wait_for_ready=None, - timeout=None, - metadata=None): - return grpc.experimental.unary_unary(request, target, '/hipstershop.PaymentService/Charge', - demo__pb2.ChargeRequest.SerializeToString, - demo__pb2.ChargeResponse.FromString, - options, channel_credentials, - insecure, call_credentials, compression, wait_for_ready, timeout, metadata) - - -class EmailServiceStub(object): - """-------------Email service----------------- - - """ - - def __init__(self, channel): - """Constructor. - - Args: - channel: A grpc.Channel. - """ - self.SendOrderConfirmation = channel.unary_unary( - '/hipstershop.EmailService/SendOrderConfirmation', - request_serializer=demo__pb2.SendOrderConfirmationRequest.SerializeToString, - response_deserializer=demo__pb2.Empty.FromString, - ) - - -class EmailServiceServicer(object): - """-------------Email service----------------- - - """ - - def SendOrderConfirmation(self, request, context): - """Missing associated documentation comment in .proto file.""" - context.set_code(grpc.StatusCode.UNIMPLEMENTED) - context.set_details('Method not implemented!') - raise NotImplementedError('Method not implemented!') - - -def add_EmailServiceServicer_to_server(servicer, server): - rpc_method_handlers = { - 'SendOrderConfirmation': grpc.unary_unary_rpc_method_handler( - servicer.SendOrderConfirmation, - request_deserializer=demo__pb2.SendOrderConfirmationRequest.FromString, - response_serializer=demo__pb2.Empty.SerializeToString, - ), - } - generic_handler = grpc.method_handlers_generic_handler( - 'hipstershop.EmailService', rpc_method_handlers) - server.add_generic_rpc_handlers((generic_handler,)) - - - # This class is part of an EXPERIMENTAL API. -class EmailService(object): - """-------------Email service----------------- - - """ - - @staticmethod - def SendOrderConfirmation(request, - target, - options=(), - channel_credentials=None, - call_credentials=None, - insecure=False, - compression=None, - wait_for_ready=None, - timeout=None, - metadata=None): - return grpc.experimental.unary_unary(request, target, '/hipstershop.EmailService/SendOrderConfirmation', - demo__pb2.SendOrderConfirmationRequest.SerializeToString, - demo__pb2.Empty.FromString, - options, channel_credentials, - insecure, call_credentials, compression, wait_for_ready, timeout, metadata) - - -class CheckoutServiceStub(object): - """-------------Checkout service----------------- - - """ - - def __init__(self, channel): - """Constructor. - - Args: - channel: A grpc.Channel. - """ - self.PlaceOrder = channel.unary_unary( - '/hipstershop.CheckoutService/PlaceOrder', - request_serializer=demo__pb2.PlaceOrderRequest.SerializeToString, - response_deserializer=demo__pb2.PlaceOrderResponse.FromString, - ) - - -class CheckoutServiceServicer(object): - """-------------Checkout service----------------- - - """ - - def PlaceOrder(self, request, context): - """Missing associated documentation comment in .proto file.""" - context.set_code(grpc.StatusCode.UNIMPLEMENTED) - context.set_details('Method not implemented!') - raise NotImplementedError('Method not implemented!') - - -def add_CheckoutServiceServicer_to_server(servicer, server): - rpc_method_handlers = { - 'PlaceOrder': grpc.unary_unary_rpc_method_handler( - servicer.PlaceOrder, - request_deserializer=demo__pb2.PlaceOrderRequest.FromString, - response_serializer=demo__pb2.PlaceOrderResponse.SerializeToString, - ), - } - generic_handler = grpc.method_handlers_generic_handler( - 'hipstershop.CheckoutService', rpc_method_handlers) - server.add_generic_rpc_handlers((generic_handler,)) - - - # This class is part of an EXPERIMENTAL API. -class CheckoutService(object): - """-------------Checkout service----------------- - - """ - - @staticmethod - def PlaceOrder(request, - target, - options=(), - channel_credentials=None, - call_credentials=None, - insecure=False, - compression=None, - wait_for_ready=None, - timeout=None, - metadata=None): - return grpc.experimental.unary_unary(request, target, '/hipstershop.CheckoutService/PlaceOrder', - demo__pb2.PlaceOrderRequest.SerializeToString, - demo__pb2.PlaceOrderResponse.FromString, - options, channel_credentials, - insecure, call_credentials, compression, wait_for_ready, timeout, metadata) - - -class AdServiceStub(object): - """------------Ad service------------------ - - """ - - def __init__(self, channel): - """Constructor. - - Args: - channel: A grpc.Channel. - """ - self.GetAds = channel.unary_unary( - '/hipstershop.AdService/GetAds', - request_serializer=demo__pb2.AdRequest.SerializeToString, - response_deserializer=demo__pb2.AdResponse.FromString, - ) - - -class AdServiceServicer(object): - """------------Ad service------------------ - - """ - - def GetAds(self, request, context): - """Missing associated documentation comment in .proto file.""" - context.set_code(grpc.StatusCode.UNIMPLEMENTED) - context.set_details('Method not implemented!') - raise NotImplementedError('Method not implemented!') - - -def add_AdServiceServicer_to_server(servicer, server): - rpc_method_handlers = { - 'GetAds': grpc.unary_unary_rpc_method_handler( - servicer.GetAds, - request_deserializer=demo__pb2.AdRequest.FromString, - response_serializer=demo__pb2.AdResponse.SerializeToString, - ), - } - generic_handler = grpc.method_handlers_generic_handler( - 'hipstershop.AdService', rpc_method_handlers) - server.add_generic_rpc_handlers((generic_handler,)) - - - # This class is part of an EXPERIMENTAL API. -class AdService(object): - """------------Ad service------------------ - - """ - - @staticmethod - def GetAds(request, - target, - options=(), - channel_credentials=None, - call_credentials=None, - insecure=False, - compression=None, - wait_for_ready=None, - timeout=None, - metadata=None): - return grpc.experimental.unary_unary(request, target, '/hipstershop.AdService/GetAds', - demo__pb2.AdRequest.SerializeToString, - demo__pb2.AdResponse.FromString, - options, channel_credentials, - insecure, call_credentials, compression, wait_for_ready, timeout, metadata) diff --git a/src/emailservice/email_client.py b/src/emailservice/email_client.py deleted file mode 100644 index 01409c83b9..0000000000 --- a/src/emailservice/email_client.py +++ /dev/null @@ -1,41 +0,0 @@ -#!/usr/bin/python -# -# Copyright 2018 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. - -import grpc - -import demo_pb2 -import demo_pb2_grpc - -from logger import getJSONLogger -logger = getJSONLogger('emailservice-client') - - -def send_confirmation_email(email, order): - channel = grpc.insecure_channel('0.0.0.0:8080') - - stub = demo_pb2_grpc.EmailServiceStub(channel) - try: - response = stub.SendOrderConfirmation(demo_pb2.SendOrderConfirmationRequest( - email = email, - order = order - )) - logger.info('Request sent.') - except grpc.RpcError as err: - logger.error(err.details()) - logger.error('{}, {}'.format(err.code().name, err.code().value)) - -if __name__ == '__main__': - logger.info('Client for email service.') diff --git a/src/emailservice/email_server.py b/src/emailservice/email_server.py deleted file mode 100644 index a8abccfcf3..0000000000 --- a/src/emailservice/email_server.py +++ /dev/null @@ -1,142 +0,0 @@ -#!/usr/bin/python -# -# Copyright 2018 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. - -from concurrent import futures -import argparse -import os -import sys -import time -import grpc -import traceback -from jinja2 import Environment, FileSystemLoader, select_autoescape, TemplateError -from google.api_core.exceptions import GoogleAPICallError - -import demo_pb2 -import demo_pb2_grpc -from grpc_health.v1 import health_pb2 -from grpc_health.v1 import health_pb2_grpc - -from opentelemetry import trace -from opentelemetry.sdk.trace import TracerProvider -from opentelemetry.sdk.trace.export import (BatchSpanProcessor) -from opentelemetry.exporter.otlp.proto.grpc.trace_exporter import OTLPSpanExporter - -from logger import getJSONLogger -logger = getJSONLogger('emailservice-server') - -tracer_provider = TracerProvider() -trace.set_tracer_provider(tracer_provider) -tracer_provider.add_span_processor(BatchSpanProcessor(OTLPSpanExporter())) - -# Loads confirmation email template from file -env = Environment( - loader=FileSystemLoader('templates'), - autoescape=select_autoescape(['html', 'xml']) -) -template = env.get_template('confirmation.html') - -class BaseEmailService(demo_pb2_grpc.EmailServiceServicer): - def Check(self, request, context): - return health_pb2.HealthCheckResponse( - status=health_pb2.HealthCheckResponse.SERVING) - - def Watch(self, request, context): - return health_pb2.HealthCheckResponse( - status=health_pb2.HealthCheckResponse.UNIMPLEMENTED) - -class EmailService(BaseEmailService): - def __init__(self): - raise Exception('cloud mail client not implemented') - super().__init__() - - @staticmethod - def send_email(client, email_address, content): - response = client.send_message( - sender = client.sender_path(project_id, region, sender_id), - envelope_from_authority = '', - header_from_authority = '', - envelope_from_address = from_address, - simple_message = { - "from": { - "address_spec": from_address, - }, - "to": [{ - "address_spec": email_address - }], - "subject": "Your Confirmation Email", - "html_body": content - } - ) - logger.info("Message sent: {}".format(response.rfc822_message_id)) - - def SendOrderConfirmation(self, request, context): - email = request.email - order = request.order - - try: - confirmation = template.render(order = order) - except TemplateError as err: - context.set_details("An error occurred when preparing the confirmation mail.") - logger.error(err.message) - context.set_code(grpc.StatusCode.INTERNAL) - return demo_pb2.Empty() - - try: - EmailService.send_email(self.client, email, confirmation) - except GoogleAPICallError as err: - context.set_details("An error occurred when sending the email.") - print(err.message) - context.set_code(grpc.StatusCode.INTERNAL) - return demo_pb2.Empty() - - return demo_pb2.Empty() - -class DummyEmailService(BaseEmailService): - def SendOrderConfirmation(self, request, context): - logger.info('A request to send order confirmation email to {} has been received.'.format(request.email)) - return demo_pb2.Empty() - -class HealthCheck(): - def Check(self, request, context): - return health_pb2.HealthCheckResponse( - status=health_pb2.HealthCheckResponse.SERVING) - -def start(dummy_mode): - server = grpc.server(futures.ThreadPoolExecutor(max_workers=10),) - service = None - if dummy_mode: - service = DummyEmailService() - else: - raise Exception('non-dummy mode not implemented yet') - - demo_pb2_grpc.add_EmailServiceServicer_to_server(service, server) - health_pb2_grpc.add_HealthServicer_to_server(service, server) - - port = os.environ.get('PORT', "8080") - logger.info("listening on port: "+port) - server.add_insecure_port('[::]:'+port) - server.start() - try: - while True: - time.sleep(3600) - except KeyboardInterrupt: - server.stop(0) - - -if __name__ == '__main__': - logger.info('starting the email service in dummy mode.') - - start(dummy_mode = True) diff --git a/src/emailservice/email_server.rb b/src/emailservice/email_server.rb new file mode 100644 index 0000000000..f5c1b1de1f --- /dev/null +++ b/src/emailservice/email_server.rb @@ -0,0 +1,22 @@ +require "ostruct" +require "pony" +require "sinatra" + +require "opentelemetry/sdk" +require "opentelemetry/exporter/otlp" +require "opentelemetry/instrumentation/sinatra" + +OpenTelemetry::SDK.configure do |c| + c.use "OpenTelemetry::Instrumentation::Sinatra" +end + +post "/send_order_confirmation" do + data = JSON.parse(request.body.read, object_class: OpenStruct) + Pony.mail( + to: data.email, + from: "noreply@example.com", + subject: "Your confirmation email", + body: erb(:confirmation, locals: { order: data.order }), + via: :logger + ) +end diff --git a/src/emailservice/logger.py b/src/emailservice/logger.py deleted file mode 100644 index ce98e268be..0000000000 --- a/src/emailservice/logger.py +++ /dev/null @@ -1,39 +0,0 @@ -#!/usr/bin/python -# -# Copyright 2018 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. - -import logging -import sys -from pythonjsonlogger import jsonlogger -from opentelemetry import trace - - -class CustomJsonFormatter(jsonlogger.JsonFormatter): - def add_fields(self, log_record, record, message_dict): - super(CustomJsonFormatter, self).add_fields(log_record, record, message_dict) - if not log_record.get('otelTraceID'): - log_record['otelTraceID'] = trace.format_trace_id(trace.get_current_span().get_span_context().trace_id) - if not log_record.get('otelSpanID'): - log_record['otelSpanID'] = trace.format_span_id(trace.get_current_span().get_span_context().span_id) - -def getJSONLogger(name): - logger = logging.getLogger(name) - handler = logging.StreamHandler(sys.stdout) - formatter = CustomJsonFormatter('%(asctime)s %(levelname)s [%(name)s] [%(filename)s:%(lineno)d] [trace_id=%(otelTraceID)s span_id=%(otelSpanID)s] - %(message)s') - handler.setFormatter(formatter) - logger.addHandler(handler) - logger.setLevel(logging.INFO) - logger.propagate = False - return logger diff --git a/src/emailservice/requirements.in b/src/emailservice/requirements.in deleted file mode 100644 index bcd79043d6..0000000000 --- a/src/emailservice/requirements.in +++ /dev/null @@ -1,12 +0,0 @@ -google-api-core==2.4.0 -grpcio-health-checking==1.43.0 -grpcio==1.43.0 -jinja2==3.0.3 -opentelemetry-api==1.9.1 -opentelemetry-exporter-otlp-proto-grpc==1.9.1 -opentelemetry-instrumentation==0.28b1 -opentelemetry-instrumentation-grpc==0.28b1 -opentelemetry-instrumentation-jinja2==0.28b1 -opentelemetry-sdk==1.9.1 -python-json-logger==2.0.2 -requests==2.27.1 diff --git a/src/emailservice/requirements.txt b/src/emailservice/requirements.txt deleted file mode 100644 index 692f736d43..0000000000 --- a/src/emailservice/requirements.txt +++ /dev/null @@ -1,105 +0,0 @@ -# -# This file is autogenerated by pip-compile with python 3.8 -# To update, run: -# -# pip-compile -# -backoff==1.10.0 - # via opentelemetry-exporter-otlp-proto-grpc -cachetools==4.2.0 - # via google-auth -certifi==2020.12.5 - # via requests -charset-normalizer==2.0.10 - # via requests -deprecated==1.2.13 - # via opentelemetry-api -google-api-core==2.4.0 - # via -r requirements.in -google-auth==2.4.1 - # via google-api-core -googleapis-common-protos==1.52.0 - # via - # google-api-core - # opentelemetry-exporter-otlp-proto-grpc -grpcio==1.43.0 - # via - # -r requirements.in - # grpcio-health-checking - # opentelemetry-exporter-otlp-proto-grpc -grpcio-health-checking==1.43.0 - # via -r requirements.in -idna==2.10 - # via requests -jinja2==3.0.3 - # via -r requirements.in -markupsafe==2.0.1 - # via jinja2 -opentelemetry-api==1.9.1 - # via - # -r requirements.in - # opentelemetry-exporter-otlp-proto-grpc - # opentelemetry-instrumentation - # opentelemetry-instrumentation-grpc - # opentelemetry-instrumentation-jinja2 - # opentelemetry-sdk -opentelemetry-exporter-otlp-proto-grpc==1.9.1 - # via -r requirements.in -opentelemetry-instrumentation==0.28b1 - # via - # -r requirements.in - # opentelemetry-instrumentation-grpc - # opentelemetry-instrumentation-jinja2 -opentelemetry-instrumentation-grpc==0.28b1 - # via -r requirements.in -opentelemetry-instrumentation-jinja2==0.28b1 - # via -r requirements.in -opentelemetry-proto==1.9.1 - # via opentelemetry-exporter-otlp-proto-grpc -opentelemetry-sdk==1.9.1 - # via - # -r requirements.in - # opentelemetry-exporter-otlp-proto-grpc - # opentelemetry-instrumentation-grpc -opentelemetry-semantic-conventions==0.28b1 - # via - # opentelemetry-instrumentation-grpc - # opentelemetry-sdk -protobuf==3.13.0 - # via - # google-api-core - # googleapis-common-protos - # grpcio-health-checking - # opentelemetry-proto -pyasn1==0.4.8 - # via - # pyasn1-modules - # rsa -pyasn1-modules==0.2.8 - # via google-auth -python-json-logger==2.0.2 - # via -r requirements.in -requests==2.27.1 - # via - # -r requirements.in - # google-api-core -rsa==4.7 - # via google-auth -six==1.15.0 - # via - # google-auth - # grpcio - # protobuf -typing-extensions==4.0.1 - # via opentelemetry-sdk -urllib3==1.25.10 - # via requests -wrapt==1.13.3 - # via - # deprecated - # opentelemetry-instrumentation - # opentelemetry-instrumentation-grpc - # opentelemetry-instrumentation-jinja2 - -# The following packages are considered to be unsafe in a requirements file: -# setuptools diff --git a/src/emailservice/templates/confirmation.html b/src/emailservice/views/confirmation.erb similarity index 60% rename from src/emailservice/templates/confirmation.html rename to src/emailservice/views/confirmation.erb index b65574509f..551721c338 100644 --- a/src/emailservice/templates/confirmation.html +++ b/src/emailservice/views/confirmation.erb @@ -29,25 +29,25 @@

Your Order Confirmation

Thanks for shopping with us!

Order ID

-

#{{ order.order_id }}

+

<%= order.order_id %>

Shipping

-

#{{ order.shipping_tracking_id }}

-

{{ order.shipping_cost.units }}. {{ "%02d" | format(order.shipping_cost.nanos // 10000000) }} {{ order.shipping_cost.currency_code }}

-

{{ order.shipping_address.street_address_1 }}, {{order.shipping_address.street_address_2}}, {{order.shipping_address.city}}, {{order.shipping_address.country}} {{order.shipping_address.zip_code}}

+

<%= order.shipping_tracking_id %>

+

<%= order.shipping_cost.units %>.<%= order.shipping_cost %> <%= order.shipping_cost.currency_code %>

+

<%= order.shipping_address.street_address_1 %>, <%= order.shipping_address.street_address_2 %>, <%= order.shipping_address.city %>, <%= order.shipping_address.country %> <%= order.shipping_address.zip_code %>

Items

- + - {% for item in order.items %} - - - - - - {% endfor %} + <% order.items.each do |item| %> + + + + + + <% end %>
Item No.QuantityQuantity Price
#{{ item.item.product_id }}{{ item.item.quantity }}{{ item.cost.units }}.{{ "%02d" | format(item.cost.nanos // 10000000) }} {{ item.cost.currency_code }}
<%= item.item.product_id %><%= item.item.quantity %><%= item.cost.units %>.<%= item.cost.nanos %> <%= item.cost.currency_code %>
From 179eb591e5cabf055415e3c8efc8b094b953c40a Mon Sep 17 00:00:00 2001 From: Andrew Hayworth Date: Sat, 4 Jun 2022 00:30:38 -0500 Subject: [PATCH 2/6] feat: call emailservice via HTTP POST This commit causes the checkoutservice to call emailservice via HTTP POST. We leverage the golang net/http autoinstrumentation to create the spans and propagate context correctly for us. --- src/checkoutservice/go.mod | 4 ++++ src/checkoutservice/go.sum | 20 ++++++++++++++++++++ src/checkoutservice/main.go | 26 ++++++++++++++++++++------ 3 files changed, 44 insertions(+), 6 deletions(-) diff --git a/src/checkoutservice/go.mod b/src/checkoutservice/go.mod index 9649d20f1c..e8709f0804 100644 --- a/src/checkoutservice/go.mod +++ b/src/checkoutservice/go.mod @@ -14,11 +14,15 @@ require ( require ( cloud.google.com/go/compute v0.1.0 // indirect github.com/cenkalti/backoff/v4 v4.1.2 // indirect + github.com/felixge/httpsnoop v1.0.2 // indirect github.com/go-logr/logr v1.2.2 // indirect github.com/go-logr/stdr v1.2.2 // indirect github.com/golang/protobuf v1.5.2 // indirect github.com/grpc-ecosystem/grpc-gateway v1.16.0 // indirect + go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.29.0 // indirect go.opentelemetry.io/otel/exporters/otlp/internal/retry v1.4.1 // indirect + go.opentelemetry.io/otel/internal/metric v0.27.0 // indirect + go.opentelemetry.io/otel/metric v0.27.0 // indirect go.opentelemetry.io/otel/trace v1.4.1 // indirect go.opentelemetry.io/proto/otlp v0.12.0 // indirect golang.org/x/net v0.0.0-20220121210141-e204ce36a2ba // indirect diff --git a/src/checkoutservice/go.sum b/src/checkoutservice/go.sum index 5f8787160c..cf444b05d3 100644 --- a/src/checkoutservice/go.sum +++ b/src/checkoutservice/go.sum @@ -81,12 +81,16 @@ github.com/envoyproxy/go-control-plane v0.9.9-0.20210217033140-668b12f5399d/go.m github.com/envoyproxy/go-control-plane v0.9.9-0.20210512163311-63b5d3c536b0/go.mod h1:hliV/p42l8fGbc6Y9bQ70uLwIvmJyVE5k4iMKlh8wCQ= github.com/envoyproxy/go-control-plane v0.9.10-0.20210907150352-cf90f659a021/go.mod h1:AFq3mo9L8Lqqiid3OhADV3RfLJnjiw63cSpi+fDTRC0= github.com/envoyproxy/protoc-gen-validate v0.1.0/go.mod h1:iSmxcyjqTsJpI2R4NaDN7+kN2VEUnK/pcBlmesArF7c= +github.com/felixge/httpsnoop v1.0.2 h1:+nS9g82KMXccJ/wp0zyRW9ZBHFETmMGtkk+2CTTrW4o= +github.com/felixge/httpsnoop v1.0.2/go.mod h1:m8KPJKqk1gH5J9DgRY2ASl2lWCfGKXixSwevea8zH2U= github.com/ghodss/yaml v1.0.0/go.mod h1:4dBDuWmgqj2HViK6kFavaiC9ZROes6MMH2rRYeMEF04= github.com/go-gl/glfw v0.0.0-20190409004039-e6da0acd62b1/go.mod h1:vR7hzQXu2zJy9AVAgeJqvqgH9Q5CA+iKCZ2gyEVpxRU= github.com/go-gl/glfw/v3.3/glfw v0.0.0-20191125211704-12ad95a8df72/go.mod h1:tQ2UAYgL5IevRw8kRxooKSPJfGvJ9fJQFa0TUsXzTg8= github.com/go-gl/glfw/v3.3/glfw v0.0.0-20200222043503-6f7a984d4dc4/go.mod h1:tQ2UAYgL5IevRw8kRxooKSPJfGvJ9fJQFa0TUsXzTg8= github.com/go-logr/logr v1.2.2 h1:ahHml/yUpnlb96Rp8HCvtYVPY8ZYpxq3g7UYchIYwbs= github.com/go-logr/logr v1.2.2/go.mod h1:jdQByPbusPIv2/zmleS9BjJVeZ6kBagPoEUsqbVz/1A= +github.com/go-logr/logr v1.2.3 h1:2DntVwHkVopvECVRSlL5PSo9eG+cAkDCuckLubN+rq0= +github.com/go-logr/logr v1.2.3/go.mod h1:jdQByPbusPIv2/zmleS9BjJVeZ6kBagPoEUsqbVz/1A= 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/glog v0.0.0-20160126235308-23def4e6c14b/go.mod h1:SBH7ygxi8pfUlaOkMMuAQtPIUF8ecWP5IEl/CR7VP2Q= @@ -190,6 +194,8 @@ github.com/stretchr/testify v1.5.1/go.mod h1:5W2xD1RspED5o8YsWQXVCued0rvSQ+mT+I5 github.com/stretchr/testify v1.6.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= github.com/stretchr/testify v1.7.0 h1:nwc3DEeHmmLAfoZucVR881uASk0Mfjw8xYJ99tb5CcY= github.com/stretchr/testify v1.7.0/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= +github.com/stretchr/testify v1.7.1 h1:5TQK59W5E3v0r2duFAb7P95B6hEeOyEnHRa8MjYSMTY= +github.com/stretchr/testify v1.7.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= github.com/yuin/goldmark v1.1.25/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= github.com/yuin/goldmark v1.1.27/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= github.com/yuin/goldmark v1.1.32/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= @@ -204,20 +210,34 @@ go.opencensus.io v0.22.5/go.mod h1:5pWMHQbX5EPX2/62yrJeAkowc+lfs/XD7Uxpq3pI6kk= go.opencensus.io v0.23.0/go.mod h1:XItmlyltB5F7CS4xOC1DcqMoFqwtC6OG2xF7mCv7P7E= go.opentelemetry.io/contrib/instrumentation/google.golang.org/grpc/otelgrpc v0.29.0 h1:n9b7AAdbQtQ0k9dm0Dm2/KUcUqtG8i2O15KzNaDze8c= go.opentelemetry.io/contrib/instrumentation/google.golang.org/grpc/otelgrpc v0.29.0/go.mod h1:LsankqVDx4W+RhZNA5uWarULII/MBhF5qwCYxTuyXjs= +go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.29.0 h1:SLme4Porm+UwX0DdHMxlwRt7FzPSE0sys81bet2o0pU= +go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.29.0/go.mod h1:tLYsuf2v8fZreBVwp9gVMhefZlLFZaUiNVSq8QxXRII= +go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.32.0 h1:mac9BKRqwaX6zxHPDe3pvmWpwuuIM0vuXv2juCnQevE= +go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.32.0/go.mod h1:5eCOqeGphOyz6TsY3ZDNjE33SM/TFAK3RGuCL2naTgY= go.opentelemetry.io/otel v1.4.0/go.mod h1:jeAqMFKy2uLIxCtKxoFj0FAL5zAPKQagc3+GtBWakzk= go.opentelemetry.io/otel v1.4.1 h1:QbINgGDDcoQUoMJa2mMaWno49lja9sHwp6aoa2n3a4g= go.opentelemetry.io/otel v1.4.1/go.mod h1:StM6F/0fSwpd8dKWDCdRr7uRvEPYdW0hBSlbdTiUde4= +go.opentelemetry.io/otel v1.7.0 h1:Z2lA3Tdch0iDcrhJXDIlC94XE+bxok1F9B+4Lz/lGsM= +go.opentelemetry.io/otel v1.7.0/go.mod h1:5BdUoMIz5WEs0vt0CUEMtSSaTSHBBVwrhnz7+nrD5xk= go.opentelemetry.io/otel/exporters/otlp/internal/retry v1.4.1 h1:imIM3vRDMyZK1ypQlQlO+brE22I9lRhJsBDXpDWjlz8= go.opentelemetry.io/otel/exporters/otlp/internal/retry v1.4.1/go.mod h1:VpP4/RMn8bv8gNo9uK7/IMY4mtWLELsS+JIP0inH0h4= go.opentelemetry.io/otel/exporters/otlp/otlptrace v1.4.1 h1:WPpPsAAs8I2rA47v5u0558meKmmwm1Dj99ZbqCV8sZ8= go.opentelemetry.io/otel/exporters/otlp/otlptrace v1.4.1/go.mod h1:o5RW5o2pKpJLD5dNTCmjF1DorYwMeFJmb/rKr5sLaa8= go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc v1.4.1 h1:AxqDiGk8CorEXStMDZF5Hz9vo9Z7ZZ+I5m8JRl/ko40= go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc v1.4.1/go.mod h1:c6E4V3/U+miqjs/8l950wggHGL1qzlp0Ypj9xoGrPqo= +go.opentelemetry.io/otel/internal/metric v0.27.0 h1:9dAVGAfFiiEq5NVB9FUJ5et+btbDQAUIJehJ+ikyryk= +go.opentelemetry.io/otel/internal/metric v0.27.0/go.mod h1:n1CVxRqKqYZtqyTh9U/onvKapPGv7y/rpyOTI+LFNzw= +go.opentelemetry.io/otel/metric v0.27.0 h1:HhJPsGhJoKRSegPQILFbODU56NS/L1UE4fS1sC5kIwQ= +go.opentelemetry.io/otel/metric v0.27.0/go.mod h1:raXDJ7uP2/Jc0nVZWQjJtzoyssOYWu/+pjZqRzfvZ7g= +go.opentelemetry.io/otel/metric v0.30.0 h1:Hs8eQZ8aQgs0U49diZoaS6Uaxw3+bBE3lcMUKBFIk3c= +go.opentelemetry.io/otel/metric v0.30.0/go.mod h1:/ShZ7+TS4dHzDFmfi1kSXMhMVubNoP0oIaBp70J6UXU= go.opentelemetry.io/otel/sdk v1.4.1 h1:J7EaW71E0v87qflB4cDolaqq3AcujGrtyIPGQoZOB0Y= go.opentelemetry.io/otel/sdk v1.4.1/go.mod h1:NBwHDgDIBYjwK2WNu1OPgsIc2IJzmBXNnvIJxJc8BpE= go.opentelemetry.io/otel/trace v1.4.0/go.mod h1:uc3eRsqDfWs9R7b92xbQbU42/eTNz4N+gLP8qJCi4aE= go.opentelemetry.io/otel/trace v1.4.1 h1:O+16qcdTrT7zxv2J6GejTPFinSwA++cYerC5iSiF8EQ= go.opentelemetry.io/otel/trace v1.4.1/go.mod h1:iYEVbroFCNut9QkwEczV9vMRPHNKSSwYZjulEtsmhFc= +go.opentelemetry.io/otel/trace v1.7.0 h1:O37Iogk1lEkMRXewVtZ1BBTVn5JEp8GrJvP92bJqC6o= +go.opentelemetry.io/otel/trace v1.7.0/go.mod h1:fzLSB9nqR2eXzxPXb2JW9IKE+ScyXA48yyE4TNvoHqU= go.opentelemetry.io/proto/otlp v0.7.0/go.mod h1:PqfVotwruBrMGOCsRd/89rSnXhoiJIqeYNgFYFoEGnI= go.opentelemetry.io/proto/otlp v0.12.0 h1:CMJ/3Wp7iOWES+CYLfnBv+DVmPbB+kmy9PJ92XvlR6c= go.opentelemetry.io/proto/otlp v0.12.0/go.mod h1:TsIjwGWIx5VFYv9KGVlOpxoBl5Dy+63SUguV7GGvlSQ= diff --git a/src/checkoutservice/main.go b/src/checkoutservice/main.go index 5e6527e269..f62a7f95e9 100644 --- a/src/checkoutservice/main.go +++ b/src/checkoutservice/main.go @@ -15,9 +15,12 @@ package main import ( + "bytes" "context" + "encoding/json" "fmt" "net" + "net/http" "os" "time" @@ -29,6 +32,7 @@ import ( "google.golang.org/grpc/status" "go.opentelemetry.io/contrib/instrumentation/google.golang.org/grpc/otelgrpc" + "go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp" "go.opentelemetry.io/otel" "go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc" "go.opentelemetry.io/otel/propagation" @@ -333,14 +337,24 @@ func (cs *checkoutService) chargeCard(ctx context.Context, amount *pb.Money, pay } func (cs *checkoutService) sendOrderConfirmation(ctx context.Context, email string, order *pb.OrderResult) error { - conn, err := createClient(ctx, cs.emailSvcAddr) + emailServicePayload, err := json.Marshal(map[string]interface{}{ + "email": email, + "order": order, + }) if err != nil { - return fmt.Errorf("failed to connect email service: %+v", err) + return fmt.Errorf("failed to marshal order to JSON: %+v", err) } - defer conn.Close() - _, err = pb.NewEmailServiceClient(conn).SendOrderConfirmation(ctx, &pb.SendOrderConfirmationRequest{ - Email: email, - Order: order}) + + resp, err := otelhttp.Post(ctx, cs.emailSvcAddr+"/send_order_confirmation", "application/json", bytes.NewBuffer(emailServicePayload)) + 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 } From 79f2f023be1662b6cb17d17d3317304040ce1b27 Mon Sep 17 00:00:00 2001 From: Andrew Hayworth Date: Sat, 4 Jun 2022 00:32:24 -0500 Subject: [PATCH 3/6] feat: modify setup to work with otel/ruby Because we rewrote the emailservice as an HTTP service, we need to modify the `EMAIL_SERVICE_ADDR` to reflect the actual scheme (`http`). We could just do some more string concatenation in the app, I guess. We pin to a specific collector version - I was getting weird segfaults with whatever version of the collector was already on my machine, and they were resolved with 0.52.0. However, that also required a minor config change to the jaeger exporter. Yay, M1 macs! We can't specify the otlp/grpc port for the ruby libraries, it won't work. So for email service we pass the correct OTLP/HTTP URL in the env var. --- .env | 2 +- compose.yml | 6 +++--- src/otelcollector/otelcol-config.yml | 4 +++- 3 files changed, 7 insertions(+), 5 deletions(-) diff --git a/.env b/.env index 0feef000df..db67f88848 100644 --- a/.env +++ b/.env @@ -30,7 +30,7 @@ CURRENCY_SERVICE_PORT=7000 CURRENCY_SERVICE_ADDR=currencyservice:${CURRENCY_SERVICE_PORT} EMAIL_SERVICE_PORT=8080 -EMAIL_SERVICE_ADDR=emailservice:${EMAIL_SERVICE_PORT} +EMAIL_SERVICE_ADDR=http://emailservice:${EMAIL_SERVICE_PORT} PAYMENT_SERVICE_PORT=50051 PAYMENT_SERVICE_ADDR=paymentservice:${PAYMENT_SERVICE_PORT} diff --git a/compose.yml b/compose.yml index 883361d552..b44d4b23a5 100644 --- a/compose.yml +++ b/compose.yml @@ -19,7 +19,7 @@ services: # Collector otelcol: - image: otel/opentelemetry-collector + image: otel/opentelemetry-collector:0.52.0 command: [ "--config=/etc/otelcol-config.yml" ] volumes: - ./src/otelcollector/otelcol-config.yml:/etc/otelcol-config.yml @@ -93,9 +93,9 @@ services: ports: - "${EMAIL_SERVICE_PORT}" environment: + - APP_ENV=production - PORT=${EMAIL_SERVICE_PORT} - - OTEL_PYTHON_LOG_CORRELATION=true - - OTEL_EXPORTER_OTLP_TRACES_ENDPOINT + - OTEL_EXPORTER_OTLP_TRACES_ENDPOINT=http://otelcol:4318/v1/traces - OTEL_RESOURCE_ATTRIBUTES=service.name=emailservice # Frontend diff --git a/src/otelcollector/otelcol-config.yml b/src/otelcollector/otelcol-config.yml index d96025f20a..fb72eccd27 100644 --- a/src/otelcollector/otelcol-config.yml +++ b/src/otelcollector/otelcol-config.yml @@ -7,8 +7,10 @@ receivers: exporters: jaeger: endpoint: "jaeger:14250" - insecure: true + tls: + insecure: true logging: + loglevel: debug processors: batch: From ab057bcd09e4d9307bdd16d230285bb5c87caa0a Mon Sep 17 00:00:00 2001 From: Andrew Hayworth Date: Sat, 4 Jun 2022 00:35:07 -0500 Subject: [PATCH 4/6] docs: note that emailservice is now ruby --- README.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 8dead6f4dd..7b76bec383 100644 --- a/README.md +++ b/README.md @@ -113,7 +113,7 @@ cache[(Cache
(redis))] cartservice(Cart Service
(.NET)):::dotnet checkoutservice(Checkout Service
(Go)):::golang currencyservice(Currency Service
(Node.js)):::nodejs -emailservice(Email Service
(Python)):::python +emailservice(Email Service
(Ruby)):::ruby frontend(Frontend
(Go)):::golang loadgenerator([Load Generator
(Python)]):::python paymentservice(Payment Service
(Node.js)):::nodejs @@ -152,7 +152,7 @@ Find **Protocol Buffers Descriptions** at the [`./pb` directory](./pb/README.md) | [currencyservice](./src/currencyservice/README.md) | Node.js | Converts one money amount to another currency. Uses real values fetched from European Central Bank. It's the highest QPS service. | | [paymentservice](./src/paymentservice/README.md) | Node.js | Charges the given credit card info (mock) with the given amount and returns a transaction ID. | | [shippingservice](./src/shippingservice/README.md) | Go | Gives shipping cost estimates based on the shopping cart. Ships items to the given address (mock) | -| [emailservice](./src/emailservice/README.md) | Python | Sends users an order confirmation email (mock). | +| [emailservice](./src/emailservice/README.md) | Ruby | Sends users an order confirmation email (mock). | | [checkoutservice](./src/checkoutservice/README.md) | Go | Retrieves user cart, prepares order and orchestrates the payment, shipping and the email notification. | | [recommendationservice](./src/recommendationservice/README.md) | Python | Recommends other products based on what's given in the cart. | | [adservice](./src/adservice/README.md) | Java | Provides text ads based on given context words. | From bdb3eccadfe5f413b717d51527aa77c5f713d6ce Mon Sep 17 00:00:00 2001 From: Andrew Hayworth Date: Sat, 4 Jun 2022 00:49:05 -0500 Subject: [PATCH 5/6] fixup: remove `loglevel: debug` from otel-col config Whoops, this was accidentally left in from my testing. --- src/otelcollector/otelcol-config.yml | 1 - 1 file changed, 1 deletion(-) diff --git a/src/otelcollector/otelcol-config.yml b/src/otelcollector/otelcol-config.yml index fb72eccd27..8d723b13a1 100644 --- a/src/otelcollector/otelcol-config.yml +++ b/src/otelcollector/otelcol-config.yml @@ -10,7 +10,6 @@ exporters: tls: insecure: true logging: - loglevel: debug processors: batch: From 8017b1cc8406c27ab9af24cfae65fba7c066828e Mon Sep 17 00:00:00 2001 From: Andrew Hayworth Date: Sat, 4 Jun 2022 00:51:55 -0500 Subject: [PATCH 6/6] fixup: appease markdownlint --- src/emailservice/README.md | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/emailservice/README.md b/src/emailservice/README.md index b61acc7956..32ac929aad 100644 --- a/src/emailservice/README.md +++ b/src/emailservice/README.md @@ -1,6 +1,7 @@ # Email Service -The Email service "sends" an email to the customer with their order details by rendering it as a log message. It expects a JSON payload like: +The Email service "sends" an email to the customer with their order details by +rendering it as a log message. It expects a JSON payload like: ```json {