Use google.api instead of custom googleapi package

Use the standard google.api package to not create conflicts with other
proto definition that uses the same package.

Change-Id: I264db977a2316ced0fdfb6ab8e499a1258726cb7
diff --git a/VERSION b/VERSION
index 76726bd..d9b058f 100644
--- a/VERSION
+++ b/VERSION
@@ -1 +1 @@
-3.3.1-dev
+4.0.0-dev
diff --git a/grpc_client/grpc_client.py b/grpc_client/grpc_client.py
index f0c5f11..f00b06e 100644
--- a/grpc_client/grpc_client.py
+++ b/grpc_client/grpc_client.py
@@ -59,6 +59,8 @@
         self.credentials = credentials
         self.restart_on_disconnect = restart_on_disconnect
 
+        self.google_api_dir = os.path.abspath(os.path.join(
+            os.path.dirname(__file__), '../protos'))
         self.plugin_dir = os.path.abspath(os.path.join(
             os.path.dirname(__file__), '../protoc_plugins'))
 
@@ -249,7 +251,7 @@
                 'cd %s && '
                 'env PATH=%s PYTHONPATH=%s '
                 'python -m grpc.tools.protoc '
-                '-I. '
+                '-I. -I %s '
                 '--python_out=. '
                 '--grpc_python_out=. '
                 '--plugin=protoc-gen-gw=%s/gw_gen.py '
@@ -260,6 +262,7 @@
                     self.work_dir,
                     ':'.join([os.environ['PATH'], self.plugin_dir]),
                     chameleon_base_dir,
+                    self.google_api_dir,
                     self.plugin_dir,
                     self.plugin_dir,
                     '--swagger_out=. ' if need_swagger else '',
diff --git a/protoc_plugins/gw_gen.py b/protoc_plugins/gw_gen.py
index c63d776..6b8598d 100755
--- a/protoc_plugins/gw_gen.py
+++ b/protoc_plugins/gw_gen.py
@@ -23,7 +23,7 @@
 from jinja2 import Template
 from simplejson import dumps
 
