|
45 | 45 | import com.google.pubsub.v1.ListTopicsRequest; |
46 | 46 | import com.google.pubsub.v1.ListTopicsResponse; |
47 | 47 | import com.google.pubsub.v1.ProjectName; |
| 48 | +import com.google.pubsub.v1.ProjectTopicName; |
48 | 49 | import com.google.pubsub.v1.PublishRequest; |
49 | 50 | import com.google.pubsub.v1.PublishResponse; |
50 | 51 | import com.google.pubsub.v1.PubsubMessage; |
@@ -462,6 +463,35 @@ public final Topic createTopic(String name) { |
462 | 463 | return createTopic(request); |
463 | 464 | } |
464 | 465 |
|
| 466 | + // AUTO-GENERATED DOCUMENTATION AND METHOD |
| 467 | + /** |
| 468 | + * Creates the given topic with the given name. See the <a |
| 469 | + * href="https://cloud.google.com/pubsub/docs/admin#resource_names"> resource name |
| 470 | + * rules</a>. |
| 471 | + * |
| 472 | + * <p>Sample code: |
| 473 | + * |
| 474 | + * <pre><code> |
| 475 | + * try (TopicAdminClient topicAdminClient = TopicAdminClient.create()) { |
| 476 | + * ProjectTopicName name = ProjectTopicName.of("[PROJECT]", "[TOPIC]"); |
| 477 | + * Topic response = topicAdminClient.createTopic(name); |
| 478 | + * } |
| 479 | + * </code></pre> |
| 480 | + * |
| 481 | + * @param name Required. The name of the topic. It must have the format |
| 482 | + * `"projects/{project}/topics/{topic}"`. `{topic}` must start with a letter, and contain only |
| 483 | + * letters (`[A-Za-z]`), numbers (`[0-9]`), dashes (`-`), underscores (`_`), periods (`.`), |
| 484 | + * tildes (`~`), plus (`+`) or percent signs (`%`). It must be between 3 and 255 characters in |
| 485 | + * length, and it must not start with `"goog"`. |
| 486 | + * @throws com.google.api.gax.rpc.ApiException if the remote call fails |
| 487 | + * @deprecated Use {@link #createTopic(TopicName)} instead. |
| 488 | + */ |
| 489 | + @Deprecated |
| 490 | + public final Topic createTopic(ProjectTopicName name) { |
| 491 | + Topic request = Topic.newBuilder().setName(name == null ? null : name.toString()).build(); |
| 492 | + return createTopic(request); |
| 493 | + } |
| 494 | + |
465 | 495 | // AUTO-GENERATED DOCUMENTATION AND METHOD. |
466 | 496 | /** |
467 | 497 | * Creates the given topic with the given name. See the [resource name rules] |
@@ -800,6 +830,31 @@ public final Topic getTopic(String topic) { |
800 | 830 | return getTopic(request); |
801 | 831 | } |
802 | 832 |
|
| 833 | + // AUTO-GENERATED DOCUMENTATION AND METHOD |
| 834 | + /** |
| 835 | + * Gets the configuration of a topic. |
| 836 | + * |
| 837 | + * <p>Sample code: |
| 838 | + * |
| 839 | + * <pre><code> |
| 840 | + * try (TopicAdminClient topicAdminClient = TopicAdminClient.create()) { |
| 841 | + * ProjectTopicName topic = ProjectTopicName.of("[PROJECT]", "[TOPIC]"); |
| 842 | + * Topic response = topicAdminClient.getTopic(topic); |
| 843 | + * } |
| 844 | + * </code></pre> |
| 845 | + * |
| 846 | + * @param topic Required. The name of the topic to get. Format is |
| 847 | + * `projects/{project}/topics/{topic}`. |
| 848 | + * @throws com.google.api.gax.rpc.ApiException if the remote call fails |
| 849 | + * @deprecated Use {@link #getTopic(TopicName)} instead. |
| 850 | + */ |
| 851 | + @Deprecated |
| 852 | + public final Topic getTopic(ProjectTopicName topic) { |
| 853 | + GetTopicRequest request = |
| 854 | + GetTopicRequest.newBuilder().setTopic(topic == null ? null : topic.toString()).build(); |
| 855 | + return getTopic(request); |
| 856 | + } |
| 857 | + |
803 | 858 | // AUTO-GENERATED DOCUMENTATION AND METHOD. |
804 | 859 | /** |
805 | 860 | * Gets the configuration of a topic. |
@@ -1079,6 +1134,35 @@ public final ListTopicSubscriptionsPagedResponse listTopicSubscriptions(String t |
1079 | 1134 | return listTopicSubscriptions(request); |
1080 | 1135 | } |
1081 | 1136 |
|
| 1137 | + // AUTO-GENERATED DOCUMENTATION AND METHOD |
| 1138 | + /** |
| 1139 | + * Lists the names of the subscriptions on this topic. |
| 1140 | + * |
| 1141 | + * <p>Sample code: |
| 1142 | + * |
| 1143 | + * <pre><code> |
| 1144 | + * try (TopicAdminClient topicAdminClient = TopicAdminClient.create()) { |
| 1145 | + * ProjectTopicName topic = ProjectTopicName.of("[PROJECT]", "[TOPIC]"); |
| 1146 | + * for (ProjectSubscriptionName element : topicAdminClient.listTopicSubscriptions(topic).iterateAllAsProjectSubscriptionName()) { |
| 1147 | + * // doThingsWith(element); |
| 1148 | + * } |
| 1149 | + * } |
| 1150 | + * </code></pre> |
| 1151 | + * |
| 1152 | + * @param topic Required. The name of the topic that subscriptions are attached to. Format is |
| 1153 | + * `projects/{project}/topics/{topic}`. |
| 1154 | + * @throws com.google.api.gax.rpc.ApiException if the remote call fails |
| 1155 | + * @deprecated Use {@link #listTopicSubscriptions(TopicName)} instead. |
| 1156 | + */ |
| 1157 | + @Deprecated |
| 1158 | + public final ListTopicSubscriptionsPagedResponse listTopicSubscriptions(ProjectTopicName topic) { |
| 1159 | + ListTopicSubscriptionsRequest request = |
| 1160 | + ListTopicSubscriptionsRequest.newBuilder() |
| 1161 | + .setTopic(topic == null ? null : topic.toString()) |
| 1162 | + .build(); |
| 1163 | + return listTopicSubscriptions(request); |
| 1164 | + } |
| 1165 | + |
1082 | 1166 | // AUTO-GENERATED DOCUMENTATION AND METHOD. |
1083 | 1167 | /** |
1084 | 1168 | * Lists the names of the attached subscriptions on this topic. |
@@ -1429,6 +1513,34 @@ public final void deleteTopic(String topic) { |
1429 | 1513 | deleteTopic(request); |
1430 | 1514 | } |
1431 | 1515 |
|
| 1516 | + // AUTO-GENERATED DOCUMENTATION AND METHOD |
| 1517 | + /** |
| 1518 | + * Deletes the topic with the given name. Returns `NOT_FOUND` if the topic does not exist. After a |
| 1519 | + * topic is deleted, a new topic may be created with the same name; this is an entirely new topic |
| 1520 | + * with none of the old configuration or subscriptions. Existing subscriptions to this topic are |
| 1521 | + * not deleted, but their `topic` field is set to `_deleted-topic_`. |
| 1522 | + * |
| 1523 | + * <p>Sample code: |
| 1524 | + * |
| 1525 | + * <pre><code> |
| 1526 | + * try (TopicAdminClient topicAdminClient = TopicAdminClient.create()) { |
| 1527 | + * ProjectTopicName topic = ProjectTopicName.of("[PROJECT]", "[TOPIC]"); |
| 1528 | + * topicAdminClient.deleteTopic(topic); |
| 1529 | + * } |
| 1530 | + * </code></pre> |
| 1531 | + * |
| 1532 | + * @param topic Required. Name of the topic to delete. Format is |
| 1533 | + * `projects/{project}/topics/{topic}`. |
| 1534 | + * @throws com.google.api.gax.rpc.ApiException if the remote call fails |
| 1535 | + * @deprecated Use {@link #deleteTopic(TopicName)} instead. |
| 1536 | + */ |
| 1537 | + @Deprecated |
| 1538 | + public final void deleteTopic(ProjectTopicName topic) { |
| 1539 | + DeleteTopicRequest request = |
| 1540 | + DeleteTopicRequest.newBuilder().setTopic(topic == null ? null : topic.toString()).build(); |
| 1541 | + deleteTopic(request); |
| 1542 | + } |
| 1543 | + |
1432 | 1544 | // AUTO-GENERATED DOCUMENTATION AND METHOD. |
1433 | 1545 | /** |
1434 | 1546 | * Deletes the topic with the given name. Returns `NOT_FOUND` if the topic does not exist. After a |
@@ -1583,6 +1695,37 @@ public final Policy setIamPolicy(SetIamPolicyRequest request) { |
1583 | 1695 | return setIamPolicyCallable().call(request); |
1584 | 1696 | } |
1585 | 1697 |
|
| 1698 | + // AUTO-GENERATED DOCUMENTATION AND METHOD |
| 1699 | + /** |
| 1700 | + * Sets the access control policy on the specified resource. Replaces any existing policy. |
| 1701 | + * |
| 1702 | + * <p>Can return Public Errors: NOT_FOUND, INVALID_ARGUMENT and PERMISSION_DENIED |
| 1703 | + * |
| 1704 | + * <p>Sample code: |
| 1705 | + * |
| 1706 | + * <pre><code> |
| 1707 | + * try (TopicAdminClient topicAdminClient = TopicAdminClient.create()) { |
| 1708 | + * String formattedResource = ProjectTopicName.format("[PROJECT]", "[TOPIC]"); |
| 1709 | + * Policy policy = Policy.newBuilder().build(); |
| 1710 | + * Policy response = topicAdminClient.setIamPolicy(formattedResource, policy); |
| 1711 | + * } |
| 1712 | + * </code></pre> |
| 1713 | + * |
| 1714 | + * @param resource REQUIRED: The resource for which the policy is being specified. See the |
| 1715 | + * operation documentation for the appropriate value for this field. |
| 1716 | + * @param policy REQUIRED: The complete policy to be applied to the `resource`. The size of the |
| 1717 | + * policy is limited to a few 10s of KB. An empty policy is a valid policy but certain Cloud |
| 1718 | + * Platform services (such as Projects) might reject them. |
| 1719 | + * @throws com.google.api.gax.rpc.ApiException if the remote call fails |
| 1720 | + * @deprecated Use {@link #setIamPolicy(SetIamPolicyRequest)} instead. |
| 1721 | + */ |
| 1722 | + @Deprecated |
| 1723 | + public final Policy setIamPolicy(String resource, Policy policy) { |
| 1724 | + SetIamPolicyRequest request = |
| 1725 | + SetIamPolicyRequest.newBuilder().setResource(resource).setPolicy(policy).build(); |
| 1726 | + return setIamPolicy(request); |
| 1727 | + } |
| 1728 | + |
1586 | 1729 | // AUTO-GENERATED DOCUMENTATION AND METHOD. |
1587 | 1730 | /** |
1588 | 1731 | * Sets the access control policy on the specified resource. Replacesany existing policy. |
@@ -1644,6 +1787,31 @@ public final Policy getIamPolicy(GetIamPolicyRequest request) { |
1644 | 1787 | return getIamPolicyCallable().call(request); |
1645 | 1788 | } |
1646 | 1789 |
|
| 1790 | + // AUTO-GENERATED DOCUMENTATION AND METHOD |
| 1791 | + /** |
| 1792 | + * Gets the access control policy for a resource. Returns an empty policy if the resource exists |
| 1793 | + * and does not have a policy set. |
| 1794 | + * |
| 1795 | + * <p>Sample code: |
| 1796 | + * |
| 1797 | + * <pre><code> |
| 1798 | + * try (TopicAdminClient topicAdminClient = TopicAdminClient.create()) { |
| 1799 | + * String formattedResource = ProjectTopicName.format("[PROJECT]", "[TOPIC]"); |
| 1800 | + * Policy response = topicAdminClient.getIamPolicy(formattedResource); |
| 1801 | + * } |
| 1802 | + * </code></pre> |
| 1803 | + * |
| 1804 | + * @param resource REQUIRED: The resource for which the policy is being requested. See the |
| 1805 | + * operation documentation for the appropriate value for this field. |
| 1806 | + * @throws com.google.api.gax.rpc.ApiException if the remote call fails |
| 1807 | + * @deprecated Use {@link #getIamPolicy(GetIamPolicyRequest)} instead. |
| 1808 | + */ |
| 1809 | + @Deprecated |
| 1810 | + public final Policy getIamPolicy(String resource) { |
| 1811 | + GetIamPolicyRequest request = GetIamPolicyRequest.newBuilder().setResource(resource).build(); |
| 1812 | + return getIamPolicy(request); |
| 1813 | + } |
| 1814 | + |
1647 | 1815 | // AUTO-GENERATED DOCUMENTATION AND METHOD. |
1648 | 1816 | /** |
1649 | 1817 | * Gets the access control policy for a resource. Returns an empty policyif the resource exists |
@@ -1707,6 +1875,44 @@ public final TestIamPermissionsResponse testIamPermissions(TestIamPermissionsReq |
1707 | 1875 | return testIamPermissionsCallable().call(request); |
1708 | 1876 | } |
1709 | 1877 |
|
| 1878 | + // AUTO-GENERATED DOCUMENTATION AND METHOD |
| 1879 | + /** |
| 1880 | + * Returns permissions that a caller has on the specified resource. If the resource does not |
| 1881 | + * exist, this will return an empty set of permissions, not a NOT_FOUND error. |
| 1882 | + * |
| 1883 | + * <p>Note: This operation is designed to be used for building permission-aware UIs and |
| 1884 | + * command-line tools, not for authorization checking. This operation may "fail open" without |
| 1885 | + * warning. |
| 1886 | + * |
| 1887 | + * <p>Sample code: |
| 1888 | + * |
| 1889 | + * <pre><code> |
| 1890 | + * try (TopicAdminClient topicAdminClient = TopicAdminClient.create()) { |
| 1891 | + * String formattedResource = ProjectTopicName.format("[PROJECT]", "[TOPIC]"); |
| 1892 | + * List<String> permissions = new ArrayList<>(); |
| 1893 | + * TestIamPermissionsResponse response = topicAdminClient.testIamPermissions(formattedResource, permissions); |
| 1894 | + * } |
| 1895 | + * </code></pre> |
| 1896 | + * |
| 1897 | + * @param resource REQUIRED: The resource for which the policy detail is being requested. See the |
| 1898 | + * operation documentation for the appropriate value for this field. |
| 1899 | + * @param permissions The set of permissions to check for the `resource`. Permissions with |
| 1900 | + * wildcards (such as '*' or 'storage.*') are not allowed. For more information see |
| 1901 | + * [IAM Overview](https://cloud.google.com/iam/docs/overview#permissions). |
| 1902 | + * @throws com.google.api.gax.rpc.ApiException if the remote call fails |
| 1903 | + * @deprecated Use {@link #testIamPermissions(TestIamPermissionsRequest)} instead. |
| 1904 | + */ |
| 1905 | + @Deprecated |
| 1906 | + public final TestIamPermissionsResponse testIamPermissions( |
| 1907 | + String resource, List<String> permissions) { |
| 1908 | + TestIamPermissionsRequest request = |
| 1909 | + TestIamPermissionsRequest.newBuilder() |
| 1910 | + .setResource(resource) |
| 1911 | + .addAllPermissions(permissions) |
| 1912 | + .build(); |
| 1913 | + return testIamPermissions(request); |
| 1914 | + } |
| 1915 | + |
1710 | 1916 | // AUTO-GENERATED DOCUMENTATION AND METHOD. |
1711 | 1917 | /** |
1712 | 1918 | * Returns permissions that a caller has on the specified resource. If theresource does not exist, |
|
0 commit comments