Client(
batch_settings: Union[google.cloud.pubsub_v1.types.BatchSettings, Sequence] = (),
publisher_options: Union[
google.cloud.pubsub_v1.types.PublisherOptions, Sequence
] = (),
**kwargs: Any
)
A publisher client for Google Cloud Pub/Sub.
This creates an object that is capable of publishing messages. Generally, you can instantiate this client with no arguments, and you get sensible defaults.
Properties
api
The underlying gapic API client.
.. versionchanged:: 2.10.0
Instead of a GAPIC PublisherClient
client instance, this property is a
proxy object to it with the same interface.
target
Return the target (where the API is).
transport
Returns the transport used by the client instance.
Type | Description |
PublisherTransport | The transport used by the client instance. |
Methods
Client
Client(
batch_settings: Union[google.cloud.pubsub_v1.types.BatchSettings, Sequence] = (),
publisher_options: Union[
google.cloud.pubsub_v1.types.PublisherOptions, Sequence
] = (),
**kwargs: Any
)
Instantiates the publisher client.
Name | Description |
credentials |
Optional[google.auth.credentials.Credentials]
The authorization credentials to attach to requests. These credentials identify the application to the service; if none are specified, the client will attempt to ascertain the credentials from the environment. |
transport |
Union[str, PublisherTransport]
The transport to use. If set to None, a transport is chosen automatically. |
client_options |
Optional[Union[google.api_core.client_options.ClientOptions, dict]]
Custom options for the client. It won't take effect if a |
client_info |
google.api_core.gapic_v1.client_info.ClientInfo
The client info used to send a user-agent string along with API requests. If |
Type | Description |
google.auth.exceptions.MutualTLSChannelError | If mutual TLS transport creation failed for any reason. |
__exit__
__exit__(type, value, traceback)
Releases underlying transport's resources.
common_billing_account_path
common_billing_account_path(billing_account: str)
Returns a fully-qualified billing_account string.
common_folder_path
common_folder_path(folder: str)
Returns a fully-qualified folder string.
common_location_path
common_location_path(project: str, location: str)
Returns a fully-qualified location string.
common_organization_path
common_organization_path(organization: str)
Returns a fully-qualified organization string.
common_project_path
common_project_path(project: str)
Returns a fully-qualified project string.
create_topic
create_topic(request: Optional[Union[google.cloud.pubsub_v1.types.Topic, dict]] = None, *, name: Optional[str] = None, retry: Union[google.api_core.retry.Retry, google.api_core.gapic_v1.method._MethodDefault] = <_MethodDefault._DEFAULT_VALUE: <object object>>, timeout: Union[int, float, google.api_core.timeout.ConstantTimeout, google.api_core.timeout.ExponentialTimeout] = <_MethodDefault._DEFAULT_VALUE: <object object>>, metadata: Sequence[Tuple[str, str]] = ())
Creates the given topic with the given name. See the resource name rules.
# This snippet has been automatically generated and should be regarded as a
# code template only.
# It will require modifications to work:
# - It may require correct/in-range values for request initialization.
# - It may require specifying regional endpoints when creating the service
# client as shown in:
# https://googleapis.dev/python/google-api-core/latest/client_options.html
from google import pubsub_v1
def sample_create_topic():
# Create a client
client = pubsub_v1.PublisherClient()
# Initialize request argument(s)
request = pubsub_v1.Topic(
name="name_value",
)
# Make the request
response = client.create_topic(request=request)
# Handle the response
print(response)
Name | Description |
request |
Union[google.pubsub_v1.types.Topic, dict]
The request object. A topic resource. |
name |
str
Required. The name of the topic. It must have the format |
retry |
google.api_core.retry.Retry
Designation of what errors, if any, should be retried. |
timeout |
TimeoutType
The timeout for this request. |
metadata |
Sequence[Tuple[str, str]]
Strings which should be sent along with the request as metadata. |
Type | Description |
google.pubsub_v1.types.Topic | A topic resource. |
delete_topic
delete_topic(request: Optional[Union[google.cloud.pubsub_v1.types.DeleteTopicRequest, dict]] = None, *, topic: Optional[str] = None, retry: Union[google.api_core.retry.Retry, google.api_core.gapic_v1.method._MethodDefault] = <_MethodDefault._DEFAULT_VALUE: <object object>>, timeout: Union[int, float, google.api_core.timeout.ConstantTimeout, google.api_core.timeout.ExponentialTimeout] = <_MethodDefault._DEFAULT_VALUE: <object object>>, metadata: Sequence[Tuple[str, str]] = ())
Deletes the topic with the given name. Returns NOT_FOUND
if
the topic does not exist. After a topic is deleted, a new topic
may be created with the same name; this is an entirely new topic
with none of the old configuration or subscriptions. Existing
subscriptions to this topic are not deleted, but their topic
field is set to _deleted-topic_
.
# This snippet has been automatically generated and should be regarded as a
# code template only.
# It will require modifications to work:
# - It may require correct/in-range values for request initialization.
# - It may require specifying regional endpoints when creating the service
# client as shown in:
# https://googleapis.dev/python/google-api-core/latest/client_options.html
from google import pubsub_v1
def sample_delete_topic():
# Create a client
client = pubsub_v1.PublisherClient()
# Initialize request argument(s)
request = pubsub_v1.DeleteTopicRequest(
topic="topic_value",
)
# Make the request
client.delete_topic(request=request)
Name | Description |
request |
Union[google.pubsub_v1.types.DeleteTopicRequest, dict]
The request object. Request for the |
topic |
str
Required. Name of the topic to delete. Format is |
retry |
google.api_core.retry.Retry
Designation of what errors, if any, should be retried. |
timeout |
TimeoutType
The timeout for this request. |
metadata |
Sequence[Tuple[str, str]]
Strings which should be sent along with the request as metadata. |
detach_subscription
detach_subscription(request: Optional[Union[google.cloud.pubsub_v1.types.DetachSubscriptionRequest, dict]] = None, *, retry: Union[google.api_core.retry.Retry, google.api_core.gapic_v1.method._MethodDefault] = <_MethodDefault._DEFAULT_VALUE: <object object>>, timeout: Union[int, float, google.api_core.timeout.ConstantTimeout, google.api_core.timeout.ExponentialTimeout] = <_MethodDefault._DEFAULT_VALUE: <object object>>, metadata: Sequence[Tuple[str, str]] = ())
Detaches a subscription from this topic. All messages retained
in the subscription are dropped. Subsequent Pull
and
StreamingPull
requests will return FAILED_PRECONDITION. If
the subscription is a push subscription, pushes to the endpoint
will stop.
# This snippet has been automatically generated and should be regarded as a
# code template only.
# It will require modifications to work:
# - It may require correct/in-range values for request initialization.
# - It may require specifying regional endpoints when creating the service
# client as shown in:
# https://googleapis.dev/python/google-api-core/latest/client_options.html
from google import pubsub_v1
def sample_detach_subscription():
# Create a client
client = pubsub_v1.PublisherClient()
# Initialize request argument(s)
request = pubsub_v1.DetachSubscriptionRequest(
subscription="subscription_value",
)
# Make the request
response = client.detach_subscription(request=request)
# Handle the response
print(response)
Name | Description |
request |
Union[google.pubsub_v1.types.DetachSubscriptionRequest, dict]
The request object. Request for the DetachSubscription method. |
retry |
google.api_core.retry.Retry
Designation of what errors, if any, should be retried. |
timeout |
TimeoutType
The timeout for this request. |
metadata |
Sequence[Tuple[str, str]]
Strings which should be sent along with the request as metadata. |
Type | Description |
google.pubsub_v1.types.DetachSubscriptionResponse | Response for the DetachSubscription method. Reserved for future use. |
ensure_cleanup_and_commit_timer_runs
ensure_cleanup_and_commit_timer_runs()
Ensure a cleanup/commit timer thread is running.
If a cleanup/commit timer thread is already running, this does nothing.
from_service_account_file
from_service_account_file(
filename: str,
batch_settings: Union[google.cloud.pubsub_v1.types.BatchSettings, Sequence] = (),
**kwargs: Any
)
Creates an instance of this client using the provided credentials file.
from_service_account_info
from_service_account_info(info: dict, *args, **kwargs)
Creates an instance of this client using the provided credentials info.
Name | Description |
info |
dict
The service account private key info. |
Type | Description |
PublisherClient | The constructed client. |
from_service_account_json
from_service_account_json(
filename: str,
batch_settings: Union[google.cloud.pubsub_v1.types.BatchSettings, Sequence] = (),
**kwargs: Any
)
Creates an instance of this client using the provided credentials file.
get_iam_policy
get_iam_policy(request: Optional[google.iam.v1.iam_policy_pb2.GetIamPolicyRequest] = None, *, retry: Union[google.api_core.retry.Retry, google.api_core.gapic_v1.method._MethodDefault] = <_MethodDefault._DEFAULT_VALUE: <object object>>, timeout: Union[int, float, google.api_core.timeout.ConstantTimeout, google.api_core.timeout.ExponentialTimeout] = <_MethodDefault._DEFAULT_VALUE: <object object>>, metadata: Sequence[Tuple[str, str]] = ())
Gets the IAM access control policy for a function.
Returns an empty policy if the function exists and does not have a policy set.
Name | Description |
request |
The request object. Request message for |
retry |
google.api_core.retry.Retry
Designation of what errors, if any, should be retried. |
timeout |
TimeoutType
The timeout for this request. |
metadata |
Sequence[Tuple[str, str]]
Strings which should be sent along with the request as metadata. |
Type | Description |
| Defines an Identity and Access Management (IAM) policy. It is used to specify access control policies for Cloud Platform resources. A Policy is a collection of bindings . A binding binds one or more members to a single role . Members can be user accounts, service accounts, Google groups, and domains (such as G Suite). A role is a named list of permissions (defined by IAM or configured by users). A binding can optionally specify a condition , which is a logic expression that further constrains the role binding based on attributes about the request and/or target resource. **JSON Example** :: { "bindings": [ { "role": "roles/resourcemanager.organizationAdmin", "members": [ "user:mike@example.com", "group:admins@example.com", "domain:google.com", "serviceAccount:my-project-id@appspot.gserviceaccount.com" ] }, { "role": "roles/resourcemanager.organizationViewer", "members": ["user:eve@example.com"], "condition": { "title": "expirable access", "description": "Does not grant access after Sep 2020", "expression": "request.time < timestamp('2020-10-01t00:00:00.000z')",="" }="" }="" ]="" }="" **yaml="" example**="" ::="" bindings:="" -="" members:="" -="" user:mike@example.com="" -="" group:admins@example.com="" -="" domain:google.com="" -="" serviceaccount:my-project-id@appspot.gserviceaccount.com="" role:="" roles/resourcemanager.organizationadmin="" -="" members:="" -="" user:eve@example.com="" role:="" roles/resourcemanager.organizationviewer="" condition:="" title:="" expirable="" access="" description:="" does="" not="" grant="" access="" after="" sep="" 2020="" expression:="" request.time="">< timestamp('2020-10-01t00:00:00.000z')="" for="" a="" description="" of="" iam="" and="" its="" features,="" see="" the="">IAM developer's guide __. |
get_mtls_endpoint_and_cert_source
get_mtls_endpoint_and_cert_source(
client_options: Optional[google.api_core.client_options.ClientOptions] = None,
)
Return the API endpoint and client cert source for mutual TLS.
The client cert source is determined in the following order:
(1) if GOOGLE_API_USE_CLIENT_CERTIFICATE
environment variable is not "true", the
client cert source is None.
(2) if client_options.client_cert_source
is provided, use the provided one; if the
default client cert source exists, use the default one; otherwise the client cert
source is None.
The API endpoint is determined in the following order:
(1) if client_options.api_endpoint
if provided, use the provided one.
(2) if GOOGLE_API_USE_CLIENT_CERTIFICATE
environment variable is "always", use the
default mTLS endpoint; if the environment variable is "never", use the default API
endpoint; otherwise if client cert source exists, use the default mTLS endpoint, otherwise
use the default API endpoint.
More details can be found at https://google.aip.dev/auth/4114.
Name | Description |
client_options |
google.api_core.client_options.ClientOptions
Custom options for the client. Only the |
Type | Description |
google.auth.exceptions.MutualTLSChannelError | If any errors happen. |
Type | Description |
Tuple[str, Callable[[], Tuple[bytes, bytes]]] | returns the API endpoint and the client cert source to use. |
get_topic
get_topic(request: Optional[Union[google.cloud.pubsub_v1.types.GetTopicRequest, dict]] = None, *, topic: Optional[str] = None, retry: Union[google.api_core.retry.Retry, google.api_core.gapic_v1.method._MethodDefault] = <_MethodDefault._DEFAULT_VALUE: <object object>>, timeout: Union[int, float, google.api_core.timeout.ConstantTimeout, google.api_core.timeout.ExponentialTimeout] = <_MethodDefault._DEFAULT_VALUE: <object object>>, metadata: Sequence[Tuple[str, str]] = ())
Gets the configuration of a topic.
# This snippet has been automatically generated and should be regarded as a
# code template only.
# It will require modifications to work:
# - It may require correct/in-range values for request initialization.
# - It may require specifying regional endpoints when creating the service
# client as shown in:
# https://googleapis.dev/python/google-api-core/latest/client_options.html
from google import pubsub_v1
def sample_get_topic():
# Create a client
client = pubsub_v1.PublisherClient()
# Initialize request argument(s)
request = pubsub_v1.GetTopicRequest(
topic="topic_value",
)
# Make the request
response = client.get_topic(request=request)
# Handle the response
print(response)
Name | Description |
request |
Union[google.pubsub_v1.types.GetTopicRequest, dict]
The request object. Request for the GetTopic method. |
topic |
str
Required. The name of the topic to get. Format is |
retry |
google.api_core.retry.Retry
Designation of what errors, if any, should be retried. |
timeout |
TimeoutType
The timeout for this request. |
metadata |
Sequence[Tuple[str, str]]
Strings which should be sent along with the request as metadata. |
Type | Description |
google.pubsub_v1.types.Topic | A topic resource. |
list_topic_snapshots
list_topic_snapshots(request: Optional[Union[google.cloud.pubsub_v1.types.ListTopicSnapshotsRequest, dict]] = None, *, topic: Optional[str] = None, retry: Union[google.api_core.retry.Retry, google.api_core.gapic_v1.method._MethodDefault] = <_MethodDefault._DEFAULT_VALUE: <object object>>, timeout: Union[int, float, google.api_core.timeout.ConstantTimeout, google.api_core.timeout.ExponentialTimeout] = <_MethodDefault._DEFAULT_VALUE: <object object>>, metadata: Sequence[Tuple[str, str]] = ())
Lists the names of the snapshots on this topic. Snapshots are
used in
Seek <https://cloud.google.com/pubsub/docs/replay-overview>
__
operations, which allow you to manage message acknowledgments in
bulk. That is, you can set the acknowledgment state of messages
in an existing subscription to the state captured by a snapshot.
# This snippet has been automatically generated and should be regarded as a
# code template only.
# It will require modifications to work:
# - It may require correct/in-range values for request initialization.
# - It may require specifying regional endpoints when creating the service
# client as shown in:
# https://googleapis.dev/python/google-api-core/latest/client_options.html
from google import pubsub_v1
def sample_list_topic_snapshots():
# Create a client
client = pubsub_v1.PublisherClient()
# Initialize request argument(s)
request = pubsub_v1.ListTopicSnapshotsRequest(
topic="topic_value",
)
# Make the request
page_result = client.list_topic_snapshots(request=request)
# Handle the response
for response in page_result:
print(response)
Name | Description |
request |
Union[google.pubsub_v1.types.ListTopicSnapshotsRequest, dict]
The request object. Request for the |
topic |
str
Required. The name of the topic that snapshots are attached to. Format is |
retry |
google.api_core.retry.Retry
Designation of what errors, if any, should be retried. |
timeout |
TimeoutType
The timeout for this request. |
metadata |
Sequence[Tuple[str, str]]
Strings which should be sent along with the request as metadata. |
Type | Description |
google.pubsub_v1.services.publisher.pagers.ListTopicSnapshotsPager | Response for the ListTopicSnapshots method. Iterating over this object will yield results and resolve additional pages automatically. |
list_topic_subscriptions
list_topic_subscriptions(request: Optional[Union[google.cloud.pubsub_v1.types.ListTopicSubscriptionsRequest, dict]] = None, *, topic: Optional[str] = None, retry: Union[google.api_core.retry.Retry, google.api_core.gapic_v1.method._MethodDefault] = <_MethodDefault._DEFAULT_VALUE: <object object>>, timeout: Union[int, float, google.api_core.timeout.ConstantTimeout, google.api_core.timeout.ExponentialTimeout] = <_MethodDefault._DEFAULT_VALUE: <object object>>, metadata: Sequence[Tuple[str, str]] = ())
Lists the names of the attached subscriptions on this topic.
# This snippet has been automatically generated and should be regarded as a
# code template only.
# It will require modifications to work:
# - It may require correct/in-range values for request initialization.
# - It may require specifying regional endpoints when creating the service
# client as shown in:
# https://googleapis.dev/python/google-api-core/latest/client_options.html
from google import pubsub_v1
def sample_list_topic_subscriptions():
# Create a client
client = pubsub_v1.PublisherClient()
# Initialize request argument(s)
request = pubsub_v1.ListTopicSubscriptionsRequest(
topic="topic_value",
)
# Make the request
page_result = client.list_topic_subscriptions(request=request)
# Handle the response
for response in page_result:
print(response)
Name | Description |
request |
Union[google.pubsub_v1.types.ListTopicSubscriptionsRequest, dict]
The request object. Request for the |
topic |
str
Required. The name of the topic that subscriptions are attached to. Format is |
retry |
google.api_core.retry.Retry
Designation of what errors, if any, should be retried. |
timeout |
TimeoutType
The timeout for this request. |
metadata |
Sequence[Tuple[str, str]]
Strings which should be sent along with the request as metadata. |
Type | Description |
google.pubsub_v1.services.publisher.pagers.ListTopicSubscriptionsPager | Response for the ListTopicSubscriptions method. Iterating over this object will yield results and resolve additional pages automatically. |
list_topics
list_topics(request: Optional[Union[google.cloud.pubsub_v1.types.ListTopicsRequest, dict]] = None, *, project: Optional[str] = None, retry: Union[google.api_core.retry.Retry, google.api_core.gapic_v1.method._MethodDefault] = <_MethodDefault._DEFAULT_VALUE: <object object>>, timeout: Union[int, float, google.api_core.timeout.ConstantTimeout, google.api_core.timeout.ExponentialTimeout] = <_MethodDefault._DEFAULT_VALUE: <object object>>, metadata: Sequence[Tuple[str, str]] = ())
Lists matching topics.
# This snippet has been automatically generated and should be regarded as a
# code template only.
# It will require modifications to work:
# - It may require correct/in-range values for request initialization.
# - It may require specifying regional endpoints when creating the service
# client as shown in:
# https://googleapis.dev/python/google-api-core/latest/client_options.html
from google import pubsub_v1
def sample_list_topics():
# Create a client
client = pubsub_v1.PublisherClient()
# Initialize request argument(s)
request = pubsub_v1.ListTopicsRequest(
project="project_value",
)
# Make the request
page_result = client.list_topics(request=request)
# Handle the response
for response in page_result:
print(response)
Name | Description |
request |
Union[google.pubsub_v1.types.ListTopicsRequest, dict]
The request object. Request for the |
project |
str
Required. The name of the project in which to list topics. Format is |
retry |
google.api_core.retry.Retry
Designation of what errors, if any, should be retried. |
timeout |
TimeoutType
The timeout for this request. |
metadata |
Sequence[Tuple[str, str]]
Strings which should be sent along with the request as metadata. |
Type | Description |
google.pubsub_v1.services.publisher.pagers.ListTopicsPager | Response for the ListTopics method. Iterating over this object will yield results and resolve additional pages automatically. |
parse_common_billing_account_path
parse_common_billing_account_path(path: str)
Parse a billing_account path into its component segments.
parse_common_folder_path
parse_common_folder_path(path: str)
Parse a folder path into its component segments.
parse_common_location_path
parse_common_location_path(path: str)
Parse a location path into its component segments.
parse_common_organization_path
parse_common_organization_path(path: str)
Parse a organization path into its component segments.
parse_common_project_path
parse_common_project_path(path: str)
Parse a project path into its component segments.
parse_schema_path
parse_schema_path(path: str)
Parses a schema path into its component segments.
parse_subscription_path
parse_subscription_path(path: str)
Parses a subscription path into its component segments.
parse_topic_path
parse_topic_path(path: str)
Parses a topic path into its component segments.
publish
publish(topic: str, data: bytes, ordering_key: str = '', retry: OptionalRetry = <_MethodDefault._DEFAULT_VALUE: <object object>>, timeout: types.OptionalTimeout = <_MethodDefault._DEFAULT_VALUE: <object object>>, **attrs: Union[bytes, str])
Publish a single message.
The reason that this is so important (and why we do not try to coerce for you) is because Pub/Sub is also platform independent and there is no way to know how to decode messages properly on the other side; therefore, encoding and decoding is a required exercise for the developer.
Add the given message to this object; this will cause it to be published once the batch either has enough messages or a sufficient period of time has elapsed. This method may block if LimitExceededBehavior.BLOCK is used in the flow control settings.
.. rubric:: Example
from google.cloud import pubsub_v1 client = pubsub_v1.PublisherClient() topic = client.topic_path('[PROJECT]', '[TOPIC]') data = b'The rain in Wales falls mainly on the snails.' response = client.publish(topic, data, username='guido')
Type | Description |
RuntimeError | If called after publisher has been stopped by a stop() method call. |
pubsub_v1.publisher.exceptions.MessageTooLargeError | If publishing the message would exceed the max size limit on the backend. |
resume_publish
resume_publish(topic: str, ordering_key: str)
Resume publish on an ordering key that has had unrecoverable errors.
Type | Description |
RuntimeError | If called after publisher has been stopped by a stop() method call. |
ValueError | If the topic/ordering key combination has not been seen before by this client. |
schema_path
schema_path(project: str, schema: str)
Returns a fully-qualified schema string.
set_iam_policy
set_iam_policy(request: Optional[google.iam.v1.iam_policy_pb2.SetIamPolicyRequest] = None, *, retry: Union[google.api_core.retry.Retry, google.api_core.gapic_v1.method._MethodDefault] = <_MethodDefault._DEFAULT_VALUE: <object object>>, timeout: Union[int, float, google.api_core.timeout.ConstantTimeout, google.api_core.timeout.ExponentialTimeout] = <_MethodDefault._DEFAULT_VALUE: <object object>>, metadata: Sequence[Tuple[str, str]] = ())
Sets the IAM access control policy on the specified function.
Replaces any existing policy.
Name | Description |
request |
The request object. Request message for |
retry |
google.api_core.retry.Retry
Designation of what errors, if any, should be retried. |
timeout |
TimeoutType
The timeout for this request. |
metadata |
Sequence[Tuple[str, str]]
Strings which should be sent along with the request as metadata. |
Type | Description |
| Defines an Identity and Access Management (IAM) policy. It is used to specify access control policies for Cloud Platform resources. A Policy is a collection of bindings . A binding binds one or more members to a single role . Members can be user accounts, service accounts, Google groups, and domains (such as G Suite). A role is a named list of permissions (defined by IAM or configured by users). A binding can optionally specify a condition , which is a logic expression that further constrains the role binding based on attributes about the request and/or target resource. **JSON Example** :: { "bindings": [ { "role": "roles/resourcemanager.organizationAdmin", "members": [ "user:mike@example.com", "group:admins@example.com", "domain:google.com", "serviceAccount:my-project-id@appspot.gserviceaccount.com" ] }, { "role": "roles/resourcemanager.organizationViewer", "members": ["user:eve@example.com"], "condition": { "title": "expirable access", "description": "Does not grant access after Sep 2020", "expression": "request.time < timestamp('2020-10-01t00:00:00.000z')",="" }="" }="" ]="" }="" **yaml="" example**="" ::="" bindings:="" -="" members:="" -="" user:mike@example.com="" -="" group:admins@example.com="" -="" domain:google.com="" -="" serviceaccount:my-project-id@appspot.gserviceaccount.com="" role:="" roles/resourcemanager.organizationadmin="" -="" members:="" -="" user:eve@example.com="" role:="" roles/resourcemanager.organizationviewer="" condition:="" title:="" expirable="" access="" description:="" does="" not="" grant="" access="" after="" sep="" 2020="" expression:="" request.time="">< timestamp('2020-10-01t00:00:00.000z')="" for="" a="" description="" of="" iam="" and="" its="" features,="" see="" the="">IAM developer's guide __. |
stop
stop()
Immediately publish all outstanding messages.
Asynchronously sends all outstanding messages and
prevents future calls to publish()
. Method should
be invoked prior to deleting this Client()
object
in order to ensure that no pending messages are lost.
Type | Description |
RuntimeError | If called after publisher has been stopped by a stop() method call. |
subscription_path
subscription_path(project: str, subscription: str)
Returns a fully-qualified subscription string.
test_iam_permissions
test_iam_permissions(request: Optional[google.iam.v1.iam_policy_pb2.TestIamPermissionsRequest] = None, *, retry: Union[google.api_core.retry.Retry, google.api_core.gapic_v1.method._MethodDefault] = <_MethodDefault._DEFAULT_VALUE: <object object>>, timeout: Union[int, float, google.api_core.timeout.ConstantTimeout, google.api_core.timeout.ExponentialTimeout] = <_MethodDefault._DEFAULT_VALUE: <object object>>, metadata: Sequence[Tuple[str, str]] = ())
Tests the specified IAM permissions against the IAM access control policy for a function.
If the function does not exist, this will return an empty set of permissions, not a NOT_FOUND error.
Name | Description |
request |
The request object. Request message for |
retry |
google.api_core.retry.Retry
Designation of what errors, if any, should be retried. |
timeout |
TimeoutType
The timeout for this request. |
metadata |
Sequence[Tuple[str, str]]
Strings which should be sent along with the request as metadata. |
Type | Description |
| Response message for TestIamPermissions method. |
topic_path
topic_path(project: str, topic: str)
Returns a fully-qualified topic string.
update_topic
update_topic(request: Optional[Union[google.cloud.pubsub_v1.types.UpdateTopicRequest, dict]] = None, *, retry: Union[google.api_core.retry.Retry, google.api_core.gapic_v1.method._MethodDefault] = <_MethodDefault._DEFAULT_VALUE: <object object>>, timeout: Union[int, float, google.api_core.timeout.ConstantTimeout, google.api_core.timeout.ExponentialTimeout] = <_MethodDefault._DEFAULT_VALUE: <object object>>, metadata: Sequence[Tuple[str, str]] = ())
Updates an existing topic. Note that certain properties of a topic are not modifiable.
# This snippet has been automatically generated and should be regarded as a
# code template only.
# It will require modifications to work:
# - It may require correct/in-range values for request initialization.
# - It may require specifying regional endpoints when creating the service
# client as shown in:
# https://googleapis.dev/python/google-api-core/latest/client_options.html
from google import pubsub_v1
def sample_update_topic():
# Create a client
client = pubsub_v1.PublisherClient()
# Initialize request argument(s)
topic = pubsub_v1.Topic()
topic.name = "name_value"
request = pubsub_v1.UpdateTopicRequest(
topic=topic,
)
# Make the request
response = client.update_topic(request=request)
# Handle the response
print(response)
Name | Description |
request |
Union[google.pubsub_v1.types.UpdateTopicRequest, dict]
The request object. Request for the UpdateTopic method. |
retry |
google.api_core.retry.Retry
Designation of what errors, if any, should be retried. |
timeout |
TimeoutType
The timeout for this request. |
metadata |
Sequence[Tuple[str, str]]
Strings which should be sent along with the request as metadata. |
Type | Description |
google.pubsub_v1.types.Topic | A topic resource. |