-from chameleon.protos import annotations_pb2, http_pb2
+from google.api import annotations_pb2, http_pb2
 
 template = Template("""
 # Generated file; please do not edit
@@ -109,7 +109,7 @@
             options = method.options
             assert isinstance(options, MethodOptions)
             for fd, http in options.ListFields():
-                if fd.full_name == 'googleapi.http':
+                if fd.full_name == 'google.api.http':
                     assert fd.name == 'http'
                     assert isinstance(http, http_pb2.HttpRule)
 
diff --git a/protoc_plugins/schema2dict.py b/protoc_plugins/schema2dict.py
index 3a7a63b..3456edc 100644
--- a/protoc_plugins/schema2dict.py
+++ b/protoc_plugins/schema2dict.py
@@ -21,7 +21,8 @@
 """
 import json
 import sys
-from chameleon.protos import schema_pb2, annotations_pb2
+from chameleon.protos import schema_pb2
+from google.api import annotations_pb2
 from protobuf_to_dict import protobuf_to_dict
 
 
diff --git a/protoc_plugins/swagger_gen.py b/protoc_plugins/swagger_gen.py
index 3b558d6..67d6a9a 100755
--- a/protoc_plugins/swagger_gen.py
+++ b/protoc_plugins/swagger_gen.py
@@ -20,7 +20,7 @@
 from simplejson import dumps
 
 # without this import, http method annotations would not be recognized:
-from chameleon.protos import annotations_pb2, http_pb2
+from google.api import annotations_pb2, http_pb2
 
 from chameleon.protoc_plugins.descriptor_parser import DescriptorParser
 from swagger_template import native_descriptors_to_swagger
diff --git a/protos/README.md b/protos/README.md
new file mode 100644
index 0000000..5a4a8f9
--- /dev/null
+++ b/protos/README.md
@@ -0,0 +1,5 @@
+NOTE: The `google/api` directory has files copied from the [Google
+APIs](https://github.com/googleapis/api-common-protos), and is only included for
+compilation of the protobuf files - these API's should be
+installed independently via the python
+[googleapis-common-protos](https://pypi.org/project/googleapis-common-protos/).
\ No newline at end of file
diff --git a/protos/annotations.proto b/protos/google/api/annotations.proto
similarity index 85%
rename from protos/annotations.proto
rename to protos/google/api/annotations.proto
index 2ed81a6..18dcf20 100644
--- a/protos/annotations.proto
+++ b/protos/google/api/annotations.proto
@@ -1,5 +1,4 @@
 // Copyright (c) 2015, Google Inc.
-// Modififications (C) 2018, Open Networking Foundation
 //
 // Licensed under the Apache License, Version 2.0 (the "License");
 // you may not use this file except in compliance with the License.
@@ -13,13 +12,11 @@
 // See the License for the specific language governing permissions and
 // limitations under the License.
 
-// See NOTE in http.proto for the modifications made to these files
-
 syntax = "proto3";
 
-package googleapi;
+package google.api;
 
-import "http.proto";
+import "google/api/http.proto";
 import "google/protobuf/descriptor.proto";
 
 option go_package = "google.golang.org/genproto/googleapis/api/annotations;annotations";
@@ -31,4 +28,4 @@
 extend google.protobuf.MethodOptions {
   // See `HttpRule`.
   HttpRule http = 72295728;
-}
+}
\ No newline at end of file
diff --git a/protos/http.proto b/protos/google/api/http.proto
similarity index 83%
rename from protos/http.proto
rename to protos/google/api/http.proto
index 99d0ce3..61168c3 100644
--- a/protos/http.proto
+++ b/protos/google/api/http.proto
@@ -1,5 +1,4 @@
 // Copyright 2018 Google LLC
-// Modififications (C) 2018, Open Networking Foundation
 //
 // Licensed under the Apache License, Version 2.0 (the "License");
 // you may not use this file except in compliance with the License.
@@ -13,48 +12,9 @@
 // See the License for the specific language governing permissions and
 // limitations under the License.
 
-// NOTE: On the provenance of and modifications to http.proto and
-// annotations.proto
-//
-// TL;DR: The files http.proto and annotations.proto are originally from here:
-//  https://github.com/googleapis/googleapis
-// They have been modified slightly to avoid a namespace conflict.
-//
-// Long winded explanation:
-// These files are designed to interact with Google's first party API's, and
-// the recommended way to use them is to compiled them to code with protoc and
-// included in your codebase before being used.  Due to the fact that we're not
-// using them that way, and because of how Chameleon and XOS work (dynamically
-// defining our own API's), we have to ship these *.proto files as a part of
-// our artifacts.
-//
-// The problems start when you try to include these specific .proto files in
-// python. The protoc compiler includes the `google.protobuf` classes, which
-// python can look up in the standard python library path. Unfortunately these
-// files are namespaced with `google.api` in the path and aren't shipped with
-// protoc.  This leads to a path conflict - you can't have two library paths
-// start with the same path component (`google` in this case) without getting
-// an "ImportError: No module named ..." on one of the paths when you import
-// them.
-//
-// Historically, various confusing hacks were implemented to override and
-// special-case the python `include` directive to include a file at a different
-// path than was specified. These hacks also failed when updating the base OS,
-// and would likely continue to fail in other, stranger ways as we update the
-// codebase.  Specifically, Python 3 reimplemented these features in the
-// importlib section of the standard library, so there's little confidence our
-// hacks would continue to work.  As an aside, there are various protobuf
-// `options` statements to deal with this sort of issue in other languages (see
-// the `go_package` and `java_package` below ) but these don't currently exist
-// for python: https://github.com/google/protobuf/issues/973
-//
-// To avoid this entire psychotic namespace hellscape, it's much easier to
-// modify these files to remove the google.api path component, and have them
-// included directly at a path of our own choice.
-
 syntax = "proto3";
 
-package googleapi;
+package google.api;
 
 option cc_enable_arenas = true;
 option go_package = "google.golang.org/genproto/googleapis/api/annotations;annotations";
@@ -337,6 +297,11 @@
   // present at the top-level of request message type.
   string body = 7;
 
+  // Optional. The name of the response field whose value is mapped to the HTTP
+  // body of response. Other response fields are ignored. When
+  // not set, the response message will be used as HTTP body of response.
+  string response_body = 12;
+
   // Additional HTTP bindings for the selector. Nested bindings must
   // not contain an `additional_bindings` field themselves (that is,
   // the nesting may only be one level deep).
@@ -350,4 +315,4 @@
 
   // The path matched by this custom verb.
   string path = 2;
-}
+}
\ No newline at end of file
diff --git a/requirements.txt b/requirements.txt
index a09582f..d8950dd 100644
--- a/requirements.txt
+++ b/requirements.txt
@@ -11,3 +11,4 @@
 service_identity==18.1.0
 simplejson==3.16.0
 structlog~=19.1.0
+googleapis-common-protos~=1.51.0