public abstract class PublisherServiceApiClient
PublisherServiceApi client wrapper, for convenient use.
Derived Types
Namespace
Google.Cloud.PubSub.V1Assembly
Google.Cloud.PubSub.V1.dll
Remarks
The service that an application uses to manipulate topics, and to send messages to a topic.
Properties
DefaultEndpoint
public static string DefaultEndpoint { get; }
The default endpoint for the PublisherServiceApi service, which is a host of "pubsub.googleapis.com" and a port of 443.
Property Value | |
---|---|
Type | Description |
String |
DefaultScopes
public static IReadOnlyList<string> DefaultScopes { get; }
The default PublisherServiceApi scopes.
Property Value | |
---|---|
Type | Description |
IReadOnlyList<String> |
The default PublisherServiceApi scopes are:
GrpcClient
public virtual Publisher.PublisherClient GrpcClient { get; }
The underlying gRPC PublisherServiceApi client
Property Value | |
---|---|
Type | Description |
Publisher.PublisherClient |
IAMPolicyClient
public virtual IAMPolicyClient IAMPolicyClient { get; }
The IAMPolicyClient associated with this client.
Property Value | |
---|---|
Type | Description |
IAMPolicyClient |
Methods
Create()
public static PublisherServiceApiClient Create()
Synchronously creates a PublisherServiceApiClient using the default credentials, endpoint and settings. To specify custom credentials or other settings, use PublisherServiceApiClientBuilder.
Returns | |
---|---|
Type | Description |
PublisherServiceApiClient | The created PublisherServiceApiClient. |
CreateAsync(CancellationToken)
public static Task<PublisherServiceApiClient> CreateAsync(CancellationToken cancellationToken = default(CancellationToken))
Asynchronously creates a PublisherServiceApiClient using the default credentials, endpoint and settings. To specify custom credentials or other settings, use PublisherServiceApiClientBuilder.
Parameter | |
---|---|
Name | Description |
cancellationToken | CancellationToken The CancellationToken to use while creating the client. |
Returns | |
---|---|
Type | Description |
Task<PublisherServiceApiClient> | The task representing the created PublisherServiceApiClient. |
CreateTopic(Topic, CallSettings)
public virtual Topic CreateTopic(Topic request, CallSettings callSettings = null)
Creates the given topic with the given name. See the resource name rules.
Parameters | |
---|---|
Name | Description |
request | Topic The request object containing all of the parameters for the API call. |
callSettings | CallSettings If not null, applies overrides to this RPC call. |
Returns | |
---|---|
Type | Description |
Topic | The RPC response. |
// Create client
PublisherServiceApiClient publisherServiceApiClient = PublisherServiceApiClient.Create();
// Initialize request argument(s)
Topic request = new Topic
{
TopicName = TopicName.FromProjectTopic("[PROJECT]", "[TOPIC]"),
Labels = { { "", "" }, },
MessageStoragePolicy = new MessageStoragePolicy(),
KmsKeyName = "",
SchemaSettings = new SchemaSettings(),
SatisfiesPzs = false,
MessageRetentionDuration = new Duration(),
};
// Make the request
Topic response = publisherServiceApiClient.CreateTopic(request);
CreateTopic(TopicName, CallSettings)
public virtual Topic CreateTopic(TopicName name, CallSettings callSettings = null)
Creates the given topic with the given name. See the resource name rules.
Parameters | |
---|---|
Name | Description |
name | TopicName Required. The name of the topic. It must have the format
|
callSettings | CallSettings If not null, applies overrides to this RPC call. |
Returns | |
---|---|
Type | Description |
Topic | The RPC response. |
PublisherServiceApiClient client = PublisherServiceApiClient.Create();
TopicName topicName = new TopicName(projectId, topicId);
Topic topic = client.CreateTopic(topicName);
Console.WriteLine($"Created {topic.Name}");
CreateTopic(String, CallSettings)
public virtual Topic CreateTopic(string name, CallSettings callSettings = null)
Creates the given topic with the given name. See the resource name rules.
Parameters | |
---|---|
Name | Description |
name | String Required. The name of the topic. It must have the format
|
callSettings | CallSettings If not null, applies overrides to this RPC call. |
Returns | |
---|---|
Type | Description |
Topic | The RPC response. |
// Create client
PublisherServiceApiClient publisherServiceApiClient = PublisherServiceApiClient.Create();
// Initialize request argument(s)
string name = "projects/[PROJECT]/topics/[TOPIC]";
// Make the request
Topic response = publisherServiceApiClient.CreateTopic(name);
CreateTopicAsync(Topic, CallSettings)
public virtual Task<Topic> CreateTopicAsync(Topic request, CallSettings callSettings = null)
Creates the given topic with the given name. See the resource name rules.
Parameters | |
---|---|
Name | Description |
request | Topic The request object containing all of the parameters for the API call. |
callSettings | CallSettings If not null, applies overrides to this RPC call. |
Returns | |
---|---|
Type | Description |
Task<Topic> | A Task containing the RPC response. |
// Create client
PublisherServiceApiClient publisherServiceApiClient = await PublisherServiceApiClient.CreateAsync();
// Initialize request argument(s)
Topic request = new Topic
{
TopicName = TopicName.FromProjectTopic("[PROJECT]", "[TOPIC]"),
Labels = { { "", "" }, },
MessageStoragePolicy = new MessageStoragePolicy(),
KmsKeyName = "",
SchemaSettings = new SchemaSettings(),
SatisfiesPzs = false,
MessageRetentionDuration = new Duration(),
};
// Make the request
Topic response = await publisherServiceApiClient.CreateTopicAsync(request);
CreateTopicAsync(Topic, CancellationToken)
public virtual Task<Topic> CreateTopicAsync(Topic request, CancellationToken cancellationToken)
Creates the given topic with the given name. See the resource name rules.
Parameters | |
---|---|
Name | Description |
request | Topic The request object containing all of the parameters for the API call. |
cancellationToken | CancellationToken A CancellationToken to use for this RPC. |
Returns | |
---|---|
Type | Description |
Task<Topic> | A Task containing the RPC response. |
// Create client
PublisherServiceApiClient publisherServiceApiClient = await PublisherServiceApiClient.CreateAsync();
// Initialize request argument(s)
Topic request = new Topic
{
TopicName = TopicName.FromProjectTopic("[PROJECT]", "[TOPIC]"),
Labels = { { "", "" }, },
MessageStoragePolicy = new MessageStoragePolicy(),
KmsKeyName = "",
SchemaSettings = new SchemaSettings(),
SatisfiesPzs = false,
MessageRetentionDuration = new Duration(),
};
// Make the request
Topic response = await publisherServiceApiClient.CreateTopicAsync(request);
CreateTopicAsync(TopicName, CallSettings)
public virtual Task<Topic> CreateTopicAsync(TopicName name, CallSettings callSettings = null)
Creates the given topic with the given name. See the resource name rules.
Parameters | |
---|---|
Name | Description |
name | TopicName Required. The name of the topic. It must have the format
|
callSettings | CallSettings If not null, applies overrides to this RPC call. |
Returns | |
---|---|
Type | Description |
Task<Topic> | A Task containing the RPC response. |
PublisherServiceApiClient client = PublisherServiceApiClient.Create();
TopicName topicName = new TopicName(projectId, topicId);
Topic topic = await client.CreateTopicAsync(topicName);
Console.WriteLine($"Created {topic.Name}");
CreateTopicAsync(TopicName, CancellationToken)
public virtual Task<Topic> CreateTopicAsync(TopicName name, CancellationToken cancellationToken)
Creates the given topic with the given name. See the resource name rules.
Parameters | |
---|---|
Name | Description |
name | TopicName Required. The name of the topic. It must have the format
|
cancellationToken | CancellationToken A CancellationToken to use for this RPC. |
Returns | |
---|---|
Type | Description |
Task<Topic> | A Task containing the RPC response. |
PublisherServiceApiClient client = PublisherServiceApiClient.Create();
TopicName topicName = new TopicName(projectId, topicId);
Topic topic = await client.CreateTopicAsync(topicName);
Console.WriteLine($"Created {topic.Name}");
CreateTopicAsync(String, CallSettings)
public virtual Task<Topic> CreateTopicAsync(string name, CallSettings callSettings = null)
Creates the given topic with the given name. See the resource name rules.
Parameters | |
---|---|
Name | Description |
name | String Required. The name of the topic. It must have the format
|
callSettings | CallSettings If not null, applies overrides to this RPC call. |
Returns | |
---|---|
Type | Description |
Task<Topic> | A Task containing the RPC response. |
// Create client
PublisherServiceApiClient publisherServiceApiClient = await PublisherServiceApiClient.CreateAsync();
// Initialize request argument(s)
string name = "projects/[PROJECT]/topics/[TOPIC]";
// Make the request
Topic response = await publisherServiceApiClient.CreateTopicAsync(name);
CreateTopicAsync(String, CancellationToken)
public virtual Task<Topic> CreateTopicAsync(string name, CancellationToken cancellationToken)
Creates the given topic with the given name. See the resource name rules.
Parameters | |
---|---|
Name | Description |
name | String Required. The name of the topic. It must have the format
|
cancellationToken | CancellationToken A CancellationToken to use for this RPC. |
Returns | |
---|---|
Type | Description |
Task<Topic> | A Task containing the RPC response. |
// Create client
PublisherServiceApiClient publisherServiceApiClient = await PublisherServiceApiClient.CreateAsync();
// Initialize request argument(s)
string name = "projects/[PROJECT]/topics/[TOPIC]";
// Make the request
Topic response = await publisherServiceApiClient.CreateTopicAsync(name);
DeleteTopic(DeleteTopicRequest, CallSettings)
public virtual void DeleteTopic(DeleteTopicRequest request, CallSettings callSettings = null)
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_
.
Parameters | |
---|---|
Name | Description |
request | DeleteTopicRequest The request object containing all of the parameters for the API call. |
callSettings | CallSettings If not null, applies overrides to this RPC call. |
// Create client
PublisherServiceApiClient publisherServiceApiClient = PublisherServiceApiClient.Create();
// Initialize request argument(s)
DeleteTopicRequest request = new DeleteTopicRequest
{
TopicAsTopicName = TopicName.FromProjectTopic("[PROJECT]", "[TOPIC]"),
};
// Make the request
publisherServiceApiClient.DeleteTopic(request);
DeleteTopic(TopicName, CallSettings)
public virtual void DeleteTopic(TopicName topic, CallSettings callSettings = null)
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_
.
Parameters | |
---|---|
Name | Description |
topic | TopicName Required. Name of the topic to delete.
Format is |
callSettings | CallSettings If not null, applies overrides to this RPC call. |
PublisherServiceApiClient client = PublisherServiceApiClient.Create();
TopicName topicName = new TopicName(projectId, topicId);
client.DeleteTopic(topicName);
Console.WriteLine($"Deleted {topicName}");
DeleteTopic(String, CallSettings)
public virtual void DeleteTopic(string topic, CallSettings callSettings = null)
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_
.
Parameters | |
---|---|
Name | Description |
topic | String Required. Name of the topic to delete.
Format is |
callSettings | CallSettings If not null, applies overrides to this RPC call. |
// Create client
PublisherServiceApiClient publisherServiceApiClient = PublisherServiceApiClient.Create();
// Initialize request argument(s)
string topic = "projects/[PROJECT]/topics/[TOPIC]";
// Make the request
publisherServiceApiClient.DeleteTopic(topic);
DeleteTopicAsync(DeleteTopicRequest, CallSettings)
public virtual Task DeleteTopicAsync(DeleteTopicRequest request, CallSettings callSettings = null)
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_
.
Parameters | |
---|---|
Name | Description |
request | DeleteTopicRequest The request object containing all of the parameters for the API call. |
callSettings | CallSettings If not null, applies overrides to this RPC call. |
Returns | |
---|---|
Type | Description |
Task | A Task containing the RPC response. |
// Create client
PublisherServiceApiClient publisherServiceApiClient = await PublisherServiceApiClient.CreateAsync();
// Initialize request argument(s)
DeleteTopicRequest request = new DeleteTopicRequest
{
TopicAsTopicName = TopicName.FromProjectTopic("[PROJECT]", "[TOPIC]"),
};
// Make the request
await publisherServiceApiClient.DeleteTopicAsync(request);
DeleteTopicAsync(DeleteTopicRequest, CancellationToken)
public virtual Task DeleteTopicAsync(DeleteTopicRequest request, CancellationToken cancellationToken)
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_
.
Parameters | |
---|---|
Name | Description |
request | DeleteTopicRequest The request object containing all of the parameters for the API call. |
cancellationToken | CancellationToken A CancellationToken to use for this RPC. |
Returns | |
---|---|
Type | Description |
Task | A Task containing the RPC response. |
// Create client
PublisherServiceApiClient publisherServiceApiClient = await PublisherServiceApiClient.CreateAsync();
// Initialize request argument(s)
DeleteTopicRequest request = new DeleteTopicRequest
{
TopicAsTopicName = TopicName.FromProjectTopic("[PROJECT]", "[TOPIC]"),
};
// Make the request
await publisherServiceApiClient.DeleteTopicAsync(request);
DeleteTopicAsync(TopicName, CallSettings)
public virtual Task DeleteTopicAsync(TopicName topic, CallSettings callSettings = null)
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_
.
Parameters | |
---|---|
Name | Description |
topic | TopicName Required. Name of the topic to delete.
Format is |
callSettings | CallSettings If not null, applies overrides to this RPC call. |
Returns | |
---|---|
Type | Description |
Task | A Task containing the RPC response. |
PublisherServiceApiClient client = PublisherServiceApiClient.Create();
TopicName topicName = new TopicName(projectId, topicId);
await client.DeleteTopicAsync(topicName);
Console.WriteLine($"Deleted {topicName}");
DeleteTopicAsync(TopicName, CancellationToken)
public virtual Task DeleteTopicAsync(TopicName topic, CancellationToken cancellationToken)
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_
.
Parameters | |
---|---|
Name | Description |
topic | TopicName Required. Name of the topic to delete.
Format is |
cancellationToken | CancellationToken A CancellationToken to use for this RPC. |
Returns | |
---|---|
Type | Description |
Task | A Task containing the RPC response. |
PublisherServiceApiClient client = PublisherServiceApiClient.Create();
TopicName topicName = new TopicName(projectId, topicId);
await client.DeleteTopicAsync(topicName);
Console.WriteLine($"Deleted {topicName}");
DeleteTopicAsync(String, CallSettings)
public virtual Task DeleteTopicAsync(string topic, CallSettings callSettings = null)
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_
.
Parameters | |
---|---|
Name | Description |
topic | String Required. Name of the topic to delete.
Format is |
callSettings | CallSettings If not null, applies overrides to this RPC call. |
Returns | |
---|---|
Type | Description |
Task | A Task containing the RPC response. |
// Create client
PublisherServiceApiClient publisherServiceApiClient = await PublisherServiceApiClient.CreateAsync();
// Initialize request argument(s)
string topic = "projects/[PROJECT]/topics/[TOPIC]";
// Make the request
await publisherServiceApiClient.DeleteTopicAsync(topic);
DeleteTopicAsync(String, CancellationToken)
public virtual Task DeleteTopicAsync(string topic, CancellationToken cancellationToken)
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_
.
Parameters | |
---|---|
Name | Description |
topic | String Required. Name of the topic to delete.
Format is |
cancellationToken | CancellationToken A CancellationToken to use for this RPC. |
Returns | |
---|---|
Type | Description |
Task | A Task containing the RPC response. |
// Create client
PublisherServiceApiClient publisherServiceApiClient = await PublisherServiceApiClient.CreateAsync();
// Initialize request argument(s)
string topic = "projects/[PROJECT]/topics/[TOPIC]";
// Make the request
await publisherServiceApiClient.DeleteTopicAsync(topic);
DetachSubscription(DetachSubscriptionRequest, CallSettings)
public virtual DetachSubscriptionResponse DetachSubscription(DetachSubscriptionRequest request, CallSettings callSettings = null)
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.
Parameters | |
---|---|
Name | Description |
request | DetachSubscriptionRequest The request object containing all of the parameters for the API call. |
callSettings | CallSettings If not null, applies overrides to this RPC call. |
Returns | |
---|---|
Type | Description |
DetachSubscriptionResponse | The RPC response. |
// Create client
PublisherServiceApiClient publisherServiceApiClient = PublisherServiceApiClient.Create();
// Initialize request argument(s)
DetachSubscriptionRequest request = new DetachSubscriptionRequest
{
SubscriptionAsSubscriptionName = SubscriptionName.FromProjectSubscription("[PROJECT]", "[SUBSCRIPTION]"),
};
// Make the request
DetachSubscriptionResponse response = publisherServiceApiClient.DetachSubscription(request);
DetachSubscriptionAsync(DetachSubscriptionRequest, CallSettings)
public virtual Task<DetachSubscriptionResponse> DetachSubscriptionAsync(DetachSubscriptionRequest request, CallSettings callSettings = null)
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.
Parameters | |
---|---|
Name | Description |
request | DetachSubscriptionRequest The request object containing all of the parameters for the API call. |
callSettings | CallSettings If not null, applies overrides to this RPC call. |
Returns | |
---|---|
Type | Description |
Task<DetachSubscriptionResponse> | A Task containing the RPC response. |
// Create client
PublisherServiceApiClient publisherServiceApiClient = await PublisherServiceApiClient.CreateAsync();
// Initialize request argument(s)
DetachSubscriptionRequest request = new DetachSubscriptionRequest
{
SubscriptionAsSubscriptionName = SubscriptionName.FromProjectSubscription("[PROJECT]", "[SUBSCRIPTION]"),
};
// Make the request
DetachSubscriptionResponse response = await publisherServiceApiClient.DetachSubscriptionAsync(request);
DetachSubscriptionAsync(DetachSubscriptionRequest, CancellationToken)
public virtual Task<DetachSubscriptionResponse> DetachSubscriptionAsync(DetachSubscriptionRequest request, CancellationToken cancellationToken)
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.
Parameters | |
---|---|
Name | Description |
request | DetachSubscriptionRequest The request object containing all of the parameters for the API call. |
cancellationToken | CancellationToken A CancellationToken to use for this RPC. |
Returns | |
---|---|
Type | Description |
Task<DetachSubscriptionResponse> | A Task containing the RPC response. |
// Create client
PublisherServiceApiClient publisherServiceApiClient = await PublisherServiceApiClient.CreateAsync();
// Initialize request argument(s)
DetachSubscriptionRequest request = new DetachSubscriptionRequest
{
SubscriptionAsSubscriptionName = SubscriptionName.FromProjectSubscription("[PROJECT]", "[SUBSCRIPTION]"),
};
// Make the request
DetachSubscriptionResponse response = await publisherServiceApiClient.DetachSubscriptionAsync(request);
GetIamPolicy(IResourceName, CallSettings)
public virtual Policy GetIamPolicy(IResourceName resource, CallSettings callSettings = null)
Gets the access control policy for a resource. Returns an empty policy if the resource exists and does not have a policy set.
Parameters | |
---|---|
Name | Description |
resource | IResourceName REQUIRED: The resource for which the policy is being requested. See the operation documentation for the appropriate value for this field. |
callSettings | CallSettings If not null, applies overrides to this RPC call. |
Returns | |
---|---|
Type | Description |
Policy | The RPC response. |
GetIamPolicy(GetIamPolicyRequest, CallSettings)
public virtual Policy GetIamPolicy(GetIamPolicyRequest request, CallSettings callSettings = null)
Gets the access control policy for a resource. Returns an empty policy if the resource exists and does not have a policy set.
Parameters | |
---|---|
Name | Description |
request | GetIamPolicyRequest The request object containing all of the parameters for the API call. |
callSettings | CallSettings If not null, applies overrides to this RPC call. |
Returns | |
---|---|
Type | Description |
Policy | The RPC response. |
GetIamPolicy(String, CallSettings)
public virtual Policy GetIamPolicy(string resource, CallSettings callSettings = null)
Gets the access control policy for a resource. Returns an empty policy if the resource exists and does not have a policy set.
Parameters | |
---|---|
Name | Description |
resource | String REQUIRED: The resource for which the policy is being requested. See the operation documentation for the appropriate value for this field. |
callSettings | CallSettings If not null, applies overrides to this RPC call. |
Returns | |
---|---|
Type | Description |
Policy | The RPC response. |
PublisherServiceApiClient client = PublisherServiceApiClient.Create();
string topicName = new TopicName(projectId, topicId).ToString();
Policy policy = client.GetIamPolicy(topicName);
Console.WriteLine($"Policy for {topicName}: {policy}");
GetIamPolicyAsync(IResourceName, CallSettings)
public virtual Task<Policy> GetIamPolicyAsync(IResourceName resource, CallSettings callSettings = null)
Gets the access control policy for a resource. Returns an empty policy if the resource exists and does not have a policy set.
Parameters | |
---|---|
Name | Description |
resource | IResourceName REQUIRED: The resource for which the policy is being requested. See the operation documentation for the appropriate value for this field. |
callSettings | CallSettings If not null, applies overrides to this RPC call. |
Returns | |
---|---|
Type | Description |
Task<Policy> | A Task containing the RPC response. |
GetIamPolicyAsync(IResourceName, CancellationToken)
public virtual Task<Policy> GetIamPolicyAsync(IResourceName resource, CancellationToken cancellationToken)
Gets the access control policy for a resource. Returns an empty policy if the resource exists and does not have a policy set.
Parameters | |
---|---|
Name | Description |
resource | IResourceName REQUIRED: The resource for which the policy is being requested. See the operation documentation for the appropriate value for this field. |
cancellationToken | CancellationToken A CancellationToken to use for this RPC. |
Returns | |
---|---|
Type | Description |
Task<Policy> | A Task containing the RPC response. |
GetIamPolicyAsync(GetIamPolicyRequest, CallSettings)
public virtual Task<Policy> GetIamPolicyAsync(GetIamPolicyRequest request, CallSettings callSettings = null)
Gets the access control policy for a resource. Returns an empty policy if the resource exists and does not have a policy set.
Parameters | |
---|---|
Name | Description |
request | GetIamPolicyRequest The request object containing all of the parameters for the API call. |
callSettings | CallSettings If not null, applies overrides to this RPC call. |
Returns | |
---|---|
Type | Description |
Task<Policy> | A Task containing the RPC response. |
GetIamPolicyAsync(GetIamPolicyRequest, CancellationToken)
public virtual Task<Policy> GetIamPolicyAsync(GetIamPolicyRequest request, CancellationToken cancellationToken)
Gets the access control policy for a resource. Returns an empty policy if the resource exists and does not have a policy set.
Parameters | |
---|---|
Name | Description |
request | GetIamPolicyRequest The request object containing all of the parameters for the API call. |
cancellationToken | CancellationToken A CancellationToken to use for this RPC. |
Returns | |
---|---|
Type | Description |
Task<Policy> | A Task containing the RPC response. |
GetIamPolicyAsync(String, CallSettings)
public virtual Task<Policy> GetIamPolicyAsync(string resource, CallSettings callSettings = null)
Gets the access control policy for a resource. Returns an empty policy if the resource exists and does not have a policy set.
Parameters | |
---|---|
Name | Description |
resource | String REQUIRED: The resource for which the policy is being requested. See the operation documentation for the appropriate value for this field. |
callSettings | CallSettings If not null, applies overrides to this RPC call. |
Returns | |
---|---|
Type | Description |
Task<Policy> | A Task containing the RPC response. |
GetIamPolicyAsync(String, CancellationToken)
public virtual Task<Policy> GetIamPolicyAsync(string resource, CancellationToken cancellationToken)
Gets the access control policy for a resource. Returns an empty policy if the resource exists and does not have a policy set.
Parameters | |
---|---|
Name | Description |
resource | String REQUIRED: The resource for which the policy is being requested. See the operation documentation for the appropriate value for this field. |
cancellationToken | CancellationToken A CancellationToken to use for this RPC. |
Returns | |
---|---|
Type | Description |
Task<Policy> | A Task containing the RPC response. |
GetTopic(GetTopicRequest, CallSettings)
public virtual Topic GetTopic(GetTopicRequest request, CallSettings callSettings = null)
Gets the configuration of a topic.
Parameters | |
---|---|
Name | Description |
request | GetTopicRequest The request object containing all of the parameters for the API call. |
callSettings | CallSettings If not null, applies overrides to this RPC call. |
Returns | |
---|---|
Type | Description |
Topic | The RPC response. |
// Create client
PublisherServiceApiClient publisherServiceApiClient = PublisherServiceApiClient.Create();
// Initialize request argument(s)
GetTopicRequest request = new GetTopicRequest
{
TopicAsTopicName = TopicName.FromProjectTopic("[PROJECT]", "[TOPIC]"),
};
// Make the request
Topic response = publisherServiceApiClient.GetTopic(request);
GetTopic(TopicName, CallSettings)
public virtual Topic GetTopic(TopicName topic, CallSettings callSettings = null)
Gets the configuration of a topic.
Parameters | |
---|---|
Name | Description |
topic | TopicName Required. The name of the topic to get.
Format is |
callSettings | CallSettings If not null, applies overrides to this RPC call. |
Returns | |
---|---|
Type | Description |
Topic | The RPC response. |
// Create client
PublisherServiceApiClient publisherServiceApiClient = PublisherServiceApiClient.Create();
// Initialize request argument(s)
TopicName topic = TopicName.FromProjectTopic("[PROJECT]", "[TOPIC]");
// Make the request
Topic response = publisherServiceApiClient.GetTopic(topic);
GetTopic(String, CallSettings)
public virtual Topic GetTopic(string topic, CallSettings callSettings = null)
Gets the configuration of a topic.
Parameters | |
---|---|
Name | Description |
topic | String Required. The name of the topic to get.
Format is |
callSettings | CallSettings If not null, applies overrides to this RPC call. |
Returns | |
---|---|
Type | Description |
Topic | The RPC response. |
// Create client
PublisherServiceApiClient publisherServiceApiClient = PublisherServiceApiClient.Create();
// Initialize request argument(s)
string topic = "projects/[PROJECT]/topics/[TOPIC]";
// Make the request
Topic response = publisherServiceApiClient.GetTopic(topic);
GetTopicAsync(GetTopicRequest, CallSettings)
public virtual Task<Topic> GetTopicAsync(GetTopicRequest request, CallSettings callSettings = null)
Gets the configuration of a topic.
Parameters | |
---|---|
Name | Description |
request | GetTopicRequest The request object containing all of the parameters for the API call. |
callSettings | CallSettings If not null, applies overrides to this RPC call. |
Returns | |
---|---|
Type | Description |
Task<Topic> | A Task containing the RPC response. |
// Create client
PublisherServiceApiClient publisherServiceApiClient = await PublisherServiceApiClient.CreateAsync();
// Initialize request argument(s)
GetTopicRequest request = new GetTopicRequest
{
TopicAsTopicName = TopicName.FromProjectTopic("[PROJECT]", "[TOPIC]"),
};
// Make the request
Topic response = await publisherServiceApiClient.GetTopicAsync(request);
GetTopicAsync(GetTopicRequest, CancellationToken)
public virtual Task<Topic> GetTopicAsync(GetTopicRequest request, CancellationToken cancellationToken)
Gets the configuration of a topic.
Parameters | |
---|---|
Name | Description |
request | GetTopicRequest The request object containing all of the parameters for the API call. |
cancellationToken | CancellationToken A CancellationToken to use for this RPC. |
Returns | |
---|---|
Type | Description |
Task<Topic> | A Task containing the RPC response. |
// Create client
PublisherServiceApiClient publisherServiceApiClient = await PublisherServiceApiClient.CreateAsync();
// Initialize request argument(s)
GetTopicRequest request = new GetTopicRequest
{
TopicAsTopicName = TopicName.FromProjectTopic("[PROJECT]", "[TOPIC]"),
};
// Make the request
Topic response = await publisherServiceApiClient.GetTopicAsync(request);
GetTopicAsync(TopicName, CallSettings)
public virtual Task<Topic> GetTopicAsync(TopicName topic, CallSettings callSettings = null)
Gets the configuration of a topic.
Parameters | |
---|---|
Name | Description |
topic | TopicName Required. The name of the topic to get.
Format is |
callSettings | CallSettings If not null, applies overrides to this RPC call. |
Returns | |
---|---|
Type | Description |
Task<Topic> | A Task containing the RPC response. |
// Create client
PublisherServiceApiClient publisherServiceApiClient = await PublisherServiceApiClient.CreateAsync();
// Initialize request argument(s)
TopicName topic = TopicName.FromProjectTopic("[PROJECT]", "[TOPIC]");
// Make the request
Topic response = await publisherServiceApiClient.GetTopicAsync(topic);
GetTopicAsync(TopicName, CancellationToken)
public virtual Task<Topic> GetTopicAsync(TopicName topic, CancellationToken cancellationToken)
Gets the configuration of a topic.
Parameters | |
---|---|
Name | Description |
topic | TopicName Required. The name of the topic to get.
Format is |
cancellationToken | CancellationToken A CancellationToken to use for this RPC. |
Returns | |
---|---|
Type | Description |
Task<Topic> | A Task containing the RPC response. |
// Create client
PublisherServiceApiClient publisherServiceApiClient = await PublisherServiceApiClient.CreateAsync();
// Initialize request argument(s)
TopicName topic = TopicName.FromProjectTopic("[PROJECT]", "[TOPIC]");
// Make the request
Topic response = await publisherServiceApiClient.GetTopicAsync(topic);
GetTopicAsync(String, CallSettings)
public virtual Task<Topic> GetTopicAsync(string topic, CallSettings callSettings = null)
Gets the configuration of a topic.
Parameters | |
---|---|
Name | Description |
topic | String Required. The name of the topic to get.
Format is |
callSettings | CallSettings If not null, applies overrides to this RPC call. |
Returns | |
---|---|
Type | Description |
Task<Topic> | A Task containing the RPC response. |
// Create client
PublisherServiceApiClient publisherServiceApiClient = await PublisherServiceApiClient.CreateAsync();
// Initialize request argument(s)
string topic = "projects/[PROJECT]/topics/[TOPIC]";
// Make the request
Topic response = await publisherServiceApiClient.GetTopicAsync(topic);
GetTopicAsync(String, CancellationToken)
public virtual Task<Topic> GetTopicAsync(string topic, CancellationToken cancellationToken)
Gets the configuration of a topic.
Parameters | |
---|---|
Name | Description |
topic | String Required. The name of the topic to get.
Format is |
cancellationToken | CancellationToken A CancellationToken to use for this RPC. |
Returns | |
---|---|
Type | Description |
Task<Topic> | A Task containing the RPC response. |
// Create client
PublisherServiceApiClient publisherServiceApiClient = await PublisherServiceApiClient.CreateAsync();
// Initialize request argument(s)
string topic = "projects/[PROJECT]/topics/[TOPIC]";
// Make the request
Topic response = await publisherServiceApiClient.GetTopicAsync(topic);
ListTopics(ProjectName, String, Nullable<Int32>, CallSettings)
public virtual PagedEnumerable<ListTopicsResponse, Topic> ListTopics(ProjectName project, string pageToken = null, int? pageSize = default(int? ), CallSettings callSettings = null)
Lists matching topics.
Parameters | |
---|---|
Name | Description |
project | ProjectName Required. The name of the project in which to list topics.
Format is |
pageToken | String The token returned from the previous request. A value of |
pageSize | Nullable<Int32> The size of page to request. The response will not be larger than this, but may be smaller. A value of
|
callSettings | CallSettings If not null, applies overrides to this RPC call. |
Returns | |
---|---|
Type | Description |
PagedEnumerable<ListTopicsResponse, Topic> | A pageable sequence of Topic resources. |
PublisherServiceApiClient client = PublisherServiceApiClient.Create();
ProjectName projectName = new ProjectName(projectId);
foreach (Topic topic in client.ListTopics(projectName))
{
Console.WriteLine(topic.Name);
}
ListTopics(ListTopicsRequest, CallSettings)
public virtual PagedEnumerable<ListTopicsResponse, Topic> ListTopics(ListTopicsRequest request, CallSettings callSettings = null)
Lists matching topics.
Parameters | |
---|---|
Name | Description |
request | ListTopicsRequest The request object containing all of the parameters for the API call. |
callSettings | CallSettings If not null, applies overrides to this RPC call. |
Returns | |
---|---|
Type | Description |
PagedEnumerable<ListTopicsResponse, Topic> | A pageable sequence of Topic resources. |
// Create client
PublisherServiceApiClient publisherServiceApiClient = PublisherServiceApiClient.Create();
// Initialize request argument(s)
ListTopicsRequest request = new ListTopicsRequest
{
ProjectAsProjectName = ProjectName.FromProject("[PROJECT]"),
};
// Make the request
PagedEnumerable<ListTopicsResponse, Topic> response = publisherServiceApiClient.ListTopics(request);
// Iterate over all response items, lazily performing RPCs as required
foreach (Topic item in response)
{
// Do something with each item
Console.WriteLine(item);
}
// Or iterate over pages (of server-defined size), performing one RPC per page
foreach (ListTopicsResponse page in response.AsRawResponses())
{
// Do something with each page of items
Console.WriteLine("A page of results:");
foreach (Topic item in page)
{
// Do something with each item
Console.WriteLine(item);
}
}
// Or retrieve a single page of known size (unless it's the final page), performing as many RPCs as required
int pageSize = 10;
Page<Topic> singlePage = response.ReadPage(pageSize);
// Do something with the page of items
Console.WriteLine($"A page of {pageSize} results (unless it's the final page):");
foreach (Topic item in singlePage)
{
// Do something with each item
Console.WriteLine(item);
}
// Store the pageToken, for when the next page is required.
string nextPageToken = singlePage.NextPageToken;
ListTopics(String, String, Nullable<Int32>, CallSettings)
public virtual PagedEnumerable<ListTopicsResponse, Topic> ListTopics(string project, string pageToken = null, int? pageSize = default(int? ), CallSettings callSettings = null)
Lists matching topics.
Parameters | |
---|---|
Name | Description |
project | String Required. The name of the project in which to list topics.
Format is |
pageToken | String The token returned from the previous request. A value of |
pageSize | Nullable<Int32> The size of page to request. The response will not be larger than this, but may be smaller. A value of
|
callSettings | CallSettings If not null, applies overrides to this RPC call. |
Returns | |
---|---|
Type | Description |
PagedEnumerable<ListTopicsResponse, Topic> | A pageable sequence of Topic resources. |
// Create client
PublisherServiceApiClient publisherServiceApiClient = PublisherServiceApiClient.Create();
// Initialize request argument(s)
string project = "projects/[PROJECT]";
// Make the request
PagedEnumerable<ListTopicsResponse, Topic> response = publisherServiceApiClient.ListTopics(project);
// Iterate over all response items, lazily performing RPCs as required
foreach (Topic item in response)
{
// Do something with each item
Console.WriteLine(item);
}
// Or iterate over pages (of server-defined size), performing one RPC per page
foreach (ListTopicsResponse page in response.AsRawResponses())
{
// Do something with each page of items
Console.WriteLine("A page of results:");
foreach (Topic item in page)
{
// Do something with each item
Console.WriteLine(item);
}
}
// Or retrieve a single page of known size (unless it's the final page), performing as many RPCs as required
int pageSize = 10;
Page<Topic> singlePage = response.ReadPage(pageSize);
// Do something with the page of items
Console.WriteLine($"A page of {pageSize} results (unless it's the final page):");
foreach (Topic item in singlePage)
{
// Do something with each item
Console.WriteLine(item);
}
// Store the pageToken, for when the next page is required.
string nextPageToken = singlePage.NextPageToken;
ListTopicsAsync(ProjectName, String, Nullable<Int32>, CallSettings)
public virtual PagedAsyncEnumerable<ListTopicsResponse, Topic> ListTopicsAsync(ProjectName project, string pageToken = null, int? pageSize = default(int? ), CallSettings callSettings = null)
Lists matching topics.
Parameters | |
---|---|
Name | Description |
project | ProjectName Required. The name of the project in which to list topics.
Format is |
pageToken | String The token returned from the previous request. A value of |
pageSize | Nullable<Int32> The size of page to request. The response will not be larger than this, but may be smaller. A value of
|
callSettings | CallSettings If not null, applies overrides to this RPC call. |
Returns | |
---|---|
Type | Description |
PagedAsyncEnumerable<ListTopicsResponse, Topic> | A pageable asynchronous sequence of Topic resources. |
PublisherServiceApiClient client = PublisherServiceApiClient.Create();
ProjectName projectName = new ProjectName(projectId);
IAsyncEnumerable<Topic> topics = client.ListTopicsAsync(projectName);
await topics.ForEachAsync(topic =>
{
Console.WriteLine(topic.Name);
});
ListTopicsAsync(ListTopicsRequest, CallSettings)
public virtual PagedAsyncEnumerable<ListTopicsResponse, Topic> ListTopicsAsync(ListTopicsRequest request, CallSettings callSettings = null)
Lists matching topics.
Parameters | |
---|---|
Name | Description |
request | ListTopicsRequest The request object containing all of the parameters for the API call. |
callSettings | CallSettings If not null, applies overrides to this RPC call. |
Returns | |
---|---|
Type | Description |
PagedAsyncEnumerable<ListTopicsResponse, Topic> | A pageable asynchronous sequence of Topic resources. |
// Create client
PublisherServiceApiClient publisherServiceApiClient = await PublisherServiceApiClient.CreateAsync();
// Initialize request argument(s)
ListTopicsRequest request = new ListTopicsRequest
{
ProjectAsProjectName = ProjectName.FromProject("[PROJECT]"),
};
// Make the request
PagedAsyncEnumerable<ListTopicsResponse, Topic> response = publisherServiceApiClient.ListTopicsAsync(request);
// Iterate over all response items, lazily performing RPCs as required
await response.ForEachAsync((Topic item) =>
{
// Do something with each item
Console.WriteLine(item);
});
// Or iterate over pages (of server-defined size), performing one RPC per page
await response.AsRawResponses().ForEachAsync((ListTopicsResponse page) =>
{
// Do something with each page of items
Console.WriteLine("A page of results:");
foreach (Topic item in page)
{
// Do something with each item
Console.WriteLine(item);
}
});
// Or retrieve a single page of known size (unless it's the final page), performing as many RPCs as required
int pageSize = 10;
Page<Topic> singlePage = await response.ReadPageAsync(pageSize);
// Do something with the page of items
Console.WriteLine($"A page of {pageSize} results (unless it's the final page):");
foreach (Topic item in singlePage)
{
// Do something with each item
Console.WriteLine(item);
}
// Store the pageToken, for when the next page is required.
string nextPageToken = singlePage.NextPageToken;
ListTopicsAsync(String, String, Nullable<Int32>, CallSettings)
public virtual PagedAsyncEnumerable<ListTopicsResponse, Topic> ListTopicsAsync(string project, string pageToken = null, int? pageSize = default(int? ), CallSettings callSettings = null)
Lists matching topics.
Parameters | |
---|---|
Name | Description |
project | String Required. The name of the project in which to list topics.
Format is |
pageToken | String The token returned from the previous request. A value of |
pageSize | Nullable<Int32> The size of page to request. The response will not be larger than this, but may be smaller. A value of
|
callSettings | CallSettings If not null, applies overrides to this RPC call. |
Returns | |
---|---|
Type | Description |
PagedAsyncEnumerable<ListTopicsResponse, Topic> | A pageable asynchronous sequence of Topic resources. |
// Create client
PublisherServiceApiClient publisherServiceApiClient = await PublisherServiceApiClient.CreateAsync();
// Initialize request argument(s)
string project = "projects/[PROJECT]";
// Make the request
PagedAsyncEnumerable<ListTopicsResponse, Topic> response = publisherServiceApiClient.ListTopicsAsync(project);
// Iterate over all response items, lazily performing RPCs as required
await response.ForEachAsync((Topic item) =>
{
// Do something with each item
Console.WriteLine(item);
});
// Or iterate over pages (of server-defined size), performing one RPC per page
await response.AsRawResponses().ForEachAsync((ListTopicsResponse page) =>
{
// Do something with each page of items
Console.WriteLine("A page of results:");
foreach (Topic item in page)
{
// Do something with each item
Console.WriteLine(item);
}
});
// Or retrieve a single page of known size (unless it's the final page), performing as many RPCs as required
int pageSize = 10;
Page<Topic> singlePage = await response.ReadPageAsync(pageSize);
// Do something with the page of items
Console.WriteLine($"A page of {pageSize} results (unless it's the final page):");
foreach (Topic item in singlePage)
{
// Do something with each item
Console.WriteLine(item);
}
// Store the pageToken, for when the next page is required.
string nextPageToken = singlePage.NextPageToken;
ListTopicSnapshots(ListTopicSnapshotsRequest, CallSettings)
public virtual PagedEnumerable<ListTopicSnapshotsResponse, string> ListTopicSnapshots(ListTopicSnapshotsRequest request, CallSettings callSettings = null)
Lists the names of the snapshots on this topic. Snapshots are used in Seek 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.
Parameters | |
---|---|
Name | Description |
request | ListTopicSnapshotsRequest The request object containing all of the parameters for the API call. |
callSettings | CallSettings If not null, applies overrides to this RPC call. |
Returns | |
---|---|
Type | Description |
PagedEnumerable<ListTopicSnapshotsResponse, String> | A pageable sequence of String resources. |
// Create client
PublisherServiceApiClient publisherServiceApiClient = PublisherServiceApiClient.Create();
// Initialize request argument(s)
ListTopicSnapshotsRequest request = new ListTopicSnapshotsRequest
{
TopicAsTopicName = TopicName.FromProjectTopic("[PROJECT]", "[TOPIC]"),
};
// Make the request
PagedEnumerable<ListTopicSnapshotsResponse, string> response = publisherServiceApiClient.ListTopicSnapshots(request);
// Iterate over all response items, lazily performing RPCs as required
foreach (string item in response)
{
// Do something with each item
Console.WriteLine(item);
}
// Or iterate over pages (of server-defined size), performing one RPC per page
foreach (ListTopicSnapshotsResponse page in response.AsRawResponses())
{
// Do something with each page of items
Console.WriteLine("A page of results:");
foreach (string item in page)
{
// Do something with each item
Console.WriteLine(item);
}
}
// Or retrieve a single page of known size (unless it's the final page), performing as many RPCs as required
int pageSize = 10;
Page<string> singlePage = response.ReadPage(pageSize);
// Do something with the page of items
Console.WriteLine($"A page of {pageSize} results (unless it's the final page):");
foreach (string item in singlePage)
{
// Do something with each item
Console.WriteLine(item);
}
// Store the pageToken, for when the next page is required.
string nextPageToken = singlePage.NextPageToken;
ListTopicSnapshots(TopicName, String, Nullable<Int32>, CallSettings)
public virtual PagedEnumerable<ListTopicSnapshotsResponse, string> ListTopicSnapshots(TopicName topic, string pageToken = null, int? pageSize = default(int? ), CallSettings callSettings = null)
Lists the names of the snapshots on this topic. Snapshots are used in Seek 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.
Parameters | |
---|---|
Name | Description |
topic | TopicName Required. The name of the topic that snapshots are attached to.
Format is |
pageToken | String The token returned from the previous request. A value of |
pageSize | Nullable<Int32> The size of page to request. The response will not be larger than this, but may be smaller. A value of
|
callSettings | CallSettings If not null, applies overrides to this RPC call. |
Returns | |
---|---|
Type | Description |
PagedEnumerable<ListTopicSnapshotsResponse, String> | A pageable sequence of String resources. |
// Create client
PublisherServiceApiClient publisherServiceApiClient = PublisherServiceApiClient.Create();
// Initialize request argument(s)
TopicName topic = TopicName.FromProjectTopic("[PROJECT]", "[TOPIC]");
// Make the request
PagedEnumerable<ListTopicSnapshotsResponse, string> response = publisherServiceApiClient.ListTopicSnapshots(topic);
// Iterate over all response items, lazily performing RPCs as required
foreach (string item in response)
{
// Do something with each item
Console.WriteLine(item);
}
// Or iterate over pages (of server-defined size), performing one RPC per page
foreach (ListTopicSnapshotsResponse page in response.AsRawResponses())
{
// Do something with each page of items
Console.WriteLine("A page of results:");
foreach (string item in page)
{
// Do something with each item
Console.WriteLine(item);
}
}
// Or retrieve a single page of known size (unless it's the final page), performing as many RPCs as required
int pageSize = 10;
Page<string> singlePage = response.ReadPage(pageSize);
// Do something with the page of items
Console.WriteLine($"A page of {pageSize} results (unless it's the final page):");
foreach (string item in singlePage)
{
// Do something with each item
Console.WriteLine(item);
}
// Store the pageToken, for when the next page is required.
string nextPageToken = singlePage.NextPageToken;
ListTopicSnapshots(String, String, Nullable<Int32>, CallSettings)
public virtual PagedEnumerable<ListTopicSnapshotsResponse, string> ListTopicSnapshots(string topic, string pageToken = null, int? pageSize = default(int? ), CallSettings callSettings = null)
Lists the names of the snapshots on this topic. Snapshots are used in Seek 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.
Parameters | |
---|---|
Name | Description |
topic | String Required. The name of the topic that snapshots are attached to.
Format is |
pageToken | String The token returned from the previous request. A value of |
pageSize | Nullable<Int32> The size of page to request. The response will not be larger than this, but may be smaller. A value of
|
callSettings | CallSettings If not null, applies overrides to this RPC call. |
Returns | |
---|---|
Type | Description |
PagedEnumerable<ListTopicSnapshotsResponse, String> | A pageable sequence of String resources. |
// Create client
PublisherServiceApiClient publisherServiceApiClient = PublisherServiceApiClient.Create();
// Initialize request argument(s)
string topic = "projects/[PROJECT]/topics/[TOPIC]";
// Make the request
PagedEnumerable<ListTopicSnapshotsResponse, string> response = publisherServiceApiClient.ListTopicSnapshots(topic);
// Iterate over all response items, lazily performing RPCs as required
foreach (string item in response)
{
// Do something with each item
Console.WriteLine(item);
}
// Or iterate over pages (of server-defined size), performing one RPC per page
foreach (ListTopicSnapshotsResponse page in response.AsRawResponses())
{
// Do something with each page of items
Console.WriteLine("A page of results:");
foreach (string item in page)
{
// Do something with each item
Console.WriteLine(item);
}
}
// Or retrieve a single page of known size (unless it's the final page), performing as many RPCs as required
int pageSize = 10;
Page<string> singlePage = response.ReadPage(pageSize);
// Do something with the page of items
Console.WriteLine($"A page of {pageSize} results (unless it's the final page):");
foreach (string item in singlePage)
{
// Do something with each item
Console.WriteLine(item);
}
// Store the pageToken, for when the next page is required.
string nextPageToken = singlePage.NextPageToken;
ListTopicSnapshotsAsync(ListTopicSnapshotsRequest, CallSettings)
public virtual PagedAsyncEnumerable<ListTopicSnapshotsResponse, string> ListTopicSnapshotsAsync(ListTopicSnapshotsRequest request, CallSettings callSettings = null)
Lists the names of the snapshots on this topic. Snapshots are used in Seek 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.
Parameters | |
---|---|
Name | Description |
request | ListTopicSnapshotsRequest The request object containing all of the parameters for the API call. |
callSettings | CallSettings If not null, applies overrides to this RPC call. |
Returns | |
---|---|
Type | Description |
PagedAsyncEnumerable<ListTopicSnapshotsResponse, String> | A pageable asynchronous sequence of String resources. |
// Create client
PublisherServiceApiClient publisherServiceApiClient = await PublisherServiceApiClient.CreateAsync();
// Initialize request argument(s)
ListTopicSnapshotsRequest request = new ListTopicSnapshotsRequest
{
TopicAsTopicName = TopicName.FromProjectTopic("[PROJECT]", "[TOPIC]"),
};
// Make the request
PagedAsyncEnumerable<ListTopicSnapshotsResponse, string> response = publisherServiceApiClient.ListTopicSnapshotsAsync(request);
// Iterate over all response items, lazily performing RPCs as required
await response.ForEachAsync((string item) =>
{
// Do something with each item
Console.WriteLine(item);
});
// Or iterate over pages (of server-defined size), performing one RPC per page
await response.AsRawResponses().ForEachAsync((ListTopicSnapshotsResponse page) =>
{
// Do something with each page of items
Console.WriteLine("A page of results:");
foreach (string item in page)
{
// Do something with each item
Console.WriteLine(item);
}
});
// Or retrieve a single page of known size (unless it's the final page), performing as many RPCs as required
int pageSize = 10;
Page<string> singlePage = await response.ReadPageAsync(pageSize);
// Do something with the page of items
Console.WriteLine($"A page of {pageSize} results (unless it's the final page):");
foreach (string item in singlePage)
{
// Do something with each item
Console.WriteLine(item);
}
// Store the pageToken, for when the next page is required.
string nextPageToken = singlePage.NextPageToken;
ListTopicSnapshotsAsync(TopicName, String, Nullable<Int32>, CallSettings)
public virtual PagedAsyncEnumerable<ListTopicSnapshotsResponse, string> ListTopicSnapshotsAsync(TopicName topic, string pageToken = null, int? pageSize = default(int? ), CallSettings callSettings = null)
Lists the names of the snapshots on this topic. Snapshots are used in Seek 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.
Parameters | |
---|---|
Name | Description |
topic | TopicName Required. The name of the topic that snapshots are attached to.
Format is |
pageToken | String The token returned from the previous request. A value of |
pageSize | Nullable<Int32> The size of page to request. The response will not be larger than this, but may be smaller. A value of
|
callSettings | CallSettings If not null, applies overrides to this RPC call. |
Returns | |
---|---|
Type | Description |
PagedAsyncEnumerable<ListTopicSnapshotsResponse, String> | A pageable asynchronous sequence of String resources. |
// Create client
PublisherServiceApiClient publisherServiceApiClient = await PublisherServiceApiClient.CreateAsync();
// Initialize request argument(s)
TopicName topic = TopicName.FromProjectTopic("[PROJECT]", "[TOPIC]");
// Make the request
PagedAsyncEnumerable<ListTopicSnapshotsResponse, string> response = publisherServiceApiClient.ListTopicSnapshotsAsync(topic);
// Iterate over all response items, lazily performing RPCs as required
await response.ForEachAsync((string item) =>
{
// Do something with each item
Console.WriteLine(item);
});
// Or iterate over pages (of server-defined size), performing one RPC per page
await response.AsRawResponses().ForEachAsync((ListTopicSnapshotsResponse page) =>
{
// Do something with each page of items
Console.WriteLine("A page of results:");
foreach (string item in page)
{
// Do something with each item
Console.WriteLine(item);
}
});
// Or retrieve a single page of known size (unless it's the final page), performing as many RPCs as required
int pageSize = 10;
Page<string> singlePage = await response.ReadPageAsync(pageSize);
// Do something with the page of items
Console.WriteLine($"A page of {pageSize} results (unless it's the final page):");
foreach (string item in singlePage)
{
// Do something with each item
Console.WriteLine(item);
}
// Store the pageToken, for when the next page is required.
string nextPageToken = singlePage.NextPageToken;
ListTopicSnapshotsAsync(String, String, Nullable<Int32>, CallSettings)
public virtual PagedAsyncEnumerable<ListTopicSnapshotsResponse, string> ListTopicSnapshotsAsync(string topic, string pageToken = null, int? pageSize = default(int? ), CallSettings callSettings = null)
Lists the names of the snapshots on this topic. Snapshots are used in Seek 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.
Parameters | |
---|---|
Name | Description |
topic | String Required. The name of the topic that snapshots are attached to.
Format is |
pageToken | String The token returned from the previous request. A value of |
pageSize | Nullable<Int32> The size of page to request. The response will not be larger than this, but may be smaller. A value of
|
callSettings | CallSettings If not null, applies overrides to this RPC call. |
Returns | |
---|---|
Type | Description |
PagedAsyncEnumerable<ListTopicSnapshotsResponse, String> | A pageable asynchronous sequence of String resources. |
// Create client
PublisherServiceApiClient publisherServiceApiClient = await PublisherServiceApiClient.CreateAsync();
// Initialize request argument(s)
string topic = "projects/[PROJECT]/topics/[TOPIC]";
// Make the request
PagedAsyncEnumerable<ListTopicSnapshotsResponse, string> response = publisherServiceApiClient.ListTopicSnapshotsAsync(topic);
// Iterate over all response items, lazily performing RPCs as required
await response.ForEachAsync((string item) =>
{
// Do something with each item
Console.WriteLine(item);
});
// Or iterate over pages (of server-defined size), performing one RPC per page
await response.AsRawResponses().ForEachAsync((ListTopicSnapshotsResponse page) =>
{
// Do something with each page of items
Console.WriteLine("A page of results:");
foreach (string item in page)
{
// Do something with each item
Console.WriteLine(item);
}
});
// Or retrieve a single page of known size (unless it's the final page), performing as many RPCs as required
int pageSize = 10;
Page<string> singlePage = await response.ReadPageAsync(pageSize);
// Do something with the page of items
Console.WriteLine($"A page of {pageSize} results (unless it's the final page):");
foreach (string item in singlePage)
{
// Do something with each item
Console.WriteLine(item);
}
// Store the pageToken, for when the next page is required.
string nextPageToken = singlePage.NextPageToken;
ListTopicSubscriptions(ListTopicSubscriptionsRequest, CallSettings)
public virtual PagedEnumerable<ListTopicSubscriptionsResponse, string> ListTopicSubscriptions(ListTopicSubscriptionsRequest request, CallSettings callSettings = null)
Lists the names of the attached subscriptions on this topic.
Parameters | |
---|---|
Name | Description |
request | ListTopicSubscriptionsRequest The request object containing all of the parameters for the API call. |
callSettings | CallSettings If not null, applies overrides to this RPC call. |
Returns | |
---|---|
Type | Description |
PagedEnumerable<ListTopicSubscriptionsResponse, String> | A pageable sequence of String resources. |
// Create client
PublisherServiceApiClient publisherServiceApiClient = PublisherServiceApiClient.Create();
// Initialize request argument(s)
ListTopicSubscriptionsRequest request = new ListTopicSubscriptionsRequest
{
TopicAsTopicName = TopicName.FromProjectTopic("[PROJECT]", "[TOPIC]"),
};
// Make the request
PagedEnumerable<ListTopicSubscriptionsResponse, string> response = publisherServiceApiClient.ListTopicSubscriptions(request);
// Iterate over all response items, lazily performing RPCs as required
foreach (string item in response)
{
// Do something with each item
Console.WriteLine(item);
}
// Or iterate over pages (of server-defined size), performing one RPC per page
foreach (ListTopicSubscriptionsResponse page in response.AsRawResponses())
{
// Do something with each page of items
Console.WriteLine("A page of results:");
foreach (string item in page)
{
// Do something with each item
Console.WriteLine(item);
}
}
// Or retrieve a single page of known size (unless it's the final page), performing as many RPCs as required
int pageSize = 10;
Page<string> singlePage = response.ReadPage(pageSize);
// Do something with the page of items
Console.WriteLine($"A page of {pageSize} results (unless it's the final page):");
foreach (string item in singlePage)
{
// Do something with each item
Console.WriteLine(item);
}
// Store the pageToken, for when the next page is required.
string nextPageToken = singlePage.NextPageToken;
ListTopicSubscriptions(TopicName, String, Nullable<Int32>, CallSettings)
public virtual PagedEnumerable<ListTopicSubscriptionsResponse, string> ListTopicSubscriptions(TopicName topic, string pageToken = null, int? pageSize = default(int? ), CallSettings callSettings = null)
Lists the names of the attached subscriptions on this topic.
Parameters | |
---|---|
Name | Description |
topic | TopicName Required. The name of the topic that subscriptions are attached to.
Format is |
pageToken | String The token returned from the previous request. A value of |
pageSize | Nullable<Int32> The size of page to request. The response will not be larger than this, but may be smaller. A value of
|
callSettings | CallSettings If not null, applies overrides to this RPC call. |
Returns | |
---|---|
Type | Description |
PagedEnumerable<ListTopicSubscriptionsResponse, String> | A pageable sequence of String resources. |
// Create client
PublisherServiceApiClient publisherServiceApiClient = PublisherServiceApiClient.Create();
// Initialize request argument(s)
TopicName topic = TopicName.FromProjectTopic("[PROJECT]", "[TOPIC]");
// Make the request
PagedEnumerable<ListTopicSubscriptionsResponse, string> response = publisherServiceApiClient.ListTopicSubscriptions(topic);
// Iterate over all response items, lazily performing RPCs as required
foreach (string item in response)
{
// Do something with each item
Console.WriteLine(item);
}
// Or iterate over pages (of server-defined size), performing one RPC per page
foreach (ListTopicSubscriptionsResponse page in response.AsRawResponses())
{
// Do something with each page of items
Console.WriteLine("A page of results:");
foreach (string item in page)
{
// Do something with each item
Console.WriteLine(item);
}
}
// Or retrieve a single page of known size (unless it's the final page), performing as many RPCs as required
int pageSize = 10;
Page<string> singlePage = response.ReadPage(pageSize);
// Do something with the page of items
Console.WriteLine($"A page of {pageSize} results (unless it's the final page):");
foreach (string item in singlePage)
{
// Do something with each item
Console.WriteLine(item);
}
// Store the pageToken, for when the next page is required.
string nextPageToken = singlePage.NextPageToken;
ListTopicSubscriptions(String, String, Nullable<Int32>, CallSettings)
public virtual PagedEnumerable<ListTopicSubscriptionsResponse, string> ListTopicSubscriptions(string topic, string pageToken = null, int? pageSize = default(int? ), CallSettings callSettings = null)
Lists the names of the attached subscriptions on this topic.
Parameters | |
---|---|
Name | Description |
topic | String Required. The name of the topic that subscriptions are attached to.
Format is |
pageToken | String The token returned from the previous request. A value of |
pageSize | Nullable<Int32> The size of page to request. The response will not be larger than this, but may be smaller. A value of
|
callSettings | CallSettings If not null, applies overrides to this RPC call. |
Returns | |
---|---|
Type | Description |
PagedEnumerable<ListTopicSubscriptionsResponse, String> | A pageable sequence of String resources. |
// Create client
PublisherServiceApiClient publisherServiceApiClient = PublisherServiceApiClient.Create();
// Initialize request argument(s)
string topic = "projects/[PROJECT]/topics/[TOPIC]";
// Make the request
PagedEnumerable<ListTopicSubscriptionsResponse, string> response = publisherServiceApiClient.ListTopicSubscriptions(topic);
// Iterate over all response items, lazily performing RPCs as required
foreach (string item in response)
{
// Do something with each item
Console.WriteLine(item);
}
// Or iterate over pages (of server-defined size), performing one RPC per page
foreach (ListTopicSubscriptionsResponse page in response.AsRawResponses())
{
// Do something with each page of items
Console.WriteLine("A page of results:");
foreach (string item in page)
{
// Do something with each item
Console.WriteLine(item);
}
}
// Or retrieve a single page of known size (unless it's the final page), performing as many RPCs as required
int pageSize = 10;
Page<string> singlePage = response.ReadPage(pageSize);
// Do something with the page of items
Console.WriteLine($"A page of {pageSize} results (unless it's the final page):");
foreach (string item in singlePage)
{
// Do something with each item
Console.WriteLine(item);
}
// Store the pageToken, for when the next page is required.
string nextPageToken = singlePage.NextPageToken;
ListTopicSubscriptionsAsync(ListTopicSubscriptionsRequest, CallSettings)
public virtual PagedAsyncEnumerable<ListTopicSubscriptionsResponse, string> ListTopicSubscriptionsAsync(ListTopicSubscriptionsRequest request, CallSettings callSettings = null)
Lists the names of the attached subscriptions on this topic.
Parameters | |
---|---|
Name | Description |
request | ListTopicSubscriptionsRequest The request object containing all of the parameters for the API call. |
callSettings | CallSettings If not null, applies overrides to this RPC call. |
Returns | |
---|---|
Type | Description |
PagedAsyncEnumerable<ListTopicSubscriptionsResponse, String> | A pageable asynchronous sequence of String resources. |
// Create client
PublisherServiceApiClient publisherServiceApiClient = await PublisherServiceApiClient.CreateAsync();
// Initialize request argument(s)
ListTopicSubscriptionsRequest request = new ListTopicSubscriptionsRequest
{
TopicAsTopicName = TopicName.FromProjectTopic("[PROJECT]", "[TOPIC]"),
};
// Make the request
PagedAsyncEnumerable<ListTopicSubscriptionsResponse, string> response = publisherServiceApiClient.ListTopicSubscriptionsAsync(request);
// Iterate over all response items, lazily performing RPCs as required
await response.ForEachAsync((string item) =>
{
// Do something with each item
Console.WriteLine(item);
});
// Or iterate over pages (of server-defined size), performing one RPC per page
await response.AsRawResponses().ForEachAsync((ListTopicSubscriptionsResponse page) =>
{
// Do something with each page of items
Console.WriteLine("A page of results:");
foreach (string item in page)
{
// Do something with each item
Console.WriteLine(item);
}
});
// Or retrieve a single page of known size (unless it's the final page), performing as many RPCs as required
int pageSize = 10;
Page<string> singlePage = await response.ReadPageAsync(pageSize);
// Do something with the page of items
Console.WriteLine($"A page of {pageSize} results (unless it's the final page):");
foreach (string item in singlePage)
{
// Do something with each item
Console.WriteLine(item);
}
// Store the pageToken, for when the next page is required.
string nextPageToken = singlePage.NextPageToken;
ListTopicSubscriptionsAsync(TopicName, String, Nullable<Int32>, CallSettings)
public virtual PagedAsyncEnumerable<ListTopicSubscriptionsResponse, string> ListTopicSubscriptionsAsync(TopicName topic, string pageToken = null, int? pageSize = default(int? ), CallSettings callSettings = null)
Lists the names of the attached subscriptions on this topic.
Parameters | |
---|---|
Name | Description |
topic | TopicName Required. The name of the topic that subscriptions are attached to.
Format is |
pageToken | String The token returned from the previous request. A value of |
pageSize | Nullable<Int32> The size of page to request. The response will not be larger than this, but may be smaller. A value of
|
callSettings | CallSettings If not null, applies overrides to this RPC call. |
Returns | |
---|---|
Type | Description |
PagedAsyncEnumerable<ListTopicSubscriptionsResponse, String> | A pageable asynchronous sequence of String resources. |
// Create client
PublisherServiceApiClient publisherServiceApiClient = await PublisherServiceApiClient.CreateAsync();
// Initialize request argument(s)
TopicName topic = TopicName.FromProjectTopic("[PROJECT]", "[TOPIC]");
// Make the request
PagedAsyncEnumerable<ListTopicSubscriptionsResponse, string> response = publisherServiceApiClient.ListTopicSubscriptionsAsync(topic);
// Iterate over all response items, lazily performing RPCs as required
await response.ForEachAsync((string item) =>
{
// Do something with each item
Console.WriteLine(item);
});
// Or iterate over pages (of server-defined size), performing one RPC per page
await response.AsRawResponses().ForEachAsync((ListTopicSubscriptionsResponse page) =>
{
// Do something with each page of items
Console.WriteLine("A page of results:");
foreach (string item in page)
{
// Do something with each item
Console.WriteLine(item);
}
});
// Or retrieve a single page of known size (unless it's the final page), performing as many RPCs as required
int pageSize = 10;
Page<string> singlePage = await response.ReadPageAsync(pageSize);
// Do something with the page of items
Console.WriteLine($"A page of {pageSize} results (unless it's the final page):");
foreach (string item in singlePage)
{
// Do something with each item
Console.WriteLine(item);
}
// Store the pageToken, for when the next page is required.
string nextPageToken = singlePage.NextPageToken;
ListTopicSubscriptionsAsync(String, String, Nullable<Int32>, CallSettings)
public virtual PagedAsyncEnumerable<ListTopicSubscriptionsResponse, string> ListTopicSubscriptionsAsync(string topic, string pageToken = null, int? pageSize = default(int? ), CallSettings callSettings = null)
Lists the names of the attached subscriptions on this topic.
Parameters | |
---|---|
Name | Description |
topic | String Required. The name of the topic that subscriptions are attached to.
Format is |
pageToken | String The token returned from the previous request. A value of |
pageSize | Nullable<Int32> The size of page to request. The response will not be larger than this, but may be smaller. A value of
|
callSettings | CallSettings If not null, applies overrides to this RPC call. |
Returns | |
---|---|
Type | Description |
PagedAsyncEnumerable<ListTopicSubscriptionsResponse, String> | A pageable asynchronous sequence of String resources. |
// Create client
PublisherServiceApiClient publisherServiceApiClient = await PublisherServiceApiClient.CreateAsync();
// Initialize request argument(s)
string topic = "projects/[PROJECT]/topics/[TOPIC]";
// Make the request
PagedAsyncEnumerable<ListTopicSubscriptionsResponse, string> response = publisherServiceApiClient.ListTopicSubscriptionsAsync(topic);
// Iterate over all response items, lazily performing RPCs as required
await response.ForEachAsync((string item) =>
{
// Do something with each item
Console.WriteLine(item);
});
// Or iterate over pages (of server-defined size), performing one RPC per page
await response.AsRawResponses().ForEachAsync((ListTopicSubscriptionsResponse page) =>
{
// Do something with each page of items
Console.WriteLine("A page of results:");
foreach (string item in page)
{
// Do something with each item
Console.WriteLine(item);
}
});
// Or retrieve a single page of known size (unless it's the final page), performing as many RPCs as required
int pageSize = 10;
Page<string> singlePage = await response.ReadPageAsync(pageSize);
// Do something with the page of items
Console.WriteLine($"A page of {pageSize} results (unless it's the final page):");
foreach (string item in singlePage)
{
// Do something with each item
Console.WriteLine(item);
}
// Store the pageToken, for when the next page is required.
string nextPageToken = singlePage.NextPageToken;
Publish(PublishRequest, CallSettings)
public virtual PublishResponse Publish(PublishRequest request, CallSettings callSettings = null)
Adds one or more messages to the topic. Returns NOT_FOUND
if the topic
does not exist.
Parameters | |
---|---|
Name | Description |
request | PublishRequest The request object containing all of the parameters for the API call. |
callSettings | CallSettings If not null, applies overrides to this RPC call. |
Returns | |
---|---|
Type | Description |
PublishResponse | The RPC response. |
// Create client
PublisherServiceApiClient publisherServiceApiClient = PublisherServiceApiClient.Create();
// Initialize request argument(s)
PublishRequest request = new PublishRequest
{
TopicAsTopicName = TopicName.FromProjectTopic("[PROJECT]", "[TOPIC]"),
Messages =
{
new PubsubMessage(),
},
};
// Make the request
PublishResponse response = publisherServiceApiClient.Publish(request);
Publish(TopicName, IEnumerable<PubsubMessage>, CallSettings)
public virtual PublishResponse Publish(TopicName topic, IEnumerable<PubsubMessage> messages, CallSettings callSettings = null)
Adds one or more messages to the topic. Returns NOT_FOUND
if the topic
does not exist.
Parameters | |
---|---|
Name | Description |
topic | TopicName Required. The messages in the request will be published on this topic.
Format is |
messages | IEnumerable<PubsubMessage> Required. The messages to publish. |
callSettings | CallSettings If not null, applies overrides to this RPC call. |
Returns | |
---|---|
Type | Description |
PublishResponse | The RPC response. |
PublisherServiceApiClient client = PublisherServiceApiClient.Create();
// Make sure we have a topic to publish to
TopicName topicName = new TopicName(projectId, topicId);
client.CreateTopic(topicName);
PubsubMessage message = new PubsubMessage
{
// The data is any arbitrary ByteString. Here, we're using text.
Data = ByteString.CopyFromUtf8("Hello, Pubsub"),
// The attributes provide metadata in a string-to-string dictionary.
Attributes =
{
{ "description", "Simple text message" }
}
};
client.Publish(topicName, new[] { message });
Publish(String, IEnumerable<PubsubMessage>, CallSettings)
public virtual PublishResponse Publish(string topic, IEnumerable<PubsubMessage> messages, CallSettings callSettings = null)
Adds one or more messages to the topic. Returns NOT_FOUND
if the topic
does not exist.
Parameters | |
---|---|
Name | Description |
topic | String Required. The messages in the request will be published on this topic.
Format is |
messages | IEnumerable<PubsubMessage> Required. The messages to publish. |
callSettings | CallSettings If not null, applies overrides to this RPC call. |
Returns | |
---|---|
Type | Description |
PublishResponse | The RPC response. |
// Create client
PublisherServiceApiClient publisherServiceApiClient = PublisherServiceApiClient.Create();
// Initialize request argument(s)
string topic = "projects/[PROJECT]/topics/[TOPIC]";
IEnumerable<PubsubMessage> messages = new PubsubMessage[]
{
new PubsubMessage(),
};
// Make the request
PublishResponse response = publisherServiceApiClient.Publish(topic, messages);
PublishAsync(PublishRequest, CallSettings)
public virtual Task<PublishResponse> PublishAsync(PublishRequest request, CallSettings callSettings = null)
Adds one or more messages to the topic. Returns NOT_FOUND
if the topic
does not exist.
Parameters | |
---|---|
Name | Description |
request | PublishRequest The request object containing all of the parameters for the API call. |
callSettings | CallSettings If not null, applies overrides to this RPC call. |
Returns | |
---|---|
Type | Description |
Task<PublishResponse> | A Task containing the RPC response. |
// Create client
PublisherServiceApiClient publisherServiceApiClient = await PublisherServiceApiClient.CreateAsync();
// Initialize request argument(s)
PublishRequest request = new PublishRequest
{
TopicAsTopicName = TopicName.FromProjectTopic("[PROJECT]", "[TOPIC]"),
Messages =
{
new PubsubMessage(),
},
};
// Make the request
PublishResponse response = await publisherServiceApiClient.PublishAsync(request);
PublishAsync(PublishRequest, CancellationToken)
public virtual Task<PublishResponse> PublishAsync(PublishRequest request, CancellationToken cancellationToken)
Adds one or more messages to the topic. Returns NOT_FOUND
if the topic
does not exist.
Parameters | |
---|---|
Name | Description |
request | PublishRequest The request object containing all of the parameters for the API call. |
cancellationToken | CancellationToken A CancellationToken to use for this RPC. |
Returns | |
---|---|
Type | Description |
Task<PublishResponse> | A Task containing the RPC response. |
// Create client
PublisherServiceApiClient publisherServiceApiClient = await PublisherServiceApiClient.CreateAsync();
// Initialize request argument(s)
PublishRequest request = new PublishRequest
{
TopicAsTopicName = TopicName.FromProjectTopic("[PROJECT]", "[TOPIC]"),
Messages =
{
new PubsubMessage(),
},
};
// Make the request
PublishResponse response = await publisherServiceApiClient.PublishAsync(request);
PublishAsync(TopicName, IEnumerable<PubsubMessage>, CallSettings)
public virtual Task<PublishResponse> PublishAsync(TopicName topic, IEnumerable<PubsubMessage> messages, CallSettings callSettings = null)
Adds one or more messages to the topic. Returns NOT_FOUND
if the topic
does not exist.
Parameters | |
---|---|
Name | Description |
topic | TopicName Required. The messages in the request will be published on this topic.
Format is |
messages | IEnumerable<PubsubMessage> Required. The messages to publish. |
callSettings | CallSettings If not null, applies overrides to this RPC call. |
Returns | |
---|---|
Type | Description |
Task<PublishResponse> | A Task containing the RPC response. |
PublisherServiceApiClient client = PublisherServiceApiClient.Create();
// Make sure we have a topic to publish to
TopicName topicName = new TopicName(projectId, topicId);
await client.CreateTopicAsync(topicName);
PubsubMessage message = new PubsubMessage
{
// The data is any arbitrary ByteString. Here, we're using text.
Data = ByteString.CopyFromUtf8("Hello, Pubsub"),
// The attributes provide metadata in a string-to-string dictionary.
Attributes =
{
{ "description", "Simple text message" }
}
};
await client.PublishAsync(topicName, new[] { message });
PublishAsync(TopicName, IEnumerable<PubsubMessage>, CancellationToken)
public virtual Task<PublishResponse> PublishAsync(TopicName topic, IEnumerable<PubsubMessage> messages, CancellationToken cancellationToken)
Adds one or more messages to the topic. Returns NOT_FOUND
if the topic
does not exist.
Parameters | |
---|---|
Name | Description |
topic | TopicName Required. The messages in the request will be published on this topic.
Format is |
messages | IEnumerable<PubsubMessage> Required. The messages to publish. |
cancellationToken | CancellationToken A CancellationToken to use for this RPC. |
Returns | |
---|---|
Type | Description |
Task<PublishResponse> | A Task containing the RPC response. |
PublisherServiceApiClient client = PublisherServiceApiClient.Create();
// Make sure we have a topic to publish to
TopicName topicName = new TopicName(projectId, topicId);
await client.CreateTopicAsync(topicName);
PubsubMessage message = new PubsubMessage
{
// The data is any arbitrary ByteString. Here, we're using text.
Data = ByteString.CopyFromUtf8("Hello, Pubsub"),
// The attributes provide metadata in a string-to-string dictionary.
Attributes =
{
{ "description", "Simple text message" }
}
};
await client.PublishAsync(topicName, new[] { message });
PublishAsync(String, IEnumerable<PubsubMessage>, CallSettings)
public virtual Task<PublishResponse> PublishAsync(string topic, IEnumerable<PubsubMessage> messages, CallSettings callSettings = null)
Adds one or more messages to the topic. Returns NOT_FOUND
if the topic
does not exist.
Parameters | |
---|---|
Name | Description |
topic | String Required. The messages in the request will be published on this topic.
Format is |
messages | IEnumerable<PubsubMessage> Required. The messages to publish. |
callSettings | CallSettings If not null, applies overrides to this RPC call. |
Returns | |
---|---|
Type | Description |
Task<PublishResponse> | A Task containing the RPC response. |
// Create client
PublisherServiceApiClient publisherServiceApiClient = await PublisherServiceApiClient.CreateAsync();
// Initialize request argument(s)
string topic = "projects/[PROJECT]/topics/[TOPIC]";
IEnumerable<PubsubMessage> messages = new PubsubMessage[]
{
new PubsubMessage(),
};
// Make the request
PublishResponse response = await publisherServiceApiClient.PublishAsync(topic, messages);
PublishAsync(String, IEnumerable<PubsubMessage>, CancellationToken)
public virtual Task<PublishResponse> PublishAsync(string topic, IEnumerable<PubsubMessage> messages, CancellationToken cancellationToken)
Adds one or more messages to the topic. Returns NOT_FOUND
if the topic
does not exist.
Parameters | |
---|---|
Name | Description |
topic | String Required. The messages in the request will be published on this topic.
Format is |
messages | IEnumerable<PubsubMessage> Required. The messages to publish. |
cancellationToken | CancellationToken A CancellationToken to use for this RPC. |
Returns | |
---|---|
Type | Description |
Task<PublishResponse> | A Task containing the RPC response. |
// Create client
PublisherServiceApiClient publisherServiceApiClient = await PublisherServiceApiClient.CreateAsync();
// Initialize request argument(s)
string topic = "projects/[PROJECT]/topics/[TOPIC]";
IEnumerable<PubsubMessage> messages = new PubsubMessage[]
{
new PubsubMessage(),
};
// Make the request
PublishResponse response = await publisherServiceApiClient.PublishAsync(topic, messages);
SetIamPolicy(IResourceName, Policy, CallSettings)
public virtual Policy SetIamPolicy(IResourceName resource, Policy policy, CallSettings callSettings = null)
Sets the access control policy on the specified resource. Replaces any existing policy.
Can return Public Errors: NOT_FOUND, INVALID_ARGUMENT and PERMISSION_DENIED
Parameters | |
---|---|
Name | Description |
resource | IResourceName REQUIRED: The resource for which the policy is being specified. See the operation documentation for the appropriate value for this field. |
policy | Policy REQUIRED: The complete policy to be applied to the |
callSettings | CallSettings If not null, applies overrides to this RPC call. |
Returns | |
---|---|
Type | Description |
Policy | The RPC response. |
SetIamPolicy(SetIamPolicyRequest, CallSettings)
public virtual Policy SetIamPolicy(SetIamPolicyRequest request, CallSettings callSettings = null)
Sets the access control policy on the specified resource. Replaces any existing policy.
Can return Public Errors: NOT_FOUND, INVALID_ARGUMENT and PERMISSION_DENIED
Parameters | |
---|---|
Name | Description |
request | SetIamPolicyRequest The request object containing all of the parameters for the API call. |
callSettings | CallSettings If not null, applies overrides to this RPC call. |
Returns | |
---|---|
Type | Description |
Policy | The RPC response. |
SetIamPolicy(String, Policy, CallSettings)
public virtual Policy SetIamPolicy(string resource, Policy policy, CallSettings callSettings = null)
Sets the access control policy on the specified resource. Replaces any existing policy.
Can return Public Errors: NOT_FOUND, INVALID_ARGUMENT and PERMISSION_DENIED
Parameters | |
---|---|
Name | Description |
resource | String REQUIRED: The resource for which the policy is being specified. See the operation documentation for the appropriate value for this field. |
policy | Policy REQUIRED: The complete policy to be applied to the |
callSettings | CallSettings If not null, applies overrides to this RPC call. |
Returns | |
---|---|
Type | Description |
Policy | The RPC response. |
SetIamPolicyAsync(IResourceName, Policy, CallSettings)
public virtual Task<Policy> SetIamPolicyAsync(IResourceName resource, Policy policy, CallSettings callSettings = null)
Sets the access control policy on the specified resource. Replaces any existing policy.
Can return Public Errors: NOT_FOUND, INVALID_ARGUMENT and PERMISSION_DENIED
Parameters | |
---|---|
Name | Description |
resource | IResourceName REQUIRED: The resource for which the policy is being specified. See the operation documentation for the appropriate value for this field. |
policy | Policy REQUIRED: The complete policy to be applied to the |
callSettings | CallSettings If not null, applies overrides to this RPC call. |
Returns | |
---|---|
Type | Description |
Task<Policy> | A Task containing the RPC response. |
SetIamPolicyAsync(IResourceName, Policy, CancellationToken)
public virtual Task<Policy> SetIamPolicyAsync(IResourceName resource, Policy policy, CancellationToken cancellationToken)
Sets the access control policy on the specified resource. Replaces any existing policy.
Can return Public Errors: NOT_FOUND, INVALID_ARGUMENT and PERMISSION_DENIED
Parameters | |
---|---|
Name | Description |
resource | IResourceName REQUIRED: The resource for which the policy is being specified. See the operation documentation for the appropriate value for this field. |
policy | Policy REQUIRED: The complete policy to be applied to the |
cancellationToken | CancellationToken A CancellationToken to use for this RPC. |
Returns | |
---|---|
Type | Description |
Task<Policy> | A Task containing the RPC response. |
SetIamPolicyAsync(SetIamPolicyRequest, CallSettings)
public virtual Task<Policy> SetIamPolicyAsync(SetIamPolicyRequest request, CallSettings callSettings = null)
Sets the access control policy on the specified resource. Replaces any existing policy.
Can return Public Errors: NOT_FOUND, INVALID_ARGUMENT and PERMISSION_DENIED
Parameters | |
---|---|
Name | Description |
request | SetIamPolicyRequest The request object containing all of the parameters for the API call. |
callSettings | CallSettings If not null, applies overrides to this RPC call. |
Returns | |
---|---|
Type | Description |
Task<Policy> | A Task containing the RPC response. |
SetIamPolicyAsync(SetIamPolicyRequest, CancellationToken)
public virtual Task<Policy> SetIamPolicyAsync(SetIamPolicyRequest request, CancellationToken cancellationToken)
Sets the access control policy on the specified resource. Replaces any existing policy.
Can return Public Errors: NOT_FOUND, INVALID_ARGUMENT and PERMISSION_DENIED
Parameters | |
---|---|
Name | Description |
request | SetIamPolicyRequest The request object containing all of the parameters for the API call. |
cancellationToken | CancellationToken A CancellationToken to use for this RPC. |
Returns | |
---|---|
Type | Description |
Task<Policy> | A Task containing the RPC response. |
SetIamPolicyAsync(String, Policy, CallSettings)
public virtual Task<Policy> SetIamPolicyAsync(string resource, Policy policy, CallSettings callSettings = null)
Sets the access control policy on the specified resource. Replaces any existing policy.
Can return Public Errors: NOT_FOUND, INVALID_ARGUMENT and PERMISSION_DENIED
Parameters | |
---|---|
Name | Description |
resource | String REQUIRED: The resource for which the policy is being specified. See the operation documentation for the appropriate value for this field. |
policy | Policy REQUIRED: The complete policy to be applied to the |
callSettings | CallSettings If not null, applies overrides to this RPC call. |
Returns | |
---|---|
Type | Description |
Task<Policy> | A Task containing the RPC response. |
SetIamPolicyAsync(String, Policy, CancellationToken)
public virtual Task<Policy> SetIamPolicyAsync(string resource, Policy policy, CancellationToken cancellationToken)
Sets the access control policy on the specified resource. Replaces any existing policy.
Can return Public Errors: NOT_FOUND, INVALID_ARGUMENT and PERMISSION_DENIED
Parameters | |
---|---|
Name | Description |
resource | String REQUIRED: The resource for which the policy is being specified. See the operation documentation for the appropriate value for this field. |
policy | Policy REQUIRED: The complete policy to be applied to the |
cancellationToken | CancellationToken A CancellationToken to use for this RPC. |
Returns | |
---|---|
Type | Description |
Task<Policy> | A Task containing the RPC response. |
ShutdownDefaultChannelsAsync()
public static Task ShutdownDefaultChannelsAsync()
Shuts down any channels automatically created by Create() and CreateAsync(CancellationToken). Channels which weren't automatically created are not affected.
Returns | |
---|---|
Type | Description |
Task | A task representing the asynchronous shutdown operation. |
After calling this method, further calls to Create() and CreateAsync(CancellationToken) will create new channels, which could in turn be shut down by another call to this method.
TestIamPermissions(IResourceName, IEnumerable<String>, CallSettings)
public virtual TestIamPermissionsResponse TestIamPermissions(IResourceName resource, IEnumerable<string> permissions, CallSettings callSettings = null)
Returns permissions that a caller has on the specified resource. If the resource does not exist, this will return an empty set of permissions, not a NOT_FOUND error.
Note: This operation is designed to be used for building permission-aware UIs and command-line tools, not for authorization checking. This operation may "fail open" without warning.
Parameters | |
---|---|
Name | Description |
resource | IResourceName REQUIRED: The resource for which the policy detail is being requested. See the operation documentation for the appropriate value for this field. |
permissions | IEnumerable<String> The set of permissions to check for the |
callSettings | CallSettings If not null, applies overrides to this RPC call. |
Returns | |
---|---|
Type | Description |
TestIamPermissionsResponse | The RPC response. |
TestIamPermissions(TestIamPermissionsRequest, CallSettings)
public virtual TestIamPermissionsResponse TestIamPermissions(TestIamPermissionsRequest request, CallSettings callSettings = null)
Returns permissions that a caller has on the specified resource. If the resource does not exist, this will return an empty set of permissions, not a NOT_FOUND error.
Note: This operation is designed to be used for building permission-aware UIs and command-line tools, not for authorization checking. This operation may "fail open" without warning.
Parameters | |
---|---|
Name | Description |
request | TestIamPermissionsRequest The request object containing all of the parameters for the API call. |
callSettings | CallSettings If not null, applies overrides to this RPC call. |
Returns | |
---|---|
Type | Description |
TestIamPermissionsResponse | The RPC response. |
TestIamPermissions(String, IEnumerable<String>, CallSettings)
public virtual TestIamPermissionsResponse TestIamPermissions(string resource, IEnumerable<string> permissions, CallSettings callSettings = null)
Returns permissions that a caller has on the specified resource. If the resource does not exist, this will return an empty set of permissions, not a NOT_FOUND error.
Note: This operation is designed to be used for building permission-aware UIs and command-line tools, not for authorization checking. This operation may "fail open" without warning.
Parameters | |
---|---|
Name | Description |
resource | String REQUIRED: The resource for which the policy detail is being requested. See the operation documentation for the appropriate value for this field. |
permissions | IEnumerable<String> The set of permissions to check for the |
callSettings | CallSettings If not null, applies overrides to this RPC call. |
Returns | |
---|---|
Type | Description |
TestIamPermissionsResponse | The RPC response. |
TestIamPermissionsAsync(IResourceName, IEnumerable<String>, CallSettings)
public virtual Task<TestIamPermissionsResponse> TestIamPermissionsAsync(IResourceName resource, IEnumerable<string> permissions, CallSettings callSettings = null)
Returns permissions that a caller has on the specified resource. If the resource does not exist, this will return an empty set of permissions, not a NOT_FOUND error.
Note: This operation is designed to be used for building permission-aware UIs and command-line tools, not for authorization checking. This operation may "fail open" without warning.
Parameters | |
---|---|
Name | Description |
resource | IResourceName REQUIRED: The resource for which the policy detail is being requested. See the operation documentation for the appropriate value for this field. |
permissions | IEnumerable<String> The set of permissions to check for the |
callSettings | CallSettings If not null, applies overrides to this RPC call. |
Returns | |
---|---|
Type | Description |
Task<TestIamPermissionsResponse> | A Task containing the RPC response. |
TestIamPermissionsAsync(IResourceName, IEnumerable<String>, CancellationToken)
public virtual Task<TestIamPermissionsResponse> TestIamPermissionsAsync(IResourceName resource, IEnumerable<string> permissions, CancellationToken cancellationToken)
Returns permissions that a caller has on the specified resource. If the resource does not exist, this will return an empty set of permissions, not a NOT_FOUND error.
Note: This operation is designed to be used for building permission-aware UIs and command-line tools, not for authorization checking. This operation may "fail open" without warning.
Parameters | |
---|---|
Name | Description |
resource | IResourceName REQUIRED: The resource for which the policy detail is being requested. See the operation documentation for the appropriate value for this field. |
permissions | IEnumerable<String> The set of permissions to check for the |
cancellationToken | CancellationToken A CancellationToken to use for this RPC. |
Returns | |
---|---|
Type | Description |
Task<TestIamPermissionsResponse> | A Task containing the RPC response. |
TestIamPermissionsAsync(TestIamPermissionsRequest, CallSettings)
public virtual Task<TestIamPermissionsResponse> TestIamPermissionsAsync(TestIamPermissionsRequest request, CallSettings callSettings = null)
Returns permissions that a caller has on the specified resource. If the resource does not exist, this will return an empty set of permissions, not a NOT_FOUND error.
Note: This operation is designed to be used for building permission-aware UIs and command-line tools, not for authorization checking. This operation may "fail open" without warning.
Parameters | |
---|---|
Name | Description |
request | TestIamPermissionsRequest The request object containing all of the parameters for the API call. |
callSettings | CallSettings If not null, applies overrides to this RPC call. |
Returns | |
---|---|
Type | Description |
Task<TestIamPermissionsResponse> | A Task containing the RPC response. |
TestIamPermissionsAsync(TestIamPermissionsRequest, CancellationToken)
public virtual Task<TestIamPermissionsResponse> TestIamPermissionsAsync(TestIamPermissionsRequest request, CancellationToken cancellationToken)
Returns permissions that a caller has on the specified resource. If the resource does not exist, this will return an empty set of permissions, not a NOT_FOUND error.
Note: This operation is designed to be used for building permission-aware UIs and command-line tools, not for authorization checking. This operation may "fail open" without warning.
Parameters | |
---|---|
Name | Description |
request | TestIamPermissionsRequest The request object containing all of the parameters for the API call. |
cancellationToken | CancellationToken A CancellationToken to use for this RPC. |
Returns | |
---|---|
Type | Description |
Task<TestIamPermissionsResponse> | A Task containing the RPC response. |
TestIamPermissionsAsync(String, IEnumerable<String>, CallSettings)
public virtual Task<TestIamPermissionsResponse> TestIamPermissionsAsync(string resource, IEnumerable<string> permissions, CallSettings callSettings = null)
Returns permissions that a caller has on the specified resource. If the resource does not exist, this will return an empty set of permissions, not a NOT_FOUND error.
Note: This operation is designed to be used for building permission-aware UIs and command-line tools, not for authorization checking. This operation may "fail open" without warning.
Parameters | |
---|---|
Name | Description |
resource | String REQUIRED: The resource for which the policy detail is being requested. See the operation documentation for the appropriate value for this field. |
permissions | IEnumerable<String> The set of permissions to check for the |
callSettings | CallSettings If not null, applies overrides to this RPC call. |
Returns | |
---|---|
Type | Description |
Task<TestIamPermissionsResponse> | A Task containing the RPC response. |
TestIamPermissionsAsync(String, IEnumerable<String>, CancellationToken)
public virtual Task<TestIamPermissionsResponse> TestIamPermissionsAsync(string resource, IEnumerable<string> permissions, CancellationToken cancellationToken)
Returns permissions that a caller has on the specified resource. If the resource does not exist, this will return an empty set of permissions, not a NOT_FOUND error.
Note: This operation is designed to be used for building permission-aware UIs and command-line tools, not for authorization checking. This operation may "fail open" without warning.
Parameters | |
---|---|
Name | Description |
resource | String REQUIRED: The resource for which the policy detail is being requested. See the operation documentation for the appropriate value for this field. |
permissions | IEnumerable<String> The set of permissions to check for the |
cancellationToken | CancellationToken A CancellationToken to use for this RPC. |
Returns | |
---|---|
Type | Description |
Task<TestIamPermissionsResponse> | A Task containing the RPC response. |
UpdateTopic(UpdateTopicRequest, CallSettings)
public virtual Topic UpdateTopic(UpdateTopicRequest request, CallSettings callSettings = null)
Updates an existing topic. Note that certain properties of a topic are not modifiable.
Parameters | |
---|---|
Name | Description |
request | UpdateTopicRequest The request object containing all of the parameters for the API call. |
callSettings | CallSettings If not null, applies overrides to this RPC call. |
Returns | |
---|---|
Type | Description |
Topic | The RPC response. |
// Create client
PublisherServiceApiClient publisherServiceApiClient = PublisherServiceApiClient.Create();
// Initialize request argument(s)
UpdateTopicRequest request = new UpdateTopicRequest
{
Topic = new Topic(),
UpdateMask = new FieldMask(),
};
// Make the request
Topic response = publisherServiceApiClient.UpdateTopic(request);
UpdateTopicAsync(UpdateTopicRequest, CallSettings)
public virtual Task<Topic> UpdateTopicAsync(UpdateTopicRequest request, CallSettings callSettings = null)
Updates an existing topic. Note that certain properties of a topic are not modifiable.
Parameters | |
---|---|
Name | Description |
request | UpdateTopicRequest The request object containing all of the parameters for the API call. |
callSettings | CallSettings If not null, applies overrides to this RPC call. |
Returns | |
---|---|
Type | Description |
Task<Topic> | A Task containing the RPC response. |
// Create client
PublisherServiceApiClient publisherServiceApiClient = await PublisherServiceApiClient.CreateAsync();
// Initialize request argument(s)
UpdateTopicRequest request = new UpdateTopicRequest
{
Topic = new Topic(),
UpdateMask = new FieldMask(),
};
// Make the request
Topic response = await publisherServiceApiClient.UpdateTopicAsync(request);
UpdateTopicAsync(UpdateTopicRequest, CancellationToken)
public virtual Task<Topic> UpdateTopicAsync(UpdateTopicRequest request, CancellationToken cancellationToken)
Updates an existing topic. Note that certain properties of a topic are not modifiable.
Parameters | |
---|---|
Name | Description |
request | UpdateTopicRequest The request object containing all of the parameters for the API call. |
cancellationToken | CancellationToken A CancellationToken to use for this RPC. |
Returns | |
---|---|
Type | Description |
Task<Topic> | A Task containing the RPC response. |
// Create client
PublisherServiceApiClient publisherServiceApiClient = await PublisherServiceApiClient.CreateAsync();
// Initialize request argument(s)
UpdateTopicRequest request = new UpdateTopicRequest
{
Topic = new Topic(),
UpdateMask = new FieldMask(),
};
// Make the request
Topic response = await publisherServiceApiClient.UpdateTopicAsync(request);