class ProjectsTopics extends Resource (View source)

The "topics" collection of methods.

Typical usage is:

 $pubsubService = new Google\Service\Pubsub(...);
 $topics = $pubsubService->projects_topics;

Methods

create(string $name, Topic $postBody, array $optParams = [])

Creates the given topic with the given name. See the [resource name rules] (https://cloud.google.com/pubsub/docs/pubsub-basics#resource_names).

delete(string $topic, array $optParams = [])

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_. (topics.delete)

get(string $topic, array $optParams = [])

Gets the configuration of a topic. (topics.get)

getIamPolicy(string $resource, array $optParams = [])

Gets the access control policy for a resource. Returns an empty policy if the resource exists and does not have a policy set. (topics.getIamPolicy)

listProjectsTopics(string $project, array $optParams = [])

Lists matching topics. (topics.listProjectsTopics)

patch(string $name, UpdateTopicRequest $postBody, array $optParams = [])

Updates an existing topic by updating the fields specified in the update mask. Note that certain properties of a topic are not modifiable.

publish(string $topic, PublishRequest $postBody, array $optParams = [])

Adds one or more messages to the topic. Returns NOT_FOUND if the topic does not exist. (topics.publish)

setIamPolicy(string $resource, SetIamPolicyRequest $postBody, array $optParams = [])

Sets the access control policy on the specified resource. Replaces any existing policy. Can return NOT_FOUND, INVALID_ARGUMENT, and PERMISSION_DENIED errors. (topics.setIamPolicy)

testIamPermissions(string $resource, TestIamPermissionsRequest $postBody, array $optParams = [])

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.

Details

Topic create(string $name, Topic $postBody, array $optParams = [])

Creates the given topic with the given name. See the [resource name rules] (https://cloud.google.com/pubsub/docs/pubsub-basics#resource_names).

(topics.create)

Parameters

string $name

Required. The name of the topic. It must have the format "projects/{project}/topics/{topic}". {topic} must start with a letter, and contain only letters ([A-Za-z]), numbers ([0-9]), dashes (-), underscores (_), periods (.), tildes (~), plus (+) or percent signs (%). It must be between 3 and 255 characters in length, and it must not start with "goog".

Topic $postBody
array $optParams

Optional parameters.

Return Value

Topic

Exceptions

Exception

PubsubEmpty delete(string $topic, array $optParams = [])

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_. (topics.delete)

Parameters

string $topic

Required. Name of the topic to delete. Format is projects/{project}/topics/{topic}.

array $optParams

Optional parameters.

Return Value

PubsubEmpty

Exceptions

Exception

Topic get(string $topic, array $optParams = [])

Gets the configuration of a topic. (topics.get)

Parameters

string $topic

Required. The name of the topic to get. Format is projects/{project}/topics/{topic}.

array $optParams

Optional parameters.

Return Value

Topic

Exceptions

Exception

Policy getIamPolicy(string $resource, array $optParams = [])

Gets the access control policy for a resource. Returns an empty policy if the resource exists and does not have a policy set. (topics.getIamPolicy)

Parameters

string $resource

REQUIRED: The resource for which the policy is being requested. See Resource names for the appropriate value for this field.

array $optParams

Optional parameters.

Return Value

Policy

Exceptions

Exception

ListTopicsResponse listProjectsTopics(string $project, array $optParams = [])

Lists matching topics. (topics.listProjectsTopics)

Parameters

string $project

Required. The name of the project in which to list topics. Format is projects/{project-id}.

array $optParams

Optional parameters.

Return Value

ListTopicsResponse

Exceptions

Exception

Topic patch(string $name, UpdateTopicRequest $postBody, array $optParams = [])

Updates an existing topic by updating the fields specified in the update mask. Note that certain properties of a topic are not modifiable.

(topics.patch)

Parameters

string $name

Required. The name of the topic. It must have the format "projects/{project}/topics/{topic}". {topic} must start with a letter, and contain only letters ([A-Za-z]), numbers ([0-9]), dashes (-), underscores (_), periods (.), tildes (~), plus (+) or percent signs (%). It must be between 3 and 255 characters in length, and it must not start with "goog".

UpdateTopicRequest $postBody
array $optParams

Optional parameters.

Return Value

Topic

Exceptions

Exception

PublishResponse publish(string $topic, PublishRequest $postBody, array $optParams = [])

Adds one or more messages to the topic. Returns NOT_FOUND if the topic does not exist. (topics.publish)

Parameters

string $topic

Required. The messages in the request will be published on this topic. Format is projects/{project}/topics/{topic}.

PublishRequest $postBody
array $optParams

Optional parameters.

Return Value

PublishResponse

Exceptions

Exception

Policy setIamPolicy(string $resource, SetIamPolicyRequest $postBody, array $optParams = [])

Sets the access control policy on the specified resource. Replaces any existing policy. Can return NOT_FOUND, INVALID_ARGUMENT, and PERMISSION_DENIED errors. (topics.setIamPolicy)

Parameters

string $resource

REQUIRED: The resource for which the policy is being specified. See Resource names for the appropriate value for this field.

SetIamPolicyRequest $postBody
array $optParams

Optional parameters.

Return Value

Policy

Exceptions

Exception

TestIamPermissionsResponse testIamPermissions(string $resource, TestIamPermissionsRequest $postBody, array $optParams = [])

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. (topics.testIamPermissions)

Parameters

string $resource

REQUIRED: The resource for which the policy detail is being requested. See Resource names for the appropriate value for this field.

TestIamPermissionsRequest $postBody
array $optParams

Optional parameters.

Return Value

TestIamPermissionsResponse

Exceptions

Exception