Skip to content

Instantly share code, notes, and snippets.

@dhermes
Last active September 27, 2016 22:25
Show Gist options
  • Save dhermes/43d931f9ecfe73f57056494f895a6341 to your computer and use it in GitHub Desktop.
Save dhermes/43d931f9ecfe73f57056494f895a6341 to your computer and use it in GitHub Desktop.
diff --git a/logging/google/cloud/logging/_gax.py b/logging/google/cloud/logging/_gax.py
index aa9d2c6..4fcfc6d 100644
--- a/logging/google/cloud/logging/_gax.py
+++ b/logging/google/cloud/logging/_gax.py
@@ -108,6 +108,13 @@ class _LoggingAPI(object):
options = None
partial_success = False
entry_pbs = [_log_entry_mapping_to_pb(entry) for entry in entries]
+ # def write_log_entries(self,
+ # entries,
+ # log_name='',
+ # resource=None,
+ # labels=None,
+ # partial_success=False,
+ # options=None):
self._gax_api.write_log_entries(entry_pbs, logger_name, resource,
labels, partial_success, options)
@@ -123,6 +130,7 @@ class _LoggingAPI(object):
options = None
path = 'projects/%s/logs/%s' % (project, logger_name)
try:
+ # def delete_log(self, log_name, options=None):
self._gax_api.delete_log(path, options)
except GaxError as exc:
if exc_to_code(exc.cause) == StatusCode.NOT_FOUND:
@@ -164,6 +172,7 @@ class _SinksAPI(object):
page_token = INITIAL_PAGE
options = CallOptions(page_token=page_token)
path = 'projects/%s' % (project,)
+ # def list_sinks(self, parent, page_size=0, options=None):
page_iter = self._gax_api.list_sinks(path, page_size, options)
sinks = [_log_sink_pb_to_mapping(log_sink_pb)
for log_sink_pb in page_iter.next()]
@@ -195,6 +204,7 @@ class _SinksAPI(object):
sink_pb = LogSink(name=sink_name, filter=filter_,
destination=destination)
try:
+ # def create_sink(self, parent, sink, options=None):
self._gax_api.create_sink(parent, sink_pb, options)
except GaxError as exc:
if exc_to_code(exc.cause) == StatusCode.FAILED_PRECONDITION:
@@ -218,6 +228,7 @@ class _SinksAPI(object):
options = None
path = 'projects/%s/sinks/%s' % (project, sink_name)
try:
+ # def get_sink(self, sink_name, options=None):
sink_pb = self._gax_api.get_sink(path, options)
except GaxError as exc:
if exc_to_code(exc.cause) == StatusCode.NOT_FOUND:
@@ -250,6 +261,7 @@ class _SinksAPI(object):
path = 'projects/%s/sinks/%s' % (project, sink_name)
sink_pb = LogSink(name=path, filter=filter_, destination=destination)
try:
+ # def update_sink(self, sink_name, sink, options=None):
self._gax_api.update_sink(path, sink_pb, options)
except GaxError as exc:
if exc_to_code(exc.cause) == StatusCode.NOT_FOUND:
@@ -269,6 +281,7 @@ class _SinksAPI(object):
options = None
path = 'projects/%s/sinks/%s' % (project, sink_name)
try:
+ # def delete_sink(self, sink_name, options=None):
self._gax_api.delete_sink(path, options)
except GaxError as exc:
if exc_to_code(exc.cause) == StatusCode.NOT_FOUND:
@@ -310,6 +323,7 @@ class _MetricsAPI(object):
page_token = INITIAL_PAGE
options = CallOptions(page_token=page_token)
path = 'projects/%s' % (project,)
+ # def list_log_metrics(self, parent, page_size=0, options=None):
page_iter = self._gax_api.list_log_metrics(path, page_size, options)
metrics = [_log_metric_pb_to_mapping(log_metric_pb)
for log_metric_pb in page_iter.next()]
@@ -340,6 +354,7 @@ class _MetricsAPI(object):
metric_pb = LogMetric(name=metric_name, filter=filter_,
description=description)
try:
+ # def create_log_metric(self, parent, metric, options=None):
self._gax_api.create_log_metric(parent, metric_pb, options)
except GaxError as exc:
if exc_to_code(exc.cause) == StatusCode.FAILED_PRECONDITION:
@@ -363,6 +378,7 @@ class _MetricsAPI(object):
options = None
path = 'projects/%s/metrics/%s' % (project, metric_name)
try:
+ # def get_log_metric(self, metric_name, options=None):
metric_pb = self._gax_api.get_log_metric(path, options)
except GaxError as exc:
if exc_to_code(exc.cause) == StatusCode.NOT_FOUND:
@@ -395,6 +411,7 @@ class _MetricsAPI(object):
metric_pb = LogMetric(name=path, filter=filter_,
description=description)
try:
+ # def update_log_metric(self, metric_name, metric, options=None):
self._gax_api.update_log_metric(path, metric_pb, options)
except GaxError as exc:
if exc_to_code(exc.cause) == StatusCode.NOT_FOUND:
@@ -414,6 +431,7 @@ class _MetricsAPI(object):
options = None
path = 'projects/%s/metrics/%s' % (project, metric_name)
try:
+ # def delete_log_metric(self, metric_name, options=None):
self._gax_api.delete_log_metric(path, options)
except GaxError as exc:
if exc_to_code(exc.cause) == StatusCode.NOT_FOUND:
diff --git a/pubsub/google/cloud/pubsub/_gax.py b/pubsub/google/cloud/pubsub/_gax.py
index 6d92c81..67793cb 100644
--- a/pubsub/google/cloud/pubsub/_gax.py
+++ b/pubsub/google/cloud/pubsub/_gax.py
@@ -70,6 +70,7 @@ class _PublisherAPI(object):
page_token = INITIAL_PAGE
options = CallOptions(page_token=page_token)
path = 'projects/%s' % (project,)
+ # def list_topics(self, project, page_size=0, options=None):
page_iter = self._gax_api.list_topics(
path, page_size=page_size, options=options)
topics = [{'name': topic_pb.name} for topic_pb in page_iter.next()]
@@ -92,6 +93,7 @@ class _PublisherAPI(object):
exists
"""
try:
+ # def create_topic(self, name, options=None):
topic_pb = self._gax_api.create_topic(topic_path)
except GaxError as exc:
if exc_to_code(exc.cause) == StatusCode.FAILED_PRECONDITION:
@@ -115,6 +117,7 @@ class _PublisherAPI(object):
exist
"""
try:
+ # def get_topic(self, topic, options=None):
topic_pb = self._gax_api.get_topic(topic_path)
except GaxError as exc:
if exc_to_code(exc.cause) == StatusCode.NOT_FOUND:
@@ -133,6 +136,7 @@ class _PublisherAPI(object):
``projects/<PROJECT>/topics/<TOPIC_NAME>``.
"""
try:
+ # def delete_topic(self, topic, options=None):
self._gax_api.delete_topic(topic_path)
except GaxError as exc:
if exc_to_code(exc.cause) == StatusCode.NOT_FOUND:
@@ -161,6 +165,7 @@ class _PublisherAPI(object):
message_pbs = [_message_pb_from_mapping(message)
for message in messages]
try:
+ # def publish(self, topic, messages, options=None):
result = self._gax_api.publish(topic_path, message_pbs,
options=options)
except GaxError as exc:
@@ -199,6 +204,7 @@ class _PublisherAPI(object):
page_token = INITIAL_PAGE
options = CallOptions(page_token=page_token)
try:
+ # def list_topic_subscriptions(self, topic, page_size=0, options=None):
page_iter = self._gax_api.list_topic_subscriptions(
topic_path, page_size=page_size, options=options)
except GaxError as exc:
@@ -247,6 +253,7 @@ class _SubscriberAPI(object):
page_token = INITIAL_PAGE
options = CallOptions(page_token=page_token)
path = 'projects/%s' % (project,)
+ # def list_subscriptions(self, project, page_size=0, options=None):
page_iter = self._gax_api.list_subscriptions(
path, page_size=page_size, options=options)
subscriptions = [_subscription_pb_to_mapping(sub_pb)
@@ -292,6 +299,12 @@ class _SubscriberAPI(object):
ack_deadline = 0
try:
+ # def create_subscription(self,
+ # name,
+ # topic,
+ # push_config=None,
+ # ack_deadline_seconds=0,
+ # options=None):
sub_pb = self._gax_api.create_subscription(
subscription_path, topic_path, push_config, ack_deadline)
except GaxError as exc:
@@ -315,6 +328,7 @@ class _SubscriberAPI(object):
:returns: ``Subscription`` resource returned from the API.
"""
try:
+ # def get_subscription(self, subscription, options=None):
sub_pb = self._gax_api.get_subscription(subscription_path)
except GaxError as exc:
if exc_to_code(exc.cause) == StatusCode.NOT_FOUND:
@@ -334,6 +348,7 @@ class _SubscriberAPI(object):
``projects/<PROJECT>/subscriptions/<SUB_NAME>``.
"""
try:
+ # def delete_subscription(self, subscription, options=None):
self._gax_api.delete_subscription(subscription_path)
except GaxError as exc:
if exc_to_code(exc.cause) == StatusCode.NOT_FOUND:
@@ -359,6 +374,7 @@ class _SubscriberAPI(object):
"""
push_config = PushConfig(push_endpoint=push_endpoint)
try:
+ # def modify_push_config(self, subscription, push_config, options=None):
self._gax_api.modify_push_config(subscription_path, push_config)
except GaxError as exc:
if exc_to_code(exc.cause) == StatusCode.NOT_FOUND:
@@ -390,6 +406,11 @@ class _SubscriberAPI(object):
:returns: the ``receivedMessages`` element of the response.
"""
try:
+ # def pull(self,
+ # subscription,
+ # max_messages,
+ # return_immediately=False,
+ # options=None):
response_pb = self._gax_api.pull(
subscription_path, max_messages, return_immediately)
except GaxError as exc:
@@ -414,6 +435,7 @@ class _SubscriberAPI(object):
:param ack_ids: ack IDs of messages being acknowledged
"""
try:
+ # def acknowledge(self, subscription, ack_ids, options=None):
self._gax_api.acknowledge(subscription_path, ack_ids)
except GaxError as exc:
if exc_to_code(exc.cause) == StatusCode.NOT_FOUND:
@@ -440,6 +462,11 @@ class _SubscriberAPI(object):
from the back-end must be acknowledged.
"""
try:
+ # def modify_ack_deadline(self,
+ # subscription,
+ # ack_ids,
+ # ack_deadline_seconds,
+ # options=None):
self._gax_api.modify_ack_deadline(
subscription_path, ack_ids, ack_deadline)
except GaxError as exc:
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment